bfd: add elfcore_write_file_note
authorMihails Strasuns <mihails.strasuns@intel.com>
Wed, 16 Dec 2020 19:36:15 +0000 (20:36 +0100)
committerMihails Strasuns <mihails.strasuns@intel.com>
Tue, 26 Jan 2021 12:22:35 +0000 (13:22 +0100)
Adds a trivial wrapper over elfcore_write_note, primarily to be more
consistent with other ELF note helper functions and highlight NT_FILE as
one of notes handled by gdb.

bfd/ChangeLog:
2020-12-17  Mihails Strasuns  <mihails.strasuns@intel.com>

* bfd-elf.h (elfcore_write_file_note): New function.
* elf.c (elfcore_write_file_note): New function.

gdb/ChangeLog:
2020-12-17  Mihails Strasuns  <mihails.strasuns@intel.com>

* linux-tdep.c (linux_make_mappings_corefile_notes): Start using
elfcore_write_file_note.

bfd/ChangeLog
bfd/elf-bfd.h
bfd/elf.c
gdb/ChangeLog
gdb/linux-tdep.c

index 96b9cdf2452361d42b9a913835e0acd435161fde..c8fcb3a684578d2c2cf29f2d9feeebb7667849dc 100644 (file)
@@ -1,3 +1,8 @@
+2020-12-17  Mihails Strasuns  <mihails.strasuns@intel.com>
+
+       * bfd-elf.h (elfcore_write_file_note): New function.
+       * elf.c (elfcore_write_file_note): New function.
+
 2021-01-26  Alan Modra  <amodra@gmail.com>
 
        * elf32-ft32.c (ft32_reloc_type_lookup): Don't miss ft32_reloc_map[0].
index 15206b4e876777b28560ce0fbeaf8364a0b9cd80..994f15e48cf07f12f6cbc56df574dabe4e1d0b45 100644 (file)
@@ -2801,6 +2801,8 @@ extern char *elfcore_write_lwpstatus
   (bfd *, char *, int *, long, int, const void *);
 extern char *elfcore_write_register_note
   (bfd *, char *, int *, const char *, const void *, int);
+extern char *elfcore_write_file_note
+  (bfd *, char *, int *, const void*, int);
 
 /* Internal structure which holds information to be included in the
    PRPSINFO section of Linux core files.
index 84a5d942817a9a54b1170fbbb594787c5839aa54..087f05e5cc8bdc5e792d79580349779bcf949e52 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -12038,6 +12038,14 @@ elfcore_write_register_note (bfd *abfd,
   return NULL;
 }
 
+char *
+elfcore_write_file_note (bfd *obfd, char *note_data, int *note_size,
+                        const void *buf, int bufsiz)
+{
+  return elfcore_write_note (obfd, note_data, note_size,
+                            "CORE", NT_FILE, buf, bufsiz);
+}
+
 static bfd_boolean
 elf_parse_notes (bfd *abfd, char *buf, size_t size, file_ptr offset,
                 size_t align)
index 0836eb36e6d175e72b3f5671668a3622fb8b8d3a..cbc75cc854f89a10358d4c560a1d83dca9a6adbe 100644 (file)
@@ -1,3 +1,8 @@
+2020-12-17  Mihails Strasuns  <mihails.strasuns@intel.com>
+
+       * linux-tdep.c (linux_make_mappings_corefile_notes): Start using
+       elfcore_write_file_note.
+
 2021-01-26  Shahab Vahedi  <shahab@synopsys.com>
 
        * arc-tdep.c (arc_add_reggroups): New function.
index 5b3b8874d11a0d4dd829894a77463365dd56c3f3..e9f8e1b61336ad4d4d4492680b0bd1878e9dfe78 100644 (file)
@@ -1591,11 +1591,9 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
       obstack_grow (&data_obstack, obstack_base (&filename_obstack),
                    size);
 
-      note_data.reset (elfcore_write_note
-                        (obfd, note_data.release (),
-                         note_size, "CORE", NT_FILE,
-                         obstack_base (&data_obstack),
-                         obstack_object_size (&data_obstack)));
+      note_data.reset (elfcore_write_file_note (obfd, note_data.release (), note_size,
+                                               obstack_base (&data_obstack),
+                                               obstack_object_size (&data_obstack)));
     }
 }