diff options
author | Tom Tromey <tromey@redhat.com> | 2012-11-08 21:16:43 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-11-08 21:16:43 +0000 |
commit | 9015683b1c9a8d301cd846fcc8bf73726310bd4f (patch) | |
tree | fd705128b6fdec9dbea260b3181dbceca9b8ee80 /gdb/corelow.c | |
parent | ea9f10bb87523d421e6c863a7ec66dfee41692b4 (diff) | |
download | gdb-9015683b1c9a8d301cd846fcc8bf73726310bd4f.zip gdb-9015683b1c9a8d301cd846fcc8bf73726310bd4f.tar.gz gdb-9015683b1c9a8d301cd846fcc8bf73726310bd4f.tar.bz2 |
gdb
* linux-tdep.c (linux_make_siginfo_note): New function.
(linux_make_corefile_notes): Use it.
* corelow.c (get_core_siginfo): New function.
(core_xfer_partial) <TARGET_OBJECT_SIGNAL_INFO>: New case.
gdb/testsuite
* gdb.base/siginfo-obj.exp: Create core file. Test siginfo from
core files, if possible.
* gdb.base/siginfo-thread.c: New file
* gdb.base/siginfo-thread.exp: New file
bfd
* elf.c (elfcore_grok_note) <NT_SIGINFO>: New case; make
pseudosection.
Diffstat (limited to 'gdb/corelow.c')
-rw-r--r-- | gdb/corelow.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c index 2080068..99611ba 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -656,6 +656,36 @@ add_to_spuid_list (bfd *abfd, asection *asect, void *list_p) list->pos += 4; } +/* Read siginfo data from the core, if possible. Returns -1 on + failure. Otherwise, returns the number of bytes read. ABFD is the + core file's BFD; READBUF, OFFSET, and LEN are all as specified by + the to_xfer_partial interface. */ + +static LONGEST +get_core_siginfo (bfd *abfd, gdb_byte *readbuf, ULONGEST offset, LONGEST len) +{ + asection *section; + long pid; + char *section_name; + const char *name = ".note.linuxcore.siginfo"; + + if (ptid_get_lwp (inferior_ptid)) + section_name = xstrprintf ("%s/%ld", name, + ptid_get_lwp (inferior_ptid)); + else + section_name = xstrdup (name); + + section = bfd_get_section_by_name (abfd, section_name); + xfree (section_name); + if (section == NULL) + return -1; + + if (!bfd_get_section_contents (abfd, section, readbuf, offset, len)) + return -1; + + return len; +} + static LONGEST core_xfer_partial (struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *readbuf, @@ -794,6 +824,11 @@ core_xfer_partial (struct target_ops *ops, enum target_object object, } return -1; + case TARGET_OBJECT_SIGNAL_INFO: + if (readbuf) + return get_core_siginfo (core_bfd, readbuf, offset, len); + return -1; + default: if (ops->beneath != NULL) return ops->beneath->to_xfer_partial (ops->beneath, object, |