> From: Dharmakan Rohit-B30502
> Sent: Monday, September 29, 2014 3:54 PM
> 
> > From: Ulrich Weigand [mailto:uweig...@de.ibm.com] Maciej W. Rozycki
> > wrote:
> > > On Mon, 4 Aug 2014, Edmar wrote:
> > >
> > > > Committed on trunk, revision 213596 Committed on 4.9 branch,
> > > > revision 213597
> > >
> > >  This change regressed GDB for e500v2 multilibs, presumably because
> > > it does not understand the new DWARF register numbers and does not
> > > know how to map them to hardware registers.
> >
> > As I understand it, the change was supposed to only affect GCC
> > internals, all externally generated debug info was supposed to remain
> unchanged.
> >
> > If there are changes in debug info, something must have gone wrong.
> 
> Let me check if I can track this down.

Maciej/Ulrich,

I was able to narrow down the issue.

Debug info generated with the current patch:
        <2><334>: Abbrev Number: 10 (DW_TAG_formal_parameter)
            <335>   DW_AT_name        : u       
            <337>   DW_AT_decl_file   : 1       
            <338>   DW_AT_decl_line   : 51      
            <339>   DW_AT_type        : <0x357> 
            <33d>   DW_AT_location    : 7 byte block: 90 7d 93 4 58 93 4        
(DW_OP_regx: 125 (r125); DW_OP_piece: 4; DW_OP_reg8 (r8); DW_OP_piece: 4)

Expected debug info:
        <2><334>: Abbrev Number: 10 (DW_TAG_formal_parameter)
            <335>   DW_AT_name        : u       
            <337>   DW_AT_decl_file   : 1       
            <338>   DW_AT_decl_line   : 51      
            <339>   DW_AT_type        : <0x359> 
            <33d>   DW_AT_location    : 8 byte block: 90 b8 9 93 4 58 93 4      
(DW_OP_regx: 1208 (r1208); DW_OP_piece: 4; DW_OP_reg8 (r8); DW_OP_piece: 4)

While emitting the location descriptors of multiple registers (SPE high/low 
part) individually, the GCC hard register number is converted in to DWARF 
register number using "dbx_reg_number" [Statement "A",  "B" & "C" below].

File1: gcc-4.9/gcc/config/rs6000/rs6000.h
=================================

...
/* Use standard DWARF numbering for DWARF debugging information.  */
#define DBX_REGISTER_NUMBER(REGNO) rs6000_dbx_register_number (REGNO)   
---------------------------------------------------------(A)
...


File2: gcc-4.9/gcc/dwarf2out.c
=========================

/* Given an RTL of a register, return a location descriptor that
   designates a value that spans more than one register.  */

static dw_loc_descr_ref
multiple_reg_loc_descriptor (rtx rtl, rtx regs,
                             enum var_init_status initialized)
{

...
  /* Now onto stupid register sets in non contiguous locations.  */

....
  for (i = 0; i < XVECLEN (regs, 0); ++i)
    {
      dw_loc_descr_ref t;
      t = one_reg_loc_descriptor (dbx_reg_number (XVECEXP (regs, 0, i)),  
VAR_INIT_STATUS_INITIALIZED);         -------------------------------(B)
      ...

    }
.....
  
}
static unsigned int
dbx_reg_number (const_rtx rtl)
{
 ....
 ....
  regno = DBX_REGISTER_NUMBER (regno);  
-------------------------------------------------------------------------------------------------------------(C)
  gcc_assert (regno != INVALID_REGNUM);
  return regno;
}

File3:gcc-4.9/gcc/config/rs6000/sysv4.h
===============================
....
/* This target uses the sysv4.opt file.  */
#define TARGET_USES_SYSV4_OPT 1

#undef DBX_REGISTER_NUMBER                  
----------------------------------------------------------------------------------------------------------(D)
....

But statement "C" macro "DBX_REGISTER_NUMBER" gets undefined by statement "D" 
hence the GCC hard register number gets emitted in the debug info instead of 
DWARF register number.
Previously, without this patch for SPE high registers the GCC hard register 
number was same as the DWARF register number (1200 onwards), hence we didn't 
see this issue.

Removing statement "D"  from "sysv4.h" file so as to generate expected DWARF 
register number does work, but will there be any side effects?

Regards,
Rohit

Reply via email to