diff options
Diffstat (limited to 'lib/compilers')
-rw-r--r-- | lib/compilers/assembly.js | 28 | ||||
-rw-r--r-- | lib/compilers/dmd.js | 3 | ||||
-rw-r--r-- | lib/compilers/pascal.js | 20 | ||||
-rw-r--r-- | lib/compilers/win32.js | 3 | ||||
-rw-r--r-- | lib/compilers/wine-vc.js | 5 |
5 files changed, 33 insertions, 26 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; + }); + }); } } diff --git a/lib/compilers/dmd.js b/lib/compilers/dmd.js index 62ef2de4a..8ee342277 100644 --- a/lib/compilers/dmd.js +++ b/lib/compilers/dmd.js @@ -52,10 +52,11 @@ class DMDCompiler extends BaseCompiler { } objdump(outputFilename, result, maxSize, intelAsm, demangle) { + const dirPath = path.dirname(outputFilename); let args = ["-d", outputFilename, "-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}) + return this.exec(this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}) .then(objResult => { result.asm = objResult.stdout; if (objResult.code !== 0) { diff --git a/lib/compilers/pascal.js b/lib/compilers/pascal.js index d9f027749..28d178917 100644 --- a/lib/compilers/pascal.js +++ b/lib/compilers/pascal.js @@ -96,18 +96,20 @@ class FPCCompiler extends BaseCompiler { } objdump(outputFilename, result, maxSize, intelAsm, demangle) { - outputFilename = this.getExecutableFilename(path.dirname(outputFilename)); + const dirPath = path.dirname(outputFilename); + outputFilename = this.getExecutableFilename(dirPath); let args = ["-d", outputFilename, "-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 => { - if (objResult.code !== 0) { - result.asm = "<No output: objdump returned " + objResult.code + ">"; - } else { - result.asm = FPCCompiler.preProcessBinaryAsm(objResult.stdout); - } - return result; - }); + return this.exec(this.compiler.objdumper, args, {maxOutput: maxSize, customCwd: dirPath}) + .then(objResult => { + if (objResult.code !== 0) { + result.asm = "<No output: objdump returned " + objResult.code + ">"; + } else { + result.asm = FPCCompiler.preProcessBinaryAsm(objResult.stdout); + } + return result; + }); } saveDummyProjectFile(filename) { diff --git a/lib/compilers/win32.js b/lib/compilers/win32.js index 9e3fa3c17..7651d2ebb 100644 --- a/lib/compilers/win32.js +++ b/lib/compilers/win32.js @@ -46,11 +46,12 @@ class Win32Compiler extends BaseCompiler { } objdump(outputFilename, result, maxSize, intelAsm) { + const dirPath = path.dirname(outputFilename); outputFilename = this.getExecutableFilename(path.dirname(outputFilename), "output"); let args = ["-d", outputFilename]; if (intelAsm) args = args.concat(["-M", "intel"]); - return this.exec(this.compiler.objdumper, args, {maxOutput: 0}) + return this.exec(this.compiler.objdumper, args, {maxOutput: 0, customCwd: dirPath}) .then((objResult) => { if (objResult.code !== 0) { result.asm = "<No output: objdump returned " + objResult.code + ">"; diff --git a/lib/compilers/wine-vc.js b/lib/compilers/wine-vc.js index 3aa47f688..0e7f8b50e 100644 --- a/lib/compilers/wine-vc.js +++ b/lib/compilers/wine-vc.js @@ -58,11 +58,12 @@ class WineVcCompiler extends BaseCompiler { } objdump(outputFilename, result, maxSize, intelAsm) { - outputFilename = this.getExecutableFilename(path.dirname(outputFilename), "output"); + const dirPath = path.dirname(outputFilename); + outputFilename = this.getExecutableFilename(dirPath, "output"); let args = ["-d", outputFilename]; if (intelAsm) args = args.concat(["-M", "intel"]); - return this.exec(this.compiler.objdumper, args, {maxOutput: 0}) + return this.exec(this.compiler.objdumper, args, {maxOutput: 0, customCwd: dirPath}) .then((objResult) => { if (objResult.code !== 0) { result.asm = "<No output: objdump returned " + objResult.code + ">"; |