From: simon.marchi@polymtl.ca
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simon.marchi@polymtl.ca>
Subject: [PATCH 1/5] gdb/linux-tdep: check return value of linux_find_memory_region_ftype callback
Date: Tue, 10 Mar 2026 13:30:32 -0400 [thread overview]
Message-ID: <20260310173104.676640-1-simon.marchi@polymtl.ca> (raw)
From: Simon Marchi <simon.marchi@polymtl.ca>
I noticed that linux_find_memory_regions_full did not check the return
value of the linux_find_memory_region_ftype callback. I think this is a
mistake. When called from linux_find_memory_regions, the
find_memory_region_ftype callback could return false, in which case we
should stop iterating.
This probably didn't matter in practice, as these callbacks generally
don't return false (only in error cases that never happen).
Change-Id: Iafc5a9aae3d955454420d700a23f18de6f0bc267
---
gdb/linux-tdep.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 495dd0680384..53ee6d9579cc 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1637,15 +1637,12 @@ linux_find_memory_regions_full (struct gdbarch *gdbarch,
for (const struct smaps_data &map : smaps)
{
/* Invoke the callback function to create the corefile segment. */
- if (should_dump_mapping_p (filterflags, map))
- {
- func (map.start_address, map.end_address - map.start_address,
- map.offset, map.read, map.write, map.exec,
- true, /* MODIFIED is true because we want to dump
- the mapping. */
- map.vmflags.memory_tagging != 0,
- map.filename, obfd);
- }
+ if (should_dump_mapping_p (filterflags, map)
+ && !func (map.start_address, map.end_address - map.start_address,
+ map.offset, map.read, map.write, map.exec,
+ /* MODIFIED is true because we want to dump the mapping. */
+ true, map.vmflags.memory_tagging != 0, map.filename, obfd))
+ return false;
}
return true;
base-commit: 1add703e09f0f8d073cde4af9d11cd59996e9763
--
2.53.0
next reply other threads:[~2026-03-10 17:32 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-10 17:30 simon.marchi [this message]
2026-03-10 17:30 ` [PATCH 2/5] gdb/gcore: check return values of some find_memory_region_ftype calls simon.marchi
2026-03-13 18:21 ` Tom Tromey
2026-03-10 17:30 ` [PATCH 3/5] gdb/linux-tdep: make linux_find_memory_region_ftype a function_view simon.marchi
2026-03-13 18:25 ` Tom Tromey
2026-03-10 17:30 ` [PATCH 4/5] gdb/linux-tdep: remove linux_collect_thread_registers_ftype typedef simon.marchi
2026-03-13 18:25 ` Tom Tromey
2026-03-14 18:43 ` Simon Marchi
2026-03-10 17:30 ` [PATCH 5/5] gdb: make find_memory_region_ftype a function_view simon.marchi
2026-03-13 18:46 ` Tom Tromey
2026-03-14 18:48 ` Simon Marchi
2026-03-14 19:06 ` [PATCH v2] " simon.marchi
2026-03-19 13:57 ` Tom Tromey
2026-03-19 14:08 ` Simon Marchi
2026-03-13 18:21 ` [PATCH 1/5] gdb/linux-tdep: check return value of linux_find_memory_region_ftype callback 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=20260310173104.676640-1-simon.marchi@polymtl.ca \
--to=simon.marchi@polymtl.ca \
--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