bfd: add elfcore_write_file_note

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.
This commit is contained in:
Mihails Strasuns 2020-12-16 20:36:15 +01:00
parent c3ffb8f340
commit 4cb1265b3f
5 changed files with 23 additions and 5 deletions

View 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].

View 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.

View File

@ -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)

View 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.

View 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)));
}
}