Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Andrew Burgess <aburgess@redhat.com>
To: gdb-patches@sourceware.org
Cc: Andrew Burgess <aburgess@redhat.com>
Subject: [PATCH 3/5] gdb: remove 'num' argument from gdbarch_read_core_file_mappings callback
Date: Sat, 14 Mar 2026 14:32:20 +0000	[thread overview]
Message-ID: <8963a8b9c1b15ee1d4d138323ede9242d5341b84.1773498341.git.aburgess@redhat.com> (raw)
In-Reply-To: <cover.1773498341.git.aburgess@redhat.com>

The gdbarch_read_core_file_mappings method takes two callback
functions.  The second of these, the loop_cb takes a 'num' parameter
that is never used.  It's not entirely clear what this 'num'
represents, and in later commits I'm going to be tweaking what gets
sent through this callback, and it's not clear to me how 'num' should
be changed.

So let's just remove the 'num' argument, this will make the later
commits easier.
---
 gdb/corelow.c    | 2 +-
 gdb/gdbarch.h    | 3 +--
 gdb/linux-tdep.c | 7 +++----
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/gdb/corelow.c b/gdb/corelow.c
index 84f44bc680e..e540e44474b 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -2138,7 +2138,7 @@ gdb_read_core_file_mappings (struct gdbarch *gdbarch, struct bfd *cbfd)
 
     /* read_core_file_mappings will invoke this lambda for each mapping
        that it finds.  */
-    [&] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
+    [&] (ULONGEST start, ULONGEST end, ULONGEST file_ofs,
 	 const char *filename, const bfd_build_id *build_id)
       {
 	/* Architecture-specific read_core_mapping methods are expected to
diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h
index fe59846b916..356aae0fee8 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -127,8 +127,7 @@ using read_core_file_mappings_pre_loop_ftype =
   gdb::function_view<void (ULONGEST count)>;
 
 using read_core_file_mappings_loop_ftype =
-  gdb::function_view<void (int num,
-			   ULONGEST start,
+  gdb::function_view<void (ULONGEST start,
 			   ULONGEST end,
 			   ULONGEST file_ofs,
 			   const char *filename,
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 2bf35a2fe00..45606015579 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1237,7 +1237,6 @@ linux_read_core_file_mappings
   /* Vector to collect proc mappings.  */
   struct proc_mapping
   {
-    int num;
     ULONGEST start;
     ULONGEST end;
     ULONGEST file_ofs;
@@ -1249,7 +1248,7 @@ linux_read_core_file_mappings
   /* Collect proc mappings.  */
   for (int i = 0; i < count; i++)
     {
-      struct proc_mapping m = { .num = i };
+      struct proc_mapping m;
       m.start = bfd_get (addr_size_bits, cbfd, descdata);
       descdata += addr_size;
       m.end = bfd_get (addr_size_bits, cbfd, descdata);
@@ -1278,7 +1277,7 @@ linux_read_core_file_mappings
   for (int i = 0; i < count; i++)
     {
       const auto &m = proc_mappings[i];
-      loop_cb (m.num, m.start, m.end, m.file_ofs, m.filename, m.build_id);
+      loop_cb (m.start, m.end, m.file_ofs, m.filename, m.build_id);
     }
 }
 
@@ -1303,7 +1302,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, struct bfd *cbfd,
 	current_uiout->table_header (0, ui_left, "objfile", "File");
 	current_uiout->table_body ();
       },
-    [=] (int num, ULONGEST start, ULONGEST end, ULONGEST file_ofs,
+    [=] (ULONGEST start, ULONGEST end, ULONGEST file_ofs,
 	 const char *filename, const bfd_build_id *build_id)
       {
 	ui_out_emit_tuple tuple_emitter (current_uiout, nullptr);
-- 
2.25.4


  parent reply	other threads:[~2026-03-14 14:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-14 14:32 [PATCH 0/5] Improved support for core files with missing NT_FILE note Andrew Burgess
2026-03-14 14:32 ` [PATCH 1/5] gdb/testsuite: improve corefile-no-threads.py script Andrew Burgess
2026-03-14 14:32 ` [PATCH 2/5] gdb/testsuite: restructure gdb.base/corefile-buildid.exp Andrew Burgess
2026-03-14 14:32 ` Andrew Burgess [this message]
2026-03-14 14:32 ` [PATCH 4/5] gdb: remove pre-loop callback from gdbarch_read_core_file_mappings Andrew Burgess
2026-03-14 14:32 ` [PATCH 5/5] gdb/linux: handle missing NT_FILE note when opening core files Andrew Burgess
2026-04-23 22:08   ` Keith Seitz
2026-05-01 19:09     ` Andrew Burgess
2026-04-23 22:06 ` [PATCH 0/5] Improved support for core files with missing NT_FILE note Keith Seitz

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=8963a8b9c1b15ee1d4d138323ede9242d5341b84.1773498341.git.aburgess@redhat.com \
    --to=aburgess@redhat.com \
    --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