[Dwarf-Discuss] how to find local variable stored in register

Jim Blandy jimb@red-bean.com
Tue Feb 5 22:03:13 GMT 2008


On Feb 5, 2008 1:18 PM, Robinson, Paul T (NonStop)
<paul.t.robinson at hp.com> wrote:
> Pedantic super-precision would have a serious cost in terms of the
> size of the debug info.

GCC generates DWARF CFI for every instruction.  In the i386 GDB
executable I have handy, .debug_frame is about 9% the size of .text.
I'm happy to pay that much to stop worrying about backtraces.  For
comparison, .debug_info is around 5x the size of .text.

As far as location lists go, .debug_loc, holding location lists, is
14% the size of .text.  It depends on your circumstances, of course,
but with disk space at twenty cents a GB, I'd again be happy to pay a
quarter (1GB) to see the value of the variable I care about.

$ readelf -S ~/gdb/pub/nat/gdb/gdb
There are 39 section headers, starting at offset 0x2bcfed4:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0]                   NULL            00000000 000000 000000 00      0   0  0
...
  [ 4] .dynsym           DYNSYM          08051aa0 009aa0 013530 10   A  5   1  4
  [ 5] .dynstr           STRTAB          08064fd0 01cfd0 016ba8 00   A  0   0  1
...
  [12] .text             PROGBITS        0807fc90 037c90 242078 00  AX  0   0 16
...
  [26] .debug_aranges    PROGBITS        00000000 33f56e 0026e0 00      0   0  1
  [27] .debug_pubnames   PROGBITS        00000000 341c4e 01d4ac 00      0   0  1
  [28] .debug_info       PROGBITS        00000000 35f0fa b2dc90 00      0   0  1
  [29] .debug_abbrev     PROGBITS        00000000 e8cd8a 031fdd 00      0   0  1
  [30] .debug_line       PROGBITS        00000000 ebed67 09c711 00      0   0  1
  [31] .debug_frame      PROGBITS        00000000 f5b478 032df0 00      0   0  4
  [32] .debug_str        PROGBITS        00000000 f8e268 01355b 00      0   0  1
  [33] .debug_loc        PROGBITS        00000000 fa17c3 055a47 00      0   0  1
  [34] .debug_macinfo    PROGBITS        00000000 ff720a 1bd8a9a 00
  0   0  1
  [35] .debug_ranges     PROGBITS        00000000 2bcfca4 0000c0 00
  0   0  1




More information about the Dwarf-discuss mailing list