1 /* Shared library support for RS/6000 (xcoff) object files, for GDB.
2 Copyright 1991, 1992 Free Software Foundation.
3 Contributed by IBM Corporation.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
21 #include <sys/types.h>
26 #include "xcoffsolib.h"
28 #ifdef SOLIB_SYMBOLS_MANUAL
30 extern struct symtab
*current_source_symtab
;
31 extern int current_source_line
;
33 /* The real work of adding a shared library file to the symtab and
37 solib_add (arg_string
, from_tty
, target
)
40 struct target_ops
*target
;
43 struct vmap
*vp
= vmap
;
45 struct symtab
*saved_symtab
;
48 int loaded
= 0; /* true if any shared obj loaded */
49 int matched
= 0; /* true if any shared obj matched */
53 else if (val
= (char *) re_comp (arg_string
)) {
54 error ("Invalid regexp: %s", val
);
59 /* save current symbol table and line number, in case they get changed
60 in symbol loading process. */
62 saved_symtab
= current_source_symtab
;
63 saved_line
= current_source_line
;
65 /* skip over the first vmap, it is the main program, always loaded. */
68 for (; vp
; vp
= vp
->nxt
) {
70 if (re_exec (vp
->name
) || (*vp
->member
&& re_exec (vp
->member
))) {
74 /* if already loaded, continue with the next one. */
77 printf ("%s%s%s%s: already loaded.\n",
78 *vp
->member
? "(" : "",
80 *vp
->member
? ") " : "",
85 printf ("Loading %s%s%s%s...",
86 *vp
->member
? "(" : "",
88 *vp
->member
? ") " : "",
92 /* This is gross and doesn't work. If this code is re-enabled,
93 just stick a objfile member into the struct vmap; that's the
94 way solib.c (for SunOS/SVR4) does it. */
95 obj
= lookup_objfile_bfd (vp
->bfd
);
97 warning ("\nObj structure for the shared object not found. Loading failed.");
101 syms_from_objfile (obj
, 0, 0, 0);
102 new_symfile_objfile (obj
, 0, 0);
103 vmap_symtab (vp
, 0, 0);
105 loaded
= vp
->loaded
= 1;
108 /* if any shared object is loaded, then misc_func_vector needs sorting. */
111 sort_misc_function_vector ();
113 current_source_symtab
= saved_symtab
;
114 current_source_line
= saved_line
;
116 /* Getting new symbols might change our opinion about what is frameless.
117 Is this correct?? FIXME. */
118 /* reinit_frame_cache(); */
121 printf ("No matching shared object found.\n");
123 #endif /* SOLIB_SYMBOLS_MANUAL */
125 /* Return the module name of a given text address. Note that returned buffer
126 is not persistent. */
129 pc_load_segment_name (addr
)
132 static char buffer
[BUFSIZ
];
133 struct vmap
*vp
= vmap
;
135 buffer
[0] = buffer
[1] = '\0';
136 for (; vp
; vp
= vp
->nxt
)
137 if (vp
->tstart
<= addr
&& addr
< vp
->tend
) {
140 strcat (&buffer
[1], vp
->member
);
141 strcat (buffer
, ")");
143 strcat (buffer
, vp
->name
);
146 return "(unknown load module)";
151 register struct ld_info
*ldi
;
154 struct vmap
*vp
= vmap
;
156 if (!vp
|| !vp
->nxt
) {
157 printf("No shared libraries loaded at this time.\n");
161 /* skip over the first vmap, it is the main program, always loaded. */
165 Text Range Data Range Syms Shared Object Library\n");
167 for (; vp
; vp
= vp
->nxt
) {
169 printf ("0x%08x-0x%08x 0x%08x-0x%08x %s %s%s%s%s\n",
170 vp
->tstart
, vp
->tend
,
171 vp
->dstart
, vp
->dend
,
172 vp
->loaded
? "Yes" : "No ",
173 *vp
->member
? "(" : "",
175 *vp
->member
? ") " : "",
180 #ifdef SOLIB_SYMBOLS_MANUAL
182 sharedlibrary_command (args
, from_tty
)
187 solib_add (args
, from_tty
, (struct target_ops
*)0);
189 #endif /* SOLIB_SYMBOLS_MANUAL */
195 #ifdef SOLIB_SYMBOLS_MANUAL
196 add_com("sharedlibrary", class_files
, sharedlibrary_command
,
197 "Load shared object library symbols for files matching REGEXP.");
199 add_info("sharedlibrary", solib_info
,
200 "Status of loaded shared object libraries");
This page took 0.03292 seconds and 4 git commands to generate.