This is the mail archive of the gdb-patches@sourceware.org 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]
Other format: [Raw text]

[commit] Fix an uninitialized variable in infrun


infrun.c:keep_going sets trap_expected = ecs->another_trap.  In
handle_inferior_event, ecs->another_trap is explicitly set before some early
calls to keep_going, but not before others, and then explicitly cleared
halfway down.

The only paths I see that could reach keep_going without the initialization
are the (relatively recent, compared to the 1999 comment I'm removing)
fork/vfork/exec events without active catchpoints.  But that's enough for a
bug... if you attach to a program which forks and then hits a breakpoint,
then trap_expected will be set when we hit the breakpoint.  This fools the
same currently_stepping() test that Andreas was having trouble with, and
results in not decrementing the PC - or reporting the breakpoint.  Instead
we'll keep going on the next instruction.

Of course on the beauty of architectural design that is i386, at this point
we may be in the middle of an instruction.  So we may get a SIGILL shortly
thereafter.  On another platform it might have been much harder to track
down...

Tested on x86_64-pc-linux-gnu and committed.

-- 
Daniel Jacobowitz
CodeSourcery, LLC

2005-09-28  Daniel Jacobowitz  <dan@codesourcery.com>

	* infrun.c (init_execution_control_state): Initialize
	ecs->another_trap.

Index: infrun.c
===================================================================
RCS file: /big/fsf/rsync/src/src/gdb/infrun.c,v
retrieving revision 1.203
diff -u -p -r1.203 infrun.c
--- infrun.c	1 Aug 2005 03:32:32 -0000	1.203
+++ infrun.c	28 Sep 2005 16:10:42 -0000
@@ -1075,7 +1075,7 @@ fetch_inferior_event (void *client_data)
 void
 init_execution_control_state (struct execution_control_state *ecs)
 {
-  /* ecs->another_trap? */
+  ecs->another_trap = 0;
   ecs->random_signal = 0;
   ecs->step_after_step_resume_breakpoint = 0;
   ecs->handling_longjmp = 0;	/* FIXME */


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