This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: target/3920: wrong register number for CTR in stabs


> Date: 20 Jun 2002 23:54:29 -0000
> From: rth@gcc.gnu.org
> Reply-To: rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
>    geoffk@gcc.gnu.org, mattias@virtutech.se, nobody@gcc.gnu.org,
>    gcc-gnats@gcc.gnu.org

> In gcc 3.0.1 it emits RSYM with an integer register
> (r3, in this case)

Why do you think this is incorrect?  The assembler code generated by
GCC 3.1 with -O2 -g -mregnames is:

sum:
.LFB1:  
        .loc 1 2 0
        .loc 1 4 0
.LBB2:  
        mr. %r3,%r3
        .loc 1 3 0
        li %r0,0
        .loc 1 4 0
        beq- %cr0,.L8
        mtctr %r3
.L9:
        .loc 1 5 0
        add %r0,%r0,%r3
        .loc 1 4 0
        addi %r3,%r3,-1
        bdnz .L9
.L8:
        .loc 1 7 0
.LBE2:  
        mr %r3,%r0
        blr

The DWARF2 output (powerpc GCC switched from stabs to dwarf2 as of
3.1) has:

        .uleb128 0x2     # (DIE (0x25) DW_TAG_subprogram)
        .4byte  0x62     # DW_AT_sibling
        .byte   0x1      # DW_AT_external
        .ascii "sum\0"   # DW_AT_name
        .byte   0x1      # DW_AT_decl_file
        .byte   0x2      # DW_AT_decl_line
        .byte   0x1      # DW_AT_prototyped
        .4byte  0x62     # DW_AT_type
        .4byte  .LFB1    # DW_AT_low_pc
        .4byte  .LFE1    # DW_AT_high_pc
        .byte   0x1      # DW_AT_frame_base
        .byte   0x51     # DW_OP_reg1
        .uleb128 0x3     # (DIE (0x40) DW_TAG_formal_parameter)
        .ascii "n\0"     # DW_AT_name
        .byte   0x1      # DW_AT_decl_file
        .byte   0x1      # DW_AT_decl_line
        .4byte  0x62     # DW_AT_type
        .byte   0x1      # DW_AT_location
        .byte   0x53     # DW_OP_reg3
        .uleb128 0x4     # (DIE (0x4b) DW_TAG_variable)
        .ascii "i\0"     # DW_AT_name
        .byte   0x1      # DW_AT_decl_file
        .byte   0x3      # DW_AT_decl_line
        .4byte  0x62     # DW_AT_type
        .byte   0x1      # DW_AT_location
        .byte   0x53     # DW_OP_reg3
        .uleb128 0x4     # (DIE (0x56) DW_TAG_variable)
        .ascii "s\0"     # DW_AT_name
        .byte   0x1      # DW_AT_decl_file
        .byte   0x3      # DW_AT_decl_line
        .4byte  0x62     # DW_AT_type
        .byte   0x1      # DW_AT_location
        .byte   0x50     # DW_OP_reg0
        .byte   0x0      # end of children of DIE 0x25

that is, 'i' is in r3, 's' is in r0, and 'n' is in r3, all of which
seem accurate.

I am unable to come up with an example that shows any register in
CTR or LR.  CR is a special case, because it isn't very helpful to say
"oh, this went in the CR"; the debugger probably really wants to know
which actual CR bits the variable is in.

I do suspect, though, that possibly a DBX_REGISTER_NUMBER definition
might be a good idea.  I will put it onto my queue.

-- 
- Geoffrey Keating <geoffk@geoffk.org> <geoffk@redhat.com>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]