From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v4 05/11] [gdb] Factor out update_section_map
Date: Wed, 7 Oct 2026 11:40:51 +0200 [thread overview]
Message-ID: <20261007094057.1811886-6-tdevries@suse.de> (raw)
In-Reply-To: <20261007094057.1811886-1-tdevries@suse.de>
Factor out update_section_map out of find_pc_section.
---
gdb/objfiles.c | 35 +++++++++++++++++++++++------------
1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index edaf7a10d86..453397c4f43 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -927,25 +927,18 @@ bsearch_cmp (const void *key, const void *elt)
return 1;
}
-/* Returns a section whose range includes PC or NULL if none found. */
+/* Update the section map for PSPACE. */
-struct obj_section *
-find_pc_section (CORE_ADDR pc)
+static void
+update_section_map (struct program_space *pspace)
{
- struct objfile_pspace_info *pspace_info;
- struct obj_section *s, **sp;
+ struct objfile_pspace_info *pspace_info = get_objfile_pspace_data (pspace);
- /* Check for mapped overlay section first. */
- s = find_pc_mapped_section (pc);
- if (s)
- return s;
-
- pspace_info = get_objfile_pspace_data (current_program_space);
if (pspace_info->section_map_dirty
|| (pspace_info->new_objfiles_available
&& !pspace_info->inhibit_updates))
{
- update_section_map (current_program_space,
+ update_section_map (pspace,
&pspace_info->sections,
&pspace_info->num_sections);
@@ -954,6 +947,24 @@ find_pc_section (CORE_ADDR pc)
pspace_info->new_objfiles_available = 0;
pspace_info->section_map_dirty = 0;
}
+}
+
+/* Returns a section whose range includes PC or NULL if none found. */
+
+struct obj_section *
+find_pc_section (CORE_ADDR pc)
+{
+ struct obj_section *s, **sp;
+
+ /* Check for mapped overlay section first. */
+ s = find_pc_mapped_section (pc);
+ if (s)
+ return s;
+
+ update_section_map (current_program_space);
+
+ struct objfile_pspace_info *pspace_info
+ = get_objfile_pspace_data (current_program_space);
/* The C standard (ISO/IEC 9899:TC2) requires the BASE argument to
bsearch be non-NULL. */
--
2.51.0
next prev parent reply other threads:[~2026-10-07 9:45 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 9:40 [PATCH v4 00/11] [gdb/tui] Some section hole handling fixes Tom de Vries
2026-10-07 9:40 ` [PATCH v4 01/11] [gdb/tui] Use early exit in tui_find_disassembly_address Tom de Vries
2026-10-07 9:40 ` [PATCH v4 02/11] [gdb/tui] Make low_prev loop-local " Tom de Vries
2026-10-07 9:40 ` [PATCH v4 03/11] [gdb/tui] Disassemble less often " Tom de Vries
2026-10-07 9:40 ` [PATCH v4 04/11] [gdb/tui] Fix buglet " Tom de Vries
2026-10-07 9:40 ` Tom de Vries [this message]
2026-10-07 9:40 ` [PATCH v4 06/11] [gdb] Add section_addrmap Tom de Vries
2026-10-07 9:40 ` [PATCH v4 07/11] [gdb] Extend addrmap::find with low/high results Tom de Vries
2026-10-07 9:40 ` [PATCH v4 08/11] [gdb] Make gdb_disassembly return number of insns Tom de Vries
2026-10-07 9:40 ` [PATCH v4 09/11] [gdb] Handle sections when disassembling Tom de Vries
2026-10-07 9:40 ` [PATCH v4 10/11] [gdb] Don't stop disassembly at section hole Tom de Vries
2026-10-07 9:40 ` [PATCH v4 11/11] [RFC, gdb/tui] Don't scroll into non-code sections Tom de Vries
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=20261007094057.1811886-6-tdevries@suse.de \
--to=tdevries@suse.de \
--cc=gdb-patches@sourceware.org \
/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