diff options
author | Ulrich Weigand <uweigand@de.ibm.com> | 2012-01-20 09:56:56 +0000 |
---|---|---|
committer | Ulrich Weigand <uweigand@de.ibm.com> | 2012-01-20 09:56:56 +0000 |
commit | 6432734d1ddb783a4f7ed377dfe5920013ee9872 (patch) | |
tree | 788eb35fda8ae21ba5caafe36331cff96d2e7ca9 /gdb/gcore.c | |
parent | 1f20dca58b3deb69b2d65df5075f3288c366f93f (diff) |
* gdbarch.sh (make_corefile_notes): New architecture callback.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* gcore.c (write_gcore_file): Try gdbarch_make_corefile_notes
before target_make_corefile_notes. If NULL is returned, the
target does not support core file generation.
* linux-nat.c: Include "linux-tdep.h".
(find_signalled_thread, find_stop_signal): Remove.
(linux_nat_do_thread_registers): Likewise.
(struct linux_nat_corefile_thread_data): Likewise.
(linux_nat_corefile_thread_callback): Likewise.
(iterate_over_spus): Likewise.
(struct linux_spu_corefile_data): Likewise.
(linux_spu_corefile_callback): Likewise.
(linux_spu_make_corefile_notes): Likewise.
(linux_nat_collect_thread_registers): New function.
(linux_nat_make_corefile_notes): Replace contents by call to
linux_make_corefile_notes passing linux_nat_collect_thread_registers
as native-only callback.
* linux-tdep.h: Include "bfd.h".
(struct regcache): Add forward declaration.
(linux_collect_thread_registers_ftype): New typedef.
(linux_make_corefile_notes): Add prototype.
* linux-tdep.c: Include "gdbthread.h", "gdbcore.h", "regcache.h",
"regset.h", and "elf-bfd.h".
(find_signalled_thread, find_stop_signal): New functions.
(linux_spu_make_corefile_notes): Likewise.
(linux_collect_thread_registers): Likewise.
(struct linux_corefile_thread_data): New data structure.
(linux_corefile_thread_callback): New funcion.
(linux_make_corefile_notes): Likewise.
(linux_make_corefile_notes_1): Likewise.
(linux_init_abi): Install it.
Diffstat (limited to 'gdb/gcore.c')
-rw-r--r-- | gdb/gcore.c | 44 |
1 files changed, 23 insertions, 21 deletions
diff --git a/gdb/gcore.c b/gdb/gcore.c index f9e7590f90..2a769d3b49 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -71,35 +71,37 @@ write_gcore_file (bfd *obfd) asection *note_sec = NULL; /* An external target method must build the notes section. */ - note_data = target_make_corefile_notes (obfd, ¬e_size); + /* FIXME: uweigand/2011-10-06: All architectures that support core file + generation should be converted to gdbarch_make_corefile_notes; at that + point, the target vector method can be removed. */ + if (!gdbarch_make_corefile_notes_p (target_gdbarch)) + note_data = target_make_corefile_notes (obfd, ¬e_size); + else + note_data = gdbarch_make_corefile_notes (target_gdbarch, obfd, ¬e_size); - /* Create the note section. */ - if (note_data != NULL && note_size != 0) - { - note_sec = bfd_make_section_anyway_with_flags (obfd, "note0", - SEC_HAS_CONTENTS - | SEC_READONLY - | SEC_ALLOC); - if (note_sec == NULL) - error (_("Failed to create 'note' section for corefile: %s"), - bfd_errmsg (bfd_get_error ())); + if (note_data == NULL || note_size == 0) + error (_("Target does not support core file generation.")); - bfd_set_section_vma (obfd, note_sec, 0); - bfd_set_section_alignment (obfd, note_sec, 0); - bfd_set_section_size (obfd, note_sec, note_size); - } + /* Create the note section. */ + note_sec = bfd_make_section_anyway_with_flags (obfd, "note0", + SEC_HAS_CONTENTS + | SEC_READONLY + | SEC_ALLOC); + if (note_sec == NULL) + error (_("Failed to create 'note' section for corefile: %s"), + bfd_errmsg (bfd_get_error ())); + + bfd_set_section_vma (obfd, note_sec, 0); + bfd_set_section_alignment (obfd, note_sec, 0); + bfd_set_section_size (obfd, note_sec, note_size); /* Now create the memory/load sections. */ if (gcore_memory_sections (obfd) == 0) error (_("gcore: failed to get corefile memory sections from target.")); /* Write out the contents of the note section. */ - if (note_data != NULL && note_size != 0) - { - if (!bfd_set_section_contents (obfd, note_sec, note_data, 0, note_size)) - warning (_("writing note section (%s)"), - bfd_errmsg (bfd_get_error ())); - } + if (!bfd_set_section_contents (obfd, note_sec, note_data, 0, note_size)) + warning (_("writing note section (%s)"), bfd_errmsg (bfd_get_error ())); } static void |