Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It seems that compiledb cannot parse gmake's change directory message #101

Open
J-keaper opened this issue Jun 30, 2020 · 0 comments
Open

Comments

@J-keaper
Copy link

I have the following two files: make.log is build log for make; gmake.log is build log for gmake;
There is no difference except build tool( make/gmake) in the build.
But the output of parsing the two files using compiledb are different.
Please see the following operation:

➜  test-compiledb$ cat make.log              
make -w -C subdir
make[1]: Entering directory `/Users/jiajiawang/Workspace/test-compiledb/subdir'
gcc main.c -o main.o
make[1]: Leaving directory `/Users/jiajiawang/Workspace/test-compiledb/subdir'
gcc main.c -o main.o
➜  test-compiledb$ compiledb -p make.log 
➜  test-compiledb$ cat compile_commands.json 
[
 {
  "directory": "/Users/jiajiawang/Workspace/test-compiledb/subdir",
  "arguments": [
   "gcc",
   "main.c",
   "-o",
   "main.o"
  ],
  "file": "main.c"
 },
 {
  "directory": "/Users/jiajiawang/Workspace/test-compiledb",
  "arguments": [
   "gcc",
   "main.c",
   "-o",
   "main.o"
  ],
  "file": "main.c"
 }
]

It's perfect, but when it meet gmake, something is wrong.

➜  test-compiledb$ cat gmake.log 
gmake -w -C subdir
gmake[1]: Entering directory '/Users/jiajiawang/Workspace/test-compiledb/subdir'
gcc main.c -o main.o
gmake[1]: Leaving directory '/Users/jiajiawang/Workspace/test-compiledb/subdir'
gcc main.c -o main.o
➜  test-compiledb$ compiledb -p gmake.log   
➜  test-compiledb$ cat compile_commands.json   
[
 {
  "directory": "/Users/jiajiawang/Workspace/test-compiledb",
  "arguments": [
   "gcc",
   "main.c",
   "-o",
   "main.o"
  ],
  "file": "main.c"
 }
]

There is only one entry, other one entry is missing. Missing entry correspond to main.c in subdir.
So i guess compiledb cannot parse gmake's change directory message.

And I read parser.py,i saw these following two lines code:

make_enter_dir = re.compile(r"^\s*make\[\d+\]: Entering directory [`\'\"](?P<dir>.*)[`\'\"]\s*$")
make_leave_dir = re.compile(r"^\s*make\[\d+\]: Leaving directory .*$")

Indeed these two regular expression cannot successfully match the change directory message in gmake.log above.

Is my statement above correct? Am I missing something?
If it is true, can you support this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant