diff options
author | Mark Kettenis <kettenis@gnu.org> | 2005-05-12 20:21:18 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@gnu.org> | 2005-05-12 20:21:18 +0000 |
commit | a77053c21717e1cefafbaa83708768ed0fde03cf (patch) | |
tree | 79953d1c27eaef6a44c7ad65c63003669df4be24 | |
parent | aaac363113ec5f611c73865a5c6231aad9b7e281 (diff) | |
download | gdb-a77053c21717e1cefafbaa83708768ed0fde03cf.zip gdb-a77053c21717e1cefafbaa83708768ed0fde03cf.tar.gz gdb-a77053c21717e1cefafbaa83708768ed0fde03cf.tar.bz2 |
* 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.
-rw-r--r-- | gdb/ChangeLog | 51 | ||||
-rw-r--r-- | gdb/Makefile.in | 24 | ||||
-rw-r--r-- | gdb/breakpoint.c | 49 | ||||
-rw-r--r-- | gdb/corelow.c | 18 | ||||
-rw-r--r-- | gdb/fork-child.c | 3 | ||||
-rw-r--r-- | gdb/infcmd.c | 7 | ||||
-rw-r--r-- | gdb/infrun.c | 33 | ||||
-rw-r--r-- | gdb/remote.c | 10 | ||||
-rw-r--r-- | gdb/solib.h | 59 | ||||
-rw-r--r-- | gdb/stack.c | 7 | ||||
-rw-r--r-- | gdb/xcoffsolib.c | 18 |
11 files changed, 143 insertions, 136 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 67aacd7..3b722c4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,54 @@ +2005-05-12 Mark Kettenis <kettenis@gnu.org> + + * 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. + 2005-05-12 Daniel Jacobowitz <dan@codesourcery.com> * cp-names.y: Renamed to ... diff --git a/gdb/Makefile.in b/gdb/Makefile.in index e042660..a971bff 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -545,7 +545,8 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c \ regcache.c reggroups.c remote.c remote-fileio.c \ scm-exp.c scm-lang.c scm-valprint.c \ sentinel-frame.c \ - serial.c ser-base.c ser-unix.c source.c \ + serial.c ser-base.c ser-unix.c \ + solib.c solib-null.c source.c \ stabsread.c stack.c std-regs.c symfile.c symfile-mem.c symmisc.c \ symtab.c \ target.c thread.c top.c tracepoint.c \ @@ -938,7 +939,8 @@ COMMON_OBS = $(DEPFILES) $(YYOBJ) \ cp-namespace.o \ reggroups.o regset.o \ trad-frame.o \ - tramp-frame.o + tramp-frame.o \ + solib.o solib-null.o TSOBS = inflow.o @@ -1438,7 +1440,7 @@ ALLDEPFILES = \ s390-tdep.c s390-nat.c \ ser-go32.c ser-pipe.c ser-tcp.c \ sh-tdep.c sh64-tdep.c shnbsd-tdep.c shnbsd-nat.c \ - solib.c solib-irix.c solib-svr4.c solib-sunos.c \ + solib-irix.c solib-svr4.c solib-sunos.c \ sparc-linux-tdep.c sparc-nat.c sparc-sol2-nat.c sparc-sol2-tdep.c \ sparc-tdep.c sparc-sol2-nat.c sparc-sol2-tdep.c sparc64-linux-nat.c \ sparc64-linux-tdep.c sparc64-nat.c sparc64-sol2-tdep.c \ @@ -1774,8 +1776,8 @@ breakpoint.o: breakpoint.c $(defs_h) $(symtab_h) $(frame_h) $(breakpoint_h) \ $(command_h) $(inferior_h) $(gdbthread_h) $(target_h) $(language_h) \ $(gdb_string_h) $(demangle_h) $(annotate_h) $(symfile_h) \ $(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \ - $(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solist_h) \ - $(observer_h) $(exceptions_h) $(gdb_events_h) + $(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solib_h) \ + $(solist_h) $(observer_h) $(exceptions_h) $(gdb_events_h) bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \ $(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \ $(readline_h) $(bsd_kvm_h) @@ -1823,7 +1825,7 @@ corelow.o: corelow.c $(defs_h) $(arch_utils_h) $(gdb_string_h) $(frame_h) \ $(inferior_h) $(symtab_h) $(command_h) $(bfd_h) $(target_h) \ $(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \ $(exec_h) $(readline_h) $(observer_h) $(gdb_assert_h) \ - $(exceptions_h) + $(exceptions_h) $(solib_h) core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \ $(inferior_h) $(target_h) $(gdb_string_h) $(gregset_h) cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \ @@ -1940,7 +1942,7 @@ f-lang.o: f-lang.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(valprint_h) $(value_h) fork-child.o: fork-child.c $(defs_h) $(gdb_string_h) $(frame_h) \ $(inferior_h) $(target_h) $(gdb_wait_h) $(gdb_vfork_h) $(gdbcore_h) \ - $(terminal_h) $(gdbthread_h) $(command_h) + $(terminal_h) $(gdbthread_h) $(command_h) $(solib_h) frame-base.o: frame-base.c $(defs_h) $(frame_base_h) $(frame_h) \ $(gdb_obstack_h) frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \ @@ -2110,7 +2112,7 @@ infcmd.o: infcmd.c $(defs_h) $(gdb_string_h) $(symtab_h) $(gdbtypes_h) \ $(symfile_h) $(gdbcore_h) $(target_h) $(language_h) $(symfile_h) \ $(objfiles_h) $(completer_h) $(ui_out_h) $(event_top_h) \ $(parser_defs_h) $(regcache_h) $(reggroups_h) $(block_h) \ - $(gdb_assert_h) + $(solib_h) $(gdb_assert_h) inf-loop.o: inf-loop.c $(defs_h) $(inferior_h) $(target_h) $(event_loop_h) \ $(event_top_h) $(inf_loop_h) $(remote_h) $(exceptions_h) inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \ @@ -2126,7 +2128,7 @@ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \ $(inferior_h) $(exceptions_h) $(breakpoint_h) $(gdb_wait_h) \ $(gdbcore_h) $(gdbcmd_h) $(cli_script_h) $(target_h) $(gdbthread_h) \ $(annotate_h) $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) \ - $(value_h) $(observer_h) $(language_h) $(gdb_assert_h) + $(value_h) $(observer_h) $(language_h) $(solib_h) $(gdb_assert_h) inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ $(gdbcore_h) $(command_h) $(gdb_stat_h) $(observer_h) $(gdb_wait_h) \ $(inflow_h) @@ -2412,7 +2414,7 @@ remote.o: remote.c $(defs_h) $(gdb_string_h) $(inferior_h) $(bfd_h) \ $(symfile_h) $(exceptions_h) $(target_h) $(gdbcmd_h) $(objfiles_h) \ $(gdb_stabs_h) $(gdbthread_h) $(remote_h) $(regcache_h) $(value_h) \ $(gdb_assert_h) $(event_loop_h) $(event_top_h) $(inf_loop_h) \ - $(serial_h) $(gdbcore_h) $(remote_fileio_h) $(observer_h) + $(serial_h) $(gdbcore_h) $(remote_fileio_h) $(solib_h) $(observer_h) remote-e7000.o: remote-e7000.c $(defs_h) $(gdbcore_h) $(gdbarch_h) \ $(inferior_h) $(target_h) $(value_h) $(command_h) $(gdb_string_h) \ $(exceptions_h) $(gdbcmd_h) $(serial_h) $(remote_utils_h) \ @@ -2627,7 +2629,7 @@ stack.o: stack.c $(defs_h) $(gdb_string_h) $(value_h) $(symtab_h) \ $(gdbcore_h) $(target_h) $(source_h) $(breakpoint_h) $(demangle_h) \ $(inferior_h) $(annotate_h) $(ui_out_h) $(block_h) $(stack_h) \ $(gdb_assert_h) $(dictionary_h) $(exceptions_h) $(reggroups_h) \ - $(regcache_h) + $(regcache_h) $(solib_h) std-regs.o: std-regs.c $(defs_h) $(user_regs_h) $(frame_h) $(gdbtypes_h) \ $(value_h) $(gdb_string_h) stop-gdb.o: stop-gdb.c $(defs_h) diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 6393c1f..21f47ba 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 diff --git a/gdb/corelow.c b/gdb/corelow.c index 75f9419..ea37df5 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -46,6 +46,7 @@ #include "observer.h" #include "gdb_assert.h" #include "exceptions.h" +#include "solib.h" #ifndef O_BINARY #define O_BINARY 0 @@ -73,10 +74,6 @@ struct gdbarch *core_gdbarch = NULL; static void core_files_info (struct target_ops *); -#ifdef SOLIB_ADD -static int solib_add_stub (void *); -#endif - static struct core_fns *sniff_core_bfd (bfd *); static int gdb_check_format (bfd *); @@ -212,6 +209,8 @@ core_close (int quitting) comments in clear_solib in solib.c. */ #ifdef CLEAR_SOLIB CLEAR_SOLIB (); +#else + clear_solib (); #endif name = bfd_get_filename (core_bfd); @@ -237,18 +236,20 @@ core_close_cleanup (void *ignore) core_close (0/*ignored*/); } -#ifdef SOLIB_ADD /* Stub function for catch_errors around shared library hacking. FROM_TTYP is really an int * which points to from_tty. */ static int solib_add_stub (void *from_ttyp) { +#ifdef SOLIB_ADD SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_target, auto_solib_add); +#else + solib_add (NULL, *(int *)from_ttyp, ¤t_target, auto_solib_add); +#endif re_enable_breakpoints_in_shlibs (); return 0; } -#endif /* SOLIB_ADD */ /* Look for sections whose names start with `.reg/' so that we can extract the list of threads in a core file. */ @@ -396,10 +397,7 @@ core_open (char *filename, int from_tty) target_fetch_registers (-1); /* Add symbols and section mappings for any shared libraries. */ -#ifdef SOLIB_ADD - catch_errors (solib_add_stub, &from_tty, (char *) 0, - RETURN_MASK_ALL); -#endif + catch_errors (solib_add_stub, &from_tty, (char *) 0, RETURN_MASK_ALL); /* Now, set up the frame cache, and print the top of stack. */ flush_cached_frames (); diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 4d8a857..f269166 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -33,6 +33,7 @@ #include "terminal.h" #include "gdbthread.h" #include "command.h" /* for dont_repeat () */ +#include "solib.h" #include <signal.h> @@ -404,6 +405,8 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env, #ifdef SOLIB_CREATE_INFERIOR_HOOK SOLIB_CREATE_INFERIOR_HOOK (pid); +#else + solib_create_inferior_hook (); #endif } diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 507924d..b7ef75d 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -44,6 +44,7 @@ #include "regcache.h" #include "reggroups.h" #include "block.h" +#include "solib.h" #include <ctype.h> #include "gdb_assert.h" @@ -1805,6 +1806,8 @@ attach_command (char *args, int from_tty) */ #ifdef CLEAR_SOLIB CLEAR_SOLIB (); +#else + clear_solib (); #endif target_attach (args, from_tty); @@ -1864,8 +1867,10 @@ attach_command (char *args, int from_tty) #ifdef SOLIB_ADD /* Add shared library symbols from the newly attached process, if any. */ SOLIB_ADD ((char *) 0, from_tty, ¤t_target, auto_solib_add); - re_enable_breakpoints_in_shlibs (); +#else + solib_add (NULL, from_tty, ¤t_target, auto_solib_add); #endif + re_enable_breakpoints_in_shlibs (); /* Take any necessary post-attaching actions for this platform. */ 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, diff --git a/gdb/remote.c b/gdb/remote.c index a46b92f..5b345b5 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -42,6 +42,7 @@ #include "value.h" #include "gdb_assert.h" #include "observer.h" +#include "solib.h" #include <ctype.h> #include <sys/time.h> @@ -2258,10 +2259,8 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, wait_forever_enabled_p = 0; } -#ifdef SOLIB_CREATE_INFERIOR_HOOK /* First delete any symbols previously loaded from shared libraries. */ no_shared_libraries (NULL, 0); -#endif /* Start the remote connection. If error() or QUIT, discard this target (we'd otherwise be in an inconsistent state) and then @@ -2300,7 +2299,7 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, putpkt ("!"); getpkt (buf, (rs->remote_packet_size), 0); } -#ifdef SOLIB_CREATE_INFERIOR_HOOK + /* FIXME: need a master target_open vector from which all remote_opens can be called, so that stuff like this can go there. Failing that, the following code must be copied @@ -2310,10 +2309,13 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, /* Set up to detect and load shared libraries. */ if (exec_bfd) /* No use without an exec file. */ { +#ifdef SOLIB_CREATE_INFERIOR_HOOK SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); +#else + solib_create_inferior_hook (); +#endif remote_check_symbols (symfile_objfile); } -#endif observer_notify_inferior_created (¤t_target, from_tty); } diff --git a/gdb/solib.h b/gdb/solib.h index 8fadf4e..28c25d0 100644 --- a/gdb/solib.h +++ b/gdb/solib.h @@ -30,15 +30,10 @@ struct target_ops; /* Called when we free all symtabs, to free the shared library information as well. */ -#define CLEAR_SOLIB clear_solib - extern void clear_solib (void); /* Called to add symbols from a shared library to gdb's symbol table. */ -#define SOLIB_ADD(filename, from_tty, targ, readsyms) \ - solib_add (filename, from_tty, targ, readsyms) - extern void solib_add (char *, int, struct target_ops *, int); extern int solib_read_symbols (struct so_list *, int); @@ -47,64 +42,16 @@ extern int solib_read_symbols (struct so_list *, int); addresses to which they are linked, and sufficient information to read in their symbols at a later time. */ -#define SOLIB_CREATE_INFERIOR_HOOK(PID) solib_create_inferior_hook () - -/* Function to be called to remove the connection between debugger and - dynamic linker that was established by SOLIB_CREATE_INFERIOR_HOOK. - (This operation does not remove shared library information from - the debugger, as CLEAR_SOLIB does.) - - This functionality is presently not implemented for this target. - */ -#define SOLIB_REMOVE_INFERIOR_HOOK(PID) (0) - -extern void solib_create_inferior_hook (void); /* solib.c */ - -/* 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). - - This function must be used only when a dynamic linker event has been - caught, and the inferior is being stepped out of the hook, or undefined - results are guaranteed. - - Presently, this functionality is not implemented. - */ - -/* - #define SOLIB_IN_DYNAMIC_LINKER(pid,pc) \ - error("catch of library loads/unloads not yet implemented on this platform") - */ - -#define SOLIB_IN_DYNAMIC_LINKER(pid,pc) \ -(0) - -/* This function must be called when the inferior is killed, and the program - restarted. This is not the same as CLEAR_SOLIB, in that it doesn't discard - any symbol tables. - - Presently, this functionality is not implemented. - */ -#define SOLIB_RESTART() \ - (0) - -/* If we can't set a breakpoint, and it's in a shared library, just - disable it. */ - -#define DISABLE_UNSETTABLE_BREAK(addr) (solib_address(addr) != NULL) - -extern char *solib_address (CORE_ADDR); /* solib.c */ +extern void solib_create_inferior_hook (void); /* If ADDR lies in a shared library, return its name. */ -#define PC_SOLIB(addr) solib_address (addr) +extern char *solib_address (CORE_ADDR); /* Return 1 if PC lies in the dynamic symbol resolution code of the run time loader. */ -#define IN_SOLIB_DYNSYM_RESOLVE_CODE(pc) in_solib_dynsym_resolve_code (pc) - -extern int in_solib_dynsym_resolve_code (CORE_ADDR); /* solib.c */ +extern int in_solib_dynsym_resolve_code (CORE_ADDR); /* Discard symbols that were auto-loaded from shared libraries. */ diff --git a/gdb/stack.c b/gdb/stack.c index 80f86bf..f0446aa 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -46,6 +46,7 @@ #include "exceptions.h" #include "reggroups.h" #include "regcache.h" +#include "solib.h" /* Prototypes for exported functions. */ @@ -686,10 +687,13 @@ print_frame (struct frame_info *fi, annotate_frame_source_end (); } -#ifdef PC_SOLIB if (!funname || (!sal.symtab || !sal.symtab->filename)) { +#ifdef PC_SOLIB char *lib = PC_SOLIB (get_frame_pc (fi)); +#else + char *lib = solib_address (get_frame_pc (fi)); +#endif if (lib) { annotate_frame_where (); @@ -698,7 +702,6 @@ print_frame (struct frame_info *fi, ui_out_field_string (uiout, "from", lib); } } -#endif /* PC_SOLIB */ /* do_cleanups will call ui_out_tuple_end() for us. */ do_cleanups (list_chain); diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c index 763f8f7..3c07566 100644 --- a/gdb/xcoffsolib.c +++ b/gdb/xcoffsolib.c @@ -157,24 +157,6 @@ sharedlibrary_command (char *pattern, int from_tty) } } -/* LOCAL FUNCTION - - no_shared_libraries -- handle command to explicitly discard symbols - from shared libraries. - - DESCRIPTION - - Implements the command "nosharedlibrary", which discards symbols - that have been auto-loaded from shared libraries. Symbols from - shared libraries that were added by explicit request of the user - are not discarded. Also called from remote.c. */ - -void -no_shared_libraries (char *ignored, int from_tty) -{ - /* FIXME */ -} - void _initialize_xcoffsolib (void) { |