This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Problem with location lists and variables on stack
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- Cc: gdb at sources dot redhat dot com
- Date: Wed, 1 Oct 2003 10:49:37 -0400
- Subject: Re: Problem with location lists and variables on stack
- References: <20031001144330.GA11707@artax.karlin.mff.cuni.cz>
On Wed, Oct 01, 2003 at 04:43:30PM +0200, Josef Zlomek wrote:
> Hello,
>
> I writing a better pass (variable tracking) for GCC which finally emits
> location lists for variables. (If you are insterested it is at
> http://artax.karlin.mff.cuni.cz/~zlomj9am/download/vt-main.patch
> It still contains many debugging checks and (disabled) prints.)
>
> Let the local variables and (some) arguments be addressed using stack pointer,
> for example x86-64 architecture with variables addressed using %rsp.
> The address emitted for variables located on stack by my new patch is always
> DW_OP_fbreg + constant.
>
> When I was testing the emitted debug info with mainline GDB I found that
> GDB probably does not adjust addresses of variables when stack pointer changes
> (like because of "pushq" instruction) if using location lists.
> I think GDB should adjust the address of %rsp addressed variables according to
> change of %rsp (probably DWARF2 sais so for DW_OP_fbreg). I think it is a
> better solution than emitting new locations to location list for all variables
> located on stack after each "push" and "pop" which would cause too large debug
> info.
>
> When I looked to gdb/dwarf2loc.c I see there:
> /* FIXME: cagney/2003-03-26: This code should be using
> get_frame_base_address(), and then implement a dwarf2 specific
> this_base method. */
> Probably this is related to my problem.
The FIXME is a cleanliness problem. We do evaluate DW_AT_frame_base,
so it _ought_ to work.
> I tested it on attached C file, assembler with debug info and x86-64 binary
> is attached too.
Do you suppose you could produce an x86 (ia32) testcase? I don't have
x86-64 hardware available yet. The debug info looks right so I'd like
to get my fingers into the problem.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer