From 6ce6d90f6aef5f229c0356d49271bf56283a50f5 Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Sat, 11 Oct 2003 12:52:30 +0000 Subject: [PATCH] * gdbarch.sh (regset_from_core_section): New method. (struct regset): Declare opaque. * gdbarch.c, gdbarch.h: Regenerated. --- gdb/ChangeLog | 6 ++++++ gdb/gdbarch.c | 33 +++++++++++++++++++++++++++++++++ gdb/gdbarch.h | 10 ++++++++++ gdb/gdbarch.sh | 5 +++++ 4 files changed, 54 insertions(+) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 00470161cd..d0f37ea9f6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2003-10-11 Mark Kettenis + + * gdbarch.sh (regset_from_core_section): New method. + (struct regset): Declare opaque. + * gdbarch.c, gdbarch.h: Regenerated. + 2003-10-11 Alan Modra * hppa-tdep.c (hppa_in_solib_call_trampoline): Don't refer directly to diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 2844918099..d5aa595a9b 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -267,6 +267,7 @@ struct gdbarch gdbarch_address_class_name_to_type_flags_ftype *address_class_name_to_type_flags; 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; }; @@ -436,6 +437,7 @@ struct gdbarch startup_gdbarch = 0, /* address_class_name_to_type_flags */ default_register_reggroup_p, /* register_reggroup_p */ 0, /* fetch_pointer_argument */ + 0, /* regset_from_core_section */ /* startup_gdbarch() */ }; @@ -765,6 +767,7 @@ verify_gdbarch (struct gdbarch *gdbarch) /* Skip verify of address_class_name_to_type_flags, has predicate */ /* 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 */ buf = ui_file_xstrdup (log, &dummy); make_cleanup (xfree, buf); if (strlen (buf) > 0) @@ -795,6 +798,12 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: frame_align = 0x%08lx\n", (long) current_gdbarch->frame_align); + fprintf_unfiltered (file, + "gdbarch_dump: gdbarch_regset_from_core_section_p() = %d\n", + gdbarch_regset_from_core_section_p (current_gdbarch)); + fprintf_unfiltered (file, + "gdbarch_dump: regset_from_core_section = 0x%08lx\n", + (long) current_gdbarch->regset_from_core_section); fprintf_unfiltered (file, "gdbarch_dump: in_function_epilogue_p = 0x%08lx\n", (long) current_gdbarch->in_function_epilogue_p); @@ -5474,6 +5483,30 @@ set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch->fetch_pointer_argument = fetch_pointer_argument; } +int +gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch) +{ + gdb_assert (gdbarch != NULL); + return gdbarch->regset_from_core_section != NULL; +} + +const struct regset * +gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size) +{ + gdb_assert (gdbarch != NULL); + gdb_assert (gdbarch->regset_from_core_section != NULL); + if (gdbarch_debug >= 2) + fprintf_unfiltered (gdb_stdlog, "gdbarch_regset_from_core_section called\n"); + return gdbarch->regset_from_core_section (gdbarch, sect_name, sect_size); +} + +void +set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, + gdbarch_regset_from_core_section_ftype regset_from_core_section) +{ + gdbarch->regset_from_core_section = regset_from_core_section; +} + /* Keep a registry of per-architecture data-pointers required by GDB modules. */ diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 0e480a0837..3f8ee0da96 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -43,6 +43,7 @@ struct objfile; struct minimal_symbol; struct regcache; struct reggroup; +struct regset; struct disassemble_info; extern struct gdbarch *current_gdbarch; @@ -2365,6 +2366,15 @@ extern void set_gdbarch_fetch_pointer_argument (struct gdbarch *gdbarch, gdbarch #define FETCH_POINTER_ARGUMENT(frame, argi, type) (gdbarch_fetch_pointer_argument (current_gdbarch, frame, argi, type)) #endif +/* Return the appropriate register set for a core file section with + name SECT_NAME and size SECT_SIZE. */ + +extern int gdbarch_regset_from_core_section_p (struct gdbarch *gdbarch); + +typedef const struct regset * (gdbarch_regset_from_core_section_ftype) (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size); +extern const struct regset * gdbarch_regset_from_core_section (struct gdbarch *gdbarch, const char *sect_name, size_t sect_size); +extern void set_gdbarch_regset_from_core_section (struct gdbarch *gdbarch, gdbarch_regset_from_core_section_ftype *regset_from_core_section); + extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 640c3e44c0..ccfde347b5 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -747,6 +747,10 @@ M:2:ADDRESS_CLASS_NAME_TO_TYPE_FLAGS:int:address_class_name_to_type_flags:const m:::int:register_reggroup_p:int regnum, struct reggroup *reggroup:regnum, reggroup:::default_register_reggroup_p::0 # Fetch the pointer to the ith function argument. F::FETCH_POINTER_ARGUMENT:CORE_ADDR:fetch_pointer_argument:struct frame_info *frame, int argi, struct type *type:frame, argi, type + +# Return the appropriate register set for a core file section with +# name SECT_NAME and size SECT_SIZE. +M:::const struct regset *:regset_from_core_section:const char *sect_name, size_t sect_size:sect_name, sect_size EOF } @@ -851,6 +855,7 @@ struct objfile; struct minimal_symbol; struct regcache; struct reggroup; +struct regset; struct disassemble_info; extern struct gdbarch *current_gdbarch; -- 2.34.1