0

Right now, I'm using a combination of gcc -g and the objdump -S modes to generate assembly code with debug source code interleaved. However, I'm having trouble correlating some of the functions that were in the executable to their original source because the final executable contains source code from many different files. Is there a way to get a debug pure source representation (with no assembly) of all of the functions in an executable, using the gcc toolchain? That is, I'm looking for the source that was used for all of the functions in my executable, arranged in the order that the functions appear in the executable, so that I can compare that source to the objdump -S output (which I'm also comparing to Ghidra and Binary Ninja output).

Thanks for your time in responding!

1 Answer 1

1

I'm not aware of any way to do what you're asking (INAE), however you could try this to obtain readable source using objdump:

objdump -l --source-comment <file>.o | grep -e '^\/' -e '^#'

This will include the filename and line number for each line of source while excluding the assembly.

1
  • This is super helpful even if it's not an exact match to what I was asking for. Commented Jul 14, 2022 at 14:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.