leaningtech / cheerp-meta

Cheerp - a C/C++ compiler for Web applications - compiles to WebAssembly and JavaScript
https://labs.leaningtech.com/cheerp
Other
1.03k stars 51 forks source link

How to debug cheerp using GDB? #122

Closed hungryzzz closed 2 years ago

hungryzzz commented 2 years ago

Hi, I want to debug cheerp using GDB, what should I do?

Can I use -DCMAKE_BUILD_TYPE=Debug when I build cheerp-compiler? Does this work?

Thanks!

carlopi commented 2 years ago

I would expect for this to work for any non-Release build, more as in for regular clang/LLVM, there are a few places in the internet discussing the specifics (like: https://stackoverflow.com/questions/2226112/debugging-an-llvm-pass-with-gdb, but probably there have to be other resources).

Consider that the packages we provided are builded in Release mode, so you will need to build from source, and I recommend doing that on tag cheerp-2.7 (as detailed here: https://docs.leaningtech.com/cheerp/Linux-build-instructions).