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.
This commit is contained in:
parent
6e5eab33ab
commit
382b69bbb7
6 changed files with 92 additions and 24 deletions
|
@ -1127,6 +1127,26 @@ linux_core_info_proc (struct gdbarch *gdbarch, const char *args,
|
|||
error (_("unable to handle request"));
|
||||
}
|
||||
|
||||
/* Read siginfo data from the core, if possible. Returns -1 on
|
||||
failure. Otherwise, returns the number of bytes read. READBUF,
|
||||
OFFSET, and LEN are all as specified by the to_xfer_partial
|
||||
interface. */
|
||||
|
||||
static LONGEST
|
||||
linux_core_xfer_siginfo (struct gdbarch *gdbarch, gdb_byte *readbuf,
|
||||
ULONGEST offset, ULONGEST len)
|
||||
{
|
||||
thread_section_name section_name (".note.linuxcore.siginfo", inferior_ptid);
|
||||
asection *section = bfd_get_section_by_name (core_bfd, section_name.c_str ());
|
||||
if (section == NULL)
|
||||
return -1;
|
||||
|
||||
if (!bfd_get_section_contents (core_bfd, section, readbuf, offset, len))
|
||||
return -1;
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
typedef int linux_find_memory_region_ftype (ULONGEST vaddr, ULONGEST size,
|
||||
ULONGEST offset, ULONGEST inode,
|
||||
int read, int write,
|
||||
|
@ -2516,6 +2536,7 @@ linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||
set_gdbarch_core_pid_to_str (gdbarch, linux_core_pid_to_str);
|
||||
set_gdbarch_info_proc (gdbarch, linux_info_proc);
|
||||
set_gdbarch_core_info_proc (gdbarch, linux_core_info_proc);
|
||||
set_gdbarch_core_xfer_siginfo (gdbarch, linux_core_xfer_siginfo);
|
||||
set_gdbarch_find_memory_regions (gdbarch, linux_find_memory_regions);
|
||||
set_gdbarch_make_corefile_notes (gdbarch, linux_make_corefile_notes);
|
||||
set_gdbarch_has_shared_address_space (gdbarch,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue