diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-06-09 20:03:33 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-06-09 20:03:33 +0000 |
commit | 4b38d6f1a4136a0aa2492bcff772b64dd8ff234b (patch) | |
tree | 9bc7b9b709a03d4075c309d24fd98a1b78b91dc5 /gdb | |
parent | 2d62ecc7b6ff8da64782856d9f5b46fdd97fa642 (diff) | |
download | gdb-4b38d6f1a4136a0aa2492bcff772b64dd8ff234b.zip gdb-4b38d6f1a4136a0aa2492bcff772b64dd8ff234b.tar.gz gdb-4b38d6f1a4136a0aa2492bcff772b64dd8ff234b.tar.bz2 |
2004-06-09 Andrew Cagney <cagney@gnu.org>
* solib-svr4.c [HANDLE_SVR4_EXEC_EMULATORS]: Delete #ifdef code.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 2 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 132 |
2 files changed, 2 insertions, 132 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7d81f5c..664aa63 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2004-06-09 Andrew Cagney <cagney@gnu.org> + * solib-svr4.c [HANDLE_SVR4_EXEC_EMULATORS]: Delete #ifdef code. + * config/ia64/tm-linux.h (TARGET_ELF64): Delete macro, Update copyright. * config/ia64/tm-aix.h (TARGET_ELF64): Ditto. diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index abf2948..7976e67 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -272,133 +272,6 @@ bfd_lookup_symbol (bfd *abfd, char *symname, flagword sect_flags) return symaddr; } -#ifdef HANDLE_SVR4_EXEC_EMULATORS - -/* - Solaris BCP (the part of Solaris which allows it to run SunOS4 - a.out files) throws in another wrinkle. Solaris does not fill - in the usual a.out link map structures when running BCP programs, - the only way to get at them is via groping around in the dynamic - linker. - The dynamic linker and it's structures are located in the shared - C library, which gets run as the executable's "interpreter" by - the kernel. - - Note that we can assume nothing about the process state at the time - we need to find these structures. We may be stopped on the first - instruction of the interpreter (C shared library), the first - instruction of the executable itself, or somewhere else entirely - (if we attached to the process for example). - */ - -static char *debug_base_symbols[] = -{ - "r_debug", /* Solaris 2.3 */ - "_r_debug", /* Solaris 2.1, 2.2 */ - NULL -}; - -static int look_for_base (int, CORE_ADDR); - -/* - - LOCAL FUNCTION - - look_for_base -- examine file for each mapped address segment - - SYNOPSYS - - static int look_for_base (int fd, CORE_ADDR baseaddr) - - DESCRIPTION - - This function is passed to proc_iterate_over_mappings, which - causes it to get called once for each mapped address space, with - an open file descriptor for the file mapped to that space, and the - base address of that mapped space. - - Our job is to find the debug base symbol in the file that this - fd is open on, if it exists, and if so, initialize the dynamic - linker structure base address debug_base. - - Note that this is a computationally expensive proposition, since - we basically have to open a bfd on every call, so we specifically - avoid opening the exec file. - */ - -static int -look_for_base (int fd, CORE_ADDR baseaddr) -{ - bfd *interp_bfd; - CORE_ADDR address = 0; - char **symbolp; - - /* If the fd is -1, then there is no file that corresponds to this - mapped memory segment, so skip it. Also, if the fd corresponds - to the exec file, skip it as well. */ - - if (fd == -1 - || (exec_bfd != NULL - && fdmatch (fileno ((FILE *) (exec_bfd->iostream)), fd))) - { - return (0); - } - - /* Try to open whatever random file this fd corresponds to. Note that - we have no way currently to find the filename. Don't gripe about - any problems we might have, just fail. */ - - if ((interp_bfd = bfd_fdopenr ("unnamed", gnutarget, fd)) == NULL) - { - return (0); - } - if (!bfd_check_format (interp_bfd, bfd_object)) - { - /* FIXME-leak: on failure, might not free all memory associated with - interp_bfd. */ - bfd_close (interp_bfd); - return (0); - } - - /* Now try to find our debug base symbol in this file, which we at - least know to be a valid ELF executable or shared library. */ - - for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++) - { - address = bfd_lookup_symbol (interp_bfd, *symbolp, 0); - if (address != 0) - { - break; - } - } - if (address == 0) - { - /* FIXME-leak: on failure, might not free all memory associated with - interp_bfd. */ - bfd_close (interp_bfd); - return (0); - } - - /* Eureka! We found the symbol. But now we may need to relocate it - by the base address. If the symbol's value is less than the base - address of the shared library, then it hasn't yet been relocated - by the dynamic linker, and we have to do it ourself. FIXME: Note - that we make the assumption that the first segment that corresponds - to the shared library has the base address to which the library - was relocated. */ - - if (address < baseaddr) - { - address += baseaddr; - } - debug_base = address; - /* FIXME-leak: on failure, might not free all memory associated with - interp_bfd. */ - bfd_close (interp_bfd); - return (1); -} -#endif /* HANDLE_SVR4_EXEC_EMULATORS */ - /* LOCAL FUNCTION @@ -579,11 +452,6 @@ locate_base (void) if (exec_bfd != NULL && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour) debug_base = elf_locate_base (); -#ifdef HANDLE_SVR4_EXEC_EMULATORS - /* Try it the hard way for emulated executables. */ - else if (!ptid_equal (inferior_ptid, null_ptid) && target_has_execution) - proc_iterate_over_mappings (look_for_base); -#endif } return (debug_base); } |