aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog27
-rw-r--r--gdb/breakpoint.c141
-rw-r--r--gdb/breakpoint.h11
-rw-r--r--gdb/symfile.c3
4 files changed, 141 insertions, 41 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 898d48a..993cb93 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,30 @@
+2002-02-04 Michael Snyder <msnyder@redhat.com>
+
+ * breakpoint.h (enum bptype): Add new overlay event bp type.
+ (enable_overlay_breakpoints, disable_overlay_breakpoints): Export.
+
+ * breakpoint.c (create_internal_breakpoint): New function.
+ (internal_breakpoint_number): Moved into create_internal_breakpoint.
+ (create_longjmp_breakpoint): Use create_internal_breakpoint.
+ (create_thread_event_breakpoint): Ditto.
+ (create_solib_event_breakpoint): Ditto.
+ (create_overlay_event_breakpoint): New function.
+ (enable_overlay_breakpoints, disable_overlay_breakpoints): New funcs.
+ (update_breakpoints_after_exec): Delete and re-initialize
+ overlay event breakpoints after an exec. Add FIXME comment
+ about longjmp breakpoint.
+ (print_it_typical): Ignore overlay event breakpoints.
+ (print_one_breakpoint): Ditto.
+ (mention): Ditto.
+ (bpstat_what): Do not stop for overlay event breakpoints.
+ (delete_breakpoint): Don't delete overlay event breakpoints.
+ (breakpoint_re_set_one): Delete the overlay event breakpoint.
+ (breakpoint_re_set): Re-create overlay event breakpoint.
+
+ * symfile.c (overlay_auto_command): Enable overlay breakpoints.
+ (overlay_manual_command): Disable overlay breakpoints.
+ (overlay_off_command): Disable overlay breakpoints.
+
2002-02-06 Richard Earnshaw <rearnsha@arm.com>
* arm-tdep.c: Include elf-bfd.h and coff/internal.h.
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index cbde2bc..b22a206 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -117,10 +117,6 @@ static int get_number_trailer (char **, int);
void set_breakpoint_count (int);
-#if 0
-static struct breakpoint *create_temp_exception_breakpoint (CORE_ADDR);
-#endif
-
typedef enum
{
mark_inserted,
@@ -151,6 +147,8 @@ static void maintenance_info_breakpoints (char *, int);
static void create_longjmp_breakpoint (char *);
#endif
+static void create_overlay_event_breakpoint (char *);
+
static int hw_breakpoint_used_count (void);
static int hw_watchpoint_used_count (enum bptype, int *);
@@ -218,8 +216,6 @@ void _initialize_breakpoint (void);
extern int addressprint; /* Print machine addresses? */
-static int internal_breakpoint_number = -1;
-
/* Are we executing breakpoint commands? */
static int executing_breakpoint_commands;
@@ -1107,8 +1103,9 @@ update_breakpoints_after_exec (void)
continue;
}
- /* Thread event breakpoints must be set anew after an exec(). */
- if (b->type == bp_thread_event)
+ /* Thread event breakpoints must be set anew after an exec(),
+ as must overlay event breakpoints. */
+ if (b->type == bp_thread_event || b->type == bp_overlay_event)
{
delete_breakpoint (b);
continue;
@@ -1216,6 +1213,8 @@ update_breakpoints_after_exec (void)
So I think this assignment could be deleted without effect. */
b->address = (CORE_ADDR) NULL;
}
+ /* FIXME what about longjmp breakpoints? Re-create them here? */
+ create_overlay_event_breakpoint ("_ovly_debug_event");
}
int
@@ -1910,6 +1909,12 @@ print_it_typical (bpstat bs)
return PRINT_NOTHING;
break;
+ case bp_overlay_event:
+ /* By analogy with the thread event, GDB should not stop for these. */
+ printf_filtered ("Overlay Event Breakpoint: gdb should not stop!\n");
+ return PRINT_NOTHING;
+ break;
+
case bp_catch_load:
annotate_catchpoint (bs->breakpoint_at->number);
printf_filtered ("\nCatchpoint %d (", bs->breakpoint_at->number);
@@ -2896,6 +2901,7 @@ bpstat_what (bpstat bs)
bs_class = shlib_event;
break;
case bp_thread_event:
+ case bp_overlay_event:
bs_class = bp_nostop;
break;
case bp_catch_load:
@@ -3072,6 +3078,7 @@ print_one_breakpoint (struct breakpoint *b,
{bp_call_dummy, "call dummy"},
{bp_shlib_event, "shlib events"},
{bp_thread_event, "thread events"},
+ {bp_overlay_event, "overlay events"},
{bp_catch_load, "catch load"},
{bp_catch_unload, "catch unload"},
{bp_catch_fork, "catch fork"},
@@ -3228,6 +3235,7 @@ print_one_breakpoint (struct breakpoint *b,
case bp_call_dummy:
case bp_shlib_event:
case bp_thread_event:
+ case bp_overlay_event:
if (addressprint)
{
annotate_field (4);
@@ -3731,36 +3739,47 @@ make_breakpoint_permanent (struct breakpoint *b)
b->inserted = 1;
}
+static struct breakpoint *
+create_internal_breakpoint (CORE_ADDR address, enum bptype type)
+{
+ static int internal_breakpoint_number = -1;
+ struct symtab_and_line sal;
+ struct breakpoint *b;
+
+ INIT_SAL (&sal); /* initialize to zeroes */
+
+ sal.pc = address;
+ sal.section = find_pc_overlay (sal.pc);
+
+ b = set_raw_breakpoint (sal, type);
+ b->number = internal_breakpoint_number--;
+ b->disposition = disp_donttouch;
+
+ return b;
+}
+
#ifdef GET_LONGJMP_TARGET
static void
create_longjmp_breakpoint (char *func_name)
{
- struct symtab_and_line sal;
struct breakpoint *b;
+ struct minimal_symbol *m;
- INIT_SAL (&sal); /* initialize to zeroes */
- if (func_name != NULL)
+ if (func_name == NULL)
+ b = create_internal_breakpoint (0, bp_longjmp_resume);
+ else
{
- struct minimal_symbol *m;
-
- m = lookup_minimal_symbol_text (func_name, NULL,
- (struct objfile *) NULL);
- if (m)
- sal.pc = SYMBOL_VALUE_ADDRESS (m);
- else
+ if ((m = lookup_minimal_symbol_text (func_name, NULL, NULL)) == NULL)
return;
+
+ b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m), bp_longjmp);
}
- sal.section = find_pc_overlay (sal.pc);
- b = set_raw_breakpoint (sal,
- func_name != NULL ? bp_longjmp : bp_longjmp_resume);
- b->disposition = disp_donttouch;
b->enable_state = bp_disabled;
b->silent = 1;
if (func_name)
b->addr_string = xstrdup (func_name);
- b->number = internal_breakpoint_number--;
}
#endif /* #ifdef GET_LONGJMP_TARGET */
@@ -3796,20 +3815,59 @@ disable_longjmp_breakpoint (void)
}
}
+static void
+create_overlay_event_breakpoint (char *func_name)
+{
+ struct breakpoint *b;
+ struct minimal_symbol *m;
+
+ if ((m = lookup_minimal_symbol_text (func_name, NULL, NULL)) == NULL)
+ return;
+
+ b = create_internal_breakpoint (SYMBOL_VALUE_ADDRESS (m),
+ bp_overlay_event);
+ b->addr_string = xstrdup (func_name);
+
+ if (overlay_debugging == ovly_auto)
+ b->enable_state = bp_enabled;
+ else
+ b->enable_state = bp_disabled;
+}
+
+void
+enable_overlay_breakpoints (void)
+{
+ register struct breakpoint *b;
+
+ ALL_BREAKPOINTS (b)
+ if (b->type == bp_overlay_event)
+ {
+ b->enable_state = bp_enabled;
+ check_duplicates (b);
+ }
+}
+
+void
+disable_overlay_breakpoints (void)
+{
+ register struct breakpoint *b;
+
+ ALL_BREAKPOINTS (b)
+ if (b->type == bp_overlay_event)
+ {
+ b->enable_state = bp_disabled;
+ check_duplicates (b);
+ }
+}
+
struct breakpoint *
create_thread_event_breakpoint (CORE_ADDR address)
{
struct breakpoint *b;
- struct symtab_and_line sal;
char addr_string[80]; /* Surely an addr can't be longer than that. */
- INIT_SAL (&sal); /* initialize to zeroes */
- sal.pc = address;
- sal.section = find_pc_overlay (sal.pc);
- b = set_raw_breakpoint (sal, bp_thread_event);
+ b = create_internal_breakpoint (address, bp_thread_event);
- b->number = internal_breakpoint_number--;
- b->disposition = disp_donttouch;
b->enable_state = bp_enabled;
/* addr_string has to be used or breakpoint_re_set will delete me. */
sprintf (addr_string, "*0x%s", paddr (b->address));
@@ -3843,15 +3901,8 @@ struct breakpoint *
create_solib_event_breakpoint (CORE_ADDR address)
{
struct breakpoint *b;
- struct symtab_and_line sal;
-
- INIT_SAL (&sal); /* initialize to zeroes */
- sal.pc = address;
- sal.section = find_pc_overlay (sal.pc);
- b = set_raw_breakpoint (sal, bp_shlib_event);
- b->number = internal_breakpoint_number--;
- b->disposition = disp_donttouch;
+ b = create_internal_breakpoint (address, bp_shlib_event);
return b;
}
@@ -4311,6 +4362,7 @@ mention (struct breakpoint *b)
case bp_watchpoint_scope:
case bp_shlib_event:
case bp_thread_event:
+ case bp_overlay_event:
break;
}
if (say_where)
@@ -6665,6 +6717,7 @@ delete_command (char *arg, int from_tty)
if (b->type != bp_call_dummy &&
b->type != bp_shlib_event &&
b->type != bp_thread_event &&
+ b->type != bp_overlay_event &&
b->number >= 0)
breaks_to_delete = 1;
}
@@ -6678,6 +6731,7 @@ delete_command (char *arg, int from_tty)
if (b->type != bp_call_dummy &&
b->type != bp_shlib_event &&
b->type != bp_thread_event &&
+ b->type != bp_overlay_event &&
b->number >= 0)
delete_breakpoint (b);
}
@@ -6861,10 +6915,11 @@ breakpoint_re_set_one (PTR bint)
default:
printf_filtered ("Deleting unknown breakpoint type %d\n", b->type);
/* fall through */
- /* Delete longjmp breakpoints, they will be reset later by
- breakpoint_re_set. */
+ /* Delete longjmp and overlay event breakpoints; they will be
+ reset later by breakpoint_re_set. */
case bp_longjmp:
case bp_longjmp_resume:
+ case bp_overlay_event:
delete_breakpoint (b);
break;
@@ -6919,6 +6974,8 @@ breakpoint_re_set (void)
create_longjmp_breakpoint ("_siglongjmp");
create_longjmp_breakpoint (NULL);
#endif
+
+ create_overlay_event_breakpoint ("_ovly_debug_event");
}
/* Reset the thread number of this breakpoint:
@@ -7047,6 +7104,10 @@ map_breakpoint_numbers (char *args, void (*function) (struct breakpoint *))
}
}
+/* Set ignore-count of breakpoint number BPTNUM to COUNT.
+ If from_tty is nonzero, it prints a message to that effect,
+ which ends with a period (no newline). */
+
void
disable_breakpoint (struct breakpoint *bpt)
{
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 44cde48..3a58aad 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -107,6 +107,14 @@ enum bptype
bp_thread_event,
+ /* On the same principal, an overlay manager can arrange to call a
+ magic location in the inferior whenever there is an interesting
+ change in overlay status. GDB can update its overlay tables
+ and fiddle with breakpoints in overlays when this breakpoint
+ is hit. */
+
+ bp_overlay_event,
+
/* These breakpoints are used to implement the "catch load" command
on platforms whose dynamic linkers support such functionality. */
bp_catch_load,
@@ -603,8 +611,9 @@ extern void update_breakpoints_after_exec (void);
extern int detach_breakpoints (int);
extern void enable_longjmp_breakpoint (void);
-
extern void disable_longjmp_breakpoint (void);
+extern void enable_overlay_breakpoints (void);
+extern void disable_overlay_breakpoints (void);
extern void set_longjmp_resume_breakpoint (CORE_ADDR, struct frame_info *);
/* These functions respectively disable or reenable all currently
diff --git a/gdb/symfile.c b/gdb/symfile.c
index bbc2376..ebdd62b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -2898,6 +2898,7 @@ static void
overlay_auto_command (char *args, int from_tty)
{
overlay_debugging = ovly_auto;
+ enable_overlay_breakpoints ();
if (info_verbose)
printf_filtered ("Automatic overlay debugging enabled.");
}
@@ -2910,6 +2911,7 @@ static void
overlay_manual_command (char *args, int from_tty)
{
overlay_debugging = ovly_on;
+ disable_overlay_breakpoints ();
if (info_verbose)
printf_filtered ("Overlay debugging enabled.");
}
@@ -2922,6 +2924,7 @@ static void
overlay_off_command (char *args, int from_tty)
{
overlay_debugging = ovly_off;
+ disable_overlay_breakpoints ();
if (info_verbose)
printf_filtered ("Overlay debugging disabled.");
}