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] update_global_location_list my comment fix [Re: [PATCH] Fix breakpoint updates for multi-inferior]


On 02/08/2012 03:27 PM, Jan Kratochvil wrote:
On Wed, 08 Feb 2012 16:47:23 +0100, Pedro Alves wrote:
We're already sorting by address first, so I'm not really sure what is
it that's user-visible that we're trying to preserve.  Jan?

I no longer remember if


(a) I was wrongly expecting "duplicate"-marked locations are somehow visible
     in "info breakpoints".
or
(b)<the new patch comment below>.

I will check the comment change in, I hope everyone agrees with the reason.


Even if that is still necessary, would it be ok to sort by address, then
pspace, and only after by bkpt number?

I agree with Pedro, update_global_location_list was introduced as GDB acceleration as the breakpoints performance became no longer bearable.

While update_global_location_list is far from perfect (it should be
incremental) we should not regress performance when it is enough to do it just
in a bit different way as Pedro suggests.

I agree. Here's a new patch that touches the bp_location_compare function instead.


Luis
2012-02-08  Luis Machado  <lgustavo@codesourcery.com>

	* breakpoint.c (bp_location_compare): Sort by pspace before sorting by
	number.

Index: gdb/gdb/breakpoint.c
===================================================================
--- gdb.orig/gdb/breakpoint.c	2012-02-08 15:55:24.535075001 -0200
+++ gdb/gdb/breakpoint.c	2012-02-08 15:57:26.107075004 -0200
@@ -10589,6 +10589,13 @@ bp_location_compare (const void *ap, con
   if (a_perm != b_perm)
     return (a_perm < b_perm) - (a_perm > b_perm);
 
+  /* Sort by pspace.  This effectively sorts locations by inferior in
+     a multi-inferior environment.  */
+
+  if (a->pspace != b->pspace)
+    return (a->pspace > b->pspace)
+	   - (a->pspace < b->pspace);
+
   /* Make the internal GDB representation stable across GDB runs
      where A and B memory inside GDB can differ.  Breakpoint locations of
      the same type at the same address can be sorted in arbitrary order.  */

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