This is the mail archive of the mailing list for the GDB project.

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

Problem with "next" in main on sparc

Here is a bug in which GDB gets in an infinite loop.

The problem was with the following change.  I'm not sure what the
rationale for this change was, and I will point out that the code
which was checked in didn't match the ChangeLog entry.  In fact the
code would seem to disable most uses of the ->frame field, so it would
look like it causes problems other than this one.

1998-09-08  Jason Molenda  (

	* breakpoint.c (bpstat_stop_status):  Declare a bp match if the
	current fp matches the bp->fp OR if the current fp is less than
	the bp->fp if we're looking at a bp_step_resume breakpoint.

After the test case I have enclosed a patch to revert the 1998-09-08

[kingdon@bart jakub]$ cat try.c
int foo = 1;
int main(void)
        foo = 2;
[kingdon@bart jakub]$ gcc -g try.c
[kingdon@bart jakub]$ ./gdb-6 a.out
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "sparc-redhat-linux"...
(gdb) b main
Breakpoint 1 at 0x103a8: file try.c, line 4.
(gdb) run
Starting program: /home/devel/kingdon/zwork/jakub/a.out 

Breakpoint 1, main () at try.c:4
4	        foo = 2;
(gdb) next
5	}
[infinite loop, hit ^C]

Program received signal SIGINT, Interrupt.
0x70049f00 in __libc_start_main () at ../sysdeps/generic/libc-start.c:120
120	../sysdeps/generic/libc-start.c: No such file or directory.
(gdb) quit
The program is running.  Exit anyway? (y or n) y

1999-08-13  Jim Kingdon  <>

	* breakpoint.c (bpstat_stop_status): Revert 1998-09-08 change
	to ->frame matching.  The change did not match the ChangeLog
	entry, looked fishy, and caused infinite stepping when running
	"next" from main on sparc.  Thanks to Jakub for the report.

[kingdon@bart gdb]$ diff -u breakpoint.c.orig breakpoint.c
--- breakpoint.c.orig	Mon Oct  4 21:35:17 1999
+++ breakpoint.c	Mon Nov  1 14:09:41 1999
@@ -2345,9 +2345,8 @@
 	real_breakpoint = 1;
-    if (b->frame && b->frame != (get_current_frame ())->frame &&
-	(b->type == bp_step_resume &&
-	 (INNER_THAN (get_current_frame ()->frame, b->frame))))
+    if (b->frame &&
+	b->frame != (get_current_frame ())->frame)
       bs->stop = 0;

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