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/09/2012 11:04 AM, Luis Gustavo wrote:
> On 02/09/2012 06:22 AM, Jan Kratochvil wrote:
>> On Thu, 09 Feb 2012 00:39:42 +0100, Luis Gustavo wrote:
>>> +  /* 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);
>>
>> This does not follow the comment I made:
>>
>>    /* Make the internal GDB representation stable across GDB runs
>>       where A and B memory inside GDB can differ.
>>
>> I would prefer there (and it will not fit on a single line :-) ):
>>
>>         return (a->pspace->num>  b->pspace->num) - (a->pspace->num<  b->pspace->num);
>>
>> NUM should be the same on each GDB run for the same inferior / command file.
> 
> I would still like to keep an appropriate comment regarding multi-inferiors next to the pspace comparison, like the following... maybe it would've been best to keep the change above your new comment. Here's a new version.
> 
> What do you think?

We need to sort by pspace even before that, before:

  /* Sort permanent breakpoints first.  */
  if (a_perm != b_perm)
    return (a_perm < b_perm) - (a_perm > b_perm);

So that you don't get:

 #1 PSPACE1 ADDR1 PERM
 #2 PSPACE2 ADDR1 PERM
 #3 PSPACE1 ADDR1
 #4 PSPACE2 ADDR1

But instead:

 #1 PSPACE1 ADDR1 PERM
 #2 PSPACE1 ADDR1
 #3 PSPACE2 ADDR1 PERM
 #4 PSPACE2 ADDR1

-- 
Pedro Alves


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