llvm-tutor icon indicating copy to clipboard operation
llvm-tutor copied to clipboard

Please add more detail about how to use gdb to debug pass

Open wuxiaoqiang12 opened this issue 4 years ago • 2 comments

I follow your guide about how to debug using gdb on ubuntu. But my gdb cannot see the source file. I using following command:

clang -emit-llvm -S -O1 input_for_mba.c -o input_for_mba.ll
gdb --args opt -S -load-pass-plugin ../build/lib/libMBAAdd.so -passes=mba-add input_for_mba.ll
b ../lib/MBAAdd.cpp:MBAAdd::run

gdb said: No source file named ../lib/MBAAdd.cpp.

(gdb) info source No current source file.

Please help me. thanks a lot

wuxiaoqiang12 avatar Mar 20 '21 07:03 wuxiaoqiang12

Hi @wuxiaoqiang12 , thank for creating this issue!

The instructions in REDME.md recommend this:

b MBAAdd.cpp:MBAAdd::run

Any particular reason to use this instead:

b ../lib/MBAAdd.cpp:MBAAdd::run

? Also, there is no MBAAdd.cpp in the lib sub directory. That's why gdb is failing.

banach-space avatar Mar 21 '21 17:03 banach-space

It helps to type y (i.e., yes) as the answer to "Make breakpoint pending on future shared library load? (y or [n])" that follows "No source file named ...".

science-enthusiast avatar Oct 12 '23 12:10 science-enthusiast