Coder Social home page Coder Social logo

cxx-compiler-explorer's People

Contributors

appden avatar dependabot[bot] avatar dprogm avatar harikrishnan94 avatar sr-tream avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

cxx-compiler-explorer's Issues

Eliminate configuration step

Hi, I wanted to use your extension with C (not C++). I wrote a C hello world and saved it and when I run "C++ Compiler Explorer: Disassemble file" it says

Failed to show assembly: Error: ENOENT: no such file or directory, open '/Users/myuser/hello/compile_commands.json'

I ran the "C/C++: Edit Configurations (JSON)" editor command and I'm able to run and debug the code with F5 (with clang), so I would expect the extension to work as well, without extra configuration. I don't know what compile_commands.json is and it would save a lot of time if I didn't have to figure that out, since VS Code evidently already has enough information to compile my code.

In fact, ideally even generating .vscode/c_cpp_properties.json, etc. and even saving a C file at all shouldn't be necessary. I sometimes want to quickly write some simple C code to compare the generated instructions, just like with Compiler Explorer, I open it (i.e. install it in my browser) and it compiles int square(int num) { return num * num; }, I don't have to configure stuff.

document link lost when switching documents

That functionality of jumping to the corresponding assembly and vice-versa is lost as soon as you switch to another .cpp file.
Going back to the original one does not bring it back.

handle spaces and escapes in compile commands

See referenced commit.
First I tried more sophisticated splitting in CompileCommand.process() with /[^"\s]*("(\\"|[^"])+")?/g but in the end it's just not feasible. Just let the shell do its job.

CMake integration doesnt' work

The merge to integrate cmake tools at

#51

Is a really cool addition that I (as a CMake user) desperately want.
however, it doesn't work.

The reason it doesn't work is because

https://github.com/harikrishnan94/cxx-compiler-explorer/blob/cb8d03d9e395c5bf1863ce5e6b1baeee7bec85c6/src/compdb.ts#L76C1-L76C82

tries to load the empty file, but fails when the file isn't there. This SHOULD trigger an exception which is caught by the except block, initializing the map with an empty map in the exception handler case...but for some reason its not. The exception passes through to the VsCode editor. Probably, ENOENT exceptions inside await blocks aren't caught by exception handlers? Or something? It seems unclear.

This issue means I can't use the CMake support.

Make use of the working directory property

It seems that currently the directory property of the compilation database isn't considered when compiling the source file. At least I cannot find any place in the extensions code where it is used (please correct me if I'm wrong). The problem is, that my compilation database consists of relative include paths and assumes the command is executed in the specified working directory, as it should be. Therefore the compiler isn't able to find the header files.

Cannot find files that are specified relative to the working directory

Currently the extension can only find files in the internal database structure if the workspace path exactly matches the path as specified in the compilation database.

Expectation: It should also try to resolve paths relative to the working directory as specified in the compilation database.

Extension does not recognize out of tree builds over RemoteSSH

Issue Type: Bug

I'm trying to use this with an out-of-tree build over RemoteSSH extension. I'm getting errors about not being able to find the files in "compile_commands.json". For example:

file:///home/anatoly/playground/memfd_fallocate/sparsetest.c is not found in compile_commands.json

Presumably this happens either because the extension is either not trying to get canonical path to files in the .json files, or because it doesn't understand how to work over RemoteSSH. Either way, not working...

Extension version: 0.2.0
VS Code version: Code - Insiders 1.39.0-insider (695ee74864ef93d10f5de0861cb66af190e76211, 2019-10-02T08:56:48.092Z)
OS version: Windows_NT x64 10.0.17763
Remote OS version: Linux x64 4.15.0-65-generic

Escaped double quotes are not respected in argument splitting

Suppose using the following compile command:

[
  {
    "directory": "/Users/hero/cpp_test/build",
    "command": "/usr/bin/c++ -DSOME_VAR=\\\"\\\" -std=gnu++17 -o CMakeFiles/cpp_test.dir/main.cpp.o -c /Users/hero/cpp_test/main.cpp",
    "file": "/Users/hero/cpp_test/main.cpp"
  }
]

The intention is to pass the double quotes to SOME_VAR. The current parser implementation does not recognize this pattern which causes the actual compile command to fail because the parser yields just two arguments.

if (quoteChar == '"') quoteChar = undefined;

Because the last quoteChar is not a double quote the whole remaining string is handled as one argument.

I will prepare a PR. But maybe there is already an argument parsing library available?

Compilation errors on MacOS with Clang

Excellent improvements to the readability of the assembly file!

I had to change the code back to this arg format to make this version work on MacOS with clang.

getDisassembleCommand(outFile) {
        // remove -o part
        let fixedCmd = this._command.replace(/[\s]-o\s[^"\s]+/, '');
        // now add necessary options to generate clean assembly
        // return fixedCmd + ' -g1 -S -masm=intel -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-dwarf2-cfi-asm -o "' + outFile + '"';
        let args = [
            this.command,
            "-g1",
            "-S",
            "-masm=intel",
            "-fno-unwind-tables",
            "-fno-asynchronous-unwind-tables",
            "-fno-dwarf2-cfi-asm",
            "-o",
            outFile
        ].concat(this.args);

        return this.getCommand(args);
    }

error handling

I tried your extension on a simple PlatformIO example project (using a compile_commands.json generated from pio run --verbose).
The 'Disassemble with extra args' command is called cause it opens the input prompt. But after that nothing happens and there is no entry in the Developer Tools Console either.

Does not seem to work on windows

I receive the following error when I try to run it:

Failed to show assembly: Unable to resolve filesystem provider with relative file path 'f:\project\build/compile_commands.json'

the variable compilerexplorer.compilationDirectory is set to ${workspaceFolder}/build

/usr/bin/c++ causes the extension to hang

Currently I am facing the following issue. If my compile_commands.json contains a compiler invocation like /usr/bin/c++ then this causes the extension to hang. There is no progress, it simply displays Compilation in progress. It turns out the issue cannot be observed anymore when we add c++ to the following replace statements. Actually it should use the system default c++filt.

parsed.name = parsed.name.replace('clang++', cxxfiltExe)

I have also tried it with an older version (0.7.0), but the issue is the same. Of course this can easily be fixed, but I guess it would be better to make it more robust. Tell me what you think about this and I will try to prepare a PR. ๐Ÿ˜„

compile_commands.json loaded at startup

The json file seems to be loaded directly at extension activation when running the disasm command for the first time, so if there is an error like missing directory element the extension fails to load and you just get a puzzling command not found error.
Later, even if you fix the json you have to restart VSCode.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.