summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c61
1 files changed, 60 insertions, 1 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 61b72255a0a..33f923e4b83 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3793,6 +3793,7 @@ describe_other_breakpoints (CORE_ADDR pc, asection *section)
b->number,
((b->enable_state == bp_disabled ||
b->enable_state == bp_shlib_disabled ||
+ b->enable_state == bp_startup_disabled ||
b->enable_state == bp_call_disabled)
? " (disabled)"
: b->enable_state == bp_permanent
@@ -4427,6 +4428,62 @@ re_enable_breakpoints_in_shlibs (void)
#endif
+void
+disable_breakpoints_at_startup (int silent)
+{
+ struct breakpoint *b;
+ int disabled_startup_breaks = 0;
+
+ if (bfd_get_start_address (exec_bfd) != entry_point_address ())
+ {
+ ALL_BREAKPOINTS (b)
+ {
+ if (((b->type == bp_breakpoint) ||
+ (b->type == bp_hardware_breakpoint)) &&
+ b->enable_state == bp_enabled &&
+ !b->loc->duplicate)
+ {
+ b->enable_state = bp_startup_disabled;
+ if (!silent)
+ {
+ if (!disabled_startup_breaks)
+ {
+ target_terminal_ours_for_output ();
+ warning ("Temporarily disabling breakpoints:");
+ }
+ disabled_startup_breaks = 1;
+ warning ("breakpoint #%d addr 0x%s", b->number, paddr_nz(b->loc->address));
+ }
+ }
+ }
+ }
+}
+
+/* Try to reenable any breakpoints after startup. */
+void
+re_enable_breakpoints_at_startup (void)
+{
+ struct breakpoint *b;
+
+ if (bfd_get_start_address (exec_bfd) != entry_point_address ())
+ {
+ ALL_BREAKPOINTS (b)
+ if (b->enable_state == bp_startup_disabled)
+ {
+ char buf[1];
+
+ /* Do not reenable the breakpoint if the shared library
+ is still not mapped in. */
+ if (target_read_memory (b->loc->address, buf, 1) == 0)
+ {
+ /*printf ("enabling breakpoint at 0x%s\n", paddr_nz(b->loc->address));*/
+ b->enable_state = bp_enabled;
+ }
+ }
+ }
+}
+
+
static void
solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
char *cond_string, enum bptype bp_kind)
@@ -6940,6 +6997,7 @@ delete_breakpoint (struct breakpoint *bpt)
&& !b->loc->duplicate
&& b->enable_state != bp_disabled
&& b->enable_state != bp_shlib_disabled
+ && b->enable_state != bp_startup_disabled
&& !b->pending
&& b->enable_state != bp_call_disabled)
{
@@ -7151,7 +7209,8 @@ breakpoint_re_set_one (void *bint)
break;
save_enable = b->enable_state;
- if (b->enable_state != bp_shlib_disabled)
+ if (b->enable_state != bp_shlib_disabled
+ || b->enable_state != bp_shlib_disabled)
b->enable_state = bp_disabled;
set_language (b->language);