if gcc were just to use that to unwind, everything would be great.
You mean GDB.
I use the following routine in my ~/.gdbinit
to unwind $rbp
frame chain:
define xbt
set $xbp = (void **)$arg0
while 1
x/2a $xbp
set $xbp = (void **)$xbp[0]
end
end
Call it with the initial base pointer address you want to start from, e.g., xbt $rbp
to use the current base pointer.
This isn't as good as allowing GDB to do it (no access to parameters or locals), but it does get at least the call trace.
For making GDB to ignore existing DWARF unwind info, you'll have to patch it out and build your own GDB.
P.S. Using --strip-dwo
will not help.
Update:
why stripping isn't feasible?
Well, --strip-dwo
only strips .dwo
sections, and that's not where unwind info is (it's in .eh_frame
and .debug_frame
sections).
That said, you should try to strip .debug_frame
with strip -g bad.o
-- if your file only has bad .debug_frame
but correct (or missing) .eh_frame
, then removing .debug_frame
should work.
strip
doesn't remove .eh_frame
because that info is usually required for unwinding.
If .eh_frame
is also bad, you may be able to remove it with objcopy
.
Some more info on unwinding here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…