18

all, is there a tool to check DWARF version of file? Something like this:

$ dwarf_tool binary_name
4
usamytch
  • 373
  • 1
  • 5
  • 13

2 Answers2

37

In Linux environment? If you have GCC installed, you should have readelf executable. So you can try this

readelf --debug-dump=info binary_name | grep -A 2 'Compilation Unit @'

jclin
  • 2,449
  • 1
  • 21
  • 27
4

You could also use llvm-dwarfdump tool as below

llvm-dwarfdump -r 1 binary_name | head | grep Compile

Sample output

0x00000000: Compile Unit: length = 0x0004710b, format = DWARF32, version = 0x0004, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x0004710f)
tech-user
  • 3
  • 2
Rajendra
  • 1,662
  • 2
  • 10
  • 11