Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: DW_AT_frame_base fix for complicated frames
@ 2003-10-02 16:56 Daniel Jacobowitz
  2003-10-02 17:54 ` Jim Blandy
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-10-02 16:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: dberlin

Does anyone remember a specific reason why this code was there?  I don't,
and I rewrote all of this stuff... I am 99.99% sure it's based on the unwind
handling for saved registers, where we get either a register number or the
address of a stack slot.  But for frame bases that's not true:

A subroutine or entry point entry may also have a DW_AT_frame_base
attribute, whose value is a location description that computes the "frame
base" for the subroutine or entry point.

i.e. it computes the frame base.  Not the address of the frame base.  This
memory read tends to find (on x86) the return address, and then we think the
stack is at <main+34>.  Oopsie.

OK?  With this patch and some code Daniel Berlin and Joseph are working on,
location lists actually work.  I can see all the arguments in an
-fomit-frame-pointer function from the beginning.  It's really quite cool.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-10-02  Daniel Jacobowitz  <drow@mvista.com>

	* dwarf2expr.c (execute_stack_op): Don't treat the frame base as
	a memory pointer.

Index: dwarf2expr.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2expr.c,v
retrieving revision 1.9
diff -u -p -r1.9 dwarf2expr.c
--- dwarf2expr.c	22 Jul 2003 15:41:59 -0000	1.9
+++ dwarf2expr.c	2 Oct 2003 16:43:21 -0000
@@ -441,18 +441,6 @@ execute_stack_op (struct dwarf_expr_cont
 	    result = dwarf_expr_fetch (ctx, 0);
 	    if (ctx->in_reg)
 	      result = (ctx->read_reg) (ctx->baton, result);
-	    else
-	      {
-		char *buf = alloca (TARGET_ADDR_BIT / TARGET_CHAR_BIT);
-		int bytes_read;
-
-		(ctx->read_mem) (ctx->baton, buf, result,
-				 TARGET_ADDR_BIT / TARGET_CHAR_BIT);
-		result = dwarf2_read_address (buf,
-					      buf + (TARGET_ADDR_BIT
-						     / TARGET_CHAR_BIT),
-					      &bytes_read);
-	      }
 	    result = result + offset;
 	    ctx->stack_len = before_stack_len;
 	    ctx->in_reg = 0;


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: DW_AT_frame_base fix for complicated frames
  2003-10-02 16:56 RFA: DW_AT_frame_base fix for complicated frames Daniel Jacobowitz
@ 2003-10-02 17:54 ` Jim Blandy
  2003-10-09 14:26   ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Jim Blandy @ 2003-10-02 17:54 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches, dberlin


Daniel Jacobowitz <drow@mvista.com> writes:
> Does anyone remember a specific reason why this code was there?  I don't,
> and I rewrote all of this stuff... I am 99.99% sure it's based on the unwind
> handling for saved registers, where we get either a register number or the
> address of a stack slot.  But for frame bases that's not true:
> 
> A subroutine or entry point entry may also have a DW_AT_frame_base
> attribute, whose value is a location description that computes the "frame
> base" for the subroutine or entry point.
> 
> i.e. it computes the frame base.  Not the address of the frame base.  This
> memory read tends to find (on x86) the return address, and then we think the
> stack is at <main+34>.  Oopsie.
> 
> OK?  With this patch and some code Daniel Berlin and Joseph are working on,
> location lists actually work.  I can see all the arguments in an
> -fomit-frame-pointer function from the beginning.  It's really quite cool.

I think you're right, there's no reason for that memory fetch to be
there.  Please commit.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: DW_AT_frame_base fix for complicated frames
  2003-10-02 17:54 ` Jim Blandy
@ 2003-10-09 14:26   ` Daniel Jacobowitz
  2003-10-09 15:14     ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-10-09 14:26 UTC (permalink / raw)
  To: gdb-patches

On Thu, Oct 02, 2003 at 12:54:32PM -0500, Jim Blandy wrote:
> 
> Daniel Jacobowitz <drow@mvista.com> writes:
> > Does anyone remember a specific reason why this code was there?  I don't,
> > and I rewrote all of this stuff... I am 99.99% sure it's based on the unwind
> > handling for saved registers, where we get either a register number or the
> > address of a stack slot.  But for frame bases that's not true:
> > 
> > A subroutine or entry point entry may also have a DW_AT_frame_base
> > attribute, whose value is a location description that computes the "frame
> > base" for the subroutine or entry point.
> > 
> > i.e. it computes the frame base.  Not the address of the frame base.  This
> > memory read tends to find (on x86) the return address, and then we think the
> > stack is at <main+34>.  Oopsie.
> > 
> > OK?  With this patch and some code Daniel Berlin and Joseph are working on,
> > location lists actually work.  I can see all the arguments in an
> > -fomit-frame-pointer function from the beginning.  It's really quite cool.
> 
> I think you're right, there's no reason for that memory fetch to be
> there.  Please commit.

Thanks.  I've committed this to trunk and branch.  I also moved this to
the branch:

2003-10-09  Daniel Jacobowitz  <drow@mvista.com>

        Merge from mainline:
        2003-07-31  Daniel Jacobowitz  <drow@mvista.com>

        * dwarf2read.c (new_symbol): Use var_decode_location for parameters.

Location expressions and lists should work reasonably well on both now.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: DW_AT_frame_base fix for complicated frames
  2003-10-09 14:26   ` Daniel Jacobowitz
@ 2003-10-09 15:14     ` Andrew Cagney
  2003-11-24  4:34       ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-10-09 15:14 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches


> Thanks.  I've committed this to trunk and branch.  I also moved this to
> the branch:
> 
> 2003-10-09  Daniel Jacobowitz  <drow@mvista.com>
> 
>         Merge from mainline:
>         2003-07-31  Daniel Jacobowitz  <drow@mvista.com>
> 
>         * dwarf2read.c (new_symbol): Use var_decode_location for parameters.
> 
> Location expressions and lists should work reasonably well on both now.

Can you please add something to the NEWS file.  That way the 6.0.1 
announcement will include information letting the user decide if they 
need to upgrade.

Andrew



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: DW_AT_frame_base fix for complicated frames
  2003-10-09 15:14     ` Andrew Cagney
@ 2003-11-24  4:34       ` Daniel Jacobowitz
  2003-11-24 16:02         ` Andrew Cagney
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-11-24  4:34 UTC (permalink / raw)
  To: gdb-patches

On Thu, Oct 09, 2003 at 11:14:19AM -0400, Andrew Cagney wrote:
> 
> >Thanks.  I've committed this to trunk and branch.  I also moved this to
> >the branch:
> >
> >2003-10-09  Daniel Jacobowitz  <drow@mvista.com>
> >
> >        Merge from mainline:
> >        2003-07-31  Daniel Jacobowitz  <drow@mvista.com>
> >
> >        * dwarf2read.c (new_symbol): Use var_decode_location for 
> >        parameters.
> >
> >Location expressions and lists should work reasonably well on both now.
> 
> Can you please add something to the NEWS file.  That way the 6.0.1 
> announcement will include information letting the user decide if they 
> need to upgrade.

Going through my email backlog...

Should I bother, or have we written off 6.0.1?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: DW_AT_frame_base fix for complicated frames
  2003-11-24  4:34       ` Daniel Jacobowitz
@ 2003-11-24 16:02         ` Andrew Cagney
  2003-11-24 17:03           ` Daniel Jacobowitz
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Cagney @ 2003-11-24 16:02 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> On Thu, Oct 09, 2003 at 11:14:19AM -0400, Andrew Cagney wrote:
> 
>> 
> 
>> >Thanks.  I've committed this to trunk and branch.  I also moved this to
>> >the branch:
>> >
>> >2003-10-09  Daniel Jacobowitz  <drow@mvista.com>
>> >
>> >        Merge from mainline:
>> >        2003-07-31  Daniel Jacobowitz  <drow@mvista.com>
>> >
>> >        * dwarf2read.c (new_symbol): Use var_decode_location for 
>> >        parameters.
>> >
>> >Location expressions and lists should work reasonably well on both now.
> 
>> 
>> Can you please add something to the NEWS file.  That way the 6.0.1 
>> announcement will include information letting the user decide if they 
>> need to upgrade.
> 
> 
> Going through my email backlog...
> 
> Should I bother, or have we written off 6.0.1?

I suspect 6.0.1 is a writeoff, but the NEWS entry in mainline will still 
help.

Andrew



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: RFA: DW_AT_frame_base fix for complicated frames
  2003-11-24 16:02         ` Andrew Cagney
@ 2003-11-24 17:03           ` Daniel Jacobowitz
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Jacobowitz @ 2003-11-24 17:03 UTC (permalink / raw)
  To: gdb-patches

On Mon, Nov 24, 2003 at 11:02:27AM -0500, Andrew Cagney wrote:
> >On Thu, Oct 09, 2003 at 11:14:19AM -0400, Andrew Cagney wrote:
> >
> >>
> >
> >>>Thanks.  I've committed this to trunk and branch.  I also moved this to
> >>>the branch:
> >>>
> >>>2003-10-09  Daniel Jacobowitz  <drow@mvista.com>
> >>>
> >>>        Merge from mainline:
> >>>        2003-07-31  Daniel Jacobowitz  <drow@mvista.com>
> >>>
> >>>        * dwarf2read.c (new_symbol): Use var_decode_location for 
> >>>        parameters.
> >>>
> >>>Location expressions and lists should work reasonably well on both now.
> >
> >>
> >>Can you please add something to the NEWS file.  That way the 6.0.1 
> >>announcement will include information letting the user decide if they 
> >>need to upgrade.
> >
> >
> >Going through my email backlog...
> >
> >Should I bother, or have we written off 6.0.1?
> 
> I suspect 6.0.1 is a writeoff, but the NEWS entry in mainline will still 
> help.

Good idea.  I've done this.

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-11-24  Daniel Jacobowitz  <drow@mvista.com>

	* NEWS: Mention improved location expression support.

Index: NEWS
===================================================================
RCS file: /cvs/src/src/gdb/NEWS,v
retrieving revision 1.126
diff -u -p -r1.126 NEWS
--- NEWS	18 Oct 2003 18:41:22 -0000	1.126
+++ NEWS	24 Nov 2003 17:02:00 -0000
@@ -3,6 +3,12 @@
 
 *** Changes since GDB 6.0:
 
+* DWARF 2 Location Expressions
+
+GDB support for location expressions has been extended to support function
+arguments and frame bases.  Older versions of GDB could crash when they
+encountered these.
+
 * New native configurations
 
 NetBSD/amd64					x86_64-*-netbsd*


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2003-11-24 17:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-02 16:56 RFA: DW_AT_frame_base fix for complicated frames Daniel Jacobowitz
2003-10-02 17:54 ` Jim Blandy
2003-10-09 14:26   ` Daniel Jacobowitz
2003-10-09 15:14     ` Andrew Cagney
2003-11-24  4:34       ` Daniel Jacobowitz
2003-11-24 16:02         ` Andrew Cagney
2003-11-24 17:03           ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox