Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: Tom Tromey <tom@tromey.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v2 3/7] [gdb/tui] Improve section handling in tui_find_backward_disassembly_start_address
Date: Sat, 19 Sep 2026 18:01:04 +0200	[thread overview]
Message-ID: <bd6cfd11-56b2-4749-be25-a656b023729b@suse.de> (raw)
In-Reply-To: <d5b0e39b-1acf-49d5-82c5-2701dc15e614@suse.de>

On 9/14/26 9:31 AM, Tom de Vries wrote:
> On 9/11/26 8:26 PM, Tom Tromey wrote:
>>>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
>>
>> Tom> -  /* Find the section that ADDR is in, and look for the start of 
>> the
>> Tom> -     section.  */
>> Tom> -  struct obj_section *section = find_pc_section (addr);
>> Tom> +  /* Find the first section with start address before ADDR, and 
>> use its start
>> Tom> +     address.  The found section may be the one containing ADDR, 
>> or the one
>> Tom> +     before it.  */
>> Tom> +  struct obj_section *section;
>> Tom> +  for (int offset = 0; offset <= 1; ++offset)
>> Tom> +    {
>> Tom> +      section = find_pc_section (addr - offset);
>> Tom> +      if (offset == 0 && section != nullptr && section->addr () 
>> == addr)
>> Tom> +    {
>> Tom> +      /* If ADDR is the start of its section, use ADDR - 1.  */
>> Tom> +      continue;
>> Tom> +    }
>> Tom> +
>> Tom> +      break;
>> Tom> +    }
>>
>> I was puzzling about this.  It seems like it would be ok to always check
>> "addr-1" here?  Since if addr is not at the start of the section, it
>> will return that same section.  And if addr is at the start of the
>> section, then that's the answer you want?
>>
> 
> Thanks for that observation, that greatly simplifies things.
> 

I've pushed this, with a test-case added  ( 
https://sourceware.org/pipermail/gdb-patches/2026-September/230469.html ).

Thanks,
- Tom

> Thanks,
> - Tom
> 
>> Tom
> 


  reply	other threads:[~2026-09-19 16:01 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-09  9:48 [PATCH v2 0/7] [gdb/tui] Some section hole handling fixes Tom de Vries
2026-09-09  9:48 ` [PATCH v2 1/7] [gdb/tui] Improve tui_disassemble comment Tom de Vries
2026-09-09  9:48 ` [PATCH v2 2/7] [gdb/tui] Fix underflow in tui_find_backward_disassembly_start_address Tom de Vries
2026-09-11 18:12   ` Tom Tromey
2026-09-11 18:14     ` Tom Tromey
2026-09-09  9:48 ` [PATCH v2 3/7] [gdb/tui] Improve section handling " Tom de Vries
2026-09-11 18:26   ` Tom Tromey
2026-09-14  7:31     ` Tom de Vries
2026-09-19 16:01       ` Tom de Vries [this message]
2026-09-09  9:48 ` [PATCH v2 4/7] [gdb] replace bsearch with std::lower_bound in find_pc_section Tom de Vries
2026-09-11 18:19   ` Tom Tromey
2026-09-14  7:34     ` Tom de Vries
2026-09-09  9:48 ` [PATCH v2 5/7] [gdb] Add prev/next params to find_pc_section Tom de Vries
2026-09-11 18:40   ` Tom Tromey
2026-09-09  9:48 ` [PATCH v2 6/7] [gdb/tui] Handle section holes when forward disassembling Tom de Vries
2026-09-11 18:39   ` Tom Tromey
2026-09-21 21:29     ` Tom de Vries
2026-09-23 15:51       ` Tom Tromey
2026-09-09  9:48 ` [PATCH v2 7/7] [gdb/tui] Handle section holes when backward disassembling Tom de Vries
2026-09-11 18:48   ` Tom Tromey
2026-09-19 21:45   ` Tom de Vries
2026-09-11 18:52 ` [PATCH v2 0/7] [gdb/tui] Some section hole handling fixes Tom Tromey

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=bd6cfd11-56b2-4749-be25-a656b023729b@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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