diff options
Diffstat (limited to 'gdb/linux-tdep.c')
-rw-r--r-- | gdb/linux-tdep.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 1afa8d7..5c7f8a0 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -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, @@ -1506,16 +1526,12 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, char *note_data, int *note_size) { struct cleanup *cleanup; - struct obstack data_obstack, filename_obstack; struct linux_make_mappings_data mapping_data; struct type *long_type = arch_integer_type (gdbarch, gdbarch_long_bit (gdbarch), 0, "long"); gdb_byte buf[sizeof (ULONGEST)]; - obstack_init (&data_obstack); - cleanup = make_cleanup_obstack_free (&data_obstack); - obstack_init (&filename_obstack); - make_cleanup_obstack_free (&filename_obstack); + auto_obstack data_obstack, filename_obstack; mapping_data.file_count = 0; mapping_data.data_obstack = &data_obstack; @@ -1548,7 +1564,6 @@ linux_make_mappings_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, obstack_object_size (&data_obstack)); } - do_cleanups (cleanup); return note_data; } @@ -2521,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, |