From 959b87241d85b42da82c45ecc4bc904895092730 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Mon, 16 Feb 2009 03:16:24 +0000 Subject: * corelow.c (core_close): Don't hardcode the core's pid. (core_open): Find core threads before calling post_create_inferior. (add_to_thread_list, get_core_register_section): Take into account systems where the regset section names encode the pid of the inferior. * gdbarch.sh (core_reg_section_encodes_pid): New gdbarch setting. * gdbarch.h, gdbarch.c: Regenerate. * amd64-sol2-tdep.c (amd64_sol2_init_abi): Set it. * i386-sol2-tdep.c (i386_sol2_init_abi): Set it. * sparc-sol2-tdep.c (sparc32_sol2_init_abi): Set it. * sparc64-sol2-tdep.c (sparc64_sol2_init_abi): Set it. --- gdb/gdbarch.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gdb/gdbarch.c') diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index b8e8258..1b4a6f4 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -223,6 +223,7 @@ struct gdbarch gdbarch_register_reggroup_p_ftype *register_reggroup_p; gdbarch_fetch_pointer_argument_ftype *fetch_pointer_argument; gdbarch_regset_from_core_section_ftype *regset_from_core_section; + int core_reg_section_encodes_pid; struct core_regset_section * core_regset_sections; gdbarch_core_xfer_shared_libraries_ftype *core_xfer_shared_libraries; int vtable_function_descriptors; @@ -356,6 +357,7 @@ struct gdbarch startup_gdbarch = default_register_reggroup_p, /* register_reggroup_p */ 0, /* fetch_pointer_argument */ 0, /* regset_from_core_section */ + 0, /* core_reg_section_encodes_pid */ 0, /* core_regset_sections */ 0, /* core_xfer_shared_libraries */ 0, /* vtable_function_descriptors */ @@ -609,6 +611,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 core_reg_section_encodes_pid, invalid_p == 0 */ /* Skip verify of core_xfer_shared_libraries, has predicate */ /* Skip verify of vtable_function_descriptors, invalid_p == 0 */ /* Skip verify of vbit_in_delta, invalid_p == 0 */ @@ -736,6 +739,9 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) "gdbarch_dump: core_read_description = <%s>\n", host_address_to_string (gdbarch->core_read_description)); fprintf_unfiltered (file, + "gdbarch_dump: core_reg_section_encodes_pid = %s\n", + plongest (gdbarch->core_reg_section_encodes_pid)); + fprintf_unfiltered (file, "gdbarch_dump: core_regset_sections = %s\n", host_address_to_string (gdbarch->core_regset_sections)); fprintf_unfiltered (file, @@ -2899,6 +2905,23 @@ set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch->regset_from_core_section = regset_from_core_section; } +int +gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + /* Skip verify of core_reg_section_encodes_pid, invalid_p == 0 */ + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_core_reg_section_encodes_pid called\n"); + return gdbarch->core_reg_section_encodes_pid; +} + +void +set_gdbarch_core_reg_section_encodes_pid (struct gdbarch *gdbarch, + int core_reg_section_encodes_pid) +{ + gdbarch->core_reg_section_encodes_pid = core_reg_section_encodes_pid; +} + struct core_regset_section * gdbarch_core_regset_sections (struct gdbarch *gdbarch) { -- cgit v1.1