Ericsson / CodeCompass

CodeCompass is a software comprehension tool for large scale software written in C/C++ and Java
https://codecompass.net
GNU General Public License v3.0
517 stars 101 forks source link

Working with a proprietary compiler #592

Open nishinkvasu opened 1 year ago

nishinkvasu commented 1 year ago

Hello,

I found this tool to be very useful and wanted to use it to understand a pretty large code base. However the code base is based on a proprietary compiler.

I managed to create a compilation database and provide it to the tool however it does not seem to recognize some of the compiler options, directives etc. I believe the parser makes use of the clang / llvm and hence I face these issues. Is there some way around this or any hints or clues? I wonder if I am doing something wrong on my side.

Thanks, Nishin

intjftw commented 1 year ago

Hi,

Thank you, we're glad you find CodeCompass useful!

As for your question: I suggest you try running the ccdb-tool on the compile command JSON file. It is designed to transform the compiler options to a clang-readable way.

zporky commented 1 year ago

Hi,

When run ccdb-tool, please ensure that the original compiler is available through the PATH environment variable.The tool wants to access the compiler to extract SYSROOT, etc. Then just run the tool (requires Python 3):

run the converter

$ ccdb-tool clangify --input compile_command.json --output clangified_comm

Bests, gsd

Anett Fekete @.***> ezt írta (időpont: 2023. febr. 16., Cs, 12:09):

Hi,

Thank you, we're glad you find CodeCompass useful!

As for your question: I suggest you try running the ccdb-tool https://github.com/gamesh411/ccdb-tool on the compile command JSON file. It is designed to transform the compiler options to a clang-readable way.

— Reply to this email directly, view it on GitHub https://github.com/Ericsson/CodeCompass/issues/592#issuecomment-1432918018, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTPLCBOMZ5LNM2SD3XTQ6LWXYDEZANCNFSM6AAAAAAUZZKPP4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nishinkvasu commented 1 year ago

Hi,

Thank you @intjftw and @zporky for your kind inputs and suggestions. I did try the ccdb tool, but did not have much luck getting the parsing to work after that.

I had ensured the compiler was part of the environment before running the ccdb tool to clangify the json. It did report an error that "--version" did not work (as it does not seem to be supported by my compiler.

However it did provide an output file that seemed to have done some level of modification. But passing it to the CodeCompass parser still did not do much help there. One of the issues is my compiler uses a bunch of directives like 'march' and 'mcpu' which does not seem to fit well with clang and few others too which still leads to a bunch of undefined types and references. I tried to manually add some of the define "-D*" but was not successful in getting it to parse successfully.

Is there anyway for the CodeCompass to continue parsing with errors but still generate as much with the information available? Asking this based on using similar tools previously (Understand / SourceInsight)? Or any tips as to how to make the code compass use my toolchain for parsing?

Once again appreciate all the help.

Thanks, Nishin