db_bin
db_bin

Reputation: 61

How to add debug symbols to stripped ELF binaries

I need to disassemble debian binaries with debug symbols and I am using IDA Pro for this. The problem is: IDA doesn't seem to recognize debug symbols if they are stored in a separate file (in the case of debian packages). However, when compiling a binary and keeping the debug symbols in it, IDA has no problem annotating all functions and variables.

So my question is: is there a way to add the debug symbols back to the stripped binary? The goal would be to create a single binary with debug symbols. Can one for example use gdb to 1) debug the stripped binary; 2) load debug symbols; and 3) produce a binary that contains these symbols.

One method I found here proposed to copy the debug sections from back into the binary. Unfortunately, this worked only partly and some symbols are still missing. I've verified this using gdb.

Upvotes: 3

Views: 3836

Answers (1)

youfu
youfu

Reputation: 1627

For gdb use set debug-file-directory

For IDA Pro:

  1. open the debug symbol file in IDA Pro
  2. export database/typeinfo as IDC script
  3. edit IDC script
    1. merge database/typeinfo IDC script manually
    2. comment out DeleteAll()
  4. open the stripped ELF file in IDA Pro
  5. after the analysis is finished, execute the IDC script

Upvotes: 1

Related Questions