PATCH: Fix DW_OP_deref for DW_TAG_formal_parameter

H. J. Lu hjl@lucon.org
Thu Jul 31 16:13:00 GMT 2003


On Thu, Jul 31, 2003 at 11:48:21AM -0400, Daniel Jacobowitz wrote:
> On Thu, Jul 31, 2003 at 08:44:05AM -0700, H. J. Lu wrote:
> > On Wed, Jul 30, 2003 at 08:27:53PM -0400, Daniel Jacobowitz wrote:
> > > On Wed, Jul 30, 2003 at 05:23:06PM -0700, H. J. Lu wrote:
> > > > On Wed, Jul 30, 2003 at 05:56:12PM -0400, Daniel Jacobowitz wrote:
> > > > > On Wed, Jul 30, 2003 at 02:54:21PM -0700, H. J. Lu wrote:
> > > > > > Does DW_OP_deref work correctly with gdb?
> > > > > 
> > > > > That depends on the context.  Things that use decode_locdesc, probably
> > > > > not.  As we find time, things are being converted to the full
> > > > > expression evaluator.  Location descriptions and frame bases should
> > > > > work.
> > > > 
> > > > I don't think it does. Intel Fortran compiler generartes DW_OP_deref.
> > > > I got
> > > 
> > > Location descriptions for parameters may not work fully.  Feel free to
> > > fix it, or to investigate the reasons why more thoroughly - search for
> > > LOC_COMPUTED_ARG, but I don't even think we generate those yet.
> > > 
> > 

> Please look more closely at what I suggested, and at how DW_OP_deref
> works for DW_TAG_variable (as opposed to DW_TAG_formal_parameter).  All
> of the above should be turned into LOC_COMPUTED_ARG.
> 

Thanks. This patch works for me.


H.J.
-------------- next part --------------
2003-07-31  H.J. Lu  <hongjiu.lu@intel.com>

	* dwarf2read.c (new_symbol): Mark DW_TAG_formal_parameter with
	DW_OP_deref with LOC_COMPUTED_ARG.

--- gdb/dwarf2read.c.arg	2003-07-30 21:38:25.000000000 -0700
+++ gdb/dwarf2read.c	2003-07-31 09:06:53.000000000 -0700
@@ -5231,9 +5231,9 @@ new_symbol (struct die_info *die, struct
 		  SYMBOL_VALUE (sym) = 
 		    DWARF2_REG_TO_REGNUM (SYMBOL_VALUE (sym));
 		}
-	      else if (offreg)
+	      else if (isderef)
 		{
-		  if (isderef)
+		  if (offreg)
 		    {
 		      if (basereg != frame_base_reg)
 			dwarf2_complex_location_expr_complaint ();
@@ -5241,10 +5241,16 @@ new_symbol (struct die_info *die, struct
 		    }
 		  else
 		    {
-		      SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
-		      SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
+		      dwarf2_symbol_mark_computed (attr, sym,
+						   cu_header, objfile);
+		      SYMBOL_CLASS (sym) = LOC_COMPUTED_ARG;
 		    }
 		}
+	      else if (offreg)
+		{
+		  SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
+		  SYMBOL_BASEREG (sym) = DWARF2_REG_TO_REGNUM (basereg);
+		}
 	      else
 		{
 		  SYMBOL_CLASS (sym) = LOC_ARG;


More information about the Gdb mailing list