Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Andrew Burgess <aburgess@redhat.com>,
	Jan Vrany <jan.vrany@labware.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] gdb: use std::vector<> to hold on blocks in struct blockvector
Date: Tue, 14 Oct 2025 15:41:06 -0400	[thread overview]
Message-ID: <77c4be93-0eac-4477-a7c2-62724a841db9@simark.ca> (raw)
In-Reply-To: <87v7kha5pg.fsf@redhat.com>

On 10/14/25 11:00 AM, Andrew Burgess wrote:
>> @@ -809,6 +810,41 @@ make_blockranges (struct objfile *objfile,
>>    return blr;
>>  }
>>  
>> +static bool
>> +block_ordering_predicate (struct block *b1, struct block *b2)
> 
> Functions should have a comment above them.
> 
>> +{
>> +  CORE_ADDR start1 = b1->start ();
>> +  CORE_ADDR start2 = b2->start ();
>> +
>> +  if (start1 != start2)
>> +    return start1 < start2;
>> +  return (b2->end () < b1->end ());
>> +}
> 
> I notice that we use a slightly different ordering function in
> buildsym.c, one that doesn't consider the end address.  Probably doesn't
> matter, but maybe it's at least worth mentioning in a comment or the
> commit message, that way, if someone is looking at the code in the
> future they can understand why these things are different.  Even if the
> reason is just "we have no motivating example for why these should be
> the same right now".

buildsym sorts them (locally, in its singly-linked list) in the inverse
order, but then fills the blockvector backwards.  So the blocks end up
in the right order in the blockvector.  I think this is an artefact from
the past and could be simplified.  The predicate for sorting blocks in a
blockvector should probably be written just once (in block.h) and used
by whoever needs it.

Simon

  reply	other threads:[~2025-10-14 19:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-13 18:23 [PATCH 0/2] " Jan Vrany
2025-10-13 18:23 ` [PATCH 1/2] gdb: allocate blockvector on heap Jan Vrany
2025-10-14 18:41   ` Simon Marchi
2025-10-13 18:23 ` [PATCH 2/2] gdb: use std::vector<> to hold on blocks in struct blockvector Jan Vrany
2025-10-14 15:00   ` Andrew Burgess
2025-10-14 19:41     ` Simon Marchi [this message]
2025-10-15 21:34       ` Jan Vraný
2025-10-14 19:29   ` Simon Marchi
2025-10-14 20:05     ` Tom Tromey
2025-10-14 20:19       ` Simon Marchi
2025-10-14 20:40         ` Jan Vraný
2025-10-15  2:00           ` Simon Marchi

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=77c4be93-0eac-4477-a7c2-62724a841db9@simark.ca \
    --to=simark@simark.ca \
    --cc=aburgess@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.vrany@labware.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