Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Luis Gustavo <luis_gustavo@mentor.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	 Pedro Alves <palves@redhat.com>,
	gdb-patches@sourceware.org
Subject: Re: [patch] update_global_location_list my comment fix  [Re: [PATCH] Fix breakpoint updates for multi-inferior]
Date: Wed, 08 Feb 2012 23:40:00 -0000	[thread overview]
Message-ID: <4F3307BE.2050909@mentor.com> (raw)
In-Reply-To: <20120208233211.GC19247@adacore.com>

[-- Attachment #1: Type: text/plain, Size: 750 bytes --]

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

[-- Attachment #2: 0001-fix_multiprocess_breaks.diff --]
[-- Type: text/x-patch, Size: 932 bytes --]

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.  */

  reply	other threads:[~2012-02-08 23:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-25 21:27 [PATCH] Fix breakpoint updates for multi-inferior Luis Gustavo
2012-02-07 23:44 ` Luis Gustavo
2012-02-08 15:17 ` Pedro Alves
2012-02-08 15:27   ` Luis Gustavo
2012-02-08 15:47     ` Pedro Alves
2012-02-08 17:28       ` [patch] update_global_location_list my comment fix [Re: [PATCH] Fix breakpoint updates for multi-inferior] Jan Kratochvil
2012-02-08 23:19         ` Luis Gustavo
2012-02-08 23:32           ` Joel Brobecker
2012-02-08 23:40             ` Luis Gustavo [this message]
2012-02-09  8:23               ` Jan Kratochvil
2012-02-09 11:05                 ` Luis Gustavo
2012-02-09 11:32                   ` Pedro Alves
2012-02-24 15:24                     ` Luis Gustavo
2012-02-09  8:21         ` [commit] " Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F3307BE.2050909@mentor.com \
    --to=luis_gustavo@mentor.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox