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 09:32 PM, Joel Brobecker wrote:
I don't know this area, so cannot formally review, but a minor comment:

+  if (a->pspace != b->pspace)
+    return (a->pspace>  b->pspace)
+	   - (a->pspace<  b->pspace);

The GNU Coding Standards asks us to use an extra pair of parentheses in order to help code formatters, even if it is strictly not necessary here, thus:

         return ((a->pspace>  b->pspace)
                 - ((a->pspace<  b->pspace)));

But going beyond this, ISTM that you can simply put the entire
expression on one line and be done with it:

   if (a->pspace != b->pspace)
     return (a->pspace>  b->pspace) - (a->pspace<  b->pspace);


I went with putting everything on one line.


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 19:29:41.887074999 -0200
+++ gdb/gdb/breakpoint.c	2012-02-08 21:38:10.935074996 -0200
@@ -10589,6 +10589,12 @@ 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]