1 /* Shared library support for RS/6000 (xcoff) object files, for GDB.
2 Copyright 1991, 1992, 2001 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., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA. */
24 #include "xcoffsolib.h"
29 #include "gdb_regex.h"
32 /* If ADDR lies in a shared library, return its name.
33 Note that returned name points to static data whose content is overwritten
37 xcoff_solib_address (CORE_ADDR addr
)
39 static char *buffer
= NULL
;
40 struct vmap
*vp
= vmap
;
42 /* The first vmap entry is for the exec file. */
46 for (vp
= vp
->nxt
; vp
; vp
= vp
->nxt
)
47 if (vp
->tstart
<= addr
&& addr
< vp
->tend
)
50 xasprintf (&buffer
, "%s%s%s%s",
52 *vp
->member
? "(" : "",
54 *vp
->member
? ")" : "");
60 static void solib_info (char *, int);
61 static void sharedlibrary_command (char *pattern
, int from_tty
);
64 solib_info (char *args
, int from_tty
)
66 struct vmap
*vp
= vmap
;
68 /* Check for new shared libraries loaded with load (). */
70 xcoff_relocate_symtab (inferior_pid
);
72 if (vp
== NULL
|| vp
->nxt
== NULL
)
74 printf_unfiltered ("No shared libraries loaded at this time.\n");
78 /* Skip over the first vmap, it is the main program, always loaded. */
82 Text Range Data Range Syms Shared Object Library\n");
84 for (; vp
!= NULL
; vp
= vp
->nxt
)
86 printf_unfiltered ("0x%s-0x%s 0x%s-0x%s %s %s%s%s%s\n",
87 paddr (vp
->tstart
),paddr (vp
->tend
),
88 paddr (vp
->dstart
), paddr (vp
->dend
),
89 vp
->loaded
? "Yes" : "No ",
91 *vp
->member
? "(" : "",
93 *vp
->member
? ")" : "");
98 sharedlibrary_command (char *pattern
, int from_tty
)
102 /* Check for new shared libraries loaded with load (). */
104 xcoff_relocate_symtab (inferior_pid
);
108 char *re_err
= re_comp (pattern
);
111 error ("Invalid regexp: %s", re_err
);
114 /* Walk the list of currently loaded shared libraries, and read
115 symbols for any that match the pattern --- or any whose symbols
116 aren't already loaded, if no pattern was given. */
119 int loaded_any_symbols
= 0;
120 struct vmap
*vp
= vmap
;
125 /* skip over the first vmap, it is the main program, always loaded. */
126 for (vp
= vp
->nxt
; vp
; vp
= vp
->nxt
)
128 || re_exec (vp
->name
)
129 || (*vp
->member
&& re_exec (vp
->member
)))
136 printf_unfiltered ("Symbols already loaded for %s\n",
141 if (vmap_add_symbols (vp
))
142 loaded_any_symbols
= 1;
146 if (from_tty
&& pattern
&& ! any_matches
)
148 ("No loaded shared libraries match the pattern `%s'.\n", pattern
);
150 if (loaded_any_symbols
)
152 /* Getting new symbols may change our opinion about what is
154 reinit_frame_cache ();
160 _initialize_solib (void)
162 add_com ("sharedlibrary", class_files
, sharedlibrary_command
,
163 "Load shared object library symbols for files matching REGEXP.");
164 add_info ("sharedlibrary", solib_info
,
165 "Status of loaded shared object libraries");
168 (add_set_cmd ("auto-solib-add", class_support
, var_zinteger
,
169 (char *) &auto_solib_add
,
170 "Set autoloading of shared library symbols.\n\
171 If nonzero, symbols from all shared object libraries will be loaded\n\
172 automatically when the inferior begins execution or when the dynamic linker\n\
173 informs gdb that a new library has been loaded. Otherwise, symbols\n\
174 must be loaded manually, using `sharedlibrary'.",
This page took 0.032414 seconds and 4 git commands to generate.