I want to get the source code path && source names just through the ELF file, the .debug_str section contains what i need, but how can i filter them out?
$ readelf --string-dump=.debug_str YOUR_PROGRAM
works fine.
However, make sure your_program is not stripped by using command
file YOUR_PROGRAM
I suggest to use this command and tools like sed or grep.
$ readelf --string-dump=.debug_str YOUR_PROGRAM
this show path and source file name:
$ readelf --string-dump=.debug_str YOUR_PROGRAM | sed -n '/\/\|\.c/{s/.*\] //p}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With