Add option to view assembly using intel syntax

refactor
Alin Rus 11 years ago
parent beeaca66e0
commit 8f32cbf56d

@ -82,6 +82,7 @@ function compile(req, res) {
return res.end(JSON.stringify({code: -1, stderr: "bad compiler " + compiler}));
}
var options = req.body.options.split(' ').filter(function(x){return x!=""});
var filters = req.body.filters;
var optionsErr = checkOptions(options);
if (optionsErr) {
return res.end(JSON.stringify({code: -1, stderr: optionsErr}));
@ -95,7 +96,9 @@ function compile(req, res) {
return res.end(JSON.stringify({code: -1, stderr: "Unable to open temp file: " + err}));
}
var outputFilename = path.join(dirPath, 'output.S');
options = options.concat([ '-x', 'c++', '-g', '-o', outputFilename, '-S', '-']);
var syntax = '-masm=att'; // default at&t
if (filters["intel"]) syntax = '-masm=intel';
options = options.concat([ '-x', 'c++', '-g', '-o', outputFilename, '-S', syntax,'-']);
var compilerWrapper = props.get("gcc-explorer", "compiler-wrapper");
if (compilerWrapper) {
options = [compiler].concat(options);

@ -121,7 +121,8 @@ function onChange() {
var data = {
source: cppEditor.getValue(),
compiler: $('.compiler').val(),
options: $('.compiler_options').val()
options: $('.compiler_options').val(),
filters: getAsmFilters()
};
window.localStorage['compiler'] = data.compiler;
window.localStorage['compilerOptions'] = data.options;

@ -76,6 +76,7 @@
<button class="btn active" type="button" value="labels">Unused labels</button>
<button class="btn active" type="button" value="directives">Directives</button>
<button class="btn active" type="button" value="commentOnly">Comment-only lines</button>
<button class="btn" type="button" value="intel">Intel syntax</button>
<button class="btn" type="button" value="colouriseAsm">Colourise</button>
</div>
</td></table>

Loading…
Cancel
Save