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 extern struct symtab
*current_source_symtab
;
29 extern int current_source_line
;
31 /* The real work of adding a shared library file to the symtab and
35 solib_add (arg_string
, from_tty
, target
)
38 struct target_ops
*target
;
41 struct vmap
*vp
= vmap
;
43 struct symtab
*saved_symtab
;
46 int loaded
= 0; /* true if any shared obj loaded */
47 int matched
= 0; /* true if any shared obj matched */
51 else if (val
= (char *) re_comp (arg_string
)) {
52 error ("Invalid regexp: %s", val
);
57 /* save current symbol table and line number, in case they get changed
58 in symbol loading process. */
60 saved_symtab
= current_source_symtab
;
61 saved_line
= current_source_line
;
63 /* skip over the first vmap, it is the main program, always loaded. */
66 for (; vp
; vp
= vp
->nxt
) {
68 if (re_exec (vp
->name
) || (*vp
->member
&& re_exec (vp
->member
))) {
72 /* if already loaded, continue with the next one. */
75 printf ("%s%s%s%s: already loaded.\n",
76 *vp
->member
? "(" : "",
78 *vp
->member
? ") " : "",
83 printf ("Loading %s%s%s%s...",
84 *vp
->member
? "(" : "",
86 *vp
->member
? ") " : "",
90 obj
= lookup_objfile_bfd (vp
->bfd
);
92 warning ("\nObj structure for the shared object not found. Loading failed.");
96 syms_from_objfile (obj
, 0, 0, 0);
97 new_symfile_objfile (obj
, 0, 0);
98 vmap_symtab (vp
, 0, 0);
100 loaded
= vp
->loaded
= 1;
103 /* if any shared object is loaded, then misc_func_vector needs sorting. */
106 sort_misc_function_vector ();
108 current_source_symtab
= saved_symtab
;
109 current_source_line
= saved_line
;
111 /* Getting new symbols might change our opinion about what is frameless.
112 Is this correct?? FIXME. */
113 /* reinit_frame_cache(); */
116 printf ("No matching shared object found.\n");
120 /* Return the module name of a given text address. Note that returned buffer
121 is not persistent. */
124 pc_load_segment_name (addr
)
127 static char buffer
[BUFSIZ
];
128 struct vmap
*vp
= vmap
;
130 buffer
[0] = buffer
[1] = '\0';
131 for (; vp
; vp
= vp
->nxt
)
132 if (vp
->tstart
<= addr
&& addr
< vp
->tend
) {
135 strcat (&buffer
[1], vp
->member
);
136 strcat (buffer
, ")");
138 strcat (buffer
, vp
->name
);
141 return "(unknown load module)";
146 register struct ld_info
*ldi
;
149 struct vmap
*vp
= vmap
;
151 if (!vp
|| !vp
->nxt
) {
152 printf("No shared libraries loaded at this time.\n");
156 /* skip over the first vmap, it is the main program, always loaded. */
160 Text Range Data Range Syms Shared Object Library\n");
162 for (; vp
; vp
= vp
->nxt
) {
164 printf ("0x%08x-0x%08x 0x%08x-0x%08x %s %s%s%s%s\n",
165 vp
->tstart
, vp
->tend
,
166 vp
->dstart
, vp
->dend
,
167 vp
->loaded
? "Yes" : "No ",
168 *vp
->member
? "(" : "",
170 *vp
->member
? ") " : "",
177 sharedlibrary_command (args
, from_tty
)
182 solib_add (args
, from_tty
, (struct target_ops
*)0);
189 add_com("sharedlibrary", class_files
, sharedlibrary_command
,
190 "Load shared object library symbols for files matching REGEXP.");
191 add_info("sharedlibrary", solib_info
,
192 "Status of loaded shared object libraries");
This page took 0.03276 seconds and 4 git commands to generate.