(struct obj_section): Add forward declaration.
* gdbarch.c, gdbarch.h: Regenerate.
* symfile.c (simple_overlay_update): Make global.
(target_overlay_update): Remove variable.
(overlay_is_mapped): Call gdbarch_overlay_update instead of
target_overlay_update.
(overlay_load_command): Likewise.
* symfile.h (struct obj_section): Add forward declaration.
(simple_overlay_update): Add prototype.
* m32r-tdep.c (m32r_gdbarch_init): Install simple_overlay_update.
+2007-05-11 Ulrich Weigand <uweigand@de.ibm.com>
+
+ * gdbarch.sh (overlay_update): New gdbarch function.
+ (struct obj_section): Add forward declaration.
+ * gdbarch.c, gdbarch.h: Regenerate.
+
+ * symfile.c (simple_overlay_update): Make global.
+ (target_overlay_update): Remove variable.
+ (overlay_is_mapped): Call gdbarch_overlay_update instead of
+ target_overlay_update.
+ (overlay_load_command): Likewise.
+ * symfile.h (struct obj_section): Add forward declaration.
+ (simple_overlay_update): Add prototype.
+
+ * m32r-tdep.c (m32r_gdbarch_init): Install simple_overlay_update.
+
2007-05-11 Ulrich Weigand <uweigand@de.ibm.com>
* observer.sh: Add "struct objfile" forward declaration.
int vtable_function_descriptors;
int vbit_in_delta;
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
+ gdbarch_overlay_update_ftype *overlay_update;
};
0, /* vtable_function_descriptors */
0, /* vbit_in_delta */
0, /* skip_permanent_breakpoint */
+ 0, /* overlay_update */
/* startup_gdbarch() */
};
/* Skip verify of vtable_function_descriptors, invalid_p == 0 */
/* Skip verify of vbit_in_delta, invalid_p == 0 */
/* Skip verify of skip_permanent_breakpoint, has predicate */
+ /* Skip verify of overlay_update, has predicate */
buf = ui_file_xstrdup (log, &dummy);
make_cleanup (xfree, buf);
if (strlen (buf) > 0)
fprintf_unfiltered (file,
"gdbarch_dump: osabi = %s\n",
paddr_d (current_gdbarch->osabi));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_overlay_update_p() = %d\n",
+ gdbarch_overlay_update_p (current_gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: overlay_update = <0x%lx>\n",
+ (long) current_gdbarch->overlay_update);
#ifdef PC_REGNUM
fprintf_unfiltered (file,
"gdbarch_dump: PC_REGNUM # %s\n",
gdbarch->skip_permanent_breakpoint = skip_permanent_breakpoint;
}
+int
+gdbarch_overlay_update_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->overlay_update != NULL;
+}
+
+void
+gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->overlay_update != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_overlay_update called\n");
+ gdbarch->overlay_update (osect);
+}
+
+void
+set_gdbarch_overlay_update (struct gdbarch *gdbarch,
+ gdbarch_overlay_update_ftype overlay_update)
+{
+ gdbarch->overlay_update = overlay_update;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
struct frame_info;
struct value;
struct objfile;
+struct obj_section;
struct minimal_symbol;
struct regcache;
struct reggroup;
extern void gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, struct regcache *regcache);
extern void set_gdbarch_skip_permanent_breakpoint (struct gdbarch *gdbarch, gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint);
+/* Refresh overlay mapped state for section OSECT. */
+
+extern int gdbarch_overlay_update_p (struct gdbarch *gdbarch);
+
+typedef void (gdbarch_overlay_update_ftype) (struct obj_section *osect);
+extern void gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect);
+extern void set_gdbarch_overlay_update (struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update);
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
# Advance PC to next instruction in order to skip a permanent breakpoint.
F::void:skip_permanent_breakpoint:struct regcache *regcache:regcache
+
+# Refresh overlay mapped state for section OSECT.
+F::void:overlay_update:struct obj_section *osect:osect
EOF
}
struct frame_info;
struct value;
struct objfile;
+struct obj_section;
struct minimal_symbol;
struct regcache;
struct reggroup;
/* Hook in the default unwinders. */
frame_unwind_append_sniffer (gdbarch, m32r_frame_sniffer);
+ /* Support simple overlay manager. */
+ set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
+
return gdbarch;
}
enum overlay_debugging_state overlay_debugging = ovly_off;
int overlay_cache_invalid = 0; /* True if need to refresh mapped state */
-/* Target vector for refreshing overlay mapped state */
-static void simple_overlay_update (struct obj_section *);
-void (*target_overlay_update) (struct obj_section *) = simple_overlay_update;
-
/* Function: section_is_overlay (SECTION)
Returns true if SECTION has VMA not equal to LMA, ie.
SECTION is loaded at an address different from where it will "run". */
case ovly_off:
return 0; /* overlay debugging off */
case ovly_auto: /* overlay debugging automatic */
- /* Unles there is a target_overlay_update function,
+ /* Unles there is a gdbarch_overlay_update function,
there's really nothing useful to do here (can't really go auto) */
- if (target_overlay_update)
+ if (gdbarch_overlay_update_p (current_gdbarch))
{
if (overlay_cache_invalid)
{
overlay_cache_invalid = 0;
}
if (osect->ovly_mapped == -1)
- (*target_overlay_update) (osect);
+ gdbarch_overlay_update (current_gdbarch, osect);
}
/* fall thru to manual case */
case ovly_on: /* overlay debugging manual */
static void
overlay_load_command (char *args, int from_tty)
{
- if (target_overlay_update)
- (*target_overlay_update) (NULL);
+ if (gdbarch_overlay_update_p (current_gdbarch))
+ gdbarch_overlay_update (current_gdbarch, NULL);
else
error (_("This target does not know how to read its overlay state."));
}
This is GDB's default target overlay layer. It works with the
minimal overlay manager supplied as an example by Cygnus. The
- entry point is via a function pointer "target_overlay_update",
+ entry point is via a function pointer "gdbarch_overlay_update",
so targets that use a different runtime overlay manager can
substitute their own overlay_update function and take over the
function pointer.
If a cached entry can't be found or the cache isn't valid, then
re-read the entire cache, and go ahead and update all sections. */
-static void
+void
simple_overlay_update (struct obj_section *osect)
{
struct objfile *objfile;
/* Opaque declarations. */
struct section_table;
struct objfile;
+struct obj_section;
struct obstack;
struct block;
/* Clear GDB symbol tables. */
extern void symbol_file_clear (int from_tty);
+/* Default overlay update function. */
+extern void simple_overlay_update (struct obj_section *);
+
extern bfd_byte *symfile_relocate_debug_section (bfd *abfd, asection *sectp,
bfd_byte * buf);