[binutils-gdb] gdb: remove 'num' argument from gdbarch_read_core_file_mappings callback

Andrew Burgess via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=4e0330b0d12e28f022976e807925be644f816af7

commit 4e0330b0d12e28f022976e807925be644f816af7
Author: Andrew Burgess <[email protected]>
Date:   Tue Mar 10 16:20:46 2026 +0000

    gdb: remove 'num' argument from gdbarch_read_core_file_mappings callback
    
    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.
    
    Reviewed-By: Keith Seitz <[email protected]>

Diff:
---
 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 d2e352fd5c1..e8e3e85e0c9 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -2176,7 +2176,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 b0b17afc6af..f5ee3074c38 100644
--- a/gdb/gdbarch.h
+++ b/gdb/gdbarch.h
@@ -128,8 +128,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 6cf8d267817..508f9f88457 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1212,7 +1212,6 @@ linux_read_core_file_mappings
   /* Vector to collect proc mappings.  */
   struct proc_mapping
   {
-    int num;
     ULONGEST start;
     ULONGEST end;
     ULONGEST file_ofs;
@@ -1224,7 +1223,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);
@@ -1253,7 +1252,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);
     }
 }
 
@@ -1278,7 +1277,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);
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.