MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / objdump

Method objdump

lib/compilers/z88dk.ts:135–203  ·  view source on GitHub ↗
(
        outputFilename: string,
        result: any,
        maxSize: number,
        intelAsm: boolean,
        demangle: boolean,
        staticReloc: boolean,
        dynamicReloc: boolean,
        filters: ParseFiltersAndOutputOptions,
    )

Source from the content-addressed store, hash-verified

133 }
134
135 override async objdump(
136 outputFilename: string,
137 result: any,
138 maxSize: number,
139 intelAsm: boolean,
140 demangle: boolean,
141 staticReloc: boolean,
142 dynamicReloc: boolean,
143 filters: ParseFiltersAndOutputOptions,
144 ) {
145 outputFilename = this.getObjdumpInputFilename(outputFilename);
146
147 // sometimes (with +z80 for example) the .bin file is written and the .s file is empty
148 if (await utils.fileExists(outputFilename + '.bin')) {
149 outputFilename += '.bin';
150 } else {
151 if (await utils.fileExists(outputFilename + '.s')) {
152 outputFilename += '.s';
153 } else {
154 result.asm = '<No output file ' + outputFilename + '.s>';
155 return result;
156 }
157 }
158
159 const args = [...this.compiler.objdumperArgs, outputFilename];
160
161 if (this.externalparser) {
162 const objResult = await this.externalparser.objdumpAndParseAssembly(result.dirPath, args, filters);
163 if (objResult.parsingTime !== undefined) {
164 objResult.objdumpTime = Number.parseInt(result.execTime, 10) - Number.parseInt(result.parsingTime, 10);
165 delete objResult.execTime;
166 }
167
168 result = {...result, ...objResult};
169 } else {
170 const execOptions: ExecutionOptions = {
171 maxOutput: maxSize,
172 customCwd: (result.dirPath as string) || path.dirname(outputFilename),
173 };
174 const objResult = await this.exec(this.compiler.objdumper, args, execOptions);
175
176 if (objResult.code === 0) {
177 result.objdumpTime = objResult.execTime;
178 result.asm = this.postProcessObjdumpOutput(objResult.stdout);
179 } else {
180 logger.error(`Error executing objdump ${this.compiler.objdumper}`, objResult);
181 result.asm = [{text: `<No output: objdump returned ${objResult.code}>`}];
182 }
183 }
184
185 if (result.code === 0 && filters.binary) {
186 const tapeFilepath = path.join(result.dirPath, this.getTapefilename());
187 if (await utils.fileExists(tapeFilepath)) {
188 await addArtifactToResult(result, tapeFilepath, ArtifactType.zxtape);
189 }
190
191 const smsFilepath = path.join(result.dirPath, this.getSmsfilename());
192 if (await utils.fileExists(smsFilepath)) {

Callers

nothing calls this directly

Calls 10

getTapefilenameMethod · 0.95
getSmsfilenameMethod · 0.95
getGbfilenameMethod · 0.95
addArtifactToResultFunction · 0.85
fileExistsMethod · 0.80
errorMethod · 0.80
execMethod · 0.45

Tested by

no test coverage detected