Override the gdbarch make_corefile_notes method for the Linux x86
arches with a new function that calls linux_make_corefile_notes and
x86_elf_make_cpuid_note to generate the core dump notes.
---
gdb/amd64-linux-tdep.c | 1 +
gdb/i386-linux-tdep.c | 15 +++++++++++++++
gdb/i386-linux-tdep.h | 7 +++++++
3 files changed, 23 insertions(+)
@@ -1838,6 +1838,7 @@ amd64_linux_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch,
set_gdbarch_core_read_description (gdbarch,
amd64_linux_core_read_description);
+ set_gdbarch_make_corefile_notes (gdbarch, i386_linux_make_corefile_notes);
/* Displaced stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch,
@@ -38,6 +38,7 @@
#include "xml-syscall.h"
#include "infrun.h"
+#include "x86-tdep.h"
#include "i387-tdep.h"
#include "gdbsupport/x86-xstate.h"
@@ -827,6 +828,19 @@ i386_linux_displaced_step_copy_insn (struct gdbarch *gdbarch,
return closure_;
}
+/* See i386-linux-tdep.h. */
+
+gdb::unique_xmalloc_ptr<char>
+i386_linux_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd,
+ int *note_size)
+{
+ gdb::unique_xmalloc_ptr<char> note_data =
+ linux_make_corefile_notes (gdbarch, obfd, note_size);
+
+ x86_elf_make_cpuid_note (obfd, ¬e_data, note_size);
+ return note_data;
+}
+
static void
i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -1068,6 +1082,7 @@ i386_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
(gdbarch, i386_linux_iterate_over_regset_sections);
set_gdbarch_core_read_description (gdbarch,
i386_linux_core_read_description);
+ set_gdbarch_make_corefile_notes (gdbarch, i386_linux_make_corefile_notes);
/* Displaced stepping. */
set_gdbarch_displaced_step_copy_insn (gdbarch,
@@ -58,6 +58,13 @@ extern void i386_linux_report_signal_info (struct gdbarch *gdbarch,
/* Return the target description according to XCR0. */
extern const struct target_desc *i386_linux_read_description (uint64_t xcr0);
+/* Create appropriate note sections for a corefile, returning them in
+ allocated memory. Extends linux_make_corefile_notes to add a
+ NT_X86_CPUID note. */
+
+extern gdb::unique_xmalloc_ptr<char> i386_linux_make_corefile_notes
+(struct gdbarch *gdbarch, bfd *obfd, int *note_size);
+
/* Format of XSAVE extended state is:
struct
{