This is the mail archive of the gdb-patches@sources.redhat.com 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]

PATCH: resume + threads + software stepping == boom


resume () in infrun.c has this block:

  if (SOFTWARE_SINGLE_STEP_P () && step)
    {
      /* Do it the hard way, w/temp breakpoints */
      SOFTWARE_SINGLE_STEP (sig, 1 /*insert-breakpoints */ );
      /* ...and don't ask hardware to do it.  */
      step = 0;

Then, further down, if (use_thread_step_needed && thread_step_needed)
and there's already a breakpoint at the PC, is this:

              if (!step)
                {
                  warning ("Internal error, changing continue to step.");

That blows up, because step will always be zero here if
SOFTWARE_SINGLE_STEP_P ().  Is this patch OK?  It seems to work in my tests
here.


-- 
Daniel Jacobowitz                           Debian GNU/Linux Developer
Monta Vista Software                              Debian Security Team
Index: gdb/infrun.c
===================================================================
RCS file: /cvs/src/src/gdb/infrun.c,v
retrieving revision 1.35
diff -u -p -r1.35 infrun.c
--- infrun.c	2001/06/02 00:36:20	1.35
+++ infrun.c	2001/06/08 19:30:34
@@ -820,6 +820,7 @@ void
 resume (int step, enum target_signal sig)
 {
   int should_resume = 1;
+  int ostep = step;
   struct cleanup *old_cleanups = make_cleanup (resume_cleanups, 0);
   QUIT;
 
@@ -927,13 +928,13 @@ resume (int step, enum target_signal sig
 	    }
 	  else
 	    {
-	      if (!step)
+	      if (!ostep)
 		{
 		  warning ("Internal error, changing continue to step.");
 		  remove_breakpoints ();
 		  breakpoints_inserted = 0;
 		  trap_expected = 1;
-		  step = 1;
+		  ostep = step = 1;
 		}
 	      resume_ptid = inferior_ptid;
 	    }

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