aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbarch.c
diff options
context:
space:
mode:
authorUlrich Weigand <uweigand@de.ibm.com>2012-01-20 09:56:56 +0000
committerUlrich Weigand <uweigand@de.ibm.com>2012-01-20 09:56:56 +0000
commit6432734d1ddb783a4f7ed377dfe5920013ee9872 (patch)
tree788eb35fda8ae21ba5caafe36331cff96d2e7ca9 /gdb/gdbarch.c
parent1f20dca58b3deb69b2d65df5075f3288c366f93f (diff)
downloadgdb-6432734d1ddb783a4f7ed377dfe5920013ee9872.zip
gdb-6432734d1ddb783a4f7ed377dfe5920013ee9872.tar.gz
gdb-6432734d1ddb783a4f7ed377dfe5920013ee9872.tar.bz2
* 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/gdbarch.c')
-rw-r--r--gdb/gdbarch.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c
index 2dbdda9..7a1db10 100644
--- a/gdb/gdbarch.c
+++ b/gdb/gdbarch.c
@@ -239,6 +239,7 @@ struct gdbarch
gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument;
gdbarch_regset_from_core_section_ftype *regset_from_core_section;
struct core_regset_section * core_regset_sections;
+ gdbarch_make_corefile_notes_ftype *make_corefile_notes;
gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries;
gdbarch_core_pid_to_str_ftype *core_pid_to_str;
const char * gcore_bfd_target;
@@ -395,6 +396,7 @@ struct gdbarch startup_gdbarch =
0, /* fetch_pointer_argument */
0, /* regset_from_core_section */
0, /* core_regset_sections */
+ 0, /* make_corefile_notes */
0, /* core_xfer_shared_libraries */
0, /* core_pid_to_str */
0, /* gcore_bfd_target */
@@ -683,6 +685,7 @@ verify_gdbarch (struct gdbarch *gdbarch)
/* Skip verify of register_reggroup_p, invalid_p == 0 */
/* Skip verify of fetch_pointer_argument, has predicate. */
/* Skip verify of regset_from_core_section, has predicate. */
+ /* Skip verify of make_corefile_notes, has predicate. */
/* Skip verify of core_xfer_shared_libraries, has predicate. */
/* Skip verify of core_pid_to_str, has predicate. */
/* Skip verify of gcore_bfd_target, has predicate. */
@@ -1039,6 +1042,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file)
"gdbarch_dump: long_long_bit = %s\n",
plongest (gdbarch->long_long_bit));
fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_make_corefile_notes_p() = %d\n",
+ gdbarch_make_corefile_notes_p (gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: make_corefile_notes = <%s>\n",
+ host_address_to_string (gdbarch->make_corefile_notes));
+ fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_max_insn_length_p() = %d\n",
gdbarch_max_insn_length_p (gdbarch));
fprintf_unfiltered (file,
@@ -3245,6 +3254,30 @@ set_gdbarch_core_regset_sections (struct gdbarch *gdbarch,
}
int
+gdbarch_make_corefile_notes_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->make_corefile_notes != NULL;
+}
+
+char *
+gdbarch_make_corefile_notes (struct gdbarch *gdbarch, bfd *obfd, int *note_size)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->make_corefile_notes != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_make_corefile_notes called\n");
+ return gdbarch->make_corefile_notes (gdbarch, obfd, note_size);
+}
+
+void
+set_gdbarch_make_corefile_notes (struct gdbarch *gdbarch,
+ gdbarch_make_corefile_notes_ftype make_corefile_notes)
+{
+ gdbarch->make_corefile_notes = make_corefile_notes;
+}
+
+int
gdbarch_core_xfer_shared_libraries_p (struct gdbarch *gdbarch)
{
gdb_assert (gdbarch != NULL);