Do you have the whole call stack of that failed __libdw_read_offset
call? Which source line in tests/dwarf-getmacros.c prints the "(null)"?
Actually I just managed to catch a backtrace by inserting an infinite
loop at the point where it would normally return -1. It turns out the
address we are looking for is not in the IDX_debug_info section, but in
the IDX_debug_macro section (which by itself isn't all that surprising,
but if that is a rule, how can this code ever work??).
Thread 1 (Thread 220048.0x35af0):
#0 0x0000000070ec311e in __libdw_read_offset (sec_ret=8, size=1,
ret=<synthetic pointer>, width=4, addr=0xe90089 ".\027", sec_index=0,
dbg_ret=<optimized out>, dbg=<optimized out>) at
D:/qtcreator-super-master/elfutils/libdw/libdwP.h:712
orig_addr = <optimized out>
#1 dwarf_formstring (attrp=attrp@entry=0x6af950) at
D:/qtcreator-super-master/elfutils/libdw/dwarf_formstring.c:69
dbg = <optimized out>
dbg_ret = <optimized out>
off = <optimized out>
#2 0x0000000070ecc709 in dwarf_macro_param2
(macro=macro@entry=0x6afaa0, paramp=paramp@entry=0x0,
strp=strp@entry=0x6af9f0) at
D:/qtcreator-super-master/elfutils/libdw/dwarf_macro_param2.c:50
param = {code = 8473, form = 14, valp = 0xe90089 ".\027", cu =
0x6afac0}
#3 0x0000000000401784 in mac (macro=0x6afaa0, dbg=0xf926f0) at
D:/qtcreator-super-master/elfutils/tests/dwarf-getmacros.c:87
value = 0xf927b8 "p?ù"
level = 0
opcode = 5
#4 0x0000000070ecbf1d in read_macros (dbg=dbg@entry=0xf926f0,
sec_index=sec_index@entry=10, macoff=macoff@entry=0, callback=<optimized
out>, callback@entry=0x4015e0 <mac>, arg=<optimized out>,
offset=<optimized out>, offset@entry=0, accept_0xff=<optimized out>,
accept_0xff@entry=false, cudie=<optimized out>, cudie@entry=0x6afe10) at
D:/qtcreator-super-master/elfutils/libdw/dwarf_getmacros.c:409
opcode = <optimized out>
idx = <optimized out>
attributesp = <optimized out>
nattributes = {{code = 8473, form = 15, valp = 0xe90088
"\001.\027", cu = 0x6afac0}, {code = 8473, form = 14, valp = 0xe90089
".\027", cu = 0x6afac0}, {code = 0, form = 0, valp = 0x0, cu = 0x0},
{code = 0, form = 0, valp = 0x0, cu = 0x0}, {code = 0, form = 0, valp =
0x0, cu = 0x0}, {code = 0, form = 0, valp = 0x0, cu = 0x0}, {code = 0,
form = 0, valp = 0x0, cu = 0x0}, {code = 0, form = 0, valp = 0x0, cu = 0x0}}
fake_cu = {dbg = 0xf926f0, start = 0, end = 0, address_size = 0
'\000', offset_size = 4 '\004', version = 4, type_offset = 0, type_sig8
= 0, abbrev_hash = {size = 0, filled = 0, table = 0x0},
orig_abbrev_offset = 0, last_abbrev_offset = 0, lines = 0x0, files =
0x0, locs = 0x0, startp = 0xe90087, endp = 0xe90ac4}
attributes = <optimized out>
macro = {table = 0xf928b0, attributes = 0x6afb40, opcode = 5
'\005'}
res = <optimized out>
d = <optimized out>
startp = <optimized out>
endp = <optimized out>
readp = 0xe9008d "\005\001î!"
#5 0x0000000070ecc302 in gnu_macros_getmacros_off (dbg=0xf926f0,
macoff=0, callback=callback@entry=0x4015e0 <mac>,
arg=arg@entry=0xf926f0, offset=offset@entry=0,
accept_0xff=accept_0xff@entry=false, cudie=cudie@entry=0x6afe10) at
D:/qtcreator-super-master/elfutils/libdw/dwarf_getmacros.c:478
No locals.
#6 0x0000000070ecc502 in dwarf_getmacros (cudie=cudie@entry=0x6afe10,
callback=callback@entry=0x4015e0 <mac>, arg=arg@entry=0xf926f0, token=0)
at D:/qtcreator-super-master/elfutils/libdw/dwarf_getmacros.c:564
macoff = 0
accept_0xff = false
offset = <optimized out>
#7 0x0000000000409a36 in main (argc=3, argv=<optimized out>) at
D:/qtcreator-super-master/elfutils/tests/dwarf-getmacros.c:133
off = <optimized out>
name = <optimized out>
cuoff = <optimized out>
new_style = <optimized out>
fd = <optimized out>
dbg = 0xf926f0
cudie_mem = {addr = 0xf93a5b, cu = 0xf92810, abbrev = 0xf92890,
padding__ = 0}
cudie = 0x6afe10