mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-10-19 22:03:57 +08:00
Cleanup solib-aix5.c as suggested by J.T. Conklin.
This commit is contained in:
@ -1,3 +1,15 @@
|
|||||||
|
2001-02-20 Kevin Buettner <kevinb@redhat.com>
|
||||||
|
|
||||||
|
* solib-aix5.c (solib-svr4.h): Remove include.
|
||||||
|
(solib_break_names): Delete names which aren't actually
|
||||||
|
used by AIX5.
|
||||||
|
(bkpt_names): Remove.
|
||||||
|
(aix5_relocate_main_executable, bfd_lookup_symbol): Replace calls
|
||||||
|
to STREQ() with equivalent calls to strcmp().
|
||||||
|
(in_svr4_dynsym_resolve_code, enable_break, bfd_lookup_symbol,
|
||||||
|
aix5_solib_create_inferior_hook): Revise comments.
|
||||||
|
(enable_break): Remove old ``bkpt_names'' code.
|
||||||
|
|
||||||
2001-02-19 Andrew Cagney <ac131313@redhat.com>
|
2001-02-19 Andrew Cagney <ac131313@redhat.com>
|
||||||
|
|
||||||
* Makefile.in (SFILES): Add frame.c .
|
* Makefile.in (SFILES): Add frame.c .
|
||||||
|
@ -46,7 +46,6 @@
|
|||||||
#include "gdbcmd.h"
|
#include "gdbcmd.h"
|
||||||
|
|
||||||
#include "solist.h"
|
#include "solist.h"
|
||||||
#include "solib-svr4.h"
|
|
||||||
|
|
||||||
/* Link map info to include in an allocated so_list entry */
|
/* Link map info to include in an allocated so_list entry */
|
||||||
|
|
||||||
@ -71,30 +70,12 @@ struct lm_info
|
|||||||
char *membername; /* member name in archive file */
|
char *membername; /* member name in archive file */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* On SVR4 systems, a list of symbols in the dynamic linker where
|
/* List of symbols in the dynamic linker where GDB can try to place
|
||||||
GDB can try to place a breakpoint to monitor shared library
|
a breakpoint to monitor shared library events. */
|
||||||
events.
|
|
||||||
|
|
||||||
If none of these symbols are found, or other errors occur, then
|
|
||||||
SVR4 systems will fall back to using a symbol as the "startup
|
|
||||||
mapping complete" breakpoint address. */
|
|
||||||
|
|
||||||
static char *solib_break_names[] =
|
static char *solib_break_names[] =
|
||||||
{
|
{
|
||||||
"r_debug_state",
|
|
||||||
"_r_debug_state",
|
"_r_debug_state",
|
||||||
"_dl_debug_state",
|
|
||||||
"rtld_db_dlactivity",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *bkpt_names[] =
|
|
||||||
{
|
|
||||||
#ifdef SOLIB_BKPT_NAME
|
|
||||||
SOLIB_BKPT_NAME, /* Prefer configured name if it exists. */
|
|
||||||
#endif
|
|
||||||
"_start",
|
|
||||||
"main",
|
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -143,7 +124,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
|
|||||||
for (i = 0; i < number_of_symbols; i++)
|
for (i = 0; i < number_of_symbols; i++)
|
||||||
{
|
{
|
||||||
sym = *symbol_table++;
|
sym = *symbol_table++;
|
||||||
if (STREQ (sym->name, symname))
|
if (strcmp (sym->name, symname) == 0)
|
||||||
{
|
{
|
||||||
/* Bfd symbols are section relative. */
|
/* Bfd symbols are section relative. */
|
||||||
symaddr = sym->value + sym->section->vma;
|
symaddr = sym->value + sym->section->vma;
|
||||||
@ -156,8 +137,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
|
|||||||
if (symaddr)
|
if (symaddr)
|
||||||
return symaddr;
|
return symaddr;
|
||||||
|
|
||||||
/* On FreeBSD, the dynamic linker is stripped by default. So we'll
|
/* Look for the symbol in the dynamic string table too. */
|
||||||
have to check the dynamic string table too. */
|
|
||||||
|
|
||||||
storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
|
storage_needed = bfd_get_dynamic_symtab_upper_bound (abfd);
|
||||||
/* FIXME: This problem should be addressed in BFD. */
|
/* FIXME: This problem should be addressed in BFD. */
|
||||||
@ -174,7 +154,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
|
|||||||
for (i = 0; i < number_of_symbols; i++)
|
for (i = 0; i < number_of_symbols; i++)
|
||||||
{
|
{
|
||||||
sym = *symbol_table++;
|
sym = *symbol_table++;
|
||||||
if (STREQ (sym->name, symname))
|
if (strcmp (sym->name, symname) == 0)
|
||||||
{
|
{
|
||||||
/* Bfd symbols are section relative. */
|
/* Bfd symbols are section relative. */
|
||||||
symaddr = sym->value + sym->section->vma;
|
symaddr = sym->value + sym->section->vma;
|
||||||
@ -422,7 +402,7 @@ aix5_current_sos (void)
|
|||||||
|
|
||||||
|
|
||||||
/* Return 1 if PC lies in the dynamic symbol resolution code of the
|
/* Return 1 if PC lies in the dynamic symbol resolution code of the
|
||||||
SVR4 run time loader. */
|
run time loader. */
|
||||||
|
|
||||||
static CORE_ADDR interp_text_sect_low;
|
static CORE_ADDR interp_text_sect_low;
|
||||||
static CORE_ADDR interp_text_sect_high;
|
static CORE_ADDR interp_text_sect_high;
|
||||||
@ -450,35 +430,10 @@ in_svr4_dynsym_resolve_code (CORE_ADDR pc)
|
|||||||
|
|
||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
|
|
||||||
Both the SunOS and the SVR4 dynamic linkers have, as part of their
|
The dynamic linkers has, as part of its debugger interface, support
|
||||||
debugger interface, support for arranging for the inferior to hit
|
for arranging for the inferior to hit a breakpoint after mapping in
|
||||||
a breakpoint after mapping in the shared libraries. This function
|
the shared libraries. This function enables that breakpoint.
|
||||||
enables that breakpoint.
|
|
||||||
|
|
||||||
For SunOS, there is a special flag location (in_debugger) which we
|
|
||||||
set to 1. When the dynamic linker sees this flag set, it will set
|
|
||||||
a breakpoint at a location known only to itself, after saving the
|
|
||||||
original contents of that place and the breakpoint address itself,
|
|
||||||
in it's own internal structures. When we resume the inferior, it
|
|
||||||
will eventually take a SIGTRAP when it runs into the breakpoint.
|
|
||||||
We handle this (in a different place) by restoring the contents of
|
|
||||||
the breakpointed location (which is only known after it stops),
|
|
||||||
chasing around to locate the shared libraries that have been
|
|
||||||
loaded, then resuming.
|
|
||||||
|
|
||||||
For SVR4, the debugger interface structure contains a member (r_brk)
|
|
||||||
which is statically initialized at the time the shared library is
|
|
||||||
built, to the offset of a function (_r_debug_state) which is guaran-
|
|
||||||
teed to be called once before mapping in a library, and again when
|
|
||||||
the mapping is complete. At the time we are examining this member,
|
|
||||||
it contains only the unrelocated offset of the function, so we have
|
|
||||||
to do our own relocation. Later, when the dynamic linker actually
|
|
||||||
runs, it relocates r_brk to be the actual address of _r_debug_state().
|
|
||||||
|
|
||||||
The debugger interface structure also contains an enumeration which
|
|
||||||
is set to either RT_ADD or RT_DELETE prior to changing the mapping,
|
|
||||||
depending upon whether or not the library is being mapped or unmapped,
|
|
||||||
and then set to RT_CONSISTENT after the library is mapped/unmapped.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -582,19 +537,6 @@ enable_break (void)
|
|||||||
warning ("Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code.");
|
warning ("Unable to find dynamic linker breakpoint function.\nGDB will be unable to debug shared library initializers\nand track explicitly loaded dynamic code.");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scan through the list of symbols, trying to look up the symbol and
|
|
||||||
set a breakpoint there. Terminate loop when we/if we succeed. */
|
|
||||||
|
|
||||||
for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
|
|
||||||
{
|
|
||||||
msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
|
|
||||||
if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
|
|
||||||
{
|
|
||||||
create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Nothing good happened. */
|
/* Nothing good happened. */
|
||||||
success = 0;
|
success = 0;
|
||||||
|
|
||||||
@ -714,11 +656,11 @@ aix5_relocate_main_executable (void)
|
|||||||
point, this function gets called via expansion of the macro
|
point, this function gets called via expansion of the macro
|
||||||
SOLIB_CREATE_INFERIOR_HOOK.
|
SOLIB_CREATE_INFERIOR_HOOK.
|
||||||
|
|
||||||
For SVR4 executables, this first instruction is either the first
|
For AIX5 executables, this first instruction is the first
|
||||||
instruction in the dynamic linker (for dynamically linked
|
instruction in the dynamic linker (for dynamically linked
|
||||||
executables) or the instruction at "start" for statically linked
|
executables) or the instruction at "start" for statically linked
|
||||||
executables. For dynamically linked executables, the system
|
executables. For dynamically linked executables, the system
|
||||||
first exec's /lib/libc.so.N, which contains the dynamic linker,
|
first exec's libc.so.N, which contains the dynamic linker,
|
||||||
and starts it running. The dynamic linker maps in any needed
|
and starts it running. The dynamic linker maps in any needed
|
||||||
shared libraries, maps in the actual user executable, and then
|
shared libraries, maps in the actual user executable, and then
|
||||||
jumps to "start" in the user executable.
|
jumps to "start" in the user executable.
|
||||||
|
Reference in New Issue
Block a user