Reputation: 160
I am debugging with GDB at work. When I input "info symbol 0xABCD", I get the following result,
sample_function + 123 in section init
I know the EXACT LOCATION is near sample_function(), and have an offset 123, but how do I locate it in the C code? I have not found any resource from internet that talks about this yet. Thanks for any help.
Upvotes: 0
Views: 237
Reputation: 213859
how do I locate it in the C code?
You can do:
(gdb) disas/m 0xABCD
From "help disas":
With a /m modifier, source lines are included (if available).
Alternatively, this command: addr2line -fe /path/to/binary 0xABCD
(run outside of GDB) should print source location (if the binary has debug line info).
Upvotes: 1