RFC: don't disable shlib breakpoints in a.out executables
Jim Blandy
jimb@cygnus.com
Wed Jun 23 12:09:00 GMT 1999
The ChangeLog records some vacillation on this question; I think this
is the right solution. I've tested it on Linux, Solaris, and SunOS 4,
with good results.
Folks have expressed misgivings about testing the BFD flavor at
run-time, instead of having a platform-specific #define. The comment
in the code explains why the decision needs to be made at run-time.
In the long run, solib.c should be split into separate SysV and SunOS
modules.
1999-06-23 Jim Blandy <jimb@zwingli.cygnus.com>
* solib.c (clear_solib): Don't disable breakpoints if we're
running an a.out executable (Solaris's SunOS emulation).
Index: solib.c
===================================================================
RCS file: /cvs/cvsfiles/devo/gdb/solib.c,v
retrieving revision 1.124
diff -c -c -b -F'^(' -r1.124 solib.c
*** solib.c 1999/04/07 01:19:52 1.124
--- solib.c 1999/06/23 19:06:33
***************
*** 1306,1315 ****
/* Called by free_all_symtabs */
void
! clear_solib()
{
struct so_list *next;
char *bfd_filename;
while (so_list_head)
{
--- 1306,1339 ----
/* Called by free_all_symtabs */
void
! clear_solib ()
{
struct so_list *next;
char *bfd_filename;
+
+ /* This function is expected to handle ELF shared libraries. It is
+ also used on Solaris, which can run either ELF or a.out binaries
+ (for compatibility with SunOS 4), both of which can use shared
+ libraries. So we don't know whether we have an ELF executable or
+ an a.out executable until the user chooses an executable file.
+
+ ELF shared libraries don't get mapped into the address space
+ until after the program starts, so we'd better not try to insert
+ breakpoints in them immediately. We have to wait until the
+ dynamic linker has loaded them; we'll hit a bp_shlib_event
+ breakpoint (look for calls to create_solib_event_breakpoint) when
+ it's ready.
+
+ SunOS shared libraries seem to be different --- they're present
+ as soon as the process begins execution, so there's no need to
+ put off inserting breakpoints. There's also nowhere to put a
+ bp_shlib_event breakpoint, so if we put it off, we'll never get
+ around to it.
+
+ So: disable breakpoints only if we're using ELF shared libs. */
+ if (exec_bfd != NULL
+ && bfd_get_flavour (exec_bfd) != bfd_target_aout_flavour)
+ disable_breakpoints_in_shlibs (1);
while (so_list_head)
{
More information about the Gdb-patches
mailing list