2011-08-09 Pedro Alves <pedro@codesourcery.com>
gdb/ * elfread.c (elf_symtab_read): Ditto. * maint.c (maintenance_command): Ditto. * somread.c (som_symtab_read): Ditto. * solib.c (solib_find, solib_map_sections, update_solib_list) (solib_add, info_sharedlibrary_command, solib_name_from_address) (solib_create_inferior_hook, in_solib_dynsym_resolve_code) (sharedlibrary_command, no_shared_libraries): Rework comments. * solib-irix.c (locate_base, disable_break, enable_break) (irix_solib_create_inferior_hook, irix_solib_create_inferior_hook) (irix_current_sos, irix_open_symbol_file_object) (irix_special_symbol_handling): Ditto. * solib-sunos.c (locate_base, first_link_map_member) (sunos_current_sos, disable_break, enable_break) (sunos_special_symbol_handling, sunos_solib_create_inferior_hook): Ditto. * solib-svr4.c (bfd_lookup_symbol, elf_locate_base, locate_base) (open_symbol_file_object, svr4_current_sos, enable_break) (svr4_special_symbol_handling, svr4_solib_create_inferior_hook): Ditto. * solib-frv.c (bfd_lookup_symbol, open_symbol_file_object) (frv_current_sos, enable_break, frv_special_symbol_handling) (frv_solib_create_inferior_hook): Ditto. * solist.h (struct target_so_ops): Extend the comments of the special_symbol_handling, current_sos and open_symbol_file_object methods.
This commit is contained in:
parent
5e239b84ac
commit
7f86f0587f
10 changed files with 150 additions and 692 deletions
|
@ -1,3 +1,31 @@
|
||||||
|
2011-08-09 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* elfread.c (elf_symtab_read): Ditto.
|
||||||
|
* maint.c (maintenance_command): Ditto.
|
||||||
|
* somread.c (som_symtab_read): Ditto.
|
||||||
|
* solib.c (solib_find, solib_map_sections, update_solib_list)
|
||||||
|
(solib_add, info_sharedlibrary_command, solib_name_from_address)
|
||||||
|
(solib_create_inferior_hook, in_solib_dynsym_resolve_code)
|
||||||
|
(sharedlibrary_command, no_shared_libraries): Rework comments.
|
||||||
|
* solib-irix.c (locate_base, disable_break, enable_break)
|
||||||
|
(irix_solib_create_inferior_hook, irix_solib_create_inferior_hook)
|
||||||
|
(irix_current_sos, irix_open_symbol_file_object)
|
||||||
|
(irix_special_symbol_handling): Ditto.
|
||||||
|
* solib-sunos.c (locate_base, first_link_map_member)
|
||||||
|
(sunos_current_sos, disable_break, enable_break)
|
||||||
|
(sunos_special_symbol_handling, sunos_solib_create_inferior_hook):
|
||||||
|
Ditto.
|
||||||
|
* solib-svr4.c (bfd_lookup_symbol, elf_locate_base, locate_base)
|
||||||
|
(open_symbol_file_object, svr4_current_sos, enable_break)
|
||||||
|
(svr4_special_symbol_handling, svr4_solib_create_inferior_hook):
|
||||||
|
Ditto.
|
||||||
|
* solib-frv.c (bfd_lookup_symbol, open_symbol_file_object)
|
||||||
|
(frv_current_sos, enable_break, frv_special_symbol_handling)
|
||||||
|
(frv_solib_create_inferior_hook): Ditto.
|
||||||
|
* solist.h (struct target_so_ops): Extend the comments of the
|
||||||
|
special_symbol_handling, current_sos and open_symbol_file_object
|
||||||
|
methods.
|
||||||
|
|
||||||
2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
2011-08-09 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
* python/lib/gdb/__init__.py: Auto-load files in command and
|
* python/lib/gdb/__init__.py: Auto-load files in command and
|
||||||
|
|
|
@ -206,18 +206,7 @@ record_minimal_symbol (const char *name, int name_len, int copy_name,
|
||||||
bfd_section, objfile);
|
bfd_section, objfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Read the symbol table of an ELF file.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
elf_symtab_read -- read the symbol table of an ELF file
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void elf_symtab_read (struct objfile *objfile, int type,
|
|
||||||
long number_of_symbols, asymbol **symbol_table)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Given an objfile, a symbol table, and a flag indicating whether the
|
Given an objfile, a symbol table, and a flag indicating whether the
|
||||||
symbol table contains regular, dynamic, or synthetic symbols, add all
|
symbol table contains regular, dynamic, or synthetic symbols, add all
|
||||||
|
@ -227,9 +216,7 @@ record_minimal_symbol (const char *name, int name_len, int copy_name,
|
||||||
defined in the ELF symbol table, which can be used to locate
|
defined in the ELF symbol table, which can be used to locate
|
||||||
the beginnings of sections from each ".o" file that was linked to
|
the beginnings of sections from each ".o" file that was linked to
|
||||||
form the executable objfile. We gather any such info and record it
|
form the executable objfile. We gather any such info and record it
|
||||||
in data structures hung off the objfile's private data.
|
in data structures hung off the objfile's private data. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define ST_REGULAR 0
|
#define ST_REGULAR 0
|
||||||
#define ST_DYNAMIC 1
|
#define ST_DYNAMIC 1
|
||||||
|
|
14
gdb/maint.c
14
gdb/maint.c
|
@ -74,19 +74,7 @@ show_watchdog (struct ui_file *file, int from_tty,
|
||||||
fprintf_filtered (file, _("Watchdog timer is %s.\n"), value);
|
fprintf_filtered (file, _("Watchdog timer is %s.\n"), value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Access the maintenance subcommands. */
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
maintenance_command -- access the maintenance subcommands
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void maintenance_command (char *args, int from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
maintenance_command (char *args, int from_tty)
|
maintenance_command (char *args, int from_tty)
|
||||||
|
|
115
gdb/solib-frv.c
115
gdb/solib-frv.c
|
@ -239,17 +239,7 @@ static void frv_relocate_main_executable (void);
|
||||||
static CORE_ADDR main_got (void);
|
static CORE_ADDR main_got (void);
|
||||||
static int enable_break2 (void);
|
static int enable_break2 (void);
|
||||||
|
|
||||||
/*
|
/* Lookup the value for a specific symbol.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
bfd_lookup_symbol -- lookup the value for a specific symbol
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
An expensive way to lookup the value of a single symbol for
|
An expensive way to lookup the value of a single symbol for
|
||||||
bfd's that are only temporary anyway. This is used by the
|
bfd's that are only temporary anyway. This is used by the
|
||||||
|
@ -257,8 +247,7 @@ static int enable_break2 (void);
|
||||||
interface structures in the shared library.
|
interface structures in the shared library.
|
||||||
|
|
||||||
Note that 0 is specifically allowed as an error return (no
|
Note that 0 is specifically allowed as an error return (no
|
||||||
such symbol).
|
such symbol). */
|
||||||
*/
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
bfd_lookup_symbol (bfd *abfd, char *symname)
|
bfd_lookup_symbol (bfd *abfd, char *symname)
|
||||||
|
@ -321,26 +310,7 @@ bfd_lookup_symbol (bfd *abfd, char *symname)
|
||||||
return symaddr;
|
return symaddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implement the "open_symbol_file_object" target_so_ops method. */
|
||||||
/*
|
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
open_symbol_file_object
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void open_symbol_file_object (void *from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
If no open symbol file, attempt to locate and open the main symbol
|
|
||||||
file.
|
|
||||||
|
|
||||||
If FROM_TTYP dereferences to a non-zero integer, allow messages to
|
|
||||||
be printed. This parameter is a pointer rather than an int because
|
|
||||||
open_symbol_file_object() is called via catch_errors() and
|
|
||||||
catch_errors() requires a pointer argument. */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
open_symbol_file_object (void *from_ttyp)
|
open_symbol_file_object (void *from_ttyp)
|
||||||
|
@ -413,24 +383,7 @@ lm_base (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Implement the "current_sos" target_so_ops method. */
|
||||||
|
|
||||||
frv_current_sos -- build a list of currently loaded shared objects
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
struct so_list *frv_current_sos ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Build a list of `struct so_list' objects describing the shared
|
|
||||||
objects currently loaded in the inferior. This list does not
|
|
||||||
include an entry for the main executable file.
|
|
||||||
|
|
||||||
Note that we only gather information directly available from the
|
|
||||||
inferior --- we don't examine any of the shared library files
|
|
||||||
themselves. The declaration of `struct so_list' says which fields
|
|
||||||
we provide values for. */
|
|
||||||
|
|
||||||
static struct so_list *
|
static struct so_list *
|
||||||
frv_current_sos (void)
|
frv_current_sos (void)
|
||||||
|
@ -601,17 +554,7 @@ enable_break_failure_warning (void)
|
||||||
"and track explicitly loaded dynamic code."));
|
"and track explicitly loaded dynamic code."));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Arrange for dynamic linker to hit breakpoint.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
enable_break -- arrange for dynamic linker to hit breakpoint
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
int enable_break (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
The dynamic linkers has, as part of its debugger interface, support
|
The dynamic linkers has, as part of its debugger interface, support
|
||||||
for arranging for the inferior to hit a breakpoint after mapping in
|
for arranging for the inferior to hit a breakpoint after mapping in
|
||||||
|
@ -631,9 +574,7 @@ enable_break_failure_warning (void)
|
||||||
using the interpreter's loadmap. Once the relocated address
|
using the interpreter's loadmap. Once the relocated address
|
||||||
is known, we fetch the value (address) corresponding to r_brk
|
is known, we fetch the value (address) corresponding to r_brk
|
||||||
and then use that value to fetch the entry point of the function
|
and then use that value to fetch the entry point of the function
|
||||||
we're interested in.
|
we're interested in. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int enable_break2_done = 0;
|
static int enable_break2_done = 0;
|
||||||
|
|
||||||
|
@ -884,28 +825,12 @@ enable_break (void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "special_symbol_handling" target_so_ops method. */
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
special_symbol_handling -- additional shared library symbol handling
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void special_symbol_handling ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Once the symbols from a shared object have been loaded in the usual
|
|
||||||
way, we are called to do any system specific symbol handling that
|
|
||||||
is needed.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
frv_special_symbol_handling (void)
|
frv_special_symbol_handling (void)
|
||||||
{
|
{
|
||||||
/* Nothing needed (yet) for FRV. */
|
/* Nothing needed for FRV. */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -983,27 +908,11 @@ frv_relocate_main_executable (void)
|
||||||
main_executable_lm_info->got_value = main_got ();
|
main_executable_lm_info->got_value = main_got ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "create_inferior_hook" target_solib_ops method.
|
||||||
|
|
||||||
GLOBAL FUNCTION
|
For the FR-V shared library ABI (FDPIC), the main executable needs
|
||||||
|
to be relocated. The shared library breakpoints also need to be
|
||||||
frv_solib_create_inferior_hook -- shared library startup support
|
enabled. */
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void frv_solib_create_inferior_hook ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
When gdb starts up the inferior, it nurses it along (through the
|
|
||||||
shell) until it is ready to execute it's first instruction. At this
|
|
||||||
point, this function gets called via expansion of the macro
|
|
||||||
SOLIB_CREATE_INFERIOR_HOOK.
|
|
||||||
|
|
||||||
For the FR-V shared library ABI (FDPIC), the main executable
|
|
||||||
needs to be relocated. The shared library breakpoints also need
|
|
||||||
to be enabled.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
frv_solib_create_inferior_hook (int from_tty)
|
frv_solib_create_inferior_hook (int from_tty)
|
||||||
|
|
137
gdb/solib-irix.c
137
gdb/solib-irix.c
|
@ -244,17 +244,7 @@ static void *base_breakpoint;
|
||||||
|
|
||||||
static CORE_ADDR debug_base; /* Base of dynamic linker structures. */
|
static CORE_ADDR debug_base; /* Base of dynamic linker structures. */
|
||||||
|
|
||||||
/*
|
/* Locate the base address of dynamic linker structs.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
locate_base -- locate the base address of dynamic linker structs
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
CORE_ADDR locate_base (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
For both the SunOS and SVR4 shared library implementations, if the
|
For both the SunOS and SVR4 shared library implementations, if the
|
||||||
inferior executable has been linked dynamically, there is a single
|
inferior executable has been linked dynamically, there is a single
|
||||||
|
@ -287,9 +277,7 @@ static CORE_ADDR debug_base; /* Base of dynamic linker structures. */
|
||||||
we need to find this address. We may be stopped on the first instruc-
|
we need to find this address. We may be stopped on the first instruc-
|
||||||
tion of the interpreter (C shared library), the first instruction of
|
tion of the interpreter (C shared library), the first instruction of
|
||||||
the executable itself, or somewhere else entirely (if we attached
|
the executable itself, or somewhere else entirely (if we attached
|
||||||
to the process for example).
|
to the process for example). */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
locate_base (void)
|
locate_base (void)
|
||||||
|
@ -305,22 +293,10 @@ locate_base (void)
|
||||||
return (address);
|
return (address);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Remove the "mapping changed" breakpoint.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
disable_break -- remove the "mapping changed" breakpoint
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static int disable_break ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Removes the breakpoint that gets hit when the dynamic linker
|
Removes the breakpoint that gets hit when the dynamic linker
|
||||||
completes a mapping change.
|
completes a mapping change. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
disable_break (void)
|
disable_break (void)
|
||||||
|
@ -346,21 +322,10 @@ disable_break (void)
|
||||||
return (status);
|
return (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Arrange for dynamic linker to hit breakpoint.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
enable_break -- arrange for dynamic linker to hit breakpoint
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
int enable_break (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
This functions inserts a breakpoint at the entry point of the
|
This functions inserts a breakpoint at the entry point of the
|
||||||
main executable, where all shared libraries are mapped in.
|
main executable, where all shared libraries are mapped in. */
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
enable_break (void)
|
enable_break (void)
|
||||||
|
@ -384,22 +349,7 @@ enable_break (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "create_inferior_hook" target_solib_ops method.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
irix_solib_create_inferior_hook -- shared library startup support
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void solib_create_inferior_hook (int from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
When gdb starts up the inferior, it nurses it along (through the
|
|
||||||
shell) until it is ready to execute it's first instruction. At this
|
|
||||||
point, this function gets called via expansion of the macro
|
|
||||||
SOLIB_CREATE_INFERIOR_HOOK.
|
|
||||||
|
|
||||||
For SunOS executables, this first instruction is typically the
|
For SunOS executables, this first instruction is typically the
|
||||||
one at "_start", or a similar text label, regardless of whether
|
one at "_start", or a similar text label, regardless of whether
|
||||||
|
@ -433,8 +383,7 @@ enable_break (void)
|
||||||
handling will probably have to wait until the implementation is
|
handling will probably have to wait until the implementation is
|
||||||
changed to use the "breakpoint handler function" method.
|
changed to use the "breakpoint handler function" method.
|
||||||
|
|
||||||
Also, what if child has exit()ed? Must exit loop somehow.
|
Also, what if child has exit()ed? Must exit loop somehow. */
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
irix_solib_create_inferior_hook (int from_tty)
|
irix_solib_create_inferior_hook (int from_tty)
|
||||||
|
@ -499,24 +448,7 @@ irix_solib_create_inferior_hook (int from_tty)
|
||||||
inf->control.stop_soon = NO_STOP_QUIETLY;
|
inf->control.stop_soon = NO_STOP_QUIETLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Implement the "current_sos" target_so_ops method. */
|
||||||
|
|
||||||
current_sos -- build a list of currently loaded shared objects
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
struct so_list *current_sos ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Build a list of `struct so_list' objects describing the shared
|
|
||||||
objects currently loaded in the inferior. This list does not
|
|
||||||
include an entry for the main executable file.
|
|
||||||
|
|
||||||
Note that we only gather information directly available from the
|
|
||||||
inferior --- we don't examine any of the shared library files
|
|
||||||
themselves. The declaration of `struct so_list' says which fields
|
|
||||||
we provide values for. */
|
|
||||||
|
|
||||||
static struct so_list *
|
static struct so_list *
|
||||||
irix_current_sos (void)
|
irix_current_sos (void)
|
||||||
|
@ -603,27 +535,12 @@ irix_current_sos (void)
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "open_symbol_file_object" target_so_ops method.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
If no open symbol file, attempt to locate and open the main symbol
|
||||||
|
file. On IRIX, this is the first link map entry. If its name is
|
||||||
irix_open_symbol_file_object
|
here, we can open it. Useful when attaching to a process without
|
||||||
|
first loading its symbol file. */
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void irix_open_symbol_file_object (void *from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
If no open symbol file, attempt to locate and open the main symbol
|
|
||||||
file. On IRIX, this is the first link map entry. If its name is
|
|
||||||
here, we can open it. Useful when attaching to a process without
|
|
||||||
first loading its symbol file.
|
|
||||||
|
|
||||||
If FROM_TTYP dereferences to a non-zero integer, allow messages to
|
|
||||||
be printed. This parameter is a pointer rather than an int because
|
|
||||||
open_symbol_file_object() is called via catch_errors() and
|
|
||||||
catch_errors() requires a pointer argument. */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
irix_open_symbol_file_object (void *from_ttyp)
|
irix_open_symbol_file_object (void *from_ttyp)
|
||||||
|
@ -676,31 +593,9 @@ irix_open_symbol_file_object (void *from_ttyp)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implement the "special_symbol_handling" target_so_ops method.
|
||||||
|
|
||||||
/*
|
For IRIX, there's nothing to do. */
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
irix_special_symbol_handling -- additional shared library symbol handling
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void irix_special_symbol_handling ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Once the symbols from a shared object have been loaded in the usual
|
|
||||||
way, we are called to do any system specific symbol handling that
|
|
||||||
is needed.
|
|
||||||
|
|
||||||
For SunOS4, this consisted of grunging around in the dynamic
|
|
||||||
linkers structures to find symbol definitions for "common" symbols
|
|
||||||
and adding them to the minimal symbol table for the runtime common
|
|
||||||
objfile.
|
|
||||||
|
|
||||||
However, for IRIX, there's nothing to do.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
irix_special_symbol_handling (void)
|
irix_special_symbol_handling (void)
|
||||||
|
|
|
@ -274,17 +274,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/* Locate the base address of dynamic linker structs.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
locate_base -- locate the base address of dynamic linker structs
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
CORE_ADDR locate_base (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
For both the SunOS and SVR4 shared library implementations, if the
|
For both the SunOS and SVR4 shared library implementations, if the
|
||||||
inferior executable has been linked dynamically, there is a single
|
inferior executable has been linked dynamically, there is a single
|
||||||
|
@ -307,9 +297,7 @@ solib_add_common_symbols (CORE_ADDR rtc_symp)
|
||||||
to a lot more work to discover the address of the debug base symbol.
|
to a lot more work to discover the address of the debug base symbol.
|
||||||
Because of this complexity, we cache the value we find and return that
|
Because of this complexity, we cache the value we find and return that
|
||||||
value on subsequent invocations. Note there is no copy in the
|
value on subsequent invocations. Note there is no copy in the
|
||||||
executable symbol tables.
|
executable symbol tables. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
locate_base (void)
|
locate_base (void)
|
||||||
|
@ -334,17 +322,7 @@ locate_base (void)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Locate first member in dynamic linker's map.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
first_link_map_member -- locate first member in dynamic linker's map
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static CORE_ADDR first_link_map_member (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Find the first element in the inferior's dynamic link map, and
|
Find the first element in the inferior's dynamic link map, and
|
||||||
return its address in the inferior. This function doesn't copy the
|
return its address in the inferior. This function doesn't copy the
|
||||||
|
@ -375,24 +353,7 @@ open_symbol_file_object (void *from_ttyp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Implement the "current_sos" target_so_ops method. */
|
||||||
|
|
||||||
current_sos -- build a list of currently loaded shared objects
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
struct so_list *current_sos ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Build a list of `struct so_list' objects describing the shared
|
|
||||||
objects currently loaded in the inferior. This list does not
|
|
||||||
include an entry for the main executable file.
|
|
||||||
|
|
||||||
Note that we only gather information directly available from the
|
|
||||||
inferior --- we don't examine any of the shared library files
|
|
||||||
themselves. The declaration of `struct so_list' says which fields
|
|
||||||
we provide values for. */
|
|
||||||
|
|
||||||
static struct so_list *
|
static struct so_list *
|
||||||
sunos_current_sos (void)
|
sunos_current_sos (void)
|
||||||
|
@ -495,22 +456,10 @@ sunos_in_dynsym_resolve_code (CORE_ADDR pc)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Remove the "mapping changed" breakpoint.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
disable_break -- remove the "mapping changed" breakpoint
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static int disable_break ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Removes the breakpoint that gets hit when the dynamic linker
|
Removes the breakpoint that gets hit when the dynamic linker
|
||||||
completes a mapping change.
|
completes a mapping change. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
disable_break (void)
|
disable_break (void)
|
||||||
|
@ -547,18 +496,7 @@ disable_break (void)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Arrange for dynamic linker to hit breakpoint.
|
||||||
/*
|
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
enable_break -- arrange for dynamic linker to hit breakpoint
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
int enable_break (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Both the SunOS and the SVR4 dynamic linkers have, as part of their
|
Both the SunOS and the SVR4 dynamic linkers have, as part of their
|
||||||
debugger interface, support for arranging for the inferior to hit
|
debugger interface, support for arranging for the inferior to hit
|
||||||
|
@ -587,9 +525,9 @@ disable_break (void)
|
||||||
|
|
||||||
The debugger interface structure also contains an enumeration which
|
The debugger interface structure also contains an enumeration which
|
||||||
is set to either RT_ADD or RT_DELETE prior to changing the mapping,
|
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,
|
depending upon whether or not the library is being mapped or
|
||||||
and then set to RT_CONSISTENT after the library is mapped/unmapped.
|
unmapped, and then set to RT_CONSISTENT after the library is
|
||||||
*/
|
mapped/unmapped. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
enable_break (void)
|
enable_break (void)
|
||||||
|
@ -626,28 +564,12 @@ enable_break (void)
|
||||||
return (success);
|
return (success);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "special_symbol_handling" target_so_ops method.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
special_symbol_handling -- additional shared library symbol handling
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void special_symbol_handling ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Once the symbols from a shared object have been loaded in the usual
|
|
||||||
way, we are called to do any system specific symbol handling that
|
|
||||||
is needed.
|
|
||||||
|
|
||||||
For SunOS4, this consists of grunging around in the dynamic
|
For SunOS4, this consists of grunging around in the dynamic
|
||||||
linkers structures to find symbol definitions for "common" symbols
|
linkers structures to find symbol definitions for "common" symbols
|
||||||
and adding them to the minimal symbol table for the runtime common
|
and adding them to the minimal symbol table for the runtime common
|
||||||
objfile.
|
objfile. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sunos_special_symbol_handling (void)
|
sunos_special_symbol_handling (void)
|
||||||
|
@ -689,22 +611,7 @@ sunos_special_symbol_handling (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "create_inferior_hook" target_solib_ops method.
|
||||||
|
|
||||||
GLOBAL FUNCTION
|
|
||||||
|
|
||||||
sunos_solib_create_inferior_hook -- shared library startup support
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void sunos_solib_create_inferior_hook ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
When gdb starts up the inferior, it nurses it along (through the
|
|
||||||
shell) until it is ready to execute it's first instruction. At this
|
|
||||||
point, this function gets called via expansion of the macro
|
|
||||||
SOLIB_CREATE_INFERIOR_HOOK.
|
|
||||||
|
|
||||||
For SunOS executables, this first instruction is typically the
|
For SunOS executables, this first instruction is typically the
|
||||||
one at "_start", or a similar text label, regardless of whether
|
one at "_start", or a similar text label, regardless of whether
|
||||||
|
@ -712,19 +619,9 @@ sunos_special_symbol_handling (void)
|
||||||
startup code takes care of dynamically linking in any shared
|
startup code takes care of dynamically linking in any shared
|
||||||
libraries, once gdb allows the inferior to continue.
|
libraries, once gdb allows the inferior to continue.
|
||||||
|
|
||||||
For SVR4 executables, this first instruction is either the first
|
We can arrange to cooperate with the dynamic linker to discover the
|
||||||
instruction in the dynamic linker (for dynamically linked
|
names of shared libraries that are dynamically linked, and the base
|
||||||
executables) or the instruction at "start" for statically linked
|
addresses to which they are linked.
|
||||||
executables. For dynamically linked executables, the system
|
|
||||||
first exec's /lib/libc.so.N, which contains the dynamic linker,
|
|
||||||
and starts it running. The dynamic linker maps in any needed
|
|
||||||
shared libraries, maps in the actual user executable, and then
|
|
||||||
jumps to "start" in the user executable.
|
|
||||||
|
|
||||||
For both SunOS shared libraries, and SVR4 shared libraries, we
|
|
||||||
can arrange to cooperate with the dynamic linker to discover the
|
|
||||||
names of shared libraries that are dynamically linked, and the
|
|
||||||
base addresses to which they are linked.
|
|
||||||
|
|
||||||
This function is responsible for discovering those names and
|
This function is responsible for discovering those names and
|
||||||
addresses, and saving sufficient information about them to allow
|
addresses, and saving sufficient information about them to allow
|
||||||
|
@ -738,8 +635,7 @@ sunos_special_symbol_handling (void)
|
||||||
handling will probably have to wait until the implementation is
|
handling will probably have to wait until the implementation is
|
||||||
changed to use the "breakpoint handler function" method.
|
changed to use the "breakpoint handler function" method.
|
||||||
|
|
||||||
Also, what if child has exit()ed? Must exit loop somehow.
|
Also, what if child has exit()ed? Must exit loop somehow. */
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sunos_solib_create_inferior_hook (int from_tty)
|
sunos_solib_create_inferior_hook (int from_tty)
|
||||||
|
|
168
gdb/solib-svr4.c
168
gdb/solib-svr4.c
|
@ -370,17 +370,7 @@ get_svr4_info (void)
|
||||||
|
|
||||||
static int match_main (const char *);
|
static int match_main (const char *);
|
||||||
|
|
||||||
/*
|
/* Lookup the value for a specific symbol.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
bfd_lookup_symbol -- lookup the value for a specific symbol
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
An expensive way to lookup the value of a single symbol for
|
An expensive way to lookup the value of a single symbol for
|
||||||
bfd's that are only temporary anyway. This is used by the
|
bfd's that are only temporary anyway. This is used by the
|
||||||
|
@ -392,8 +382,7 @@ static int match_main (const char *);
|
||||||
if this architecture uses function descriptors.
|
if this architecture uses function descriptors.
|
||||||
|
|
||||||
Note that 0 is specifically allowed as an error return (no
|
Note that 0 is specifically allowed as an error return (no
|
||||||
such symbol).
|
such symbol). */
|
||||||
*/
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
bfd_lookup_symbol (bfd *abfd, const char *symname)
|
bfd_lookup_symbol (bfd *abfd, const char *symname)
|
||||||
|
@ -764,19 +753,8 @@ scan_dyntag_auxv (int dyntag, CORE_ADDR *ptr)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Locate the base address of dynamic linker structs for SVR4 elf
|
||||||
/*
|
targets.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
elf_locate_base -- locate the base address of dynamic linker structs
|
|
||||||
for SVR4 elf targets.
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
CORE_ADDR elf_locate_base (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
For SVR4 elf targets the address of the dynamic linker's runtime
|
For SVR4 elf targets the address of the dynamic linker's runtime
|
||||||
structure is contained within the dynamic info section in the
|
structure is contained within the dynamic info section in the
|
||||||
|
@ -785,9 +763,7 @@ scan_dyntag_auxv (int dyntag, CORE_ADDR *ptr)
|
||||||
real address before starting the inferior, we have to read in the
|
real address before starting the inferior, we have to read in the
|
||||||
dynamic info section from the inferior address space.
|
dynamic info section from the inferior address space.
|
||||||
If there are any errors while trying to find the address, we
|
If there are any errors while trying to find the address, we
|
||||||
silently return 0, otherwise the found address is returned.
|
silently return 0, otherwise the found address is returned. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
elf_locate_base (void)
|
elf_locate_base (void)
|
||||||
|
@ -828,17 +804,7 @@ elf_locate_base (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Locate the base address of dynamic linker structs.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
locate_base -- locate the base address of dynamic linker structs
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
CORE_ADDR locate_base (struct svr4_info *)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
For both the SunOS and SVR4 shared library implementations, if the
|
For both the SunOS and SVR4 shared library implementations, if the
|
||||||
inferior executable has been linked dynamically, there is a single
|
inferior executable has been linked dynamically, there is a single
|
||||||
|
@ -861,9 +827,7 @@ elf_locate_base (void)
|
||||||
to a lot more work to discover the address of the debug base symbol.
|
to a lot more work to discover the address of the debug base symbol.
|
||||||
Because of this complexity, we cache the value we find and return that
|
Because of this complexity, we cache the value we find and return that
|
||||||
value on subsequent invocations. Note there is no copy in the
|
value on subsequent invocations. Note there is no copy in the
|
||||||
executable symbol tables.
|
executable symbol tables. */
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
locate_base (struct svr4_info *info)
|
locate_base (struct svr4_info *info)
|
||||||
|
@ -983,27 +947,12 @@ svr4_keep_data_in_core (CORE_ADDR vaddr, unsigned long size)
|
||||||
return (name_lm >= vaddr && name_lm < vaddr + size);
|
return (name_lm >= vaddr && name_lm < vaddr + size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "open_symbol_file_object" target_so_ops method.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
If no open symbol file, attempt to locate and open the main symbol
|
||||||
|
file. On SVR4 systems, this is the first link map entry. If its
|
||||||
open_symbol_file_object
|
name is here, we can open it. Useful when attaching to a process
|
||||||
|
without first loading its symbol file. */
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void open_symbol_file_object (void *from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
If no open symbol file, attempt to locate and open the main symbol
|
|
||||||
file. On SVR4 systems, this is the first link map entry. If its
|
|
||||||
name is here, we can open it. Useful when attaching to a process
|
|
||||||
without first loading its symbol file.
|
|
||||||
|
|
||||||
If FROM_TTYP dereferences to a non-zero integer, allow messages to
|
|
||||||
be printed. This parameter is a pointer rather than an int because
|
|
||||||
open_symbol_file_object() is called via catch_errors() and
|
|
||||||
catch_errors() requires a pointer argument. */
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
open_symbol_file_object (void *from_ttyp)
|
open_symbol_file_object (void *from_ttyp)
|
||||||
|
@ -1108,24 +1057,7 @@ svr4_default_sos (void)
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Implement the "current_sos" target_so_ops method. */
|
||||||
|
|
||||||
current_sos -- build a list of currently loaded shared objects
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
struct so_list *current_sos ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Build a list of `struct so_list' objects describing the shared
|
|
||||||
objects currently loaded in the inferior. This list does not
|
|
||||||
include an entry for the main executable file.
|
|
||||||
|
|
||||||
Note that we only gather information directly available from the
|
|
||||||
inferior --- we don't examine any of the shared library files
|
|
||||||
themselves. The declaration of `struct so_list' says which fields
|
|
||||||
we provide values for. */
|
|
||||||
|
|
||||||
static struct so_list *
|
static struct so_list *
|
||||||
svr4_current_sos (void)
|
svr4_current_sos (void)
|
||||||
|
@ -1321,17 +1253,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
|
||||||
targ);
|
targ);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Arrange for dynamic linker to hit breakpoint.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
enable_break -- arrange for dynamic linker to hit breakpoint
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
int enable_break (void)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Both the SunOS and the SVR4 dynamic linkers have, as part of their
|
Both the SunOS and the SVR4 dynamic linkers have, as part of their
|
||||||
debugger interface, support for arranging for the inferior to hit
|
debugger interface, support for arranging for the inferior to hit
|
||||||
|
@ -1361,8 +1283,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ)
|
||||||
The debugger interface structure also contains an enumeration which
|
The debugger interface structure also contains an enumeration which
|
||||||
is set to either RT_ADD or RT_DELETE prior to changing the mapping,
|
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,
|
depending upon whether or not the library is being mapped or unmapped,
|
||||||
and then set to RT_CONSISTENT after the library is mapped/unmapped.
|
and then set to RT_CONSISTENT after the library is mapped/unmapped. */
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
enable_break (struct svr4_info *info, int from_tty)
|
enable_break (struct svr4_info *info, int from_tty)
|
||||||
|
@ -1649,34 +1570,12 @@ enable_break (struct svr4_info *info, int from_tty)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "special_symbol_handling" target_so_ops method. */
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
special_symbol_handling -- additional shared library symbol handling
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void special_symbol_handling ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Once the symbols from a shared object have been loaded in the usual
|
|
||||||
way, we are called to do any system specific symbol handling that
|
|
||||||
is needed.
|
|
||||||
|
|
||||||
For SunOS4, this consisted of grunging around in the dynamic
|
|
||||||
linkers structures to find symbol definitions for "common" symbols
|
|
||||||
and adding them to the minimal symbol table for the runtime common
|
|
||||||
objfile.
|
|
||||||
|
|
||||||
However, for SVR4, there's nothing to do.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
svr4_special_symbol_handling (void)
|
svr4_special_symbol_handling (void)
|
||||||
{
|
{
|
||||||
|
/* Nothing to do. */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the ELF program headers from ABFD. Return the contents and
|
/* Read the ELF program headers from ABFD. Return the contents and
|
||||||
|
@ -2133,28 +2032,7 @@ svr4_relocate_main_executable (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implement the "create_inferior_hook" target_solib_ops method.
|
||||||
|
|
||||||
GLOBAL FUNCTION
|
|
||||||
|
|
||||||
svr4_solib_create_inferior_hook -- shared library startup support
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void svr4_solib_create_inferior_hook (int from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
When gdb starts up the inferior, it nurses it along (through the
|
|
||||||
shell) until it is ready to execute it's first instruction. At this
|
|
||||||
point, this function gets called via expansion of the macro
|
|
||||||
SOLIB_CREATE_INFERIOR_HOOK.
|
|
||||||
|
|
||||||
For SunOS executables, this first instruction is typically the
|
|
||||||
one at "_start", or a similar text label, regardless of whether
|
|
||||||
the executable is statically or dynamically linked. The runtime
|
|
||||||
startup code takes care of dynamically linking in any shared
|
|
||||||
libraries, once gdb allows the inferior to continue.
|
|
||||||
|
|
||||||
For SVR4 executables, this first instruction is either the first
|
For SVR4 executables, this first instruction is either the first
|
||||||
instruction in the dynamic linker (for dynamically linked
|
instruction in the dynamic linker (for dynamically linked
|
||||||
|
@ -2165,10 +2043,9 @@ svr4_relocate_main_executable (void)
|
||||||
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.
|
||||||
|
|
||||||
For both SunOS shared libraries, and SVR4 shared libraries, we
|
We can arrange to cooperate with the dynamic linker to discover the
|
||||||
can arrange to cooperate with the dynamic linker to discover the
|
names of shared libraries that are dynamically linked, and the base
|
||||||
names of shared libraries that are dynamically linked, and the
|
addresses to which they are linked.
|
||||||
base addresses to which they are linked.
|
|
||||||
|
|
||||||
This function is responsible for discovering those names and
|
This function is responsible for discovering those names and
|
||||||
addresses, and saving sufficient information about them to allow
|
addresses, and saving sufficient information about them to allow
|
||||||
|
@ -2182,8 +2059,7 @@ svr4_relocate_main_executable (void)
|
||||||
handling will probably have to wait until the implementation is
|
handling will probably have to wait until the implementation is
|
||||||
changed to use the "breakpoint handler function" method.
|
changed to use the "breakpoint handler function" method.
|
||||||
|
|
||||||
Also, what if child has exit()ed? Must exit loop somehow.
|
Also, what if child has exit()ed? Must exit loop somehow. */
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
svr4_solib_create_inferior_hook (int from_tty)
|
svr4_solib_create_inferior_hook (int from_tty)
|
||||||
|
|
189
gdb/solib.c
189
gdb/solib.c
|
@ -114,17 +114,10 @@ show_solib_search_path (struct ui_file *file, int from_tty,
|
||||||
# define DOS_BASED_FILE_SYSTEM 0
|
# define DOS_BASED_FILE_SYSTEM 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/* Returns the full pathname of the shared library file, or NULL if
|
||||||
|
not found. (The pathname is malloc'ed; it needs to be freed by the
|
||||||
GLOBAL FUNCTION
|
caller.) *FD is set to either -1 or an open file handle for the
|
||||||
|
library.
|
||||||
solib_find -- Find a shared library file.
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
char *solib_find (char *in_pathname, int *fd);
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Global variable GDB_SYSROOT is used as a prefix directory
|
Global variable GDB_SYSROOT is used as a prefix directory
|
||||||
to search for shared libraries if they have an absolute path.
|
to search for shared libraries if they have an absolute path.
|
||||||
|
@ -146,12 +139,7 @@ show_solib_search_path (struct ui_file *file, int from_tty,
|
||||||
*
|
*
|
||||||
* The last check avoids doing this search when targetting remote
|
* The last check avoids doing this search when targetting remote
|
||||||
* machines since gdb_sysroot will almost always be set.
|
* machines since gdb_sysroot will almost always be set.
|
||||||
|
*/
|
||||||
RETURNS
|
|
||||||
|
|
||||||
Full pathname of the shared library file, or NULL if not found.
|
|
||||||
(The pathname is malloc'ed; it needs to be freed by the caller.)
|
|
||||||
*FD is set to either -1 or an open file handle for the library. */
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
solib_find (char *in_pathname, int *fd)
|
solib_find (char *in_pathname, int *fd)
|
||||||
|
@ -452,33 +440,17 @@ solib_bfd_open (char *pathname)
|
||||||
return abfd;
|
return abfd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Given a pointer to one of the shared objects in our list of mapped
|
||||||
|
objects, use the recorded name to open a bfd descriptor for the
|
||||||
|
object, build a section table, relocate all the section addresses
|
||||||
|
by the base address at which the shared object was mapped, and then
|
||||||
|
add the sections to the target's section table.
|
||||||
|
|
||||||
/*
|
FIXME: In most (all?) cases the shared object file name recorded in
|
||||||
|
the dynamic linkage tables will be a fully qualified pathname. For
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
solib_map_sections -- open bfd and build sections for shared lib
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static int solib_map_sections (struct so_list *so)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Given a pointer to one of the shared objects in our list
|
|
||||||
of mapped objects, use the recorded name to open a bfd
|
|
||||||
descriptor for the object, build a section table, and then
|
|
||||||
relocate all the section addresses by the base address at
|
|
||||||
which the shared object was mapped.
|
|
||||||
|
|
||||||
FIXMES
|
|
||||||
|
|
||||||
In most (all?) cases the shared object file name recorded in the
|
|
||||||
dynamic linkage tables will be a fully qualified pathname. For
|
|
||||||
cases where it isn't, do we really mimic the systems search
|
cases where it isn't, do we really mimic the systems search
|
||||||
mechanism correctly in the below code (particularly the tilde
|
mechanism correctly in the below code (particularly the tilde
|
||||||
expansion stuff?).
|
expansion stuff?). */
|
||||||
*/
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
solib_map_sections (struct so_list *so)
|
solib_map_sections (struct so_list *so)
|
||||||
|
@ -570,17 +542,7 @@ free_so_symbols (struct so_list *so)
|
||||||
strcpy (so->so_name, so->so_original_name);
|
strcpy (so->so_name, so->so_original_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Free the storage associated with the `struct so_list' object SO.
|
||||||
|
|
||||||
free_so --- free a `struct so_list' object
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void free_so (struct so_list *so)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Free the storage associated with the `struct so_list' object SO.
|
|
||||||
If we have opened a BFD for SO, close it.
|
If we have opened a BFD for SO, close it.
|
||||||
|
|
||||||
The caller is responsible for removing SO from whatever list it is
|
The caller is responsible for removing SO from whatever list it is
|
||||||
|
@ -671,13 +633,7 @@ solib_read_symbols (struct so_list *so, int flags)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Synchronize GDB's shared object list with inferior's.
|
||||||
|
|
||||||
update_solib_list --- synchronize GDB's shared object list with inferior's
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void update_solib_list (int from_tty, struct target_ops *TARGET)
|
|
||||||
|
|
||||||
Extract the list of currently loaded shared objects from the
|
Extract the list of currently loaded shared objects from the
|
||||||
inferior, and compare it with the list of shared objects currently
|
inferior, and compare it with the list of shared objects currently
|
||||||
|
@ -888,18 +844,7 @@ libpthread_solib_p (struct so_list *so)
|
||||||
return libpthread_name_p (so->so_name);
|
return libpthread_name_p (so->so_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GLOBAL FUNCTION
|
/* Read in symbolic information for any shared objects whose names
|
||||||
|
|
||||||
solib_add -- read in symbol info for newly added shared libraries
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void solib_add (char *pattern, int from_tty, struct target_ops
|
|
||||||
*TARGET, int readsyms)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Read in symbolic information for any shared objects whose names
|
|
||||||
match PATTERN. (If we've already read a shared object's symbol
|
match PATTERN. (If we've already read a shared object's symbol
|
||||||
info, leave it alone.) If PATTERN is zero, read them all.
|
info, leave it alone.) If PATTERN is zero, read them all.
|
||||||
|
|
||||||
|
@ -982,23 +927,10 @@ solib_add (char *pattern, int from_tty,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Implement the "info sharedlibrary" command. Walk through the
|
||||||
/*
|
shared library list and print information about each attached
|
||||||
|
library matching PATTERN. If PATTERN is elided, print them
|
||||||
LOCAL FUNCTION
|
all. */
|
||||||
|
|
||||||
info_sharedlibrary_command -- code for "info sharedlibrary"
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static void info_sharedlibrary_command ()
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Walk through the shared library list and print information
|
|
||||||
about each attached library matching PATTERN. If PATTERN is elided,
|
|
||||||
print them all.
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
info_sharedlibrary_command (char *pattern, int from_tty)
|
info_sharedlibrary_command (char *pattern, int from_tty)
|
||||||
|
@ -1125,27 +1057,16 @@ solib_contains_address_p (const struct so_list *const solib,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* If ADDRESS is in a shared lib in program space PSPACE, return its
|
||||||
|
name.
|
||||||
|
|
||||||
GLOBAL FUNCTION
|
Provides a hook for other gdb routines to discover whether or not a
|
||||||
|
particular address is within the mapped address space of a shared
|
||||||
solib_name_from_address -- if an address is in a shared lib, return
|
library.
|
||||||
its name.
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
char * solib_name_from_address (CORE_ADDR address)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Provides a hook for other gdb routines to discover whether or
|
|
||||||
not a particular address is within the mapped address space of
|
|
||||||
a shared library.
|
|
||||||
|
|
||||||
For example, this routine is called at one point to disable
|
For example, this routine is called at one point to disable
|
||||||
breakpoints which are in shared libraries that are not currently
|
breakpoints which are in shared libraries that are not currently
|
||||||
mapped in.
|
mapped in. */
|
||||||
*/
|
|
||||||
|
|
||||||
char *
|
char *
|
||||||
solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
|
solib_name_from_address (struct program_space *pspace, CORE_ADDR address)
|
||||||
|
@ -1221,20 +1142,10 @@ clear_solib (void)
|
||||||
ops->clear_solib ();
|
ops->clear_solib ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GLOBAL FUNCTION
|
/* Shared library startup support. When GDB starts up the inferior,
|
||||||
|
it nurses it along (through the shell) until it is ready to execute
|
||||||
solib_create_inferior_hook -- shared library startup support
|
its first instruction. At this point, this function gets
|
||||||
|
called. */
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void solib_create_inferior_hook (int from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
When gdb starts up the inferior, it nurses it along (through the
|
|
||||||
shell) until it is ready to execute it's first instruction. At this
|
|
||||||
point, this function gets called via expansion of the macro
|
|
||||||
SOLIB_CREATE_INFERIOR_HOOK. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
solib_create_inferior_hook (int from_tty)
|
solib_create_inferior_hook (int from_tty)
|
||||||
|
@ -1244,21 +1155,8 @@ solib_create_inferior_hook (int from_tty)
|
||||||
ops->solib_create_inferior_hook (from_tty);
|
ops->solib_create_inferior_hook (from_tty);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GLOBAL FUNCTION
|
/* Check to see if an address is in the dynamic loader's dynamic
|
||||||
|
symbol resolution code. Return 1 if so, 0 otherwise. */
|
||||||
in_solib_dynsym_resolve_code -- check to see if an address is in
|
|
||||||
dynamic loader's dynamic symbol
|
|
||||||
resolution code
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
int in_solib_dynsym_resolve_code (CORE_ADDR pc)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Determine if PC is in the dynamic linker's symbol resolution
|
|
||||||
code. Return 1 if so, 0 otherwise.
|
|
||||||
*/
|
|
||||||
|
|
||||||
int
|
int
|
||||||
in_solib_dynsym_resolve_code (CORE_ADDR pc)
|
in_solib_dynsym_resolve_code (CORE_ADDR pc)
|
||||||
|
@ -1268,19 +1166,7 @@ in_solib_dynsym_resolve_code (CORE_ADDR pc)
|
||||||
return ops->in_dynsym_resolve_code (pc);
|
return ops->in_dynsym_resolve_code (pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/* Implements the "sharedlibrary" command. */
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
sharedlibrary_command -- handle command to explicitly add library
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
static void sharedlibrary_command (char *args, int from_tty)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sharedlibrary_command (char *args, int from_tty)
|
sharedlibrary_command (char *args, int from_tty)
|
||||||
|
@ -1289,14 +1175,7 @@ sharedlibrary_command (char *args, int from_tty)
|
||||||
solib_add (args, from_tty, (struct target_ops *) 0, 1);
|
solib_add (args, from_tty, (struct target_ops *) 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LOCAL FUNCTION
|
/* Implements the command "nosharedlibrary", which discards symbols
|
||||||
|
|
||||||
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
|
that have been auto-loaded from shared libraries. Symbols from
|
||||||
shared libraries that were added by explicit request of the user
|
shared libraries that were added by explicit request of the user
|
||||||
are not discarded. Also called from remote.c. */
|
are not discarded. Also called from remote.c. */
|
||||||
|
|
20
gdb/solist.h
20
gdb/solist.h
|
@ -96,14 +96,26 @@ struct target_so_ops
|
||||||
/* Target dependent code to run after child process fork. */
|
/* Target dependent code to run after child process fork. */
|
||||||
void (*solib_create_inferior_hook) (int from_tty);
|
void (*solib_create_inferior_hook) (int from_tty);
|
||||||
|
|
||||||
/* Do additional symbol handling, lookup, etc. after symbols
|
/* Do additional symbol handling, lookup, etc. after symbols for a
|
||||||
for a shared object have been loaded. */
|
shared object have been loaded in the usual way. This is
|
||||||
|
called to do any system specific symbol handling that might be
|
||||||
|
needed. */
|
||||||
void (*special_symbol_handling) (void);
|
void (*special_symbol_handling) (void);
|
||||||
|
|
||||||
/* Construct a list of the currently loaded shared objects. */
|
/* Construct a list of the currently loaded shared objects. This
|
||||||
|
list does not include an entry for the main executable file.
|
||||||
|
|
||||||
|
Note that we only gather information directly available from the
|
||||||
|
inferior --- we don't examine any of the shared library files
|
||||||
|
themselves. The declaration of `struct so_list' says which fields
|
||||||
|
we provide values for. */
|
||||||
struct so_list *(*current_sos) (void);
|
struct so_list *(*current_sos) (void);
|
||||||
|
|
||||||
/* Find, open, and read the symbols for the main executable. */
|
/* Find, open, and read the symbols for the main executable. If
|
||||||
|
FROM_TTYP dereferences to a non-zero integer, allow messages to
|
||||||
|
be printed. This parameter is a pointer rather than an int
|
||||||
|
because open_symbol_file_object is called via catch_errors and
|
||||||
|
catch_errors requires a pointer argument. */
|
||||||
int (*open_symbol_file_object) (void *from_ttyp);
|
int (*open_symbol_file_object) (void *from_ttyp);
|
||||||
|
|
||||||
/* Determine if PC lies in the dynamic symbol resolution code of
|
/* Determine if PC lies in the dynamic symbol resolution code of
|
||||||
|
|
|
@ -36,24 +36,12 @@
|
||||||
|
|
||||||
#include "solib-som.h"
|
#include "solib-som.h"
|
||||||
|
|
||||||
/*
|
/* Read the symbol table of a SOM file.
|
||||||
|
|
||||||
LOCAL FUNCTION
|
|
||||||
|
|
||||||
som_symtab_read -- read the symbol table of a SOM file
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
|
|
||||||
void som_symtab_read (bfd *abfd, struct objfile *objfile,
|
|
||||||
struct section_offsets *section_offsets)
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
|
|
||||||
Given an open bfd, a base address to relocate symbols to, and a
|
Given an open bfd, a base address to relocate symbols to, and a
|
||||||
flag that specifies whether or not this bfd is for an executable
|
flag that specifies whether or not this bfd is for an executable
|
||||||
or not (may be shared library for example), add all the global
|
or not (may be shared library for example), add all the global
|
||||||
function and data symbols to the minimal symbol table.
|
function and data symbols to the minimal symbol table. */
|
||||||
*/
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
som_symtab_read (bfd *abfd, struct objfile *objfile,
|
som_symtab_read (bfd *abfd, struct objfile *objfile,
|
||||||
|
|
Loading…
Reference in a new issue