tdep->gregset_num_regs = ARRAY_SIZE (amd64_linux_gregset_reg_offset);
tdep->sizeof_gregset = 27 * 8;
+ /* x32's layout is not compatible with the 32-bit layout. */
+ set_gdbarch_elfcore_write_linux_prstatus
+ (gdbarch, gdb_deprecated_elfcore_write_linux_prstatus);
+
amd64_x32_init_abi (info, gdbarch);
/* Reserve a number for orig_rax. */
gdbarch_iterate_over_regset_sections_ftype *iterate_over_regset_sections;
gdbarch_make_corefile_notes_ftype *make_corefile_notes;
gdbarch_elfcore_write_linux_prpsinfo_ftype *elfcore_write_linux_prpsinfo;
+ gdbarch_elfcore_write_linux_prstatus_ftype *elfcore_write_linux_prstatus;
gdbarch_find_memory_regions_ftype *find_memory_regions;
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix;
/* Skip verify of iterate_over_regset_sections, has predicate. */
/* Skip verify of make_corefile_notes, has predicate. */
/* Skip verify of elfcore_write_linux_prpsinfo, has predicate. */
+ /* Skip verify of elfcore_write_linux_prstatus, has predicate. */
/* Skip verify of find_memory_regions, has predicate. */
/* Skip verify of core_xfer_shared_libraries, has predicate. */
/* Skip verify of core_xfer_shared_libraries_aix, has predicate. */
fprintf_unfiltered (file,
"gdbarch_dump: elfcore_write_linux_prpsinfo = <%s>\n",
host_address_to_string (gdbarch->elfcore_write_linux_prpsinfo));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_elfcore_write_linux_prstatus_p() = %d\n",
+ gdbarch_elfcore_write_linux_prstatus_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: elfcore_write_linux_prstatus = <%s>\n",
+ host_address_to_string (gdbarch->elfcore_write_linux_prstatus));
fprintf_unfiltered (file,
"gdbarch_dump: fast_tracepoint_valid_at = <%s>\n",
host_address_to_string (gdbarch->fast_tracepoint_valid_at));
gdbarch->elfcore_write_linux_prpsinfo = elfcore_write_linux_prpsinfo;
}
+int
+gdbarch_elfcore_write_linux_prstatus_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->elfcore_write_linux_prstatus != NULL;
+}
+
+char *
+gdbarch_elfcore_write_linux_prstatus (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prstatus *info)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->elfcore_write_linux_prstatus != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_elfcore_write_linux_prstatus called\n");
+ return gdbarch->elfcore_write_linux_prstatus (obfd, note_data, note_size, info);
+}
+
+void
+set_gdbarch_elfcore_write_linux_prstatus (struct gdbarch *gdbarch,
+ gdbarch_elfcore_write_linux_prstatus_ftype elfcore_write_linux_prstatus)
+{
+ gdbarch->elfcore_write_linux_prstatus = elfcore_write_linux_prstatus;
+}
+
int
gdbarch_find_memory_regions_p (struct gdbarch *gdbarch)
{
struct parser_state;
struct ravenscar_arch_ops;
struct elf_internal_linux_prpsinfo;
+struct elf_internal_linux_prstatus;
struct mem_range;
struct syscalls_info;
struct thread_info;
extern char * gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size);
extern void set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch, gdbarch_make_corefile_notes_ftype *make_corefile_notes);
-/* The elfcore writer hook to use to write Linux prpsinfo notes to core
- files. Most Linux architectures use the same prpsinfo32 or
- prpsinfo64 layouts, and so won't need to provide this hook, as we
- call the Linux generic routines in bfd to write prpsinfo notes by
+/* The elfcore writer hooks to use to write Linux notes to core files.
+ Most Linux architectures use the same prpsinfo{32,64} and
+ prstatus{32,64} layouts, and so won't need to provide these hooks,
+ as we call the Linux generic routines in bfd to write notes by
default. */
extern int gdbarch_elfcore_write_linux_prpsinfo_p (struct gdbarch *gdbarch);
extern char * gdbarch_elfcore_write_linux_prpsinfo (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info);
extern void set_gdbarch_elfcore_write_linux_prpsinfo (struct gdbarch *gdbarch, gdbarch_elfcore_write_linux_prpsinfo_ftype *elfcore_write_linux_prpsinfo);
+extern int gdbarch_elfcore_write_linux_prstatus_p (struct gdbarch *gdbarch);
+
+typedef char * (gdbarch_elfcore_write_linux_prstatus_ftype) (bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prstatus *info);
+extern char * gdbarch_elfcore_write_linux_prstatus (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prstatus *info);
+extern void set_gdbarch_elfcore_write_linux_prstatus (struct gdbarch *gdbarch, gdbarch_elfcore_write_linux_prstatus_ftype *elfcore_write_linux_prstatus);
+
/* Find core file memory regions */
extern int gdbarch_find_memory_regions_p (struct gdbarch *gdbarch);
# Create core file notes
M:char *:make_corefile_notes:bfd *obfd, int *note_size:obfd, note_size
-# The elfcore writer hook to use to write Linux prpsinfo notes to core
-# files. Most Linux architectures use the same prpsinfo32 or
-# prpsinfo64 layouts, and so won't need to provide this hook, as we
-# call the Linux generic routines in bfd to write prpsinfo notes by
+# The elfcore writer hooks to use to write Linux notes to core files.
+# Most Linux architectures use the same prpsinfo{32,64} and
+# prstatus{32,64} layouts, and so won't need to provide these hooks,
+# as we call the Linux generic routines in bfd to write notes by
# default.
F:char *:elfcore_write_linux_prpsinfo:bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prpsinfo *info:obfd, note_data, note_size, info
+F:char *:elfcore_write_linux_prstatus:bfd *obfd, char *note_data, int *note_size, const struct elf_internal_linux_prstatus *info:obfd, note_data, note_size, info
# Find core file memory regions
M:int:find_memory_regions:find_memory_region_ftype func, void *data:func, data
struct parser_state;
struct ravenscar_arch_ops;
struct elf_internal_linux_prpsinfo;
+struct elf_internal_linux_prstatus;
struct mem_range;
struct syscalls_info;
struct thread_info;
return note_data;
}
+/* See linux-tdep.h.
+
+ FIXME: This should be reimplemented on the BFD side along the lines
+ of elfcore_write_linux_prstatus{32,64}, instead of relying on
+ elfcore_write_prstatus. */
+
+char *
+gdb_deprecated_elfcore_write_linux_prstatus
+ (bfd *obfd, char *note_data, int *note_size,
+ const struct elf_internal_linux_prstatus *info)
+{
+ return elfcore_write_prstatus (obfd, note_data, note_size, info->pr_pid,
+ info->pr_cursig, info->pr_reg);
+}
+
/* Structure for passing information from
linux_collect_thread_registers via an iterator to
linux_collect_regset_section_cb. */
/* PRSTATUS still needs to be treated specially. */
if (strcmp (sect_name, ".reg") == 0)
- data->note_data = (char *) elfcore_write_prstatus
- (data->obfd, data->note_data, data->note_size, data->lwp,
- gdb_signal_to_host (data->stop_signal), buf);
+ {
+ struct elf_internal_linux_prstatus prstatus;
+
+ memset (&prstatus, 0, sizeof (prstatus));
+ prstatus.pr_reg = buf;
+ prstatus.pr_reg_size = size;
+ prstatus.pr_pid = data->lwp;
+ prstatus.pr_cursig = gdb_signal_to_host (data->stop_signal);
+ if (gdbarch_elfcore_write_linux_prstatus_p (data->gdbarch))
+ data->note_data = gdbarch_elfcore_write_linux_prstatus (data->gdbarch,
+ data->obfd,
+ data->note_data,
+ data->note_size,
+ &prstatus);
+ else if (gdbarch_ptr_bit (data->gdbarch) == 64)
+ data->note_data = elfcore_write_linux_prstatus64 (data->obfd,
+ data->note_data,
+ data->note_size,
+ &prstatus);
+ else
+ data->note_data = elfcore_write_linux_prstatus32 (data->obfd,
+ data->note_data,
+ data->note_size,
+ &prstatus);
+ }
else
data->note_data = (char *) elfcore_write_register_note
(data->obfd, data->note_data, data->note_size,
extern int linux_is_uclinux (void);
+/* Stop-gap gdbarch_elfcore_write_linux_prstatus implementation for
+ architectures whose prstatus{32,64} layout differs from the
+ standard one, and for which BFD doesn't provide a custom writer
+ yet. */
+extern char *gdb_deprecated_elfcore_write_linux_prstatus
+ (bfd *obfd, char *note_data, int *note_size,
+ const struct elf_internal_linux_prstatus *info);
+
#endif /* linux-tdep.h */
µmips_linux_n32_rt_sigframe);
tramp_frame_prepend_unwinder (gdbarch, &mips_linux_n32_rt_sigframe);
set_xml_syscall_file_name (gdbarch, "syscalls/mips-n32-linux.xml");
+
+ /* N32 uses a different prstatus compared to most other Linux
+ archs. */
+ set_gdbarch_elfcore_write_linux_prstatus
+ (gdbarch, gdb_deprecated_elfcore_write_linux_prstatus);
break;
case MIPS_ABI_N64:
set_gdbarch_get_longjmp_target (gdbarch,
tdep->fpregset = &sparc64_linux_fpregset;
tdep->sizeof_fpregset = 280;
+ /* Sparc64 uses a different prstatus compared to most other Linux
+ archs. */
+ set_gdbarch_elfcore_write_linux_prstatus
+ (gdbarch, gdb_deprecated_elfcore_write_linux_prstatus);
+
tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe);
/* Hook in the DWARF CFI frame unwinder. */