From 382b69bbb7a4fec5213d2382fe70a68d7a46b3e7 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Wed, 28 Jun 2017 11:11:20 -0700 Subject: Add a new gdbarch method to fetch signal information from core files. Previously the core_xfer_partial method used core_get_siginfo to handle TARGET_OBJECT_SIGNAL_INFO requests. However, core_get_siginfo looked for Linux-specific sections in the core file. To support fetching siginfo from cores on other systems, add a new gdbarch method (`core_xfer_siginfo`) and move the body of the existing core_get_siginfo into a linux_core_xfer_siginfo implementation of this method in linux-tdep.c. gdb/ChangeLog: * corelow.c (get_core_siginfo): Remove. (core_xfer_partial): Use the gdbarch "core_xfer_siginfo" method instead of get_core_siginfo. * gdbarch.sh (core_xfer_siginfo): New gdbarch callback. * gdbarch.h: Re-generate. * gdbarch.c: Re-generate. * linux-tdep.c (linux_core_xfer_siginfo): New. (linux_init_abi): Install gdbarch "core_xfer_siginfo" method. --- gdb/gdbarch.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index e5efdfb..24521b5 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -287,6 +287,7 @@ struct gdbarch gdbarch_core_xfer_shared_libraries_aix_ftype *core_xfer_shared_libraries_aix; gdbarch_core_pid_to_str_ftype *core_pid_to_str; gdbarch_core_thread_name_ftype *core_thread_name; + gdbarch_core_xfer_siginfo_ftype *core_xfer_siginfo; const char * gcore_bfd_target; int vtable_function_descriptors; int vbit_in_delta; @@ -646,6 +647,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of core_xfer_shared_libraries_aix, has predicate. */ /* Skip verify of core_pid_to_str, has predicate. */ /* Skip verify of core_thread_name, has predicate. */ + /* Skip verify of core_xfer_siginfo, has predicate. */ /* Skip verify of gcore_bfd_target, has predicate. */ /* Skip verify of vtable_function_descriptors, invalid_p == 0 */ /* Skip verify of vbit_in_delta, invalid_p == 0 */ @@ -884,6 +886,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: core_xfer_shared_libraries_aix = <%s>\n", host_address_to_string (gdbarch->core_xfer_shared_libraries_aix)); fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_core_xfer_siginfo_p() = %d\n", + gdbarch_core_xfer_siginfo_p (gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: core_xfer_siginfo = <%s>\n", + host_address_to_string (gdbarch->core_xfer_siginfo)); + fprintf_unfiltered (file, "gdbarch_dump: decr_pc_after_break = %s\n", core_addr_to_string_nz (gdbarch->decr_pc_after_break)); fprintf_unfiltered (file, @@ -3797,6 +3805,30 @@ set_gdbarch_core_thread_name (struct gdbarch *gdbarch, } int +gdbarch_core_xfer_siginfo_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->core_xfer_siginfo != NULL; +} + +LONGEST +gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->core_xfer_siginfo != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_core_xfer_siginfo called\n"); + return gdbarch->core_xfer_siginfo (gdbarch, readbuf, offset, len); +} + +void +set_gdbarch_core_xfer_siginfo (struct gdbarch *gdbarch, + gdbarch_core_xfer_siginfo_ftype core_xfer_siginfo) +{ + gdbarch->core_xfer_siginfo = core_xfer_siginfo; +} + +int gdbarch_gcore_bfd_target_p (struct gdbarch *gdbarch) { gdb_assert (gdbarch != NULL); -- cgit v1.1