Reputation: 838
I have to debug a program with gdb. This program is compiled with debug options with gcc. My problem is that the sources are not in the same machine I use to debug and run this program. I can't use remote gdb debugging. Is there a way to now the line/file location when advancing in gdb? Is there some other solutions for this problem?
Thanks
Upvotes: 3
Views: 6600
Reputation: 78
You can debug it with the assembly code.
objdump -d
shows all the contents. Then run gdb
with break atmain
function, and ni
to run the next instruction(assembly). Oh, don't forget to enable display $pc
will help you.
The above advice is only for toy code.
If you have installed IDA(and the plugin), you can use its restore to C code
function.
Upvotes: 3
Reputation: 805
If you are experiencing a segmentation fault
, you may use core dump on linux machine by enabling it
ulimit -c unlimited
then transfer the core dump file to the other machine where you've got the source and run gdb with coredump file to identify where in the code you are getting the segmentation fault.
Upvotes: 1
Reputation: 838
I found the command info line
in gdb which shows the location in source file, even if gdb did not find the source files. This workaround seems OK for me.
Upvotes: -1