* 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.
This commit is contained in:
parent
421e2c270e
commit
11be829fa1
|
@ -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>
|
Sun Mar 3 17:18:57 1996 James G. Smith <jsmith@cygnus.co.uk>
|
||||||
|
|
||||||
* remote-mips.c (common_breakpoint): Explicitly terminate the
|
* remote-mips.c (common_breakpoint): Explicitly terminate the
|
||||||
|
|
18
gdb/infrun.c
18
gdb/infrun.c
|
@ -1042,7 +1042,19 @@ wait_for_inferior ()
|
||||||
/* Check for any newly added shared libraries if we're
|
/* Check for any newly added shared libraries if we're
|
||||||
supposed to be adding them automatically. */
|
supposed to be adding them automatically. */
|
||||||
if (auto_solib_add)
|
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
|
/* If requested, stop when the dynamic linker notifies
|
||||||
gdb of events. This allows the user to get control
|
gdb of events. This allows the user to get control
|
||||||
|
@ -1658,7 +1670,9 @@ Further execution is probably impossible.\n");
|
||||||
|
|
||||||
target_terminal_ours ();
|
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");
|
printf_filtered ("Stopped due to shared library event\n");
|
||||||
|
|
||||||
/* Look up the hook_stop and run it if it exists. */
|
/* Look up the hook_stop and run it if it exists. */
|
||||||
|
|
41
gdb/solib.c
41
gdb/solib.c
|
@ -1371,9 +1371,7 @@ enable_break ()
|
||||||
#ifdef BKPT_AT_SYMBOL
|
#ifdef BKPT_AT_SYMBOL
|
||||||
|
|
||||||
struct minimal_symbol *msymbol;
|
struct minimal_symbol *msymbol;
|
||||||
struct objfile *objfile;
|
|
||||||
char **bkpt_namep;
|
char **bkpt_namep;
|
||||||
CORE_ADDR bkpt_addr;
|
|
||||||
asection *interp_sect;
|
asection *interp_sect;
|
||||||
|
|
||||||
/* First, remove all the solib event breakpoints. Their addresses
|
/* First, remove all the solib event breakpoints. Their addresses
|
||||||
|
@ -1390,7 +1388,7 @@ enable_break ()
|
||||||
char *buf;
|
char *buf;
|
||||||
CORE_ADDR load_addr;
|
CORE_ADDR load_addr;
|
||||||
bfd *tmp_bfd;
|
bfd *tmp_bfd;
|
||||||
asection *lowest_sect;
|
CORE_ADDR sym_addr = 0;
|
||||||
|
|
||||||
/* Read the contents of the .interp section into a local buffer;
|
/* Read the contents of the .interp section into a local buffer;
|
||||||
the contents specify the dynamic linker this program uses. */
|
the contents specify the dynamic linker this program uses. */
|
||||||
|
@ -1424,42 +1422,21 @@ enable_break ()
|
||||||
linker) and subtracting the offset of the entry point. */
|
linker) and subtracting the offset of the entry point. */
|
||||||
load_addr = read_pc () - tmp_bfd->start_address;
|
load_addr = read_pc () - tmp_bfd->start_address;
|
||||||
|
|
||||||
/* load_addr now has the base address of the dynamic linker;
|
/* Now try to set a breakpoint in the dynamic linker. */
|
||||||
however, due to severe braindamage in syms_from_objfile
|
for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
warning ("Unable to find base address for dynamic linker %s\n", buf);
|
sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
|
||||||
bfd_close (tmp_bfd);
|
if (sym_addr != 0)
|
||||||
goto bkpt_at_symbol;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
load_addr += bfd_section_vma (tmp_bfd, lowest_sect);
|
|
||||||
|
|
||||||
/* We're done with the temporary bfd. */
|
/* We're done with the temporary bfd. */
|
||||||
bfd_close (tmp_bfd);
|
bfd_close (tmp_bfd);
|
||||||
|
|
||||||
/* Now make GDB aware of the symbols in the dynamic linker. Some
|
if (sym_addr != 0)
|
||||||
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++)
|
|
||||||
{
|
{
|
||||||
msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objfile);
|
create_solib_event_breakpoint (load_addr + sym_addr);
|
||||||
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
return 1;
|
||||||
{
|
|
||||||
create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For whatever reason we couldn't set a breakpoint in the dynamic
|
/* For whatever reason we couldn't set a breakpoint in the dynamic
|
||||||
|
|
Loading…
Reference in New Issue