From 00ee2fc8b0983993536204b749fc4b05b470f993 Mon Sep 17 00:00:00 2001 From: Ofek Date: Mon, 6 Oct 2025 18:00:53 +0300 Subject: [PATCH] Initial support for binary/binary-obj in msvc (#8165) --- .github/copilot-instructions.md | 1 + docs/WindowsLocal.properties | 17 +- etc/config/c.amazonwin.properties | 2 + lib/base-compiler.ts | 2 +- lib/compilers/win32.ts | 21 +- lib/objdumper/_all.ts | 1 + lib/objdumper/base.ts | 4 +- lib/objdumper/da65.ts | 2 +- lib/objdumper/goldengate.ts | 2 +- lib/objdumper/vc.ts | 60 +++ lib/parsers/asm-parser-cc65.ts | 4 +- lib/parsers/asm-parser-vc.ts | 18 +- package-lock.json | 30 +- test/base-compiler-tests.ts | 2 + test/compilers/msvc-test.ts | 4 + ...asm.binary.directives.labels.comments.json | 372 +++++++++++++- ...asm.binary.directives.labels.comments.json | 324 +++++++++++- ...asm.binary.directives.labels.comments.json | 68 ++- ...asm.binary.directives.labels.comments.json | 404 ++++++++++++++- ...asm.binary.directives.labels.comments.json | 472 +++++++++++++++++- test/objdumper-tests.ts | 4 +- 21 files changed, 1773 insertions(+), 41 deletions(-) create mode 100644 .github/copilot-instructions.md create mode 100644 lib/objdumper/vc.ts diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 000000000..c5c5f05cc --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1 @@ +For each answer to the user, evaluate your level of confidence in the correctness of the answer on a scale from 1 to 10, where 1 is very uncertain and 10 is absolutely certain. If your confidence level is below 8, state so and suggest ways to verify the answer. \ No newline at end of file diff --git a/docs/WindowsLocal.properties b/docs/WindowsLocal.properties index 8f923d3ea..56e116162 100644 --- a/docs/WindowsLocal.properties +++ b/docs/WindowsLocal.properties @@ -3,13 +3,14 @@ # you can set it up in that compiler's config, with, say # compiler.my_clang.includePath=path_to_libc++ -includePath=c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\include;c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\ATLMFC\include;c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um +includePath=c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\include;c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\ATLMFC\include;c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\VS\include;C:\Program Files (x86)\Windows Kits\10\include\10.0.22621.0\ucrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\um;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\shared;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\winrt;C:\Program Files (x86)\Windows Kits\10\\include\10.0.22621.0\\cppwinrt;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um # replace with the result of `where undname.exe` from a developer command prompt - -demangler=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\undname.exe +demangler=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\undname.exe demanglerType=win32 - +# replace with the result of `where dumpbin.exe` from a developer command prompt +objdumper=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\dumpbin.exe +objdumperType=vc # the compiler you want compiler explorer to start up in defaultCompiler=vc2022_64 @@ -41,12 +42,14 @@ group.vc2022.groupName=Visual Studio MSVC # these are pointed at my own installation; # you'll likely have to change the paths for your own machine -compiler.vc2022_32.exe=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x86\cl.exe +compiler.vc2022_32.exe=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x86\cl.exe compiler.vc2022_32.name=VC 2022 x86 +compiler.vc2022_32.libPath=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x86;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.26100.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.26100.0\\um\x86 -compiler.vc2022_64.exe=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.42.34433\bin\Hostx64\x64\cl.exe +compiler.vc2022_64.exe=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\bin\Hostx64\x64\cl.exe compiler.vc2022_64.name=VC 2022 amd64 - +# obtain by `> echo %LIB%` from a developer command prompt: +compiler.vc2022_64.libPath=C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.44.35207\lib\x64;C:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\lib\um\x64;C:\Program Files (x86)\Windows Kits\10\lib\10.0.26100.0\ucrt\x64;C:\Program Files (x86)\Windows Kits\10\\lib\10.0.26100.0\\um\x64 # clang compilers # if you want more compilers, you can do that by separating the names with `:` diff --git a/etc/config/c.amazonwin.properties b/etc/config/c.amazonwin.properties index 3d3adc663..fa6c8ff3f 100644 --- a/etc/config/c.amazonwin.properties +++ b/etc/config/c.amazonwin.properties @@ -65,6 +65,8 @@ group.vc.versionRe=^.*Microsoft \(R\).*$ group.vc.isSemVer=true group.vc.demangler=Z:/compilers/msvc/14.29.30133-14.29.30153.0/bin/Hostx64/x64/undname.exe group.vc.demanglerType=win32 +group.vc.objdumper=Z:/compilers/msvc/14.29.30133-14.29.30153.0/bin/Hostx64/x64/dumpbin.exe +group.vc.objdumperType=vc group.vc.compilerCategories=msvc group.vc.notification=The use of this compiler is only permitted for internal evaluation purposes
and is otherwise governed by the MSVC License Agreement. group.vc.licenseName=MSVC Proprietary diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index 8276f70f9..eef76aabd 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -654,7 +654,7 @@ export class BaseCompiler { } const objdumper = new this.objdumperClass(); - const args = objdumper.getDefaultArgs( + const args = objdumper.getArgs( outputFilename, demangle, intelAsm, diff --git a/lib/compilers/win32.ts b/lib/compilers/win32.ts index 4027fd8d1..83fcdfa13 100644 --- a/lib/compilers/win32.ts +++ b/lib/compilers/win32.ts @@ -39,7 +39,7 @@ import {BaseCompiler} from '../base-compiler.js'; import {copyNeededDlls} from '../binaries/win-utils.js'; import {CompilationEnvironment} from '../compilation-env.js'; import {MapFileReaderVS} from '../mapfiles/map-file-vs.js'; -import {AsmParser} from '../parsers/asm-parser.js'; +import {VcAsmParser} from '../parsers/asm-parser-vc.js'; import {PELabelReconstructor} from '../pe32-support.js'; export class Win32Compiler extends BaseCompiler { @@ -47,12 +47,12 @@ export class Win32Compiler extends BaseCompiler { return 'win32'; } - binaryAsmParser: AsmParser; + binaryAsmParser: VcAsmParser; constructor(compilerInfo: PreliminaryCompilerInfo, env: CompilationEnvironment) { super(compilerInfo, env); - this.binaryAsmParser = new AsmParser(this.compilerProps); + this.binaryAsmParser = new VcAsmParser(); } private findExistingLibFile(libName: string, libPaths: string[]): string | null { @@ -99,10 +99,6 @@ export class Win32Compiler extends BaseCompiler { return this.getOutputFilename(dirPath, outputFilebase, key) + '.exe'; } - override getObjdumpOutputFilename(defaultOutputFilename: string) { - return this.getExecutableFilename(path.dirname(defaultOutputFilename), 'output'); - } - override getSharedLibraryPathsAsArguments( libraries: SelectedLibraryVersion[], libDownloadPath: string | undefined, @@ -254,19 +250,22 @@ export class Win32Compiler extends BaseCompiler { return [ '/nologo', - '/FA', - '/Fa' + this.filename(outputFilename.replace(/\.exe$/, '')), - '/Fo' + this.filename(outputFilename.replace(/\.exe$/, '') + '.obj'), + '/FA', // assembly listing with source and machine code + '/Fa' + this.filename(outputFilename.replace(/\.exe$/, '')), // assembly listing + '/Fo' + this.filename(outputFilename.replace(/\.exe$/, '') + '.obj'), // object file '/Fm' + this.filename(mapFilename), '/Fe' + this.filename(this.getExecutableFilename(path.dirname(outputFilename), 'output')), + '/Zi', // complete debugging information ]; } return [ '/nologo', '/FA', - '/c', + '/c', // compile only, do not link '/Fa' + this.filename(outputFilename), '/Fo' + this.filename(outputFilename + '.obj'), + '/Zi', + '/Fd' + this.filename(outputFilename + '.pdb'), // default pdb name for obj is vcXXX.pdb ]; } diff --git a/lib/objdumper/_all.ts b/lib/objdumper/_all.ts index 7437f05e3..85e357949 100644 --- a/lib/objdumper/_all.ts +++ b/lib/objdumper/_all.ts @@ -28,3 +28,4 @@ export {DefaultObjdumper} from './default.js'; export {ElfToolChainObjdumper} from './elftoolchain.js'; export {GoldenGateObjdumper} from './goldengate.js'; export {LlvmObjdumper} from './llvm.js'; +export {VcObjdumper} from './vc.js'; diff --git a/lib/objdumper/base.ts b/lib/objdumper/base.ts index a602da896..b6ad842c9 100644 --- a/lib/objdumper/base.ts +++ b/lib/objdumper/base.ts @@ -24,6 +24,7 @@ import type {ExecutionOptions} from '../../types/compilation/compilation.interfaces.js'; import type {UnprocessedExecResult} from '../../types/execution/execution.interfaces.js'; +import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js'; export interface ObjdumpResult { code: number; @@ -39,13 +40,14 @@ export abstract class BaseObjdumper { protected readonly widthOptions: string[], ) {} - getDefaultArgs( + getArgs( outputFilename: string, demangle?: boolean, intelAsm?: boolean, staticReloc?: boolean, dynamicReloc?: boolean, objdumperArguments?: string[], + filters?: ParseFiltersAndOutputOptions, ) { const args = ['-d', outputFilename, '-l', ...this.widthOptions]; diff --git a/lib/objdumper/da65.ts b/lib/objdumper/da65.ts index 1398f3c8f..d4d0287f2 100644 --- a/lib/objdumper/da65.ts +++ b/lib/objdumper/da65.ts @@ -29,7 +29,7 @@ export class Da65Objdumper extends BaseObjdumper { super([], []); } - override getDefaultArgs(outputFilename: string) { + override getArgs(outputFilename: string) { return [outputFilename]; } diff --git a/lib/objdumper/goldengate.ts b/lib/objdumper/goldengate.ts index a97664897..80feb666e 100644 --- a/lib/objdumper/goldengate.ts +++ b/lib/objdumper/goldengate.ts @@ -29,7 +29,7 @@ export class GoldenGateObjdumper extends BaseObjdumper { super([], []); } - override getDefaultArgs(outputFilename: string) { + override getArgs(outputFilename: string) { return [outputFilename]; } diff --git a/lib/objdumper/vc.ts b/lib/objdumper/vc.ts new file mode 100644 index 000000000..79f4a249c --- /dev/null +++ b/lib/objdumper/vc.ts @@ -0,0 +1,60 @@ +// Copyright (c) 2025, Compiler Explorer Authors +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// * Redistributions of source code must retain the above copyright notice, +// this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +// POSSIBILITY OF SUCH DAMAGE. + +import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js'; +import {BaseObjdumper} from './base.js'; + +export class VcObjdumper extends BaseObjdumper { + constructor() { + super([], []); + } + + static override get key() { + return 'vc'; + } + + override getArgs( + outputFilename: string, + demangle?: boolean, + intelAsm?: boolean, + staticReloc?: boolean, + dynamicReloc?: boolean, + objdumperArguments?: string[], + filters?: ParseFiltersAndOutputOptions, + ) { + // Not setting /OUT, as CE wants the output on stdout + const args = ['/LINENUMBERS', '/DISASM']; + // TODO: check if this actually does anything: + if (filters?.directives) args.push('/DIRECTIVES'); + + // if (staticReloc || dynamicReloc) args.push('/RELOCATIONS'); + + // TODO: handle demangling in post-process + // TODO: disable intel-syntax checkbox as selected, dumpbin supports only that + if (objdumperArguments) args.push(...objdumperArguments); + + args.push(`${outputFilename}.obj`); + return args; + } +} diff --git a/lib/parsers/asm-parser-cc65.ts b/lib/parsers/asm-parser-cc65.ts index 9ea7c1dd9..1d3069380 100644 --- a/lib/parsers/asm-parser-cc65.ts +++ b/lib/parsers/asm-parser-cc65.ts @@ -22,7 +22,7 @@ // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. -import {AsmResultLabel, ParsedAsmResultLine} from '../../types/asmresult/asmresult.interfaces.js'; +import {AsmResultLabel, ParsedAsmResult, ParsedAsmResultLine} from '../../types/asmresult/asmresult.interfaces.js'; import {ParseFiltersAndOutputOptions} from '../../types/features/filters.interfaces.js'; import {PropertyGetter} from '../properties.interfaces.js'; @@ -70,7 +70,7 @@ export class CC65AsmParser extends AsmParser { return undefined; } - override processBinaryAsm(asm: string, filters: ParseFiltersAndOutputOptions) { + override processBinaryAsm(asm: string, filters: ParseFiltersAndOutputOptions): ParsedAsmResult { const result: ParsedAsmResultLine[] = []; const asmLines = asm.split('\n'); diff --git a/lib/parsers/asm-parser-vc.ts b/lib/parsers/asm-parser-vc.ts index eeef5e3a5..4a254ecbd 100644 --- a/lib/parsers/asm-parser-vc.ts +++ b/lib/parsers/asm-parser-vc.ts @@ -48,7 +48,6 @@ type ResultObject = { }; export class VcAsmParser extends AsmParser { - private readonly asmBinaryParser: AsmParser; private readonly filenameComment = /^; File (.+)/; protected miscDirective = /^\s*(include|INCLUDELIB|TITLE|\.|THUMB|ARM64|TTL|DD|voltbl|_volmd|END$)/; private readonly postfixComment = /; (.*)/; @@ -64,7 +63,6 @@ export class VcAsmParser extends AsmParser { constructor(compilerProps?: PropertyGetter) { super(compilerProps); - this.asmBinaryParser = new AsmParser(compilerProps); this.commentOnly = /^;/; this.labelDef = /^\|?([$?@A-Z_a-z][\w$<>?@]*)\|?\s+(PROC|=|D[BWDQT])/; @@ -102,9 +100,23 @@ export class VcAsmParser extends AsmParser { return this.hasOpcodeRe.test(line); } + override processBinaryAsm(asm: string, filters: ParseFiltersAndOutputOptions): ParsedAsmResult { + // TODO: actually implement + const result: ParsedAsmResultLine[] = []; + const asmLines = asm.split('\n'); + + for (const line of asmLines) { + result.push({text: line, source: null}); + } + + return { + asm: result, + }; + } + override processAsm(asm: string, filters: ParseFiltersAndOutputOptions): ParsedAsmResult { if (filters.binary || filters.binaryObject) { - return this.asmBinaryParser.processAsm(asm, filters); + return this.processBinaryAsm(asm, filters); } const getFilenameFromComment = (line: string): string | null => { diff --git a/package-lock.json b/package-lock.json index fcc26ba48..928ef8503 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2863,6 +2863,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=8.0.0" } @@ -2884,6 +2885,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/context-async-hooks/-/context-async-hooks-2.1.0.tgz", "integrity": "sha512-zOyetmZppnwTyPrt4S7jMfXiSX9yyfF0hxlA8B5oo2TtKl+/RGCy7fi4DrBfIf3lCPrkKsRBWZZD7RFojK7FDg==", "license": "Apache-2.0", + "peer": true, "engines": { "node": "^18.19.0 || >=20.6.0" }, @@ -2896,6 +2898,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/core/-/core-2.1.0.tgz", "integrity": "sha512-RMEtHsxJs/GiHHxYT58IY57UXAQTuUnZVco6ymDEqTNlJKTimM4qPUPVe8InNFyBjhHBEAx4k3Q8LtNayBsbUQ==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/semantic-conventions": "^1.29.0" }, @@ -2911,6 +2914,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.204.0.tgz", "integrity": "sha512-vV5+WSxktzoMP8JoYWKeopChy6G3HKk4UQ2hESCRDUUTZqQ3+nM3u8noVG0LmNfRWwcFBnbZ71GKC7vaYYdJ1g==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/api-logs": "0.204.0", "import-in-the-middle": "^1.8.1", @@ -3303,6 +3307,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/resources/-/resources-2.1.0.tgz", "integrity": "sha512-1CJjf3LCvoefUOgegxi8h6r4B/wLSzInyhGP2UmIBYNlo4Qk5CZ73e1eEyWmfXvFtm1ybkmfb2DqWvspsYLrWw==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/core": "2.1.0", "@opentelemetry/semantic-conventions": "^1.29.0" @@ -3319,6 +3324,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-2.1.0.tgz", "integrity": "sha512-uTX9FBlVQm4S2gVQO1sb5qyBLq/FPjbp+tmGoxu4tIgtYGmBYB44+KX/725RFDe30yBSaA9Ml9fqphe1hbUyLQ==", "license": "Apache-2.0", + "peer": true, "dependencies": { "@opentelemetry/core": "2.1.0", "@opentelemetry/resources": "2.1.0", @@ -3336,6 +3342,7 @@ "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.37.0.tgz", "integrity": "sha512-JD6DerIKdJGmRp4jQyX5FlrQjA4tjOw1cvfsPAZXfOOEErMUHjPcPSICS+6WnM0nB0efSFARh0KAZss+bvExOA==", "license": "Apache-2.0", + "peer": true, "engines": { "node": ">=14" } @@ -3706,6 +3713,7 @@ "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.11.8.tgz", "integrity": "sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==", "license": "MIT", + "peer": true, "funding": { "type": "opencollective", "url": "https://opencollective.com/popperjs" @@ -6021,6 +6029,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -6068,6 +6077,7 @@ "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.17.1.tgz", "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -6620,6 +6630,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", @@ -8170,6 +8181,7 @@ "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ansi-colors": "^4.1.1", "strip-ansi": "^6.0.1" @@ -8793,6 +8805,7 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -11502,7 +11515,8 @@ "version": "0.49.0", "resolved": "https://registry.npmjs.org/monaco-editor/-/monaco-editor-0.49.0.tgz", "integrity": "sha512-2I8/T3X/hLxB2oPHgqcNYUVdA/ZEFShT7IAujifIPMfKkNbLOqY8XCoyHCXrsdjb36dW9MwoTwBCFpXKMwNwaQ==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/monaco-editor-webpack-plugin": { "version": "7.1.0", @@ -12521,6 +12535,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -13840,6 +13855,7 @@ "integrity": "sha512-t+YPtOQHpGW1QWsh1CHQ5cPIr9lbbGZLZnbihP/D/qZj/yuV68m8qarcV17nvkOX81BCrvzAlq2klCQFZghyTg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", @@ -14919,6 +14935,7 @@ "resolved": "https://registry.npmjs.org/terser/-/terser-5.44.0.tgz", "integrity": "sha512-nIVck8DK+GM/0Frwd+nIhZ84pR/BX7rmXMfYwyg+Sri5oGVE99/E3KvXqpC2xHFxyqXyGHTKBSioxxplrO4I4w==", "license": "BSD-2-Clause", + "peer": true, "dependencies": { "@jridgewell/source-map": "^0.3.3", "acorn": "^8.15.0", @@ -15108,6 +15125,7 @@ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -15332,13 +15350,15 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" + "license": "0BSD", + "peer": true }, "node_modules/tsx": { "version": "4.20.6", "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.20.6.tgz", "integrity": "sha512-ytQKuwgmrrkDTFP4LjR0ToE2nqgy886GpvRSpU0JAnrdBYppuY5rLkRUYPU1yCryb24SsKBTL/hlDQAEFVwtZg==", "license": "MIT", + "peer": true, "dependencies": { "esbuild": "~0.25.0", "get-tsconfig": "^4.7.5" @@ -15502,6 +15522,7 @@ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -15705,6 +15726,7 @@ "integrity": "sha512-oBXvfSHEOL8jF+R9Am7h59Up07kVVGH1NrFGFoEG6bPDZP3tGpQhvkBpy5x7U6+E6wZCu9OihsWgJqDbQIm8LQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -15821,6 +15843,7 @@ "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": ">=12" }, @@ -15834,6 +15857,7 @@ "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/chai": "^5.2.2", "@vitest/expect": "3.2.4", @@ -15954,6 +15978,7 @@ "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.102.0.tgz", "integrity": "sha512-hUtqAR3ZLVEYDEABdBioQCIqSoguHbFn1K7WlPPWSuXmx0031BD73PSE35jKyftdSh4YLDoQNgK4pqBt5Q82MA==", "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -16003,6 +16028,7 @@ "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.6.1", "@webpack-cli/configtest": "^3.0.1", diff --git a/test/base-compiler-tests.ts b/test/base-compiler-tests.ts index d31eded6d..59cb971f8 100644 --- a/test/base-compiler-tests.ts +++ b/test/base-compiler-tests.ts @@ -246,6 +246,8 @@ describe('Compiler execution', () => { '/c', '/Faexample.s', '/Foexample.s.obj', + '/Zi', + '/Fdexample.s.pdb', '/std=c++17', '/IC:/program files (x86)/Company name/Compiler 1.2.3/include', '/D', diff --git a/test/compilers/msvc-test.ts b/test/compilers/msvc-test.ts index cdb2b6e64..9e6a6bab4 100644 --- a/test/compilers/msvc-test.ts +++ b/test/compilers/msvc-test.ts @@ -48,6 +48,8 @@ describe('msvc tests', () => { '/c', '/Faoutput.s', '/Fooutput.s.obj', + '/Zi', + '/Fdoutput.s.pdb', '/EHsc', '/utf-8', 'example.cpp', @@ -70,6 +72,8 @@ describe('msvc tests', () => { '/c', '/Faoutput.s', '/Fooutput.s.obj', + '/Zi', + '/Fdoutput.s.pdb', '/EHsc', '/O2', '/source-charset:windows-1252', diff --git a/test/filters-cases/arm-moose.asm.binary.directives.labels.comments.json b/test/filters-cases/arm-moose.asm.binary.directives.labels.comments.json index f10807f1e..2e26abcd5 100644 --- a/test/filters-cases/arm-moose.asm.binary.directives.labels.comments.json +++ b/test/filters-cases/arm-moose.asm.binary.directives.labels.comments.json @@ -1,4 +1,372 @@ { - "asm": [], - "labelDefinitions": {} + "asm": [ + { + "source": null, + "text": "; Listing generated by Microsoft (R) Optimizing Compiler Version 19.15.26504.0 " + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tTTL\tC:\\Source\\compiler-explorer\\test\\cases\\arm-moose-example.cpp" + }, + { + "source": null, + "text": "\tTHUMB" + }, + { + "source": null, + "text": "\t.drectve" + }, + { + "source": null, + "text": "\tDCB\t\"-defaultlib:LIBCMT \"" + }, + { + "source": null, + "text": "\tDCB\t\"-defaultlib:OLDNAMES \"" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tEXPORT\t|moose|" + }, + { + "source": null, + "text": ";\tCOMDAT .pdata" + }, + { + "source": null, + "text": ".pdata\tSEGMENT" + }, + { + "source": null, + "text": "|$pdata1$moose| DCD imagerel |moose|" + }, + { + "source": null, + "text": "\tDCD\t0xfd1160d5" + }, + { + "source": null, + "text": "; Function compile flags: /Ogtpy" + }, + { + "source": null, + "text": ";\tCOMDAT moose" + }, + { + "source": null, + "text": ".text$mn\tSEGMENT" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "|moose|\tPROC" + }, + { + "source": null, + "text": "; File c:\\source\\compiler-explorer\\test\\cases\\arm-moose-example.cpp" + }, + { + "source": null, + "text": "; Line 9" + }, + { + "source": null, + "text": "\tpush {r3-r5,lr}" + }, + { + "source": null, + "text": "|$M22|" + }, + { + "source": null, + "text": "\tmov r5,r0" + }, + { + "source": null, + "text": "; Line 10" + }, + { + "source": null, + "text": "\tmovs r0,#1" + }, + { + "source": null, + "text": "\tmovs r4,#0" + }, + { + "source": null, + "text": "\tvdup.32 q10,r5" + }, + { + "source": null, + "text": "; Line 12" + }, + { + "source": null, + "text": "\tcmp r1,#0" + }, + { + "source": null, + "text": "\tble |$LN18@moose|" + }, + { + "source": null, + "text": "\tcmp r1,#8" + }, + { + "source": null, + "text": "\tbcc |$LN11@moose|" + }, + { + "source": null, + "text": "; Line 10" + }, + { + "source": null, + "text": "\tasrs r3,r1,#2" + }, + { + "source": null, + "text": "\tadd r3,r1,r3,lsr #0x1D" + }, + { + "source": null, + "text": "\tasrs r3,r3,#3" + }, + { + "source": null, + "text": "\tsub r3,r1,r3,lsl #3" + }, + { + "source": null, + "text": "\tvmov.i64 q8,#0" + }, + { + "source": null, + "text": "\tsubs r3,r1,r3" + }, + { + "source": null, + "text": "\tvmov q9,q8" + }, + { + "source": null, + "text": "\tvmul.i32 q10,q10,q10" + }, + { + "source": null, + "text": "|$LL4@moose|" + }, + { + "source": null, + "text": "; Line 12" + }, + { + "source": null, + "text": "\tadds r4,r4,#8" + }, + { + "source": null, + "text": "\tcmp r4,r3" + }, + { + "source": null, + "text": "; Line 13" + }, + { + "source": null, + "text": "\tvadd.i32 q8,q10,q8" + }, + { + "source": null, + "text": "\tvadd.i32 q9,q10,q9" + }, + { + "source": null, + "text": "\tblt |$LL4@moose|" + }, + { + "source": null, + "text": "; Line 10" + }, + { + "source": null, + "text": "\tvadd.i32 q8,q9,q8" + }, + { + "source": null, + "text": "\tvmov.32 r2,d17[1]" + }, + { + "source": null, + "text": "\tvmov.32 r3,d17[0]" + }, + { + "source": null, + "text": "\tadd r2,r2,r3" + }, + { + "source": null, + "text": "\tvmov.32 r3,d16[1]" + }, + { + "source": null, + "text": "\tadd r2,r2,r3" + }, + { + "source": null, + "text": "\tvmov.32 r3,d16[0]" + }, + { + "source": null, + "text": "\tadd r3,r3,r2" + }, + { + "source": null, + "text": "\tadds r0,r3,#1" + }, + { + "source": null, + "text": "|$LN11@moose|" + }, + { + "source": null, + "text": "; Line 12" + }, + { + "source": null, + "text": "\tcmp r4,r1" + }, + { + "source": null, + "text": "\tbge |$LN17@moose|" + }, + { + "source": null, + "text": "\tsubs r3,r1,r4" + }, + { + "source": null, + "text": "\tmul r3,r3,r5" + }, + { + "source": null, + "text": "\tmla r0,r3,r5,r0" + }, + { + "source": null, + "text": "|$LN17@moose|" + }, + { + "source": null, + "text": "|$M20|" + }, + { + "source": null, + "text": "; Line 16" + }, + { + "source": null, + "text": "\tpop {r3-r5,pc}" + }, + { + "source": null, + "text": "|$LN18@moose|" + }, + { + "source": null, + "text": "|$M21|" + }, + { + "source": null, + "text": "\tpop {r3-r5,pc}" + }, + { + "source": null, + "text": "|$M23|" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tENDP ; |moose|" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "; Function compile flags: /Ogtpy" + }, + { + "source": null, + "text": ";\tCOMDAT thing" + }, + { + "source": null, + "text": ".text$mn\tSEGMENT" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "|thing|\tPROC" + }, + { + "source": null, + "text": "; File c:\\source\\compiler-explorer\\test\\cases\\arm-moose-example.cpp" + }, + { + "source": null, + "text": "; Line 7" + }, + { + "source": null, + "text": "\tmul r0,r0,r0" + }, + { + "source": null, + "text": "|$M4|" + }, + { + "source": null, + "text": "\tbx lr" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tENDP ; |thing|" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tEND" + }, + { + "source": null, + "text": "" + } + ] } diff --git a/test/filters-cases/vc-main-opt-out.asm.binary.directives.labels.comments.json b/test/filters-cases/vc-main-opt-out.asm.binary.directives.labels.comments.json index f10807f1e..3fd790d46 100644 --- a/test/filters-cases/vc-main-opt-out.asm.binary.directives.labels.comments.json +++ b/test/filters-cases/vc-main-opt-out.asm.binary.directives.labels.comments.json @@ -1,4 +1,324 @@ { - "asm": [], - "labelDefinitions": {} + "asm": [ + { + "source": null, + "text": "; Listing generated by Microsoft (R) Optimizing Compiler Version 19.14.26433.0 " + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "include listing.inc" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "INCLUDELIB LIBCMT" + }, + { + "source": null, + "text": "INCLUDELIB OLDNAMES" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "PUBLIC\tmain" + }, + { + "source": null, + "text": "PUBLIC\t??A?$array@H$0L@@std@@QEBAAEBH_K@Z\t\t; std::array::operator[]" + }, + { + "source": null, + "text": "EXTRN\t__GSHandlerCheck:PROC" + }, + { + "source": null, + "text": "EXTRN\t__security_check_cookie:PROC" + }, + { + "source": null, + "text": "EXTRN\t__security_cookie:QWORD" + }, + { + "source": null, + "text": "pdata\tSEGMENT" + }, + { + "source": null, + "text": "$pdata$main DD\timagerel $LN3" + }, + { + "source": null, + "text": "\tDD\timagerel $LN3+142" + }, + { + "source": null, + "text": "\tDD\timagerel $unwind$main" + }, + { + "source": null, + "text": "pdata\tENDS" + }, + { + "source": null, + "text": "xdata\tSEGMENT" + }, + { + "source": null, + "text": "$unwind$main DD\t011319H" + }, + { + "source": null, + "text": "\tDD\t0c204H" + }, + { + "source": null, + "text": "\tDD\timagerel __GSHandlerCheck" + }, + { + "source": null, + "text": "\tDD\t050H" + }, + { + "source": null, + "text": "xdata\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": ";\tCOMDAT ??A?$array@H$0L@@std@@QEBAAEBH_K@Z" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "this$ = 8" + }, + { + "source": null, + "text": "_Pos$ = 16" + }, + { + "source": null, + "text": "??A?$array@H$0L@@std@@QEBAAEBH_K@Z PROC\t\t\t; std::array::operator[], COMDAT" + }, + { + "source": null, + "text": "; File std\\array" + }, + { + "source": null, + "text": "; Line 187" + }, + { + "source": null, + "text": "\tmov\tQWORD PTR [rsp+16], rdx" + }, + { + "source": null, + "text": "\tmov\tQWORD PTR [rsp+8], rcx" + }, + { + "source": null, + "text": "; Line 197" + }, + { + "source": null, + "text": "\tmov\trax, QWORD PTR this$[rsp]" + }, + { + "source": null, + "text": "\tmov\trcx, QWORD PTR _Pos$[rsp]" + }, + { + "source": null, + "text": "\tlea\trax, QWORD PTR [rax+rcx*4]" + }, + { + "source": null, + "text": "; Line 198" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "??A?$array@H$0L@@std@@QEBAAEBH_K@Z ENDP\t\t\t; std::array::operator[]" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "a$ = 32" + }, + { + "source": null, + "text": "__$ArrayPad$ = 80" + }, + { + "source": null, + "text": "main\tPROC" + }, + { + "source": null, + "text": "; File c:\\source\\compiler-explorer\\test\\cases\\vc-main-opt-out-example.cpp" + }, + { + "source": null, + "text": "; Line 10" + }, + { + "source": null, + "text": "$LN3:" + }, + { + "source": null, + "text": "\tsub\trsp, 104\t\t\t\t; 00000068H" + }, + { + "source": null, + "text": "\tmov\trax, QWORD PTR __security_cookie" + }, + { + "source": null, + "text": "\txor\trax, rsp" + }, + { + "source": null, + "text": "\tmov\tQWORD PTR __$ArrayPad$[rsp], rax" + }, + { + "source": null, + "text": "; Line 11" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp], 1" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+4], 3" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+8], 4" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+12], 2" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+16], 3" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+20], 5" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+24], 6" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+28], 4" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+32], 8" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+36], 9" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR a$[rsp+40], 2" + }, + { + "source": null, + "text": "; Line 13" + }, + { + "source": null, + "text": "\tmov\tedx, 2" + }, + { + "source": null, + "text": "\tlea\trcx, QWORD PTR a$[rsp]" + }, + { + "source": null, + "text": "\tcall\t??A?$array@H$0L@@std@@QEBAAEBH_K@Z\t; std::array::operator[]" + }, + { + "source": null, + "text": "\tmov\teax, DWORD PTR [rax]" + }, + { + "source": null, + "text": "; Line 14" + }, + { + "source": null, + "text": "\tmov\trcx, QWORD PTR __$ArrayPad$[rsp]" + }, + { + "source": null, + "text": "\txor\trcx, rsp" + }, + { + "source": null, + "text": "\tcall\t__security_check_cookie" + }, + { + "source": null, + "text": "\tadd\trsp, 104\t\t\t\t; 00000068H" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "main\tENDP" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "END" + }, + { + "source": null, + "text": "" + } + ] } diff --git a/test/filters-cases/vc-numbers.asm.binary.directives.labels.comments.json b/test/filters-cases/vc-numbers.asm.binary.directives.labels.comments.json index f10807f1e..27e9b8b67 100644 --- a/test/filters-cases/vc-numbers.asm.binary.directives.labels.comments.json +++ b/test/filters-cases/vc-numbers.asm.binary.directives.labels.comments.json @@ -1,4 +1,68 @@ { - "asm": [], - "labelDefinitions": {} + "asm": [ + { + "source": null, + "text": "; Listing generated by Microsoft (R) Optimizing Compiler Version 19.15.26504.0" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tTITLE\tC:\\Source\\compiler-explorer\\test\\cases\\vc-regex-example.cpp" + }, + { + "source": null, + "text": "\t.686P" + }, + { + "source": null, + "text": "\t.XMM" + }, + { + "source": null, + "text": "\tinclude listing.inc" + }, + { + "source": null, + "text": "\t.model\tflat" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "INCLUDELIB LIBCMT" + }, + { + "source": null, + "text": "INCLUDELIB OLDNAMES" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "; only here to exercise bug https://github.com/compiler-explorer/compiler-explorer/issues/1337" + }, + { + "source": null, + "text": "1234" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "END" + }, + { + "source": null, + "text": "" + } + ] } diff --git a/test/filters-cases/vc-regex.asm.binary.directives.labels.comments.json b/test/filters-cases/vc-regex.asm.binary.directives.labels.comments.json index f10807f1e..3c897cfe4 100644 --- a/test/filters-cases/vc-regex.asm.binary.directives.labels.comments.json +++ b/test/filters-cases/vc-regex.asm.binary.directives.labels.comments.json @@ -1,4 +1,404 @@ { - "asm": [], - "labelDefinitions": {} + "asm": [ + { + "source": null, + "text": "; Listing generated by Microsoft (R) Optimizing Compiler Version 19.15.26504.0 " + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "\tTITLE\tC:\\Source\\compiler-explorer\\test\\cases\\vc-regex-example.cpp" + }, + { + "source": null, + "text": "\t.686P" + }, + { + "source": null, + "text": "\t.XMM" + }, + { + "source": null, + "text": "\tinclude listing.inc" + }, + { + "source": null, + "text": "\t.model\tflat" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "INCLUDELIB LIBCMT" + }, + { + "source": null, + "text": "INCLUDELIB OLDNAMES" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "CONST\tSEGMENT" + }, + { + "source": null, + "text": "$SG39290 DB\t'Some people, when confronted with a problem, think \"I k'" + }, + { + "source": null, + "text": "\tDB\t'now, I''ll use regular expressions.\" Now they have two proble'" + }, + { + "source": null, + "text": "\tDB\t'ms.', 00H" + }, + { + "source": null, + "text": "$SG39291 DB\t'REGULAR EXPRESSIONS', 00H" + }, + { + "source": null, + "text": "CONST\tENDS" + }, + { + "source": null, + "text": "PUBLIC\t?regexTest@@YAXXZ\t\t\t\t; regexTest" + }, + { + "source": null, + "text": "xdata$x\tSEGMENT" + }, + { + "source": null, + "text": "__unwindtable$?regexTest@@YAXXZ DD 0ffffffffH" + }, + { + "source": null, + "text": "\tDD\tFLAT:__unwindfunclet$?regexTest@@YAXXZ$0" + }, + { + "source": null, + "text": "__ehfuncinfo$?regexTest@@YAXXZ DD 019930522H" + }, + { + "source": null, + "text": "\tDD\t01H" + }, + { + "source": null, + "text": "\tDD\tFLAT:__unwindtable$?regexTest@@YAXXZ" + }, + { + "source": null, + "text": "\tDD\t2 DUP(00H)" + }, + { + "source": null, + "text": "\tDD\t2 DUP(00H)" + }, + { + "source": null, + "text": "\tDD\t00H" + }, + { + "source": null, + "text": "\tDD\t01H" + }, + { + "source": null, + "text": "xdata$x\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "_self_regex$ = -60\t\t\t\t\t; size = 20" + }, + { + "source": null, + "text": "_s$ = -40\t\t\t\t\t\t; size = 24" + }, + { + "source": null, + "text": "__$ArrayPad$ = -16\t\t\t\t\t; size = 4" + }, + { + "source": null, + "text": "__$EHRec$ = -12\t\t\t\t\t\t; size = 12" + }, + { + "source": null, + "text": "?regexTest@@YAXXZ PROC\t\t\t\t\t; regexTest" + }, + { + "source": null, + "text": "; File c:\\source\\compiler-explorer\\test\\cases\\vc-regex-example.cpp" + }, + { + "source": null, + "text": "; Line 7" + }, + { + "source": null, + "text": "\tpush\tebp" + }, + { + "source": null, + "text": "\tmov\tebp, esp" + }, + { + "source": null, + "text": "\tpush\t-1" + }, + { + "source": null, + "text": "\tpush\t__ehhandler$?regexTest@@YAXXZ" + }, + { + "source": null, + "text": "\tmov\teax, DWORD PTR fs:0" + }, + { + "source": null, + "text": "\tpush\teax" + }, + { + "source": null, + "text": "\tsub\tesp, 48\t\t\t\t\t; 00000030H" + }, + { + "source": null, + "text": "\tmov\teax, DWORD PTR ___security_cookie" + }, + { + "source": null, + "text": "\txor\teax, ebp" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR __$ArrayPad$[ebp], eax" + }, + { + "source": null, + "text": "\tpush\teax" + }, + { + "source": null, + "text": "\tlea\teax, DWORD PTR __$EHRec$[ebp]" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR fs:0, eax" + }, + { + "source": null, + "text": "; Line 8" + }, + { + "source": null, + "text": "\tpush\tOFFSET $SG39290" + }, + { + "source": null, + "text": "\tlea\tecx, DWORD PTR _s$[ebp]" + }, + { + "source": null, + "text": "\tcall\t??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@QBD@Z ; std::basic_string,std::allocator >::basic_string,std::allocator >" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR __$EHRec$[ebp+8], 0" + }, + { + "source": null, + "text": "; Line 11" + }, + { + "source": null, + "text": "\tpush\t256\t\t\t\t\t; 00000100H" + }, + { + "source": null, + "text": "\tpush\t1" + }, + { + "source": null, + "text": "\tcall\t??Uregex_constants@std@@YA?AW4syntax_option_type@01@W4201@0@Z ; std::regex_constants::operator|" + }, + { + "source": null, + "text": "\tadd\tesp, 8" + }, + { + "source": null, + "text": "\tpush\teax" + }, + { + "source": null, + "text": "\tpush\tOFFSET $SG39291" + }, + { + "source": null, + "text": "\tlea\tecx, DWORD PTR _self_regex$[ebp]" + }, + { + "source": null, + "text": "\tcall\t??0?$basic_regex@DV?$regex_traits@D@std@@@std@@QAE@PBDW4syntax_option_type@regex_constants@1@@Z ; std::basic_regex >::basic_regex >" + }, + { + "source": null, + "text": "; Line 13" + }, + { + "source": null, + "text": "\tlea\tecx, DWORD PTR _self_regex$[ebp]" + }, + { + "source": null, + "text": "\tcall\t??1?$basic_regex@DV?$regex_traits@D@std@@@std@@QAE@XZ ; std::basic_regex >::~basic_regex >" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR __$EHRec$[ebp+8], -1" + }, + { + "source": null, + "text": "\tlea\tecx, DWORD PTR _s$[ebp]" + }, + { + "source": null, + "text": "\tcall\t??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ ; std::basic_string,std::allocator >::~basic_string,std::allocator >" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR __$EHRec$[ebp]" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR fs:0, ecx" + }, + { + "source": null, + "text": "\tpop\tecx" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR __$ArrayPad$[ebp]" + }, + { + "source": null, + "text": "\txor\tecx, ebp" + }, + { + "source": null, + "text": "\tcall\t@__security_check_cookie@4" + }, + { + "source": null, + "text": "\tmov\tesp, ebp" + }, + { + "source": null, + "text": "\tpop\tebp" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "text$x\tSEGMENT" + }, + { + "source": null, + "text": "__unwindfunclet$?regexTest@@YAXXZ$0:" + }, + { + "source": null, + "text": "\tlea\tecx, DWORD PTR _s$[ebp]" + }, + { + "source": null, + "text": "\tjmp\t??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ ; std::basic_string,std::allocator >::~basic_string,std::allocator >" + }, + { + "source": null, + "text": "__ehhandler$?regexTest@@YAXXZ:" + }, + { + "source": null, + "text": "\tmov\tedx, DWORD PTR [esp+8]" + }, + { + "source": null, + "text": "\tlea\teax, DWORD PTR [edx+12]" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR [edx-52]" + }, + { + "source": null, + "text": "\txor\tecx, eax" + }, + { + "source": null, + "text": "\tcall\t@__security_check_cookie@4" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR [edx-4]" + }, + { + "source": null, + "text": "\txor\tecx, eax" + }, + { + "source": null, + "text": "\tcall\t@__security_check_cookie@4" + }, + { + "source": null, + "text": "\tmov\teax, OFFSET __ehfuncinfo$?regexTest@@YAXXZ" + }, + { + "source": null, + "text": "\tjmp\t___CxxFrameHandler3" + }, + { + "source": null, + "text": "text$x\tENDS" + }, + { + "source": null, + "text": "?regexTest@@YAXXZ ENDP\t\t\t\t\t; regexTest" + }, + { + "source": null, + "text": "END" + }, + { + "source": null, + "text": "" + } + ] } diff --git a/test/filters-cases/vc-threadlocalddef.asm.binary.directives.labels.comments.json b/test/filters-cases/vc-threadlocalddef.asm.binary.directives.labels.comments.json index f10807f1e..19f7effda 100644 --- a/test/filters-cases/vc-threadlocalddef.asm.binary.directives.labels.comments.json +++ b/test/filters-cases/vc-threadlocalddef.asm.binary.directives.labels.comments.json @@ -1,4 +1,472 @@ { - "asm": [], - "labelDefinitions": {} + "asm": [ + { + "source": null, + "text": "; Listing generated by Microsoft (R) Optimizing Compiler Version 19.15.26729.0 " + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "include listing.inc" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "INCLUDELIB LIBCMT" + }, + { + "source": null, + "text": "INCLUDELIB OLDNAMES" + }, + { + "source": null, + "text": "" + }, + { + "source": null, + "text": "PUBLIC\t?g@@3Usafetls@@A\t\t\t\t; g" + }, + { + "source": null, + "text": "PUBLIC\t?h@@3HA\t\t\t\t\t\t; h" + }, + { + "source": null, + "text": "_TLS\tSEGMENT" + }, + { + "source": null, + "text": "?h@@3HA\tDD\t012345H\t\t\t\t\t; h" + }, + { + "source": null, + "text": "\tORG $+4" + }, + { + "source": null, + "text": "?g@@3Usafetls@@A DD 098765H\t\t\t\t; g" + }, + { + "source": null, + "text": "\tORG $+8" + }, + { + "source": null, + "text": "_TLS\tENDS" + }, + { + "source": null, + "text": "PUBLIC\t?value@safetls@@QEAAHXZ\t\t\t\t; safetls::value" + }, + { + "source": null, + "text": "PUBLIC\t?func@@YAHXZ\t\t\t\t\t; func" + }, + { + "source": null, + "text": "PUBLIC\t?func2@@YAHXZ\t\t\t\t\t; func2" + }, + { + "source": null, + "text": "PUBLIC\tmain" + }, + { + "source": null, + "text": "EXTRN\t_tls_index:DWORD" + }, + { + "source": null, + "text": ";\tCOMDAT pdata" + }, + { + "source": null, + "text": "pdata\tSEGMENT" + }, + { + "source": null, + "text": "$pdata$?func@@YAHXZ DD imagerel $LN3" + }, + { + "source": null, + "text": "\tDD\timagerel $LN3+43" + }, + { + "source": null, + "text": "\tDD\timagerel $unwind$?func@@YAHXZ" + }, + { + "source": null, + "text": "pdata\tENDS" + }, + { + "source": null, + "text": "pdata\tSEGMENT" + }, + { + "source": null, + "text": "$pdata$main DD\timagerel $LN3" + }, + { + "source": null, + "text": "\tDD\timagerel $LN3+31" + }, + { + "source": null, + "text": "\tDD\timagerel $unwind$main" + }, + { + "source": null, + "text": "pdata\tENDS" + }, + { + "source": null, + "text": "xdata\tSEGMENT" + }, + { + "source": null, + "text": "$unwind$main DD\t010401H" + }, + { + "source": null, + "text": "\tDD\t06204H" + }, + { + "source": null, + "text": "xdata\tENDS" + }, + { + "source": null, + "text": ";\tCOMDAT xdata" + }, + { + "source": null, + "text": "xdata\tSEGMENT" + }, + { + "source": null, + "text": "$unwind$?func@@YAHXZ DD 010401H" + }, + { + "source": null, + "text": "\tDD\t04204H" + }, + { + "source": null, + "text": "xdata\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "tv64 = 32" + }, + { + "source": null, + "text": "main\tPROC" + }, + { + "source": null, + "text": "; File c:\\users\\quist\\appdata\\local\\temp\\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\\example.cpp" + }, + { + "source": null, + "text": "; Line 26" + }, + { + "source": null, + "text": "$LN3:" + }, + { + "source": null, + "text": "\tsub\trsp, 56\t\t\t\t\t; 00000038H" + }, + { + "source": null, + "text": "; Line 27" + }, + { + "source": null, + "text": "\tcall\t?func@@YAHXZ\t\t\t\t; func" + }, + { + "source": null, + "text": "\tmov\tDWORD PTR tv64[rsp], eax" + }, + { + "source": null, + "text": "\tcall\t?func2@@YAHXZ\t\t\t\t; func2" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR tv64[rsp]" + }, + { + "source": null, + "text": "\tadd\tecx, eax" + }, + { + "source": null, + "text": "\tmov\teax, ecx" + }, + { + "source": null, + "text": "; Line 28" + }, + { + "source": null, + "text": "\tadd\trsp, 56\t\t\t\t\t; 00000038H" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "main\tENDP" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": ";\tCOMDAT ?func2@@YAHXZ" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "?func2@@YAHXZ PROC\t\t\t\t\t; func2, COMDAT" + }, + { + "source": null, + "text": "; File c:\\users\\quist\\appdata\\local\\temp\\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\\example.cpp" + }, + { + "source": null, + "text": "; Line 22" + }, + { + "source": null, + "text": "\tmov\teax, OFFSET FLAT:?h@@3HA\t\t; h" + }, + { + "source": null, + "text": "\tmov\teax, eax" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR _tls_index" + }, + { + "source": null, + "text": "\tmov\trdx, QWORD PTR gs:88" + }, + { + "source": null, + "text": "\tmov\trcx, QWORD PTR [rdx+rcx*8]" + }, + { + "source": null, + "text": "\tmov\teax, DWORD PTR [rax+rcx]" + }, + { + "source": null, + "text": "; Line 23" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "?func2@@YAHXZ ENDP\t\t\t\t\t; func2" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": ";\tCOMDAT ?func@@YAHXZ" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "?func@@YAHXZ PROC\t\t\t\t\t; func, COMDAT" + }, + { + "source": null, + "text": "; File c:\\users\\quist\\appdata\\local\\temp\\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\\example.cpp" + }, + { + "source": null, + "text": "; Line 16" + }, + { + "source": null, + "text": "$LN3:" + }, + { + "source": null, + "text": "\tsub\trsp, 40\t\t\t\t\t; 00000028H" + }, + { + "source": null, + "text": "; Line 17" + }, + { + "source": null, + "text": "\tmov\teax, OFFSET FLAT:?g@@3Usafetls@@A\t; g" + }, + { + "source": null, + "text": "\tmov\teax, eax" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR _tls_index" + }, + { + "source": null, + "text": "\tmov\trdx, QWORD PTR gs:88" + }, + { + "source": null, + "text": "\tadd\trax, QWORD PTR [rdx+rcx*8]" + }, + { + "source": null, + "text": "\tmov\trcx, rax" + }, + { + "source": null, + "text": "\tcall\t?value@safetls@@QEAAHXZ\t\t\t; safetls::value" + }, + { + "source": null, + "text": "; Line 18" + }, + { + "source": null, + "text": "\tadd\trsp, 40\t\t\t\t\t; 00000028H" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "?func@@YAHXZ ENDP\t\t\t\t\t; func" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "; Function compile flags: /Odtp" + }, + { + "source": null, + "text": ";\tCOMDAT ?value@safetls@@QEAAHXZ" + }, + { + "source": null, + "text": "_TEXT\tSEGMENT" + }, + { + "source": null, + "text": "this$ = 8" + }, + { + "source": null, + "text": "?value@safetls@@QEAAHXZ PROC\t\t\t\t; safetls::value, COMDAT" + }, + { + "source": null, + "text": "; File c:\\users\\quist\\appdata\\local\\temp\\compiler-explorer-compiler118927-25960-1r4bdyh.ql7u\\example.cpp" + }, + { + "source": null, + "text": "; Line 9" + }, + { + "source": null, + "text": "\tmov\tQWORD PTR [rsp+8], rcx" + }, + { + "source": null, + "text": "\tmov\trax, QWORD PTR this$[rsp]" + }, + { + "source": null, + "text": "\tmov\trcx, QWORD PTR this$[rsp]" + }, + { + "source": null, + "text": "\tmov\tecx, DWORD PTR [rcx+4]" + }, + { + "source": null, + "text": "\tmov\teax, DWORD PTR [rax]" + }, + { + "source": null, + "text": "\tsub\teax, ecx" + }, + { + "source": null, + "text": "\tmov\trcx, QWORD PTR this$[rsp]" + }, + { + "source": null, + "text": "\tadd\teax, DWORD PTR [rcx+8]" + }, + { + "source": null, + "text": "\tret\t0" + }, + { + "source": null, + "text": "?value@safetls@@QEAAHXZ ENDP\t\t\t\t; safetls::value" + }, + { + "source": null, + "text": "_TEXT\tENDS" + }, + { + "source": null, + "text": "END" + }, + { + "source": null, + "text": "" + } + ] } diff --git a/test/objdumper-tests.ts b/test/objdumper-tests.ts index 2f78eaba7..e60f9a07d 100644 --- a/test/objdumper-tests.ts +++ b/test/objdumper-tests.ts @@ -98,11 +98,11 @@ describe('Objdumper', () => { }); }); - describe('getDefaultArgs', () => { + describe('getArgs', () => { it('should generate correct arguments', () => { const objdumper = new DefaultObjdumper(); - const args = objdumper.getDefaultArgs( + const args = objdumper.getArgs( 'test.o', true, // demangle true, // intelAsm