Problem with "next" in main on sparc

Jason Molenda jsm@cygnus.com
Mon Nov 8 16:28:00 GMT 1999


On Mon, Nov 01, 1999 at 02:38:31PM -0500, Jim Kingdon wrote:
> Here is a bug in which GDB gets in an infinite loop.

I am sorry I took so long to reply.  I resolved to look into this before
I sent out this week's snapshot.

I tried reproducing it on a SPARC Solaris box with gcc and I didn't have
the problem described.  AFAIK we don't have a SPARC RH box locally so I
can't test that.  The GCC I was using is not one of the FSF releasese,
it is similar to the GCC working sources around February or March.

Maybe you show me the end bit of try.s if you compile "gcc -S -g try.c"
on your side?  I'm getting this here:

main:
.stabn 68,0,3,.LM1-main
.LM1:
        !#PROLOGUE# 0
        save    %sp, -112, %sp
        !#PROLOGUE# 1
.stabn 68,0,4,.LM2-main
.LM2:
        sethi   %hi(foo), %o1
        or      %o1, %lo(foo), %o0
        mov     2, %o1
        st      %o1, [%o0]
.stabn 68,0,5,.LM3-main
.LM3:
.LL2:
        ret
        restore
.LLfe1:
        .size    main,.LLfe1-main
.LLscope0:


Which GDB (current development version) handles correctly:

; ./gdb -q a.out
(gdb) b main
Breakpoint 1 at 0x10704: file try.c, line 4.
(gdb) run
Starting program: /horton/jsm/comp-tools/i-sparc/bin/a.out 

Breakpoint 1, main () at try.c:4
4               foo = 2;                                                 
(gdb) n
5       }
(gdb) 
0x105fc in .nope ()
(gdb) 
Single stepping until exit from function .nope, 
which has no line number information.

Program exited with code 01.
(gdb) 


Jason


More information about the Gdb-patches mailing list