From a77053c21717e1cefafbaa83708768ed0fde03cf Mon Sep 17 00:00:00 2001 From: Mark Kettenis Date: Thu, 12 May 2005 20:21:18 +0000 Subject: * 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. --- gdb/infrun.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'gdb/infrun.c') diff --git a/gdb/infrun.c b/gdb/infrun.c index a078693..19a8d25 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -45,6 +45,8 @@ #include "value.h" #include "observer.h" #include "language.h" +#include "solib.h" + #include "gdb_assert.h" /* Prototypes for local functions */ @@ -160,10 +162,6 @@ show_debug_infrun (struct ui_file *file, int from_tty, signalling an error, which will obscure the change in the inferior's state. */ -#ifndef IN_SOLIB_DYNSYM_RESOLVE_CODE -#define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) 0 -#endif - /* This function returns TRUE if pc is the address of an instruction that lies within the dynamic linker (such as the event hook, or the dld itself). @@ -253,7 +251,6 @@ static struct symbol *step_start_function; static int trap_expected; -#ifdef SOLIB_ADD /* Nonzero if we want to give control to the user when we're notified of shared library events by the dynamic linker. */ static int stop_on_solib_events; @@ -264,7 +261,6 @@ show_stop_on_solib_events (struct ui_file *file, int from_tty, fprintf_filtered (file, _("Stopping for shared library events is %s.\n"), value); } -#endif /* Nonzero means expecting a trace trap and should stop the inferior and return silently when it happens. */ @@ -448,6 +444,8 @@ follow_exec (int pid, char *execd_pathname) #endif #ifdef SOLIB_CREATE_INFERIOR_HOOK SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); +#else + solib_create_inferior_hook (); #endif /* Reinsert all breakpoints. (Those which were symbolic have @@ -2132,7 +2130,6 @@ process_event_stop_test: case BPSTAT_WHAT_CHECK_SHLIBS: case BPSTAT_WHAT_CHECK_SHLIBS_RESUME_FROM_HOOK: -#ifdef SOLIB_ADD { if (debug_infrun) fprintf_unfiltered (gdb_stdlog, "infrun: BPSTATE_WHAT_CHECK_SHLIBS\n"); @@ -2163,7 +2160,11 @@ process_event_stop_test: exec/process stratum, instead relying on the target stack to propagate relevant changes (stop, section table changed, ...) up to other layers. */ +#ifdef SOLIB_ADD SOLIB_ADD (NULL, 0, ¤t_target, auto_solib_add); +#else + solib_add (NULL, 0, ¤t_target, auto_solib_add); +#endif target_terminal_inferior (); /* Try to reenable shared library breakpoints, additional @@ -2222,7 +2223,6 @@ process_event_stop_test: break; } } -#endif break; case BPSTAT_WHAT_LAST: @@ -2311,7 +2311,12 @@ process_event_stop_test: until we exit the run time loader code and reach the callee's address. */ if (step_over_calls == STEP_OVER_UNDEBUGGABLE - && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc)) +#ifdef IN_SOLIB_DYNSYM_RESOLVE_CODE + && IN_SOLIB_DYNSYM_RESOLVE_CODE (stop_pc) +#else + && in_solib_dynsym_resolve_code (stop_pc) +#endif + ) { CORE_ADDR pc_after_resolver = gdbarch_skip_solib_resolver (current_gdbarch, stop_pc); @@ -2395,7 +2400,13 @@ process_event_stop_test: if (real_stop_pc != 0) ecs->stop_func_start = real_stop_pc; - if (IN_SOLIB_DYNSYM_RESOLVE_CODE (ecs->stop_func_start)) + if ( +#ifdef IN_SOLIB_DYNSYM_RESOLVE_CODE + IN_SOLIB_DYNSYM_RESOLVE_CODE (ecs->stop_func_start) +#else + in_solib_dynsym_resolve_code (ecs->stop_func_start) +#endif +) { struct symtab_and_line sr_sal; init_sal (&sr_sal); @@ -3919,7 +3930,6 @@ When non-zero, inferior specific debugging is enabled."), signal_stop[TARGET_SIGNAL_CANCEL] = 0; signal_print[TARGET_SIGNAL_CANCEL] = 0; -#ifdef SOLIB_ADD add_setshow_zinteger_cmd ("stop-on-solib-events", class_support, &stop_on_solib_events, _("\ Set stopping for shared library events."), _("\ @@ -3930,7 +3940,6 @@ to the user would be loading/unloading of a new library."), NULL, show_stop_on_solib_events, &setlist, &showlist); -#endif add_setshow_enum_cmd ("follow-fork-mode", class_run, follow_fork_mode_kind_names, -- cgit v1.1