Given the following code from gdb's funcargs test:

typedef struct s
{
  short s;
  int i;
  long l;
} SVAL;

void recurse (SVAL a, int depth)
{
  a.s = a.i = a.l = --depth;
  if (depth == 0)
    hitbottom ();
  else
    recurse (a, depth);
}

compiled with -g

gcc-4.0 does not emit a dwarf location for the 'a' argument:

$ readelf -wi funcargs
[....]
 <2><1921>: Abbrev Number: 11 (DW_TAG_formal_parameter)
     DW_AT_name        : a
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 612
     DW_AT_type        : <18e0>

in gcc-3.x, you will get one more dwarf attribute:
     DW_AT_location    : 3 byte block: 91 18 6  (DW_OP_fbreg: 24; DW_OP_deref)

The difference is that in gcc 3.x, the first argument is first copied from the
incoming argument register to the stack. In gcc-4.x the generated code does not
do this stack save and uses the incoming register directly (actually it first
copies it to a scratch register).


-- 
           Summary: gcc generates code that does not allow retrieval of
                    struct arguments with debugger
           Product: gcc
           Version: 4.0.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tausq at debian dot org
 GCC build triplet: hppa-unknown-linux
  GCC host triplet: hppa-unknown-linux
GCC target triplet: hppa-unknown-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26330

Reply via email to