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]

[patch 2/3] bpstat_print should consider all candidates


Hi,

I cannot find a reproducer, accidentally always the most important breakpoint
comes first.  Formerly I believe it was a required part but I cannot find
a difference of this series without this patch now.


Thanks,
Jan


gdb/
2010-05-03  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* breakpoint.c (bpstat_print): Change variable val to retval,
	initialize it, return it at the end.  Search for the lowest RETVAL
	value, do not stop on the first valid return value.
	* breakpoint.h (enum print_stop_action): Put PRINT_UNKNOWN as the
	highest value.  Extend the comment.

--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3434,7 +3434,7 @@ print_bp_stop_message (bpstat bs)
 enum print_stop_action
 bpstat_print (bpstat bs)
 {
-  int val;
+  enum print_stop_action retval = PRINT_UNKNOWN;
 
   /* Maybe another breakpoint in the chain caused us to stop.
      (Currently all watchpoints go on the bpstat whether hit or not.
@@ -3442,16 +3442,14 @@ bpstat_print (bpstat bs)
      with respect to bpstat_explains_signal).  */
   for (; bs; bs = bs->next)
     {
+      enum print_stop_action val;
+      
       val = print_bp_stop_message (bs);
-      if (val == PRINT_SRC_ONLY 
-	  || val == PRINT_SRC_AND_LOC 
-	  || val == PRINT_NOTHING)
-	return val;
+      if (val < retval)
+	retval = val;
     }
 
-  /* We reached the end of the chain, or we got a null BS to start
-     with and nothing was printed. */
-  return PRINT_UNKNOWN;
+  return retval;
 }
 
 /* Evaluate the expression EXP and return 1 if value is zero.
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -638,14 +638,16 @@ struct bpstat_what
     enum stop_stack_kind call_dummy;
   };
 
-/* The possible return values for print_bpstat, print_it_normal,
-   print_it_done, print_it_noop. */
+/* The possible return values for print_bpstat, print_it_normal, print_it_done,
+   print_it_noop.  bpstat_print depends on ther ordering where each item is an
+   information subset of the previous one.  */
+
 enum print_stop_action
   {
-    PRINT_UNKNOWN = -1,
     PRINT_SRC_AND_LOC,
     PRINT_SRC_ONLY,
-    PRINT_NOTHING
+    PRINT_NOTHING,
+    PRINT_UNKNOWN
   };
 
 /* Tell what to do about this bpstat.  */


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