]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: remove 'num' argument from gdbarch_read_core_file_mappings callback
authorAndrew Burgess <aburgess@redhat.com>
Tue, 10 Mar 2026 16:20:46 +0000 (16:20 +0000)
committerAndrew Burgess <aburgess@redhat.com>
Fri, 1 May 2026 18:56:56 +0000 (19:56 +0100)
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 <keiths@redhat.com>
gdb/corelow.c
gdb/gdbarch.h
gdb/linux-tdep.c

index d2e352fd5c1f1d82aee038ba898f90f2aeac52e0..e8e3e85e0c91ac4381dbc61104fe45af0fdac436 100644 (file)
@@ -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
index b0b17afc6af9a3d2302690416dda51bd601d2873..f5ee3074c38266c456b18c1d9d8c38c669e6abe9 100644 (file)
@@ -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,
index 6cf8d267817dc7e2facde1bd50d283351f23faf8..508f9f88457150f88fc7f056831b58bc36ef778a 100644 (file)
@@ -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);