Hello,

I have problem with gcc3.x and stabs debugging format on powerpc (ppc32 603e).
gdb doesn't recognize builtin unsigned int/long formats.

I compile the following program with: powerpc-gcc -gstabs a.c
int main()
{       
        unsigned int a;
        int b;
        
        return 0;
}
and try to debug it:
> gdb a.out
(gdb) b main
Breakpoint 1 at 0x100003bc: file a.c, line 6.
(gdb) r
Starting program: a.out

Breakpoint 1, main () at a.c:6
6               return 0;
(gdb) info locals
a = <error type>
b = -1
(gdb)  q
The program is running.  Exit anyway? (y or n) y
>

After little investigation I discovered that gcc emits wrong stabs entry for
unsigned int format.
.stabs  "unsigned int:t(0,4)=r(0,4);0;4294967295;",128,0,0,0
The problem is with the max value. According to gdb source code if the value
too big for int it should be emitted in octal. Here is what gcc for intel emits
in this case by the way:
.stabs  "unsigned int:t(0,4)=r(0,4);0;-1;",128,0,0,0

After further investigation I saw that HOST_BITS_PER_WIDE_INT for powerpc is
defined to 64 and gdb rightfully things that widest int is 32 bit long on my 32
bit powerpc CPU and bails out since constant from stabs entry is to big. The
definition of HOST_BITS_PER_WIDE_INT depends on need_64bit_hwint from config.gcc
and it's set to "yes" for all powerpc CPUs there.

I've removed definition of need_64bit_hwint for powerpc and the result compiler
emits right stab entry now, but it can't compile glibc. The error is in file
glibc-2.3.2/sysdeps/unix/sysv/linux/powerpc/sys/procfs.h. It uses __uint128_t
and gcc provides it only if HOST_BITS_PER_WIDE_INT is at least 64 bits.

-- 
           Summary: gstabs emits wrong entry for "unsigned int/long" types
                    on powerpc
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gleb76 at gmail dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-linux-gnu
  GCC host triplet: i686-linux-gnu
GCC target triplet: powerpc-linux-gnu


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

Reply via email to