Giter Site home page Giter Site logo

compile-db-gen's Introduction

compile-db-gen

Generate JSON compilation database from make (or other compile tools).

The cmake can generate the compilation database with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON.

And the Build EAR try to generate the compilation database, but it maybe failed for some cross-compile project.

compile-db-gen do well for complicate compiler.

How to use

Just put your make command after compile-db-gen.py, eg:

compile-db-gen.py make

Then you’ll get the compile_commands.json. And you also can run follow command when you wan’t to get detail:

python compile-db-gen.py trace make OPTS
python compile-db-gen.py parse compile_commands.raw compile_commands.json

for more options, please run

python compile-db-gen.py -h

How dose it work

The strace can follow the compile tools and give the compile detail.

And compile-db-gen.py will follow the log file from strace compile procedural, then output the compile commands.

Requirment

The strace-4.8 or high required.

The compile-db-gen.py depends on the child terminal informations contain parent pid from strace output, the follow log give hists that child(pid=937) ended, and pid for it’s parent is pid=936.

[pid 936] — SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=937, si_status=0, si_utime=0, si_stime=0} —

but the strace-4.5 seems dosn’t give the child pid.

[pid 936] — si_code=CLD_EXITED SIGCHLD 0 —

I didn’t try compile-db-gen.py with the strace-4.6, strace-4.7, if you run compile-db-gen.py with starce-4.6/4.7, please let me know it success or failed.

Similar tools

scan-build It replace the CC, CXX env string, and get the compile database, but some makefile didn’t care the CC, CXX env settings.

Build EAR It inject libbear.so via LD_PRELOAD or DYLD_INSERT_LIBRARIES environment variables, then filter the compile command. I found Bear didn’t work for some complicate sencen. For example, on amd_64 environment, the libear.so is ELF-64, then make file call some x86 exetable, the LD_PRELOAD won’t work.

clang-tags trace The compile-db-gen.py very similar to ‘clang-tags trace’, but more flexiable.

compile-db-gen's People

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.