Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* PATCH to dwarf2read.c:decode_locdesc
@ 2002-01-10  4:26 Jason Merrill
  2002-01-10 11:57 ` Daniel Jacobowitz
  2002-01-10 14:07 ` Elena Zannoni
  0 siblings, 2 replies; 5+ messages in thread
From: Jason Merrill @ 2002-01-10  4:26 UTC (permalink / raw)
  To: gdb-patches; +Cc: Jason Merrill

[-- Attachment #1: Type: text/plain, Size: 924 bytes --]

I noticed that even with Daniel's recent C++ improvements (thanks!), vbase
handling was still broken with dwarf2 because dwarf2read.c still didn't
grok the complex location expression gcc now emits.  As it happens, by a
fluke simply adding support for the missing opcodes causes decode_locdesc
to produce the answer gdb wants.  The dwarf2 output expects the stack to
start with the address of the object and produce the address of the base,
whereas in the current gdb the stack starts with 0 and produces the
negation of whatever constant is provided, which matches the stabs output.

Of course, gdb tries to complain about the derefs twice in the process, but
is currently muffled.

So, it's not a complete solution, but it's entirely correct and fixes
gdb.c++/inherit.exp.

OK to commit?

2002-01-10  Jason Merrill  <jason@redhat.com>

	* dwarf2read.c (decode_locdesc): Implement DW_OP_litn, DW_OP_dup.
	Fix DW_OP_minus.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1634 bytes --]

*** dwarf2read.c.~1~	Tue Jan  8 14:17:30 2002
--- dwarf2read.c	Thu Jan 10 11:54:45 2002
*************** decode_locdesc (struct dwarf_block *blk,
*** 5807,5812 ****
--- 5807,5847 ----
        op = data[i++];
        switch (op)
  	{
+ 	case DW_OP_lit0:
+ 	case DW_OP_lit1:
+ 	case DW_OP_lit2:
+ 	case DW_OP_lit3:
+ 	case DW_OP_lit4:
+ 	case DW_OP_lit5:
+ 	case DW_OP_lit6:
+ 	case DW_OP_lit7:
+ 	case DW_OP_lit8:
+ 	case DW_OP_lit9:
+ 	case DW_OP_lit10:
+ 	case DW_OP_lit11:
+ 	case DW_OP_lit12:
+ 	case DW_OP_lit13:
+ 	case DW_OP_lit14:
+ 	case DW_OP_lit15:
+ 	case DW_OP_lit16:
+ 	case DW_OP_lit17:
+ 	case DW_OP_lit18:
+ 	case DW_OP_lit19:
+ 	case DW_OP_lit20:
+ 	case DW_OP_lit21:
+ 	case DW_OP_lit22:
+ 	case DW_OP_lit23:
+ 	case DW_OP_lit24:
+ 	case DW_OP_lit25:
+ 	case DW_OP_lit26:
+ 	case DW_OP_lit27:
+ 	case DW_OP_lit28:
+ 	case DW_OP_lit29:
+ 	case DW_OP_lit30:
+ 	case DW_OP_lit31:
+ 	  stack[++stacki] = op - DW_OP_lit0;
+ 	  break;
+ 
  	case DW_OP_reg0:
  	case DW_OP_reg1:
  	case DW_OP_reg2:
*************** decode_locdesc (struct dwarf_block *blk,
*** 5965,5970 ****
--- 6000,6010 ----
  	  i += bytes_read;
  	  break;
  
+ 	case DW_OP_dup:
+ 	  stack[stacki + 1] = stack[stacki];
+ 	  stacki++;
+ 	  break;
+ 
  	case DW_OP_plus:
  	  stack[stacki - 1] += stack[stacki];
  	  stacki--;
*************** decode_locdesc (struct dwarf_block *blk,
*** 5976,5982 ****
  	  break;
  
  	case DW_OP_minus:
! 	  stack[stacki - 1] = stack[stacki] - stack[stacki - 1];
  	  stacki--;
  	  break;
  
--- 6016,6022 ----
  	  break;
  
  	case DW_OP_minus:
! 	  stack[stacki - 1] -= stack[stacki];
  	  stacki--;
  	  break;
  

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

* Re: PATCH to dwarf2read.c:decode_locdesc
  2002-01-10  4:26 PATCH to dwarf2read.c:decode_locdesc Jason Merrill
@ 2002-01-10 11:57 ` Daniel Jacobowitz
  2002-01-10 14:07 ` Elena Zannoni
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-01-10 11:57 UTC (permalink / raw)
  To: gdb-patches

On Thu, Jan 10, 2002 at 12:26:33PM +0000, Jason Merrill wrote:
> I noticed that even with Daniel's recent C++ improvements (thanks!), vbase
> handling was still broken with dwarf2 because dwarf2read.c still didn't
> grok the complex location expression gcc now emits.  As it happens, by a
> fluke simply adding support for the missing opcodes causes decode_locdesc
> to produce the answer gdb wants.  The dwarf2 output expects the stack to
> start with the address of the object and produce the address of the base,
> whereas in the current gdb the stack starts with 0 and produces the
> negation of whatever constant is provided, which matches the stabs output.
> 
> Of course, gdb tries to complain about the derefs twice in the process, but
> is currently muffled.
> 
> So, it's not a complete solution, but it's entirely correct and fixes
> gdb.c++/inherit.exp.
> 
> OK to commit?

[I can't approve but] thanks!  This has been stewing on my TODO list
while I fixed other things in the type code.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

* Re: PATCH to dwarf2read.c:decode_locdesc
  2002-01-10  4:26 PATCH to dwarf2read.c:decode_locdesc Jason Merrill
  2002-01-10 11:57 ` Daniel Jacobowitz
@ 2002-01-10 14:07 ` Elena Zannoni
  2002-01-11  2:13   ` Jason Merrill
  1 sibling, 1 reply; 5+ messages in thread
From: Elena Zannoni @ 2002-01-10 14:07 UTC (permalink / raw)
  To: Jason Merrill; +Cc: gdb-patches

Jason Merrill writes:
 > I noticed that even with Daniel's recent C++ improvements (thanks!), vbase
 > handling was still broken with dwarf2 because dwarf2read.c still didn't
 > grok the complex location expression gcc now emits.  As it happens, by a
 > fluke simply adding support for the missing opcodes causes decode_locdesc
 > to produce the answer gdb wants.  The dwarf2 output expects the stack to
 > start with the address of the object and produce the address of the base,
 > whereas in the current gdb the stack starts with 0 and produces the
 > negation of whatever constant is provided, which matches the stabs output.
 > 
 > Of course, gdb tries to complain about the derefs twice in the process, but
 > is currently muffled.
 > 
 > So, it's not a complete solution, but it's entirely correct and fixes
 > gdb.c++/inherit.exp.
 > 

Sigh! There have been several attempts to get the location expression
support in gdb. They all stopped dead for one reason or another. There
are several WIP patches out there.
http://sources.redhat.com/ml/gdb-patches/2001-02/msg00276.html
http://sources.redhat.com/ml/gdb-patches/2001-06/msg00390.html
http://sources.redhat.com/ml/gdb-patches/2001-06/msg00502.html
http://sources.redhat.com/ml/gdb-patches/2001-07/msg00008.html

Hmm, DW_OP_dup wasn't handled in the above patches.

Anyway, this is approved.

Elena


 > OK to commit?
 > 
 > 2002-01-10  Jason Merrill  <jason@redhat.com>
 > 
 > 	* dwarf2read.c (decode_locdesc): Implement DW_OP_litn, DW_OP_dup.
 > 	Fix DW_OP_minus.
 > 
 > *** dwarf2read.c.~1~	Tue Jan  8 14:17:30 2002
 > --- dwarf2read.c	Thu Jan 10 11:54:45 2002
 > *************** decode_locdesc (struct dwarf_block *blk,
 > *** 5807,5812 ****
 > --- 5807,5847 ----
 >         op = data[i++];
 >         switch (op)
 >   	{
 > + 	case DW_OP_lit0:
 > + 	case DW_OP_lit1:
 > + 	case DW_OP_lit2:
 > + 	case DW_OP_lit3:
 > + 	case DW_OP_lit4:
 > + 	case DW_OP_lit5:
 > + 	case DW_OP_lit6:
 > + 	case DW_OP_lit7:
 > + 	case DW_OP_lit8:
 > + 	case DW_OP_lit9:
 > + 	case DW_OP_lit10:
 > + 	case DW_OP_lit11:
 > + 	case DW_OP_lit12:
 > + 	case DW_OP_lit13:
 > + 	case DW_OP_lit14:
 > + 	case DW_OP_lit15:
 > + 	case DW_OP_lit16:
 > + 	case DW_OP_lit17:
 > + 	case DW_OP_lit18:
 > + 	case DW_OP_lit19:
 > + 	case DW_OP_lit20:
 > + 	case DW_OP_lit21:
 > + 	case DW_OP_lit22:
 > + 	case DW_OP_lit23:
 > + 	case DW_OP_lit24:
 > + 	case DW_OP_lit25:
 > + 	case DW_OP_lit26:
 > + 	case DW_OP_lit27:
 > + 	case DW_OP_lit28:
 > + 	case DW_OP_lit29:
 > + 	case DW_OP_lit30:
 > + 	case DW_OP_lit31:
 > + 	  stack[++stacki] = op - DW_OP_lit0;
 > + 	  break;
 > + 
 >   	case DW_OP_reg0:
 >   	case DW_OP_reg1:
 >   	case DW_OP_reg2:
 > *************** decode_locdesc (struct dwarf_block *blk,
 > *** 5965,5970 ****
 > --- 6000,6010 ----
 >   	  i += bytes_read;
 >   	  break;
 >   
 > + 	case DW_OP_dup:
 > + 	  stack[stacki + 1] = stack[stacki];
 > + 	  stacki++;
 > + 	  break;
 > + 
 >   	case DW_OP_plus:
 >   	  stack[stacki - 1] += stack[stacki];
 >   	  stacki--;
 > *************** decode_locdesc (struct dwarf_block *blk,
 > *** 5976,5982 ****
 >   	  break;
 >   
 >   	case DW_OP_minus:
 > ! 	  stack[stacki - 1] = stack[stacki] - stack[stacki - 1];
 >   	  stacki--;
 >   	  break;
 >   
 > --- 6016,6022 ----
 >   	  break;
 >   
 >   	case DW_OP_minus:
 > ! 	  stack[stacki - 1] -= stack[stacki];
 >   	  stacki--;
 >   	  break;
 >   


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

* Re: PATCH to dwarf2read.c:decode_locdesc
  2002-01-10 14:07 ` Elena Zannoni
@ 2002-01-11  2:13   ` Jason Merrill
  2002-01-11 14:48     ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Jason Merrill @ 2002-01-11  2:13 UTC (permalink / raw)
  To: Elena Zannoni; +Cc: gdb-patches

>>>>> "Elena" == Elena Zannoni <ezannoni@redhat.com> writes:

> Sigh! There have been several attempts to get the location expression
> support in gdb. They all stopped dead for one reason or another. There
> are several WIP patches out there.
> http://sources.redhat.com/ml/gdb-patches/2001-02/msg00276.html
> http://sources.redhat.com/ml/gdb-patches/2001-06/msg00390.html
> http://sources.redhat.com/ml/gdb-patches/2001-06/msg00502.html
> http://sources.redhat.com/ml/gdb-patches/2001-07/msg00008.html

> Hmm, DW_OP_dup wasn't handled in the above patches.

Actually, none of these patches make any attempt to generalize location
expression handling.  The first just copies some organizational changes
from gcc.  The others are Dan Berlin's WIP dwarf2read rewrite, which
doesn't touch the locexp code (though I think it does fix inter-CU
references, which is needed before we can do any duplicate elimination on
the compiler/linker side).

> Anyway, this is approved.

Applied, thanks.

Jason


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

* Re: PATCH to dwarf2read.c:decode_locdesc
  2002-01-11  2:13   ` Jason Merrill
@ 2002-01-11 14:48     ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-01-11 14:48 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Elena Zannoni, gdb-patches

On Fri, Jan 11, 2002 at 10:12:39AM +0000, Jason Merrill wrote:
> >>>>> "Elena" == Elena Zannoni <ezannoni@redhat.com> writes:
> 
> > Sigh! There have been several attempts to get the location expression
> > support in gdb. They all stopped dead for one reason or another. There
> > are several WIP patches out there.
> > http://sources.redhat.com/ml/gdb-patches/2001-02/msg00276.html
> > http://sources.redhat.com/ml/gdb-patches/2001-06/msg00390.html
> > http://sources.redhat.com/ml/gdb-patches/2001-06/msg00502.html
> > http://sources.redhat.com/ml/gdb-patches/2001-07/msg00008.html
> 
> > Hmm, DW_OP_dup wasn't handled in the above patches.
> 
> Actually, none of these patches make any attempt to generalize location
> expression handling.  The first just copies some organizational changes
> from gcc.  The others are Dan Berlin's WIP dwarf2read rewrite, which
> doesn't touch the locexp code (though I think it does fix inter-CU
> references, which is needed before we can do any duplicate elimination on
> the compiler/linker side).

For what it's worth, I'm working over the rewrite patches and breaking
them down into chunks now.  inter-CU references aren't tricky once we
have some cleanup in place.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


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

end of thread, other threads:[~2002-01-11 22:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-10  4:26 PATCH to dwarf2read.c:decode_locdesc Jason Merrill
2002-01-10 11:57 ` Daniel Jacobowitz
2002-01-10 14:07 ` Elena Zannoni
2002-01-11  2:13   ` Jason Merrill
2002-01-11 14:48     ` Daniel Jacobowitz

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