aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1996-03-04 21:50:10 +0000
committerJeff Law <law@redhat.com>1996-03-04 21:50:10 +0000
commit11be829fa134e93be9c6f1f41afead451b9c06d6 (patch)
treed19618c2e172d8d84e98db09258b41aade4af9cb
parent421e2c270e512c5f812197fc2da3215279c8b932 (diff)
downloadgdb-11be829fa134e93be9c6f1f41afead451b9c06d6.zip
gdb-11be829fa134e93be9c6f1f41afead451b9c06d6.tar.gz
gdb-11be829fa134e93be9c6f1f41afead451b9c06d6.tar.bz2
* From Peter Schauer:
* infrun.c (wait_for_inferior): Remove breakpoints and switch terminal settings before calling SOLIB_ADD. * solib.c (enable_break, SVR4 variant): Don't map in symbols for the dynamic linker, the namespace pollution causes real problems.
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/infrun.c18
-rw-r--r--gdb/solib.c41
3 files changed, 34 insertions, 34 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 45bf2b4..4460998 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,12 @@
+Mon Mar 4 14:44:54 1996 Jeffrey A Law (law@cygnus.com)
+
+ * From Peter Schauer:
+ * infrun.c (wait_for_inferior): Remove breakpoints and
+ switch terminal settings before calling SOLIB_ADD.
+ * solib.c (enable_break, SVR4 variant): Don't map in symbols
+ for the dynamic linker, the namespace pollution causes real
+ problems.
+
Sun Mar 3 17:18:57 1996 James G. Smith <jsmith@cygnus.co.uk>
* remote-mips.c (common_breakpoint): Explicitly terminate the
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 19ff2d3..623e1da 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -1042,7 +1042,19 @@ wait_for_inferior ()
/* Check for any newly added shared libraries if we're
supposed to be adding them automatically. */
if (auto_solib_add)
- SOLIB_ADD (NULL, 0, NULL);
+ {
+ /* Remove breakpoints, SOLIB_ADD might adjust breakpoint
+ addresses via breakpoint_re_set. */
+ if (breakpoints_inserted)
+ remove_breakpoints ();
+ breakpoints_inserted = 0;
+
+ /* Switch terminal for any messages produced by
+ breakpoint_re_set. */
+ target_terminal_ours_for_output ();
+ SOLIB_ADD (NULL, 0, NULL);
+ target_terminal_inferior ();
+ }
/* If requested, stop when the dynamic linker notifies
gdb of events. This allows the user to get control
@@ -1658,7 +1670,9 @@ Further execution is probably impossible.\n");
target_terminal_ours ();
- if (stop_bpstat && stop_bpstat->breakpoint_at->type == bp_shlib_event)
+ if (stop_bpstat
+ && stop_bpstat->breakpoint_at
+ && stop_bpstat->breakpoint_at->type == bp_shlib_event)
printf_filtered ("Stopped due to shared library event\n");
/* Look up the hook_stop and run it if it exists. */
diff --git a/gdb/solib.c b/gdb/solib.c
index cc60196..d0319bf 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1371,9 +1371,7 @@ enable_break ()
#ifdef BKPT_AT_SYMBOL
struct minimal_symbol *msymbol;
- struct objfile *objfile;
char **bkpt_namep;
- CORE_ADDR bkpt_addr;
asection *interp_sect;
/* First, remove all the solib event breakpoints. Their addresses
@@ -1390,7 +1388,7 @@ enable_break ()
char *buf;
CORE_ADDR load_addr;
bfd *tmp_bfd;
- asection *lowest_sect;
+ CORE_ADDR sym_addr = 0;
/* Read the contents of the .interp section into a local buffer;
the contents specify the dynamic linker this program uses. */
@@ -1424,42 +1422,21 @@ enable_break ()
linker) and subtracting the offset of the entry point. */
load_addr = read_pc () - tmp_bfd->start_address;
- /* load_addr now has the base address of the dynamic linker;
- however, due to severe braindamage in syms_from_objfile
- we need to add the address of the .text section, or the
- lowest section of .text doesn't exist to work around the
- braindamage. Gross. */
- lowest_sect = bfd_get_section_by_name (tmp_bfd, ".text");
- if (lowest_sect == NULL)
- bfd_map_over_sections (tmp_bfd, find_lowest_section,
- (PTR) &lowest_sect);
-
- if (lowest_sect == NULL)
+ /* Now try to set a breakpoint in the dynamic linker. */
+ for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
{
- warning ("Unable to find base address for dynamic linker %s\n", buf);
- bfd_close (tmp_bfd);
- goto bkpt_at_symbol;
+ sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
+ if (sym_addr != 0)
+ break;
}
- load_addr += bfd_section_vma (tmp_bfd, lowest_sect);
-
/* We're done with the temporary bfd. */
bfd_close (tmp_bfd);
- /* Now make GDB aware of the symbols in the dynamic linker. Some
- might complain about namespace pollution, but as a developer I've
- often wanted these symbols available from within the debugger. */
- objfile = symbol_file_add (buf, 0, load_addr, 0, 0, 1);
-
- /* Now try to set a breakpoint in the dynamic linker. */
- for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
+ if (sym_addr != 0)
{
- msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objfile);
- if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
- {
- create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
- return 1;
- }
+ create_solib_event_breakpoint (load_addr + sym_addr);
+ return 1;
}
/* For whatever reason we couldn't set a breakpoint in the dynamic