diff options
author | Matt Godbolt <matt@godbolt.org> | 2019-05-15 12:03:36 -0500 |
---|---|---|
committer | Matt Godbolt <matt@godbolt.org> | 2019-05-15 12:03:36 -0500 |
commit | 8807b6ae7bb1c5c0f233937a9b16fc9d9b81eff4 (patch) | |
tree | 6d37b587d29f1d7b6a367ed2a1b7beb34b0ffabb /lib/compilers/assembly.js | |
parent | ef260168ab75aa8eaf8dc54bc1938a41259c9cf9 (diff) | |
download | compiler-explorer-8807b6ae7bb1c5c0f233937a9b16fc9d9b81eff4.tar.gz compiler-explorer-8807b6ae7bb1c5c0f233937a9b16fc9d9b81eff4.zip |
Ensure objdump runs in the right directory
Diffstat (limited to 'lib/compilers/assembly.js')
-rw-r--r-- | lib/compilers/assembly.js | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/compilers/assembly.js b/lib/compilers/assembly.js index 4382a94f6..86b1e5ee2 100644 --- a/lib/compilers/assembly.js +++ b/lib/compilers/assembly.js @@ -79,19 +79,21 @@ class AssemblyCompiler extends BaseCompiler { } objdump(outputFilename, result, maxSize, intelAsm, demangle) { - return this.getGeneratedOutputfilename(outputFilename).then((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}) - .then(objResult => { - result.asm = objResult.stdout; - if (objResult.code !== 0) { - result.asm = "<No output: objdump returned " + objResult.code + ">"; - } - return result; - }); - }); + 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; + }); + }); } } |