summaryrefslogtreecommitdiff
path: root/gdb/breakpoint.c
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2005-05-12 20:21:18 +0000
committerMark Kettenis <kettenis@gnu.org>2005-05-12 20:21:18 +0000
commitcad9537f844cacbb73c1529249f77421b5e56c45 (patch)
tree6d560aca05f82ef7db203f27c91bfd24e675c134 /gdb/breakpoint.c
parent0a3e8d712a81c4476228ee809d1fc8957e21c413 (diff)
downloadgdb-cad9537f844cacbb73c1529249f77421b5e56c45.tar.gz
* solib.h (CLEAR_SOLIB, SOLIB_ADD)
(SOLIB_CREATE_INFERIOR_HOOK, SOLIB_REMOVE_INFERIOR_HOOK) (SOLIB_IN_DYNAMIC_LINKER, SOLIB_RESTART) (DISABLE_UNSETTABLE_BREAK, PC_SOLIB) (IN_SOLIB_DYNSYM_RESOLVE_CODE): Remove defines and orphaned comments. * breakpoint.c: Include "solib.h". (insert_bp_location) [!DISABLE_UNSETTABLE_BREAK]: Call solib_address. (remove_solib_event_breakpoints, create_solib_event_breakpoint) (disable_breakpoints_in_shlibs) (disable_breakpoints_in_unloaded_shlib) (re_enable_breakpoints_in_shlibs): Compile if SOLIB_ADD isn't defined. If PC_SOLIB isn't defined, call solib_address. (_initialize_breakpoint): Unconditionally install observer. * corelow.c: Include "solib.h". [SOLIB_ADD] (solib_add_stub): Remove prototype. (core_close) [!CLEAR_SOLIB]: Call clear_solib. (solib_add_stub) [!SOLIB_ADD] Call solib_add. (core_open): Unconditionally call solib_add_stub. * fork-child.c: Include "solib.h". (fork_inferior) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. * infcmd.c: Include "solib.h". (attach_command) [!SOLIB_ADD]: Call shlib_rescan. Unconditionally call re_enable_breakpoints_in_shlibs. * infrun.c: Include "solib.h". (SOLIB_IN_SYNSYM_RESOLVE_CODE): Don't define if not already defined. (stop_on_solib_events, show_stop_on_solib_events): Include unconditionally. (follow_exec) [!SOLIB_CREATE_INFERIOR_HOOK]: Call solib_create_inferior_hook. (handle_inferior_event) [!SOLIB_ADD]: Call shlib_add. [!IN_SOLIB_DYNSYM_RESOLVE_CODE]: Call in_solib_dynsym_resolve_code. (_initialize_infrun): Unconditionally add "stop_on_solib-events" command. * remote.c: Include "solib.h". (remote_open_1): Unconditionally call no_shared_libraries. [!SOLIB_CREATE_INFERIOR_HOOK] Call solib_create_inferior_hook. * stack.c: Include "solib.h". (print_frame) [!PC_SOLIB] Call shlib_for_pc. * xcoffsolib.c (no_shared_libraries): Remove function. * Makefile.in (SFILES): Add solib.c. (ALLDEPFILES): Remove solib.c. (COMMON_OBS): Add solib.o. (breakpoint.o, corelow.o, fork-chiled.o, infcmd.o, infrun.o) (remote.o, stack.o): Update dependencies.
Diffstat (limited to 'gdb/breakpoint.c')
-rw-r--r--gdb/breakpoint.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6393c1f5a5c..21f47ba4144 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -49,6 +49,7 @@
#include "cli/cli-script.h"
#include "gdb_assert.h"
#include "block.h"
+#include "solib.h"
#include "solist.h"
#include "observer.h"
#include "exceptions.h"
@@ -853,8 +854,13 @@ insert_bp_location (struct bp_location *bpt,
if (val)
{
/* Can't set the breakpoint. */
+ if (
#if defined (DISABLE_UNSETTABLE_BREAK)
- if (DISABLE_UNSETTABLE_BREAK (bpt->address))
+ DISABLE_UNSETTABLE_BREAK (bpt->address)
+#else
+ solib_address (bpt->address)
+#endif
+ )
{
/* See also: disable_breakpoints_in_shlibs. */
val = 0;
@@ -872,7 +878,6 @@ insert_bp_location (struct bp_location *bpt,
"breakpoint #%d\n", bpt->owner->number);
}
else
-#endif
{
#ifdef ONE_PROCESS_WRITETEXT
*process_warning = 1;
@@ -4330,7 +4335,6 @@ resolve_pending_breakpoint (struct breakpoint *b)
return rc;
}
-#ifdef SOLIB_ADD
void
remove_solib_event_breakpoints (void)
{
@@ -4362,12 +4366,14 @@ disable_breakpoints_in_shlibs (int silent)
/* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */
ALL_BREAKPOINTS (b)
{
-#if defined (PC_SOLIB)
- if (((b->type == bp_breakpoint) ||
- (b->type == bp_hardware_breakpoint)) &&
- breakpoint_enabled (b) &&
- !b->loc->duplicate &&
- PC_SOLIB (b->loc->address))
+ if (((b->type == bp_breakpoint) || (b->type == bp_hardware_breakpoint))
+ && breakpoint_enabled (b) && !b->loc->duplicate
+#ifdef PC_SOLIB
+ && PC_SOLIB (b->loc->address)
+#else
+ && solib_address (b->loc->address)
+#endif
+ )
{
b->enable_state = bp_shlib_disabled;
if (!silent)
@@ -4381,7 +4387,6 @@ disable_breakpoints_in_shlibs (int silent)
warning (_("breakpoint #%d "), b->number);
}
}
-#endif
}
}
@@ -4394,18 +4399,19 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
struct breakpoint *b;
int disabled_shlib_breaks = 0;
-#if defined (PC_SOLIB)
/* See also: insert_breakpoints, under DISABLE_UNSETTABLE_BREAK. */
ALL_BREAKPOINTS (b)
{
if ((b->loc->loc_type == bp_loc_hardware_breakpoint
|| b->loc->loc_type == bp_loc_software_breakpoint)
- && breakpoint_enabled (b)
- && !b->loc->duplicate)
+ && breakpoint_enabled (b) && !b->loc->duplicate)
{
+#ifdef PC_SOLIB
char *so_name = PC_SOLIB (b->loc->address);
- if (so_name
- && !strcmp (so_name, solib->so_name))
+#else
+ char *so_name = solib_address (b->loc->address);
+#endif
+ if (so_name && !strcmp (so_name, solib->so_name))
{
b->enable_state = bp_shlib_disabled;
/* At this point, we cannot rely on remove_breakpoint
@@ -4422,7 +4428,6 @@ disable_breakpoints_in_unloaded_shlib (struct so_list *solib)
}
}
}
-#endif
}
/* Try to reenable any breakpoints in shared libraries. */
@@ -4437,9 +4442,13 @@ re_enable_breakpoints_in_shlibs (void)
{
char buf[1], *lib;
- /* Do not reenable the breakpoint if the shared library
- is still not mapped in. */
+ /* Do not reenable the breakpoint if the shared library is
+ still not mapped in. */
+#ifdef PC_SOLIB
lib = PC_SOLIB (b->loc->address);
+#else
+ lib = solib_address (b->loc->address);
+#endif
if (lib != NULL && target_read_memory (b->loc->address, buf, 1) == 0)
b->enable_state = bp_enabled;
}
@@ -4451,8 +4460,6 @@ re_enable_breakpoints_in_shlibs (void)
}
}
-#endif
-
static void
solib_load_unload_1 (char *hookname, int tempflag, char *dll_pathname,
char *cond_string, enum bptype bp_kind)
@@ -7632,9 +7639,7 @@ _initialize_breakpoint (void)
static struct cmd_list_element *breakpoint_show_cmdlist;
struct cmd_list_element *c;
-#ifdef SOLIB_ADD
observer_attach_solib_unloaded (disable_breakpoints_in_unloaded_shlib);
-#endif
breakpoint_chain = 0;
/* Don't bother to call set_breakpoint_count. $bpnum isn't useful