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: Fix regression in always-inserted breakpoints mode.


On Fri, 20 Nov 2009 03:11:18 +0100, Pedro Alves wrote:
> There's for loop a bit below, that starts iterating on
> `locp', and that would misses a few locations,

I agree I brought in such regression, thanks for catching it.

I will check-in the [obv] patch below after you check it in.


> There's another problem with this for loop.  The
> breakpoint_address_match is too strict when debugging
> more than one inferior.  Even if breakpoint_address_match
> fails due to address space mismatch, there could be other
> locations with the same address following loc2p.

This is unrelated to the regression from me.


Sorry,
Jan


gdb/
2009-11-20  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* breakpoint.c (bp_location_compare): Change parameter a to ap and b to
	bp.  New variables a and b.
	(bp_location_compare_for_qsort): Remove.
	(update_global_location_list): Use now bp_location_compare.

--- ./gdb/breakpoint.c-1	2009-11-20 12:22:12.000000000 +0100
+++ ./gdb/breakpoint.c	2009-11-20 12:27:44.000000000 +0100
@@ -8073,15 +8073,17 @@ breakpoint_auto_delete (bpstat bs)
   }
 }
 
-/* A comparison function for bp_location A and B being interfaced to qsort.
+/* A comparison function for bp_location AP and BP being interfaced to qsort.
    Sort elements primarily by their ADDRESS (no matter what does
    breakpoint_address_is_meaningful say for its OWNER), secondarily by ordering
    first bp_permanent OWNERed elements and terciarily just ensuring the array
    is sorted stable way despite qsort being an instable algorithm.  */
 
 static int
-bp_location_compare (struct bp_location *a, struct bp_location *b)
+bp_location_compare (const void *ap, const void *bp)
 {
+  struct bp_location *a = *(void **) ap;
+  struct bp_location *b = *(void **) bp;
   int a_perm = a->owner->enable_state == bp_permanent;
   int b_perm = b->owner->enable_state == bp_permanent;
 
@@ -8102,17 +8104,6 @@ bp_location_compare (struct bp_location 
   return (a > b) - (a < b);
 }
 
-/* Interface bp_location_compare as the COMPAR parameter of qsort function.  */
-
-static int
-bp_location_compare_for_qsort (const void *ap, const void *bp)
-{
-  struct bp_location *a = *(void **) ap;
-  struct bp_location *b = *(void **) bp;
-
-  return bp_location_compare (a, b);
-}
-
 /* Set bp_location_placed_address_before_address_max and
    bp_location_shadow_len_after_address_max according to the current content of
    the bp_location array.  */
@@ -8196,7 +8187,7 @@ update_global_location_list (int should_
     for (loc = b->loc; loc; loc = loc->next)
       *locp++ = loc;
   qsort (bp_location, bp_location_count, sizeof (*bp_location),
-	 bp_location_compare_for_qsort);
+	 bp_location_compare);
 
   bp_location_target_extensions_update ();
 


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