Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH 1/5] gdb/linux-tdep: check return value of linux_find_memory_region_ftype callback
@ 2026-03-10 17:30 simon.marchi
  2026-03-10 17:30 ` [PATCH 2/5] gdb/gcore: check return values of some find_memory_region_ftype calls simon.marchi
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: simon.marchi @ 2026-03-10 17:30 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2026-03-19 14:09 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-10 17:30 [PATCH 1/5] gdb/linux-tdep: check return value of linux_find_memory_region_ftype callback simon.marchi
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox