mirror of
https://github.com/darlinghq/darling-gdb.git
synced 2024-11-29 23:10:26 +00:00
990f9fe3aa
ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * coff-solib.c (coff_solib_add): Add new readsyms arg. * irix5-nat.c (solib_add): Ditto. * osfsolib.c (solib_add): Ditto. * pa64solib.c (pa64_solib_add): Ditto. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * solib.c (solib_add): Ditto. * somsolib.c (som_solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * coff-solib.h (coff_solib_add): Add new readsyms arg to prototype. * pa64solib.c (add_to_solist): Ditto. * pa64solib.c (read_dld_descriptor): Ditto. * pa64solib.h (pa64_solib_add): Ditto. * solib.h (solib_add): Ditto. * somsolib.h (som_solib_add): Ditto. * config/i386/tm-cygwin.h (child_solib_add): Ditto. * coff-solib.c (coff_solib_add): If readsyms is zero don't read symbols but do any other needed work for shared libs. * irix5-nat.c: Ditto. * osfsolib.c (solib_add): Ditto. * solib.c (solib_add): Ditto. * win32-nat.c (child_solib_add): Ditto. * xcoffsolib.c (solib_add): Ditto. * irix5-nat.c (sharedlibrary_command): Pass 1 as readsyms to solib_add to force reading of shared library symbols. * osfsolib.c (sharedlibrary_command;): Ditto. * pa64solib.c (pa64_solib_sharedlibrary_command): Ditto. * solib.c (sharedlibrary_command): Ditto. * somsolib.c (som_solib_sharedlibrary_command): Ditto. * xcoffsolib.c (sharedlibrary_command): Ditto. * coff-solib.c (coff_solib_create_inferior_hook): Call solib_add unconditionally with auto_solib_add. * irix5-nat.c (solib_create_inferior_hook): Ditto. * osfsolib.c (solib_create_inferior_hook): Ditto. * solib.c (solib_create_inferior_hook): Ditto. * solib-osf.c (osf_solib_create_inferior_hook): Ditto. * solib-svr4.c (enable_break): Ditto. * solib-sunos.c (sunos_solib_create_inferior_hook): Ditto. * corelow.c (solib_add_stub): Add auto_solib_add to args passed via SOLIB_ADD. * sol-thread.c (sol_thread_attach): Ditto. * config/rs6000/nm-rs6000.h (SOLIB_ADD): Ditto. * infcmd.c (attach_command): Remove auto_solib_add decl. Call SOLIB_ADD directly with auto_solib_add. * infrun.c (handle_inferior_event): Ditto. * coff-solib.h (SOLIB_ADD): Add readsyms arg. * pa64solib.h (SOLIB_ADD): Ditto. * solib.h (SOLIB_ADD): Ditto. * somsolib.h (SOLIB_ADD): Ditto. * config/i386/tm-cygwin.h (SOLIB_ADD): Ditto. * fork-child.c (clone_and_follow_inferior): Remove unused auto_solib_add decl. * pa64solib.c (pa64_solib_add): Call add_to_solist with readsyms. (read_dld_descriptor): Ditto. (pa64_solib_add): Call read_dld_descriptor with readsyms. (pa64_solib_in_dynamic_linker): Ditto. * corelow.c (symfile.h): Need this for auto_solib_add declaration. * sol-thread.c (symfile.h): Ditto. Approved by eliz@is.elta.co.il doc/ChangeLog entry: 2001-11-01 Fred Fish <fnf@redhat.com> * gdbint.texinfo (SOLIB_ADD): Document additional new "readsyms" arg.
135 lines
3.2 KiB
C
135 lines
3.2 KiB
C
/* Handle COFF SVR3 shared libraries for GDB, the GNU Debugger.
|
|
Copyright 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program; if not, write to the Free Software
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
#include "frame.h"
|
|
#include "bfd.h"
|
|
#include "gdbcore.h"
|
|
#include "symtab.h"
|
|
#include "symfile.h"
|
|
#include "objfiles.h"
|
|
|
|
/*
|
|
|
|
GLOBAL FUNCTION
|
|
|
|
coff_solib_add -- add a shared library files to the symtab list. We
|
|
examine the `.lib' section of the exec file and determine the names of
|
|
the shared libraries.
|
|
|
|
This function is responsible for discovering those names and
|
|
addresses, and saving sufficient information about them to allow
|
|
their symbols to be read at a later time.
|
|
|
|
SYNOPSIS
|
|
|
|
void coff_solib_add (char *arg_string, int from_tty,
|
|
struct target_ops *target, int readsyms)
|
|
|
|
DESCRIPTION
|
|
|
|
*/
|
|
|
|
void
|
|
coff_solib_add (char *arg_string, int from_tty, struct target_ops *target, int readsyms)
|
|
{
|
|
asection *libsect;
|
|
|
|
if (!readsyms)
|
|
return;
|
|
|
|
libsect = bfd_get_section_by_name (exec_bfd, ".lib");
|
|
|
|
if (libsect)
|
|
{
|
|
int libsize;
|
|
unsigned char *lib;
|
|
struct libent
|
|
{
|
|
bfd_byte len[4];
|
|
bfd_byte nameoffset[4];
|
|
};
|
|
|
|
libsize = bfd_section_size (exec_bfd, libsect);
|
|
|
|
lib = (unsigned char *) alloca (libsize);
|
|
|
|
bfd_get_section_contents (exec_bfd, libsect, lib, 0, libsize);
|
|
|
|
while (libsize > 0)
|
|
{
|
|
struct libent *ent;
|
|
struct objfile *objfile;
|
|
int len, nameoffset;
|
|
char *filename;
|
|
|
|
ent = (struct libent *) lib;
|
|
|
|
len = bfd_get_32 (exec_bfd, ent->len);
|
|
|
|
nameoffset = bfd_get_32 (exec_bfd, ent->nameoffset);
|
|
|
|
if (len <= 0)
|
|
break;
|
|
|
|
filename = (char *) ent + nameoffset * 4;
|
|
|
|
objfile = symbol_file_add (filename, from_tty,
|
|
NULL, /* no offsets */
|
|
0, /* not mainline */
|
|
OBJF_SHARED); /* flags */
|
|
|
|
libsize -= len * 4;
|
|
lib += len * 4;
|
|
}
|
|
|
|
/* Getting new symbols may change our opinion about what is
|
|
frameless. */
|
|
reinit_frame_cache ();
|
|
}
|
|
}
|
|
|
|
/*
|
|
|
|
GLOBAL FUNCTION
|
|
|
|
coff_solib_create_inferior_hook -- shared library startup support
|
|
|
|
SYNOPSIS
|
|
|
|
void coff_solib_create_inferior_hook()
|
|
|
|
DESCRIPTION
|
|
|
|
When gdb starts up the inferior, the kernel maps in the shared
|
|
libraries. We get here with the target stopped at it's first
|
|
instruction, and the libraries already mapped. At this point, this
|
|
function gets called via expansion of the macro
|
|
SOLIB_CREATE_INFERIOR_HOOK.
|
|
*/
|
|
|
|
void
|
|
coff_solib_create_inferior_hook (void)
|
|
{
|
|
coff_solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);
|
|
}
|