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]

Re: [Patch]: Little Cleanup


Hi,

thank you for your comment.

Eli Zaretskii wrote:

Actually, I find your version harder to read for someone not knowing the insert_breakpoints API by heart.

FWIW, I agree. The new version requires a comment to be as readable as the old one.

(Of course, I'd expect the optimizer to produce the same code from
both old and new versions.)
I agree.

Comment in insert_breakpoints() says:
"Both return zero if successful,   or an `errno' value if ..." so
"if (insert_breakpoints () != 0)" is more clear and precise.

I changed the patch. Ok ?

ChangeLog:

        * infrun.c (breakpoints_failed): Remove unnecessary variable.
        (handle_inferior_event): Remove unnecessary braces.
        * breakpoint.c (bpstat_what): Remove wrong comment.



--
Markus Deuling
GNU Toolchain for Linux on Cell BE
deuling@de.ibm.com


diff -urN src/gdb/breakpoint.c dev/gdb/breakpoint.c
--- src/gdb/breakpoint.c	2007-02-27 20:46:04.000000000 +0100
+++ dev/gdb/breakpoint.c	2007-03-02 07:29:06.000000000 +0100
@@ -3134,8 +3134,6 @@
   /* step_resume entries: a step resume breakpoint overrides another
      breakpoint of signal handling (see comment in wait_for_inferior
      at where we set the step_resume breakpoint).  */
-  /* We handle the through_sigtramp_breakpoint the same way; having both
-     one of those and a step_resume_breakpoint is probably very rare (?).  */
 
   static const enum bpstat_what_main_action
     table[(int) class_last][(int) BPSTAT_WHAT_LAST] =
diff -urN src/gdb/infrun.c dev/gdb/infrun.c
--- src/gdb/infrun.c	2007-03-01 06:45:40.000000000 +0100
+++ dev/gdb/infrun.c	2007-03-02 07:28:17.000000000 +0100
@@ -288,10 +288,6 @@
 
 struct regcache *stop_registers;
 
-/* Nonzero if program stopped due to error trying to insert breakpoints.  */
-
-static int breakpoints_failed;
-
 /* Nonzero after stop if current stack frame should be printed.  */
 
 static int stop_print_frame;
@@ -1830,7 +1826,6 @@
   stop_print_frame = 1;
   ecs->random_signal = 0;
   stopped_by_random_signal = 0;
-  breakpoints_failed = 0;
 
   if (stop_signal == TARGET_SIGNAL_TRAP
       && trap_expected
@@ -2126,9 +2121,7 @@
         if (debug_infrun)
 	  fprintf_unfiltered (gdb_stdlog, "infrun: BPSTAT_WHAT_SINGLE\n");
 	if (breakpoints_inserted)
-	  {
-	    remove_breakpoints ();
-	  }
+	  remove_breakpoints ();
 	breakpoints_inserted = 0;
 	ecs->another_trap = 1;
 	/* Still need to check other stuff, at least the case
@@ -2909,8 +2902,7 @@
 
       if (!breakpoints_inserted && !ecs->another_trap)
 	{
-	  breakpoints_failed = insert_breakpoints ();
-	  if (breakpoints_failed)
+          if (insert_breakpoints () != 0)
 	    {
 	      stop_stepping (ecs);
 	      return;

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