1
/* Handle COFF SVR3 shared libraries for GDB, the GNU Debugger.
2
Copyright (C) 1993, 1994, 1998, 1999, 2000 Free Software Foundation, Inc.
4
This file is part of GDB.
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 51 Franklin Street, Fifth Floor,
19
Boston, MA 02110-1301, USA. */
35
coff_solib_add -- add a shared library files to the symtab list. We
36
examine the `.lib' section of the exec file and determine the names of
39
This function is responsible for discovering those names and
40
addresses, and saving sufficient information about them to allow
41
their symbols to be read at a later time.
45
void coff_solib_add (char *arg_string, int from_tty,
46
struct target_ops *target, int readsyms)
53
coff_solib_add (char *arg_string, int from_tty, struct target_ops *target, int readsyms)
60
libsect = bfd_get_section_by_name (exec_bfd, ".lib");
69
bfd_byte nameoffset[4];
72
libsize = bfd_section_size (exec_bfd, libsect);
74
lib = (unsigned char *) alloca (libsize);
76
bfd_get_section_contents (exec_bfd, libsect, lib, 0, libsize);
81
struct objfile *objfile;
85
ent = (struct libent *) lib;
87
len = bfd_get_32 (exec_bfd, ent->len);
89
nameoffset = bfd_get_32 (exec_bfd, ent->nameoffset);
94
filename = (char *) ent + nameoffset * 4;
96
objfile = symbol_file_add (filename, from_tty,
97
NULL, /* no offsets */
99
OBJF_SHARED); /* flags */
105
/* Getting new symbols may change our opinion about what is
107
reinit_frame_cache ();
115
coff_solib_create_inferior_hook -- shared library startup support
119
void coff_solib_create_inferior_hook ()
123
When gdb starts up the inferior, the kernel maps in the shared
124
libraries. We get here with the target stopped at it's first
125
instruction, and the libraries already mapped. At this point, this
126
function gets called via expansion of the macro
127
SOLIB_CREATE_INFERIOR_HOOK.
131
coff_solib_create_inferior_hook (void)
133
coff_solib_add ((char *) 0, 0, (struct target_ops *) 0, auto_solib_add);