diff options
Diffstat (limited to 'lib/compilers/assembly.js')
-rw-r--r-- | lib/compilers/assembly.js | 45 |
1 files changed, 20 insertions, 25 deletions
diff --git a/lib/compilers/assembly.js b/lib/compilers/assembly.js index 076b83c01..25156ae22 100644 --- a/lib/compilers/assembly.js +++ b/lib/compilers/assembly.js @@ -49,25 +49,24 @@ class AssemblyCompiler extends BaseCompiler { return []; } - runCompiler(compiler, options, inputFilename, execOptions) { + async runCompiler(compiler, options, inputFilename, execOptions) { if (!execOptions) { execOptions = this.getDefaultExecOptions(); } execOptions.customCwd = path.dirname(inputFilename); - return this.exec(compiler, options, execOptions).then(result => { - result.inputFilename = inputFilename; - result.stdout = utils.parseOutput(result.stdout, inputFilename); - result.stderr = utils.parseOutput(result.stderr, inputFilename); - return result; - }); + const result = await this.exec(compiler, options, execOptions); + result.inputFilename = inputFilename; + result.stdout = utils.parseOutput(result.stdout, inputFilename); + result.stderr = utils.parseOutput(result.stderr, inputFilename); + return result; } checkOutputFileAndDoPostProcess(asmResult, outputFilename, filters) { return this.postProcess(asmResult, outputFilename, filters); } - getGeneratedOutputfilename(inputFilename) { + getGeneratedOutputFilename(inputFilename) { const outputFolder = path.dirname(inputFilename); return new Promise((resolve, reject) => { @@ -82,24 +81,20 @@ class AssemblyCompiler extends BaseCompiler { }); } - objdump(outputFilename, result, maxSize, intelAsm, demangle) { - return this.getGeneratedOutputfilename(outputFilename) - .then((realOutputFilename) => { - const dirPath = path.dirname(realOutputFilename); - let args = ["-d", realOutputFilename, "-l", "--insn-width=16"]; - if (demangle) args = args.concat("-C"); - if (intelAsm) args = args.concat(["-M", "intel"]); - return this.exec(this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}) - .then(objResult => { - result.asm = objResult.stdout; - if (objResult.code !== 0) { - result.asm = "<No output: objdump returned " + objResult.code + ">"; - } - return result; - }); - }); + async objdump(outputFilename, result, maxSize, intelAsm, demangle) { + const realOutputFilename = await this.getGeneratedOutputFilename(outputFilename); + const dirPath = path.dirname(realOutputFilename); + let args = ["-d", realOutputFilename, "-l", "--insn-width=16"]; + if (demangle) args = args.concat("-C"); + if (intelAsm) args = args.concat(["-M", "intel"]); + const objResult = await this.exec( + this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}); + result.asm = objResult.stdout; + if (objResult.code !== 0) { + result.asm = "<No output: objdump returned " + objResult.code + ">"; + } + return result; } } - module.exports = AssemblyCompiler; |