This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Argument pointers, dwarf and prologue analysis
- From: Jim Blandy <jimb at red-bean dot com>
- To: Randolph Chung <randolph at tausq dot org>
- Cc: gdb at sources dot redhat dot com
- Date: Sun, 20 Nov 2005 23:42:31 -0800
- Subject: Re: Argument pointers, dwarf and prologue analysis
- References: <4381603E.1060500@tausq.org>
It seems to me that the real problem is that the Dwarf debugging info
doesn't accurately describe where the bar's arguments live after the
call to foo. That is, when you return from foo, since r20 is
caller-saved, its value is unknown, and it's incorrect for the
debugging info to claim that the debugger can find the variables
relative to its value.
I don't think that the wacky idea about recovering r20's value by
looking at the call site will work. I mean, if r20 is a scratch
register, you have no way of knowing that it hasn't been used for
something else since the function was entered, right? I admit I don't
really understand that.
But I think it's clear that the locations of the variables in the
debug info is incorrect. There's all kinds of heuristic crud in
gcc/dwarf2out.c where it tries to figure out the right register to use
as the base for variable locations (maybe I'm thinking of the way the
CFI code chooses a CFA register; I don't really remember), but it
seemed like it could be easily confused by the use of temporaries like
r20 in the example you posted.