* configure.in: Add $(LIBIDETCL) as well as $(LIBIDE) if
[deliverable/binutils-gdb.git] / gdb / solib.c
CommitLineData
f8b76e70 1/* Handle SunOS and SVR4 shared libraries for GDB, the GNU Debugger.
7d0a3fc8 2 Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998
1a494973 3 Free Software Foundation, Inc.
f8b76e70 4
bd5635a1
RP
5This file is part of GDB.
6
bdbd5f50 7This program is free software; you can redistribute it and/or modify
bd5635a1 8it under the terms of the GNU General Public License as published by
bdbd5f50
JG
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
bd5635a1 11
bdbd5f50 12This program is distributed in the hope that it will be useful,
bd5635a1
RP
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
bdbd5f50 18along with this program; if not, write to the Free Software
2858b1f2 19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
bd5635a1 20
f8b76e70 21
b0246b3b
FF
22#include "defs.h"
23
ace4b8d7
FF
24/* This file is only compilable if link.h is available. */
25
26#ifdef HAVE_LINK_H
27
bd5635a1 28#include <sys/types.h>
f8b76e70 29#include <signal.h>
2b576293 30#include "gdb_string.h"
d0237a54
JK
31#include <sys/param.h>
32#include <fcntl.h>
1a494973 33#include <unistd.h>
be772100
JG
34
35#ifndef SVR4_SHARED_LIBS
36 /* SunOS shared libs need the nlist structure. */
37#include <a.out.h>
2fe3b329 38#else
1a494973 39#include "elf/external.h"
be772100 40#endif
f8b76e70 41
1a494973
C
42#include <link.h>
43
bd5635a1 44#include "symtab.h"
b0246b3b
FF
45#include "bfd.h"
46#include "symfile.h"
be772100 47#include "objfiles.h"
bd5635a1
RP
48#include "gdbcore.h"
49#include "command.h"
b3fdaf3d 50#include "target.h"
2403f49b 51#include "frame.h"
464c6c5f 52#include "gnu-regex.h"
bdbd5f50 53#include "inferior.h"
6047ab6a 54#include "environ.h"
a71c0593 55#include "language.h"
1a494973 56#include "gdbcmd.h"
bdbd5f50 57
2858b1f2 58#define MAX_PATH_SIZE 512 /* FIXME: Should be dynamic */
f8b76e70 59
464c6c5f
JL
60/* On SVR4 systems, a list of symbols in the dynamic linker where
61 GDB can try to place a breakpoint to monitor shared library
62 events.
63
64 If none of these symbols are found, or other errors occur, then
65 SVR4 systems will fall back to using a symbol as the "startup
66 mapping complete" breakpoint address. */
67
68#ifdef SVR4_SHARED_LIBS
69static char *solib_break_names[] = {
70 "r_debug_state",
a404ea25 71 "_r_debug_state",
464c6c5f 72 "_dl_debug_state",
7d0a3fc8 73 "rtld_db_dlactivity",
464c6c5f
JL
74 NULL
75};
76#endif
f8b76e70 77
a608f919
FF
78#define BKPT_AT_SYMBOL 1
79
a71c0593 80#if defined (BKPT_AT_SYMBOL) && defined (SVR4_SHARED_LIBS)
a608f919
FF
81static char *bkpt_names[] = {
82#ifdef SOLIB_BKPT_NAME
83 SOLIB_BKPT_NAME, /* Prefer configured name if it exists. */
84#endif
85 "_start",
86 "main",
87 NULL
88};
a71c0593 89#endif
f8b76e70 90
4ad0021e
JK
91/* Symbols which are used to locate the base of the link map structures. */
92
2fe3b329 93#ifndef SVR4_SHARED_LIBS
4ad0021e 94static char *debug_base_symbols[] = {
2fe3b329 95 "_DYNAMIC",
1a494973 96 "_DYNAMIC__MGC",
4ad0021e
JK
97 NULL
98};
2fe3b329 99#endif
4ad0021e 100
1a494973
C
101static char *main_name_list[] = {
102 "main_$main",
103 NULL
104};
105
f8b76e70
FF
106/* local data declarations */
107
d261ece7 108#ifndef SVR4_SHARED_LIBS
f8b76e70 109
f8b76e70
FF
110#define LM_ADDR(so) ((so) -> lm.lm_addr)
111#define LM_NEXT(so) ((so) -> lm.lm_next)
112#define LM_NAME(so) ((so) -> lm.lm_name)
4ad0021e
JK
113/* Test for first link map entry; first entry is a shared library. */
114#define IGNORE_FIRST_LINK_MAP_ENTRY(x) (0)
f8b76e70
FF
115static struct link_dynamic dynamic_copy;
116static struct link_dynamic_2 ld_2_copy;
117static struct ld_debug debug_copy;
118static CORE_ADDR debug_addr;
119static CORE_ADDR flag_addr;
120
d261ece7 121#else /* SVR4_SHARED_LIBS */
f8b76e70 122
f8b76e70
FF
123#define LM_ADDR(so) ((so) -> lm.l_addr)
124#define LM_NEXT(so) ((so) -> lm.l_next)
125#define LM_NAME(so) ((so) -> lm.l_name)
4ad0021e
JK
126/* Test for first link map entry; first entry is the exec-file. */
127#define IGNORE_FIRST_LINK_MAP_ENTRY(x) ((x).l_prev == NULL)
f8b76e70 128static struct r_debug debug_copy;
f8b76e70 129char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */
f8b76e70 130
d261ece7 131#endif /* !SVR4_SHARED_LIBS */
bd5635a1 132
bd5635a1 133struct so_list {
f8b76e70
FF
134 struct so_list *next; /* next structure in linked list */
135 struct link_map lm; /* copy of link map from inferior */
136 struct link_map *lmaddr; /* addr in inferior lm was read from */
137 CORE_ADDR lmend; /* upper addr bound of mapped object */
138 char so_name[MAX_PATH_SIZE]; /* shared object lib name (FIXME) */
139 char symbols_loaded; /* flag: symbols read in yet? */
140 char from_tty; /* flag: print msgs? */
b0246b3b 141 struct objfile *objfile; /* objfile for loaded lib */
f8b76e70
FF
142 struct section_table *sections;
143 struct section_table *sections_end;
51b57ded 144 struct section_table *textsection;
a71c0593 145 bfd *abfd;
bd5635a1
RP
146};
147
f8b76e70
FF
148static struct so_list *so_list_head; /* List of known shared objects */
149static CORE_ADDR debug_base; /* Base of dynamic linker structures */
150static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
151
7d0a3fc8
DT
152static int solib_cleanup_queued = 0; /* make_run_cleanup called */
153
51b57ded
FF
154extern int
155fdmatch PARAMS ((int, int)); /* In libiberty */
156
b0246b3b
FF
157/* Local function prototypes */
158
7d0a3fc8
DT
159static void
160do_clear_solib PARAMS ((PTR));
161
162static int
163match_main PARAMS ((char *));
164
b0246b3b
FF
165static void
166special_symbol_handling PARAMS ((struct so_list *));
167
168static void
169sharedlibrary_command PARAMS ((char *, int));
170
171static int
172enable_break PARAMS ((void));
173
b0246b3b 174static void
51b57ded 175info_sharedlibrary_command PARAMS ((char *, int));
b0246b3b
FF
176
177static int
178symbol_add_stub PARAMS ((char *));
179
180static struct so_list *
181find_solib PARAMS ((struct so_list *));
182
183static struct link_map *
184first_link_map_member PARAMS ((void));
185
186static CORE_ADDR
187locate_base PARAMS ((void));
188
be772100
JG
189static void
190solib_map_sections PARAMS ((struct so_list *));
191
192#ifdef SVR4_SHARED_LIBS
193
b0246b3b 194static CORE_ADDR
2fe3b329 195elf_locate_base PARAMS ((void));
b0246b3b 196
be772100 197#else
b0246b3b 198
ace4b8d7
FF
199static int
200disable_break PARAMS ((void));
201
b0246b3b 202static void
1a494973
C
203allocate_rt_common_objfile PARAMS ((void));
204
205static void
206solib_add_common_symbols PARAMS ((struct rtc_symb *));
b0246b3b
FF
207
208#endif
bd5635a1 209
76420d46
SG
210/* If non-zero, this is a prefix that will be added to the front of the name
211 shared libraries with an absolute filename for loading. */
212static char *solib_absolute_prefix = NULL;
213
214/* If non-empty, this is a search path for loading non-absolute shared library
215 symbol files. This takes precedence over the environment variables PATH
216 and LD_LIBRARY_PATH. */
217static char *solib_search_path = NULL;
218
d0237a54 219/*
f8b76e70
FF
220
221LOCAL FUNCTION
222
223 solib_map_sections -- open bfd and build sections for shared lib
224
225SYNOPSIS
226
227 static void solib_map_sections (struct so_list *so)
228
229DESCRIPTION
230
231 Given a pointer to one of the shared objects in our list
232 of mapped objects, use the recorded name to open a bfd
233 descriptor for the object, build a section table, and then
234 relocate all the section addresses by the base address at
235 which the shared object was mapped.
236
237FIXMES
238
239 In most (all?) cases the shared object file name recorded in the
240 dynamic linkage tables will be a fully qualified pathname. For
241 cases where it isn't, do we really mimic the systems search
242 mechanism correctly in the below code (particularly the tilde
243 expansion stuff?).
244 */
245
d0237a54 246static void
f8b76e70
FF
247solib_map_sections (so)
248 struct so_list *so;
d0237a54
JK
249{
250 char *filename;
251 char *scratch_pathname;
252 int scratch_chan;
253 struct section_table *p;
de9bef49
JG
254 struct cleanup *old_chain;
255 bfd *abfd;
d0237a54 256
f8b76e70 257 filename = tilde_expand (so -> so_name);
d0237a54 258
76420d46
SG
259 if (solib_absolute_prefix && ROOTED_P (filename))
260 /* Prefix shared libraries with absolute filenames with
261 SOLIB_ABSOLUTE_PREFIX. */
262 {
263 char *pfxed_fn;
264 int pfx_len;
265
266 pfx_len = strlen (solib_absolute_prefix);
267
268 /* Remove trailing slashes. */
269 while (pfx_len > 0 && SLASH_P (solib_absolute_prefix[pfx_len - 1]))
270 pfx_len--;
271
272 pfxed_fn = xmalloc (pfx_len + strlen (filename) + 1);
273 strcpy (pfxed_fn, solib_absolute_prefix);
274 strcat (pfxed_fn, filename);
275 free (filename);
276
277 filename = pfxed_fn;
278 }
279
280 old_chain = make_cleanup (free, filename);
281
282 scratch_chan = -1;
283
284 if (solib_search_path)
285 scratch_chan = openp (solib_search_path,
286 1, filename, O_RDONLY, 0, &scratch_pathname);
287 if (scratch_chan < 0)
288 scratch_chan = openp (get_in_environ (inferior_environ, "PATH"),
289 1, filename, O_RDONLY, 0, &scratch_pathname);
d0237a54 290 if (scratch_chan < 0)
f8b76e70 291 {
6047ab6a
KH
292 scratch_chan = openp (get_in_environ
293 (inferior_environ, "LD_LIBRARY_PATH"),
294 1, filename, O_RDONLY, 0, &scratch_pathname);
f8b76e70 295 }
d0237a54 296 if (scratch_chan < 0)
f8b76e70
FF
297 {
298 perror_with_name (filename);
a608f919 299 }
a71c0593 300 /* Leave scratch_pathname allocated. abfd->name will point to it. */
f8b76e70 301
a71c0593 302 abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan);
de9bef49 303 if (!abfd)
f8b76e70 304 {
de9bef49 305 close (scratch_chan);
f8b76e70 306 error ("Could not open `%s' as an executable file: %s",
4ad0021e 307 scratch_pathname, bfd_errmsg (bfd_get_error ()));
f8b76e70 308 }
a608f919 309 /* Leave bfd open, core_xfer_memory and "info files" need it. */
a71c0593 310 so -> abfd = abfd;
a608f919 311 abfd -> cacheable = true;
de9bef49 312
2858b1f2
KH
313 /* copy full path name into so_name, so that later symbol_file_add can find
314 it */
315 if (strlen (scratch_pathname) >= MAX_PATH_SIZE)
316 error ("Full path name length of shared library exceeds MAX_PATH_SIZE in so_list structure.");
317 strcpy (so->so_name, scratch_pathname);
318
de9bef49 319 if (!bfd_check_format (abfd, bfd_object))
f8b76e70
FF
320 {
321 error ("\"%s\": not in executable format: %s.",
4ad0021e 322 scratch_pathname, bfd_errmsg (bfd_get_error ()));
f8b76e70 323 }
de9bef49 324 if (build_section_table (abfd, &so -> sections, &so -> sections_end))
f8b76e70
FF
325 {
326 error ("Can't find the file sections in `%s': %s",
2fe3b329 327 bfd_get_filename (abfd), bfd_errmsg (bfd_get_error ()));
f8b76e70
FF
328 }
329
330 for (p = so -> sections; p < so -> sections_end; p++)
331 {
332 /* Relocate the section binding addresses as recorded in the shared
333 object's file by the base address to which the object was actually
334 mapped. */
335 p -> addr += (CORE_ADDR) LM_ADDR (so);
336 p -> endaddr += (CORE_ADDR) LM_ADDR (so);
337 so -> lmend = (CORE_ADDR) max (p -> endaddr, so -> lmend);
2fe3b329 338 if (STREQ (p -> the_bfd_section -> name, ".text"))
51b57ded
FF
339 {
340 so -> textsection = p;
341 }
f8b76e70 342 }
de9bef49
JG
343
344 /* Free the file names, close the file now. */
345 do_cleanups (old_chain);
f8b76e70
FF
346}
347
7f435241
FF
348#ifndef SVR4_SHARED_LIBS
349
1a494973
C
350/* Allocate the runtime common object file. */
351
352static void
353allocate_rt_common_objfile ()
354{
355 struct objfile *objfile;
356 struct objfile *last_one;
357
358 objfile = (struct objfile *) xmalloc (sizeof (struct objfile));
359 memset (objfile, 0, sizeof (struct objfile));
360 objfile -> md = NULL;
464c6c5f
JL
361 obstack_specify_allocation (&objfile -> psymbol_cache.cache, 0, 0,
362 xmalloc, free);
1a494973
C
363 obstack_specify_allocation (&objfile -> psymbol_obstack, 0, 0, xmalloc,
364 free);
365 obstack_specify_allocation (&objfile -> symbol_obstack, 0, 0, xmalloc,
366 free);
367 obstack_specify_allocation (&objfile -> type_obstack, 0, 0, xmalloc,
368 free);
369 objfile -> name = mstrsave (objfile -> md, "rt_common");
370
371 /* Add this file onto the tail of the linked list of other such files. */
372
373 objfile -> next = NULL;
374 if (object_files == NULL)
375 object_files = objfile;
376 else
377 {
378 for (last_one = object_files;
379 last_one -> next;
380 last_one = last_one -> next);
381 last_one -> next = objfile;
382 }
383
384 rt_common_objfile = objfile;
385}
2a4e8cc3 386
1a494973
C
387/* Read all dynamically loaded common symbol definitions from the inferior
388 and put them into the minimal symbol table for the runtime common
389 objfile. */
2a4e8cc3 390
d261ece7 391static void
1a494973 392solib_add_common_symbols (rtc_symp)
d261ece7
SG
393 struct rtc_symb *rtc_symp;
394{
395 struct rtc_symb inferior_rtc_symb;
396 struct nlist inferior_rtc_nlist;
b0246b3b
FF
397 int len;
398 char *name;
d261ece7 399
1a494973
C
400 /* Remove any runtime common symbols from previous runs. */
401
402 if (rt_common_objfile != NULL && rt_common_objfile -> minimal_symbol_count)
403 {
404 obstack_free (&rt_common_objfile -> symbol_obstack, 0);
405 obstack_specify_allocation (&rt_common_objfile -> symbol_obstack, 0, 0,
406 xmalloc, free);
407 rt_common_objfile -> minimal_symbol_count = 0;
408 rt_common_objfile -> msymbols = NULL;
409 }
410
b0246b3b
FF
411 init_minimal_symbol_collection ();
412 make_cleanup (discard_minimal_symbols, 0);
d261ece7
SG
413
414 while (rtc_symp)
415 {
b0246b3b
FF
416 read_memory ((CORE_ADDR) rtc_symp,
417 (char *) &inferior_rtc_symb,
418 sizeof (inferior_rtc_symb));
419 read_memory ((CORE_ADDR) inferior_rtc_symb.rtc_sp,
420 (char *) &inferior_rtc_nlist,
421 sizeof(inferior_rtc_nlist));
422 if (inferior_rtc_nlist.n_type == N_COMM)
423 {
424 /* FIXME: The length of the symbol name is not available, but in the
425 current implementation the common symbol is allocated immediately
426 behind the name of the symbol. */
427 len = inferior_rtc_nlist.n_value - inferior_rtc_nlist.n_un.n_strx;
428
ace4b8d7 429 name = xmalloc (len);
b0246b3b
FF
430 read_memory ((CORE_ADDR) inferior_rtc_nlist.n_un.n_name, name, len);
431
1a494973
C
432 /* Allocate the runtime common objfile if necessary. */
433 if (rt_common_objfile == NULL)
434 allocate_rt_common_objfile ();
d261ece7 435
1a494973
C
436 prim_record_minimal_symbol (name, inferior_rtc_nlist.n_value,
437 mst_bss, rt_common_objfile);
ace4b8d7 438 free (name);
b0246b3b
FF
439 }
440 rtc_symp = inferior_rtc_symb.rtc_next;
d261ece7
SG
441 }
442
b0246b3b 443 /* Install any minimal symbols that have been collected as the current
1a494973 444 minimal symbols for the runtime common objfile. */
b0246b3b 445
1a494973 446 install_minimal_symbols (rt_common_objfile);
d261ece7
SG
447}
448
7f435241
FF
449#endif /* SVR4_SHARED_LIBS */
450
2fe3b329 451
be772100
JG
452#ifdef SVR4_SHARED_LIBS
453
54d478cd
PS
454static CORE_ADDR
455bfd_lookup_symbol PARAMS ((bfd *, char *));
456
457/*
458
459LOCAL FUNCTION
460
461 bfd_lookup_symbol -- lookup the value for a specific symbol
462
463SYNOPSIS
464
465 CORE_ADDR bfd_lookup_symbol (bfd *abfd, char *symname)
466
467DESCRIPTION
468
469 An expensive way to lookup the value of a single symbol for
470 bfd's that are only temporary anyway. This is used by the
471 shared library support to find the address of the debugger
472 interface structures in the shared library.
473
474 Note that 0 is specifically allowed as an error return (no
475 such symbol).
476*/
477
478static CORE_ADDR
479bfd_lookup_symbol (abfd, symname)
480 bfd *abfd;
481 char *symname;
482{
483 unsigned int storage_needed;
484 asymbol *sym;
485 asymbol **symbol_table;
486 unsigned int number_of_symbols;
487 unsigned int i;
488 struct cleanup *back_to;
489 CORE_ADDR symaddr = 0;
490
491 storage_needed = bfd_get_symtab_upper_bound (abfd);
492
493 if (storage_needed > 0)
494 {
495 symbol_table = (asymbol **) xmalloc (storage_needed);
496 back_to = make_cleanup (free, (PTR)symbol_table);
497 number_of_symbols = bfd_canonicalize_symtab (abfd, symbol_table);
498
499 for (i = 0; i < number_of_symbols; i++)
500 {
501 sym = *symbol_table++;
502 if (STREQ (sym -> name, symname))
503 {
504 /* Bfd symbols are section relative. */
505 symaddr = sym -> value + sym -> section -> vma;
506 break;
507 }
508 }
509 do_cleanups (back_to);
510 }
511 return (symaddr);
512}
513
a404ea25
JL
514#ifdef HANDLE_SVR4_EXEC_EMULATORS
515
516/*
517 Solaris BCP (the part of Solaris which allows it to run SunOS4
518 a.out files) throws in another wrinkle. Solaris does not fill
519 in the usual a.out link map structures when running BCP programs,
520 the only way to get at them is via groping around in the dynamic
521 linker.
522 The dynamic linker and it's structures are located in the shared
523 C library, which gets run as the executable's "interpreter" by
524 the kernel.
525
526 Note that we can assume nothing about the process state at the time
527 we need to find these structures. We may be stopped on the first
528 instruction of the interpreter (C shared library), the first
529 instruction of the executable itself, or somewhere else entirely
530 (if we attached to the process for example).
531*/
532
533static char *debug_base_symbols[] = {
534 "r_debug", /* Solaris 2.3 */
535 "_r_debug", /* Solaris 2.1, 2.2 */
536 NULL
537};
538
539static int
540look_for_base PARAMS ((int, CORE_ADDR));
541
54d478cd
PS
542/*
543
544LOCAL FUNCTION
545
546 look_for_base -- examine file for each mapped address segment
547
548SYNOPSYS
549
550 static int look_for_base (int fd, CORE_ADDR baseaddr)
551
552DESCRIPTION
553
554 This function is passed to proc_iterate_over_mappings, which
555 causes it to get called once for each mapped address space, with
556 an open file descriptor for the file mapped to that space, and the
557 base address of that mapped space.
558
559 Our job is to find the debug base symbol in the file that this
560 fd is open on, if it exists, and if so, initialize the dynamic
561 linker structure base address debug_base.
562
563 Note that this is a computationally expensive proposition, since
564 we basically have to open a bfd on every call, so we specifically
565 avoid opening the exec file.
566 */
567
568static int
569look_for_base (fd, baseaddr)
570 int fd;
571 CORE_ADDR baseaddr;
572{
573 bfd *interp_bfd;
574 CORE_ADDR address = 0;
575 char **symbolp;
576
577 /* If the fd is -1, then there is no file that corresponds to this
578 mapped memory segment, so skip it. Also, if the fd corresponds
579 to the exec file, skip it as well. */
580
581 if (fd == -1
582 || (exec_bfd != NULL
583 && fdmatch (fileno ((GDB_FILE *)(exec_bfd -> iostream)), fd)))
584 {
585 return (0);
586 }
587
588 /* Try to open whatever random file this fd corresponds to. Note that
589 we have no way currently to find the filename. Don't gripe about
590 any problems we might have, just fail. */
591
592 if ((interp_bfd = bfd_fdopenr ("unnamed", gnutarget, fd)) == NULL)
593 {
594 return (0);
595 }
596 if (!bfd_check_format (interp_bfd, bfd_object))
597 {
1a494973
C
598 /* FIXME-leak: on failure, might not free all memory associated with
599 interp_bfd. */
54d478cd
PS
600 bfd_close (interp_bfd);
601 return (0);
602 }
603
604 /* Now try to find our debug base symbol in this file, which we at
605 least know to be a valid ELF executable or shared library. */
606
607 for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
608 {
609 address = bfd_lookup_symbol (interp_bfd, *symbolp);
610 if (address != 0)
611 {
612 break;
613 }
614 }
615 if (address == 0)
616 {
1a494973
C
617 /* FIXME-leak: on failure, might not free all memory associated with
618 interp_bfd. */
54d478cd
PS
619 bfd_close (interp_bfd);
620 return (0);
621 }
622
623 /* Eureka! We found the symbol. But now we may need to relocate it
624 by the base address. If the symbol's value is less than the base
625 address of the shared library, then it hasn't yet been relocated
626 by the dynamic linker, and we have to do it ourself. FIXME: Note
627 that we make the assumption that the first segment that corresponds
628 to the shared library has the base address to which the library
629 was relocated. */
630
631 if (address < baseaddr)
632 {
633 address += baseaddr;
634 }
635 debug_base = address;
1a494973
C
636 /* FIXME-leak: on failure, might not free all memory associated with
637 interp_bfd. */
54d478cd
PS
638 bfd_close (interp_bfd);
639 return (1);
640}
641#endif /* HANDLE_SVR4_EXEC_EMULATORS */
642
f8b76e70
FF
643/*
644
645LOCAL FUNCTION
646
2fe3b329
PS
647 elf_locate_base -- locate the base address of dynamic linker structs
648 for SVR4 elf targets.
f8b76e70
FF
649
650SYNOPSIS
651
2fe3b329 652 CORE_ADDR elf_locate_base (void)
f8b76e70
FF
653
654DESCRIPTION
655
2fe3b329
PS
656 For SVR4 elf targets the address of the dynamic linker's runtime
657 structure is contained within the dynamic info section in the
658 executable file. The dynamic section is also mapped into the
659 inferior address space. Because the runtime loader fills in the
660 real address before starting the inferior, we have to read in the
661 dynamic info section from the inferior address space.
662 If there are any errors while trying to find the address, we
663 silently return 0, otherwise the found address is returned.
f8b76e70 664
2fe3b329 665 */
f8b76e70
FF
666
667static CORE_ADDR
2fe3b329 668elf_locate_base ()
f8b76e70 669{
1a494973 670 sec_ptr dyninfo_sect;
2fe3b329
PS
671 int dyninfo_sect_size;
672 CORE_ADDR dyninfo_addr;
673 char *buf;
674 char *bufend;
675
676 /* Find the start address of the .dynamic section. */
1a494973 677 dyninfo_sect = bfd_get_section_by_name (exec_bfd, ".dynamic");
2fe3b329
PS
678 if (dyninfo_sect == NULL)
679 return 0;
1a494973 680 dyninfo_addr = bfd_section_vma (exec_bfd, dyninfo_sect);
2fe3b329
PS
681
682 /* Read in .dynamic section, silently ignore errors. */
1a494973 683 dyninfo_sect_size = bfd_section_size (exec_bfd, dyninfo_sect);
2fe3b329
PS
684 buf = alloca (dyninfo_sect_size);
685 if (target_read_memory (dyninfo_addr, buf, dyninfo_sect_size))
686 return 0;
687
688 /* Find the DT_DEBUG entry in the the .dynamic section.
689 For mips elf we look for DT_MIPS_RLD_MAP, mips elf apparently has
690 no DT_DEBUG entries. */
124e64bb 691#ifndef TARGET_ELF64
2fe3b329
PS
692 for (bufend = buf + dyninfo_sect_size;
693 buf < bufend;
694 buf += sizeof (Elf32_External_Dyn))
f8b76e70 695 {
2fe3b329
PS
696 Elf32_External_Dyn *x_dynp = (Elf32_External_Dyn *)buf;
697 long dyn_tag;
698 CORE_ADDR dyn_ptr;
699
700 dyn_tag = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
701 if (dyn_tag == DT_NULL)
702 break;
703 else if (dyn_tag == DT_DEBUG)
d0237a54 704 {
2fe3b329
PS
705 dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
706 return dyn_ptr;
d0237a54 707 }
1a494973 708#ifdef DT_MIPS_RLD_MAP
2fe3b329 709 else if (dyn_tag == DT_MIPS_RLD_MAP)
4ad0021e 710 {
2fe3b329
PS
711 char pbuf[TARGET_PTR_BIT / HOST_CHAR_BIT];
712
713 /* DT_MIPS_RLD_MAP contains a pointer to the address
714 of the dynamic link structure. */
715 dyn_ptr = bfd_h_get_32 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
716 if (target_read_memory (dyn_ptr, pbuf, sizeof (pbuf)))
717 return 0;
718 return extract_unsigned_integer (pbuf, sizeof (pbuf));
4ad0021e 719 }
1a494973 720#endif
4ad0021e 721 }
124e64bb
JM
722#else /* ELF64 */
723 for (bufend = buf + dyninfo_sect_size;
724 buf < bufend;
725 buf += sizeof (Elf64_External_Dyn))
726 {
727 Elf64_External_Dyn *x_dynp = (Elf64_External_Dyn *)buf;
728 long dyn_tag;
729 CORE_ADDR dyn_ptr;
730
731 dyn_tag = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_tag);
732 if (dyn_tag == DT_NULL)
733 break;
734 else if (dyn_tag == DT_DEBUG)
735 {
736 dyn_ptr = bfd_h_get_64 (exec_bfd, (bfd_byte *) x_dynp->d_un.d_ptr);
737 return dyn_ptr;
738 }
739 }
740#endif
d261ece7 741
2fe3b329
PS
742 /* DT_DEBUG entry not found. */
743 return 0;
d261ece7
SG
744}
745
2fe3b329 746#endif /* SVR4_SHARED_LIBS */
be772100 747
d261ece7
SG
748/*
749
f8b76e70
FF
750LOCAL FUNCTION
751
752 locate_base -- locate the base address of dynamic linker structs
753
754SYNOPSIS
755
756 CORE_ADDR locate_base (void)
757
758DESCRIPTION
759
760 For both the SunOS and SVR4 shared library implementations, if the
761 inferior executable has been linked dynamically, there is a single
762 address somewhere in the inferior's data space which is the key to
d261ece7 763 locating all of the dynamic linker's runtime structures. This
4ad0021e
JK
764 address is the value of the debug base symbol. The job of this
765 function is to find and return that address, or to return 0 if there
766 is no such address (the executable is statically linked for example).
f8b76e70
FF
767
768 For SunOS, the job is almost trivial, since the dynamic linker and
769 all of it's structures are statically linked to the executable at
770 link time. Thus the symbol for the address we are looking for has
b0246b3b
FF
771 already been added to the minimal symbol table for the executable's
772 objfile at the time the symbol file's symbols were read, and all we
773 have to do is look it up there. Note that we explicitly do NOT want
774 to find the copies in the shared library.
f8b76e70 775
2fe3b329
PS
776 The SVR4 version is a bit more complicated because the address
777 is contained somewhere in the dynamic info section. We have to go
4ad0021e
JK
778 to a lot more work to discover the address of the debug base symbol.
779 Because of this complexity, we cache the value we find and return that
780 value on subsequent invocations. Note there is no copy in the
781 executable symbol tables.
f8b76e70 782
f8b76e70
FF
783 */
784
785static CORE_ADDR
786locate_base ()
787{
f8b76e70 788
d261ece7 789#ifndef SVR4_SHARED_LIBS
f8b76e70 790
b0246b3b 791 struct minimal_symbol *msymbol;
d261ece7 792 CORE_ADDR address = 0;
4ad0021e 793 char **symbolp;
f8b76e70 794
4ad0021e
JK
795 /* For SunOS, we want to limit the search for the debug base symbol to the
796 executable being debugged, since there is a duplicate named symbol in the
797 shared library. We don't want the shared library versions. */
b0246b3b 798
4ad0021e 799 for (symbolp = debug_base_symbols; *symbolp != NULL; symbolp++)
f8b76e70 800 {
1a494973 801 msymbol = lookup_minimal_symbol (*symbolp, NULL, symfile_objfile);
4ad0021e
JK
802 if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
803 {
804 address = SYMBOL_VALUE_ADDRESS (msymbol);
805 return (address);
806 }
f8b76e70 807 }
4ad0021e 808 return (0);
f8b76e70 809
d261ece7 810#else /* SVR4_SHARED_LIBS */
f8b76e70 811
d261ece7
SG
812 /* Check to see if we have a currently valid address, and if so, avoid
813 doing all this work again and just return the cached address. If
2fe3b329 814 we have no cached address, try to locate it in the dynamic info
54d478cd 815 section for ELF executables. */
f8b76e70 816
d261ece7 817 if (debug_base == 0)
f8b76e70 818 {
54d478cd
PS
819 if (exec_bfd != NULL
820 && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour)
821 debug_base = elf_locate_base ();
822#ifdef HANDLE_SVR4_EXEC_EMULATORS
823 /* Try it the hard way for emulated executables. */
ace4b8d7 824 else if (inferior_pid != 0 && target_has_execution)
54d478cd
PS
825 proc_iterate_over_mappings (look_for_base);
826#endif
f8b76e70 827 }
d261ece7 828 return (debug_base);
f8b76e70 829
d261ece7 830#endif /* !SVR4_SHARED_LIBS */
f8b76e70
FF
831
832}
bd5635a1 833
a608f919
FF
834/*
835
836LOCAL FUNCTION
837
838 first_link_map_member -- locate first member in dynamic linker's map
839
840SYNOPSIS
841
842 static struct link_map *first_link_map_member (void)
843
844DESCRIPTION
845
846 Read in a copy of the first member in the inferior's dynamic
847 link map from the inferior's dynamic linker structures, and return
848 a pointer to the copy in our address space.
849*/
850
f8b76e70
FF
851static struct link_map *
852first_link_map_member ()
bd5635a1 853{
f8b76e70
FF
854 struct link_map *lm = NULL;
855
d261ece7 856#ifndef SVR4_SHARED_LIBS
f8b76e70 857
b0246b3b 858 read_memory (debug_base, (char *) &dynamic_copy, sizeof (dynamic_copy));
f8b76e70
FF
859 if (dynamic_copy.ld_version >= 2)
860 {
861 /* It is a version that we can deal with, so read in the secondary
862 structure and find the address of the link map list from it. */
b0246b3b 863 read_memory ((CORE_ADDR) dynamic_copy.ld_un.ld_2, (char *) &ld_2_copy,
f8b76e70
FF
864 sizeof (struct link_dynamic_2));
865 lm = ld_2_copy.ld_loaded;
866 }
867
d261ece7 868#else /* SVR4_SHARED_LIBS */
f8b76e70 869
b0246b3b 870 read_memory (debug_base, (char *) &debug_copy, sizeof (struct r_debug));
a608f919
FF
871 /* FIXME: Perhaps we should validate the info somehow, perhaps by
872 checking r_version for a known version number, or r_state for
873 RT_CONSISTENT. */
f8b76e70
FF
874 lm = debug_copy.r_map;
875
d261ece7 876#endif /* !SVR4_SHARED_LIBS */
d0237a54 877
f8b76e70
FF
878 return (lm);
879}
880
881/*
882
b0246b3b 883LOCAL FUNCTION
f8b76e70
FF
884
885 find_solib -- step through list of shared objects
886
887SYNOPSIS
888
889 struct so_list *find_solib (struct so_list *so_list_ptr)
890
891DESCRIPTION
892
893 This module contains the routine which finds the names of any
894 loaded "images" in the current process. The argument in must be
895 NULL on the first call, and then the returned value must be passed
896 in on subsequent calls. This provides the capability to "step" down
897 the list of loaded objects. On the last object, a NULL value is
898 returned.
d0237a54 899
f8b76e70
FF
900 The arg and return value are "struct link_map" pointers, as defined
901 in <link.h>.
902 */
d0237a54 903
b0246b3b 904static struct so_list *
f8b76e70
FF
905find_solib (so_list_ptr)
906 struct so_list *so_list_ptr; /* Last lm or NULL for first one */
907{
908 struct so_list *so_list_next = NULL;
909 struct link_map *lm = NULL;
910 struct so_list *new;
911
912 if (so_list_ptr == NULL)
913 {
914 /* We are setting up for a new scan through the loaded images. */
915 if ((so_list_next = so_list_head) == NULL)
916 {
917 /* We have not already read in the dynamic linking structures
918 from the inferior, lookup the address of the base structure. */
919 debug_base = locate_base ();
a608f919 920 if (debug_base != 0)
f8b76e70
FF
921 {
922 /* Read the base structure in and find the address of the first
923 link map list member. */
924 lm = first_link_map_member ();
925 }
926 }
927 }
928 else
929 {
930 /* We have been called before, and are in the process of walking
931 the shared library list. Advance to the next shared object. */
932 if ((lm = LM_NEXT (so_list_ptr)) == NULL)
933 {
934 /* We have hit the end of the list, so check to see if any were
935 added, but be quiet if we can't read from the target any more. */
936 int status = target_read_memory ((CORE_ADDR) so_list_ptr -> lmaddr,
937 (char *) &(so_list_ptr -> lm),
938 sizeof (struct link_map));
939 if (status == 0)
940 {
941 lm = LM_NEXT (so_list_ptr);
942 }
943 else
944 {
945 lm = NULL;
946 }
947 }
948 so_list_next = so_list_ptr -> next;
949 }
950 if ((so_list_next == NULL) && (lm != NULL))
951 {
952 /* Get next link map structure from inferior image and build a local
953 abbreviated load_map structure */
954 new = (struct so_list *) xmalloc (sizeof (struct so_list));
de9bef49 955 memset ((char *) new, 0, sizeof (struct so_list));
f8b76e70
FF
956 new -> lmaddr = lm;
957 /* Add the new node as the next node in the list, or as the root
958 node if this is the first one. */
959 if (so_list_ptr != NULL)
960 {
961 so_list_ptr -> next = new;
962 }
963 else
964 {
965 so_list_head = new;
7d0a3fc8
DT
966
967 if (! solib_cleanup_queued)
968 {
969 make_run_cleanup (do_clear_solib);
970 solib_cleanup_queued = 1;
971 }
972
f8b76e70
FF
973 }
974 so_list_next = new;
b0246b3b
FF
975 read_memory ((CORE_ADDR) lm, (char *) &(new -> lm),
976 sizeof (struct link_map));
4ad0021e
JK
977 /* For SVR4 versions, the first entry in the link map is for the
978 inferior executable, so we must ignore it. For some versions of
979 SVR4, it has no name. For others (Solaris 2.3 for example), it
980 does have a name, so we can no longer use a missing name to
981 decide when to ignore it. */
982 if (!IGNORE_FIRST_LINK_MAP_ENTRY (new -> lm))
f8b76e70 983 {
4ad0021e
JK
984 int errcode;
985 char *buffer;
986 target_read_string ((CORE_ADDR) LM_NAME (new), &buffer,
987 MAX_PATH_SIZE - 1, &errcode);
988 if (errcode != 0)
989 error ("find_solib: Can't read pathname for load map: %s\n",
990 safe_strerror (errcode));
991 strncpy (new -> so_name, buffer, MAX_PATH_SIZE - 1);
992 new -> so_name[MAX_PATH_SIZE - 1] = '\0';
993 free (buffer);
f8b76e70
FF
994 solib_map_sections (new);
995 }
996 }
997 return (so_list_next);
bd5635a1 998}
d0237a54 999
bdbd5f50
JG
1000/* A small stub to get us past the arg-passing pinhole of catch_errors. */
1001
1002static int
1003symbol_add_stub (arg)
1004 char *arg;
d0237a54 1005{
f8b76e70 1006 register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
7d0a3fc8
DT
1007 CORE_ADDR text_addr = 0;
1008
1009 if (so -> textsection)
1010 text_addr = so -> textsection -> addr;
1011 else
1012 {
1013 asection *lowest_sect;
1014
1015 /* If we didn't find a mapped non zero sized .text section, set up
1016 text_addr so that the relocation in symbol_file_add does no harm. */
1017
1018 lowest_sect = bfd_get_section_by_name (so -> abfd, ".text");
1019 if (lowest_sect == NULL)
1020 bfd_map_over_sections (so -> abfd, find_lowest_section,
1021 (PTR) &lowest_sect);
1022 if (lowest_sect)
1023 text_addr = bfd_section_vma (so -> abfd, lowest_sect)
1024 + (CORE_ADDR) LM_ADDR (so);
1025 }
f8b76e70 1026
7d0a3fc8
DT
1027 ALL_OBJFILES (so -> objfile)
1028 {
1029 if (strcmp (so -> objfile -> name, so -> so_name) == 0)
1030 return 1;
1031 }
54d478cd
PS
1032 so -> objfile =
1033 symbol_file_add (so -> so_name, so -> from_tty,
7d0a3fc8 1034 text_addr,
54d478cd 1035 0, 0, 0);
f8b76e70 1036 return (1);
d0237a54 1037}
bd5635a1 1038
1a494973
C
1039/* This function will check the so name to see if matches the main list.
1040 In some system the main object is in the list, which we want to exclude */
1041
1042static int match_main (soname)
1043 char *soname;
1044{
2858b1f2 1045 char **mainp;
1a494973 1046
2858b1f2
KH
1047 for (mainp = main_name_list; *mainp != NULL; mainp++)
1048 {
1049 if (strcmp (soname, *mainp) == 0)
1a494973 1050 return (1);
2858b1f2 1051 }
1a494973 1052
2858b1f2 1053 return (0);
1a494973
C
1054}
1055
f8b76e70
FF
1056/*
1057
1058GLOBAL FUNCTION
1059
1060 solib_add -- add a shared library file to the symtab and section list
1061
1062SYNOPSIS
1063
1064 void solib_add (char *arg_string, int from_tty,
1065 struct target_ops *target)
1066
1067DESCRIPTION
1068
1069*/
bdbd5f50
JG
1070
1071void
1072solib_add (arg_string, from_tty, target)
1073 char *arg_string;
1074 int from_tty;
1075 struct target_ops *target;
bd5635a1 1076{
f8b76e70 1077 register struct so_list *so = NULL; /* link map state variable */
a71c0593
FF
1078
1079 /* Last shared library that we read. */
1080 struct so_list *so_last = NULL;
1081
f8b76e70
FF
1082 char *re_err;
1083 int count;
1084 int old;
1085
1086 if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
1087 {
1088 error ("Invalid regexp: %s", re_err);
1089 }
1090
2fe3b329 1091 /* Add the shared library sections to the section table of the
54d478cd 1092 specified target, if any. */
f8b76e70
FF
1093 if (target)
1094 {
1095 /* Count how many new section_table entries there are. */
1096 so = NULL;
1097 count = 0;
1098 while ((so = find_solib (so)) != NULL)
1099 {
1a494973 1100 if (so -> so_name[0] && !match_main (so -> so_name))
f8b76e70
FF
1101 {
1102 count += so -> sections_end - so -> sections;
1103 }
1104 }
1105
1106 if (count)
1107 {
464c6c5f
JL
1108 int update_coreops;
1109
1110 /* We must update the to_sections field in the core_ops structure
1111 here, otherwise we dereference a potential dangling pointer
1112 for each call to target_read/write_memory within this routine. */
1113 update_coreops = core_ops.to_sections == target->to_sections;
1114
f8b76e70 1115 /* Reallocate the target's section table including the new size. */
ee0613d1 1116 if (target -> to_sections)
f8b76e70 1117 {
ee0613d1
JG
1118 old = target -> to_sections_end - target -> to_sections;
1119 target -> to_sections = (struct section_table *)
a71c0593 1120 xrealloc ((char *)target -> to_sections,
f8b76e70
FF
1121 (sizeof (struct section_table)) * (count + old));
1122 }
1123 else
1124 {
1125 old = 0;
ee0613d1 1126 target -> to_sections = (struct section_table *)
a71c0593 1127 xmalloc ((sizeof (struct section_table)) * count);
f8b76e70 1128 }
ee0613d1 1129 target -> to_sections_end = target -> to_sections + (count + old);
f8b76e70 1130
464c6c5f
JL
1131 /* Update the to_sections field in the core_ops structure
1132 if needed. */
1133 if (update_coreops)
1134 {
1135 core_ops.to_sections = target->to_sections;
1136 core_ops.to_sections_end = target->to_sections_end;
1137 }
1138
f8b76e70
FF
1139 /* Add these section table entries to the target's table. */
1140 while ((so = find_solib (so)) != NULL)
1141 {
1142 if (so -> so_name[0])
1143 {
1144 count = so -> sections_end - so -> sections;
de9bef49
JG
1145 memcpy ((char *) (target -> to_sections + old),
1146 so -> sections,
1147 (sizeof (struct section_table)) * count);
f8b76e70
FF
1148 old += count;
1149 }
1150 }
1151 }
1152 }
2fe3b329
PS
1153
1154 /* Now add the symbol files. */
1155 while ((so = find_solib (so)) != NULL)
1156 {
1a494973
C
1157 if (so -> so_name[0] && re_exec (so -> so_name) &&
1158 !match_main (so -> so_name))
2fe3b329
PS
1159 {
1160 so -> from_tty = from_tty;
1161 if (so -> symbols_loaded)
1162 {
1163 if (from_tty)
1164 {
1165 printf_unfiltered ("Symbols already loaded for %s\n", so -> so_name);
1166 }
1167 }
1168 else if (catch_errors
1169 (symbol_add_stub, (char *) so,
1170 "Error while reading shared library symbols:\n",
1171 RETURN_MASK_ALL))
1172 {
1173 so_last = so;
1174 so -> symbols_loaded = 1;
1175 }
1176 }
1177 }
a71c0593 1178
54d478cd
PS
1179 /* Getting new symbols may change our opinion about what is
1180 frameless. */
1181 if (so_last)
1182 reinit_frame_cache ();
1183
a71c0593
FF
1184 if (so_last)
1185 special_symbol_handling (so_last);
bd5635a1 1186}
bdbd5f50 1187
f8b76e70 1188/*
bd5635a1 1189
f8b76e70
FF
1190LOCAL FUNCTION
1191
1192 info_sharedlibrary_command -- code for "info sharedlibrary"
1193
1194SYNOPSIS
1195
1196 static void info_sharedlibrary_command ()
1197
1198DESCRIPTION
bd5635a1 1199
f8b76e70
FF
1200 Walk through the shared library list and print information
1201 about each attached library.
1202*/
1203
1204static void
51b57ded
FF
1205info_sharedlibrary_command (ignore, from_tty)
1206 char *ignore;
1207 int from_tty;
f8b76e70
FF
1208{
1209 register struct so_list *so = NULL; /* link map state variable */
1210 int header_done = 0;
124e64bb
JM
1211 int addr_width;
1212 char *addr_fmt;
1213
f8b76e70
FF
1214 if (exec_bfd == NULL)
1215 {
8d60affd 1216 printf_unfiltered ("No exec file.\n");
f8b76e70
FF
1217 return;
1218 }
124e64bb
JM
1219
1220#ifndef TARGET_ELF64
1221 addr_width = 8+4;
1222 addr_fmt = "08l";
1223#else
1224 addr_width = 16+4;
1225 addr_fmt = "016l";
1226#endif
1227
f8b76e70
FF
1228 while ((so = find_solib (so)) != NULL)
1229 {
1230 if (so -> so_name[0])
1231 {
1232 if (!header_done)
1233 {
124e64bb
JM
1234 printf_unfiltered("%-*s%-*s%-12s%s\n", addr_width, "From",
1235 addr_width, "To", "Syms Read",
1236 "Shared Object Library");
f8b76e70
FF
1237 header_done++;
1238 }
124e64bb
JM
1239
1240 printf_unfiltered ("%-*s", addr_width,
a71c0593 1241 local_hex_string_custom ((unsigned long) LM_ADDR (so),
124e64bb
JM
1242 addr_fmt));
1243 printf_unfiltered ("%-*s", addr_width,
a71c0593 1244 local_hex_string_custom ((unsigned long) so -> lmend,
124e64bb 1245 addr_fmt));
8d60affd
JK
1246 printf_unfiltered ("%-12s", so -> symbols_loaded ? "Yes" : "No");
1247 printf_unfiltered ("%s\n", so -> so_name);
bd5635a1 1248 }
bd5635a1 1249 }
f8b76e70
FF
1250 if (so_list_head == NULL)
1251 {
8d60affd 1252 printf_unfiltered ("No shared libraries loaded at this time.\n");
bd5635a1
RP
1253 }
1254}
1255
1256/*
f8b76e70
FF
1257
1258GLOBAL FUNCTION
1259
1260 solib_address -- check to see if an address is in a shared lib
1261
1262SYNOPSIS
1263
464c6c5f 1264 char * solib_address (CORE_ADDR address)
f8b76e70
FF
1265
1266DESCRIPTION
1267
1268 Provides a hook for other gdb routines to discover whether or
1269 not a particular address is within the mapped address space of
1270 a shared library. Any address between the base mapping address
1271 and the first address beyond the end of the last mapping, is
1272 considered to be within the shared library address space, for
1273 our purposes.
1274
1275 For example, this routine is called at one point to disable
1276 breakpoints which are in shared libraries that are not currently
1277 mapped in.
1278 */
1279
464c6c5f 1280char *
f8b76e70 1281solib_address (address)
bd5635a1
RP
1282 CORE_ADDR address;
1283{
f8b76e70
FF
1284 register struct so_list *so = 0; /* link map state variable */
1285
1286 while ((so = find_solib (so)) != NULL)
1287 {
1288 if (so -> so_name[0])
1289 {
1290 if ((address >= (CORE_ADDR) LM_ADDR (so)) &&
1291 (address < (CORE_ADDR) so -> lmend))
464c6c5f 1292 return (so->so_name);
f8b76e70
FF
1293 }
1294 }
1295 return (0);
1296}
1297
1298/* Called by free_all_symtabs */
bd5635a1 1299
f8b76e70
FF
1300void
1301clear_solib()
1302{
1303 struct so_list *next;
a608f919 1304 char *bfd_filename;
f8b76e70
FF
1305
1306 while (so_list_head)
1307 {
1308 if (so_list_head -> sections)
1309 {
be772100 1310 free ((PTR)so_list_head -> sections);
f8b76e70 1311 }
a71c0593 1312 if (so_list_head -> abfd)
a608f919 1313 {
a71c0593 1314 bfd_filename = bfd_get_filename (so_list_head -> abfd);
1a494973
C
1315 if (!bfd_close (so_list_head -> abfd))
1316 warning ("cannot close \"%s\": %s",
1317 bfd_filename, bfd_errmsg (bfd_get_error ()));
a608f919
FF
1318 }
1319 else
1320 /* This happens for the executable on SVR4. */
1321 bfd_filename = NULL;
1322
f8b76e70 1323 next = so_list_head -> next;
a608f919
FF
1324 if (bfd_filename)
1325 free ((PTR)bfd_filename);
1326 free ((PTR)so_list_head);
f8b76e70 1327 so_list_head = next;
bd5635a1 1328 }
f8b76e70 1329 debug_base = 0;
bd5635a1
RP
1330}
1331
7d0a3fc8
DT
1332static void
1333do_clear_solib (dummy)
1334 PTR dummy;
1335{
1336 solib_cleanup_queued = 0;
1337 clear_solib ();
1338}
1339
1340#ifdef SVR4_SHARED_LIBS
1341
1342/* Return 1 if PC lies in the dynamic symbol resolution code of the
1343 SVR4 run time loader. */
1344
1345static CORE_ADDR interp_text_sect_low;
1346static CORE_ADDR interp_text_sect_high;
1347static CORE_ADDR interp_plt_sect_low;
1348static CORE_ADDR interp_plt_sect_high;
1349
1350int
1351in_svr4_dynsym_resolve_code (pc)
1352 CORE_ADDR pc;
1353{
1354 return ((pc >= interp_text_sect_low && pc < interp_text_sect_high)
1355 || (pc >= interp_plt_sect_low && pc < interp_plt_sect_high)
1356 || in_plt_section (pc, NULL));
1357}
1358#endif
1359
bd5635a1 1360/*
f8b76e70
FF
1361
1362LOCAL FUNCTION
1363
1364 disable_break -- remove the "mapping changed" breakpoint
1365
1366SYNOPSIS
1367
1368 static int disable_break ()
1369
1370DESCRIPTION
1371
1372 Removes the breakpoint that gets hit when the dynamic linker
1373 completes a mapping change.
1374
bd5635a1 1375*/
f8b76e70 1376
ace4b8d7
FF
1377#ifndef SVR4_SHARED_LIBS
1378
f8b76e70
FF
1379static int
1380disable_break ()
bd5635a1 1381{
f8b76e70
FF
1382 int status = 1;
1383
d261ece7 1384#ifndef SVR4_SHARED_LIBS
f8b76e70
FF
1385
1386 int in_debugger = 0;
1387
f8b76e70
FF
1388 /* Read the debugger structure from the inferior to retrieve the
1389 address of the breakpoint and the original contents of the
1390 breakpoint address. Remove the breakpoint by writing the original
1391 contents back. */
1392
b0246b3b 1393 read_memory (debug_addr, (char *) &debug_copy, sizeof (debug_copy));
d261ece7
SG
1394
1395 /* Set `in_debugger' to zero now. */
1396
b0246b3b 1397 write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
d261ece7 1398
f8b76e70 1399 breakpoint_addr = (CORE_ADDR) debug_copy.ldd_bp_addr;
b0246b3b 1400 write_memory (breakpoint_addr, (char *) &debug_copy.ldd_bp_inst,
f8b76e70
FF
1401 sizeof (debug_copy.ldd_bp_inst));
1402
d261ece7 1403#else /* SVR4_SHARED_LIBS */
f8b76e70
FF
1404
1405 /* Note that breakpoint address and original contents are in our address
1406 space, so we just need to write the original contents back. */
1407
1408 if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
1409 {
1410 status = 0;
1411 }
1412
d261ece7 1413#endif /* !SVR4_SHARED_LIBS */
f8b76e70
FF
1414
1415 /* For the SVR4 version, we always know the breakpoint address. For the
1416 SunOS version we don't know it until the above code is executed.
1417 Grumble if we are stopped anywhere besides the breakpoint address. */
1418
1419 if (stop_pc != breakpoint_addr)
1420 {
1421 warning ("stopped at unknown breakpoint while handling shared libraries");
1422 }
1423
1424 return (status);
bdbd5f50
JG
1425}
1426
ace4b8d7
FF
1427#endif /* #ifdef SVR4_SHARED_LIBS */
1428
f8b76e70 1429/*
bdbd5f50 1430
f8b76e70
FF
1431LOCAL FUNCTION
1432
1433 enable_break -- arrange for dynamic linker to hit breakpoint
1434
1435SYNOPSIS
1436
1437 int enable_break (void)
1438
1439DESCRIPTION
1440
1441 Both the SunOS and the SVR4 dynamic linkers have, as part of their
1442 debugger interface, support for arranging for the inferior to hit
1443 a breakpoint after mapping in the shared libraries. This function
1444 enables that breakpoint.
1445
1446 For SunOS, there is a special flag location (in_debugger) which we
1447 set to 1. When the dynamic linker sees this flag set, it will set
1448 a breakpoint at a location known only to itself, after saving the
1449 original contents of that place and the breakpoint address itself,
1450 in it's own internal structures. When we resume the inferior, it
1451 will eventually take a SIGTRAP when it runs into the breakpoint.
1452 We handle this (in a different place) by restoring the contents of
1453 the breakpointed location (which is only known after it stops),
1454 chasing around to locate the shared libraries that have been
1455 loaded, then resuming.
1456
1457 For SVR4, the debugger interface structure contains a member (r_brk)
1458 which is statically initialized at the time the shared library is
1459 built, to the offset of a function (_r_debug_state) which is guaran-
1460 teed to be called once before mapping in a library, and again when
1461 the mapping is complete. At the time we are examining this member,
1462 it contains only the unrelocated offset of the function, so we have
1463 to do our own relocation. Later, when the dynamic linker actually
1464 runs, it relocates r_brk to be the actual address of _r_debug_state().
1465
1466 The debugger interface structure also contains an enumeration which
1467 is set to either RT_ADD or RT_DELETE prior to changing the mapping,
1468 depending upon whether or not the library is being mapped or unmapped,
1469 and then set to RT_CONSISTENT after the library is mapped/unmapped.
1470*/
1471
1472static int
1473enable_break ()
bdbd5f50 1474{
a608f919 1475 int success = 0;
bdbd5f50 1476
d261ece7 1477#ifndef SVR4_SHARED_LIBS
bdbd5f50 1478
51b57ded 1479 int j;
f8b76e70 1480 int in_debugger;
51b57ded 1481
bdbd5f50 1482 /* Get link_dynamic structure */
f8b76e70
FF
1483
1484 j = target_read_memory (debug_base, (char *) &dynamic_copy,
1485 sizeof (dynamic_copy));
1486 if (j)
1487 {
1488 /* unreadable */
1489 return (0);
1490 }
06b6c733 1491
bdbd5f50 1492 /* Calc address of debugger interface structure */
f8b76e70
FF
1493
1494 debug_addr = (CORE_ADDR) dynamic_copy.ldd;
1495
bdbd5f50 1496 /* Calc address of `in_debugger' member of debugger interface structure */
f8b76e70
FF
1497
1498 flag_addr = debug_addr + (CORE_ADDR) ((char *) &debug_copy.ldd_in_debugger -
1499 (char *) &debug_copy);
1500
bdbd5f50 1501 /* Write a value of 1 to this member. */
f8b76e70 1502
bdbd5f50 1503 in_debugger = 1;
b0246b3b 1504 write_memory (flag_addr, (char *) &in_debugger, sizeof (in_debugger));
a608f919 1505 success = 1;
f8b76e70 1506
d261ece7 1507#else /* SVR4_SHARED_LIBS */
f8b76e70 1508
a608f919 1509#ifdef BKPT_AT_SYMBOL
f8b76e70 1510
b0246b3b 1511 struct minimal_symbol *msymbol;
a608f919 1512 char **bkpt_namep;
464c6c5f
JL
1513 asection *interp_sect;
1514
1515 /* First, remove all the solib event breakpoints. Their addresses
1516 may have changed since the last time we ran the program. */
1517 remove_solib_event_breakpoints ();
1518
1519#ifdef SVR4_SHARED_LIBS
7d0a3fc8
DT
1520 interp_text_sect_low = interp_text_sect_high = 0;
1521 interp_plt_sect_low = interp_plt_sect_high = 0;
1522
464c6c5f
JL
1523 /* Find the .interp section; if not found, warn the user and drop
1524 into the old breakpoint at symbol code. */
1525 interp_sect = bfd_get_section_by_name (exec_bfd, ".interp");
1526 if (interp_sect)
1527 {
1528 unsigned int interp_sect_size;
1529 char *buf;
1530 CORE_ADDR load_addr;
1531 bfd *tmp_bfd;
11be829f 1532 CORE_ADDR sym_addr = 0;
464c6c5f
JL
1533
1534 /* Read the contents of the .interp section into a local buffer;
1535 the contents specify the dynamic linker this program uses. */
1536 interp_sect_size = bfd_section_size (exec_bfd, interp_sect);
1537 buf = alloca (interp_sect_size);
1538 bfd_get_section_contents (exec_bfd, interp_sect,
1539 buf, 0, interp_sect_size);
1540
1541 /* Now we need to figure out where the dynamic linker was
1542 loaded so that we can load its symbols and place a breakpoint
1543 in the dynamic linker itself.
1544
1545 This address is stored on the stack. However, I've been unable
1546 to find any magic formula to find it for Solaris (appears to
1547 be trivial on Linux). Therefore, we have to try an alternate
1548 mechanism to find the dynamic linker's base address. */
1549 tmp_bfd = bfd_openr (buf, gnutarget);
1550 if (tmp_bfd == NULL)
1551 goto bkpt_at_symbol;
1552
1553 /* Make sure the dynamic linker's really a useful object. */
1554 if (!bfd_check_format (tmp_bfd, bfd_object))
1555 {
1556 warning ("Unable to grok dynamic linker %s as an object file", buf);
1557 bfd_close (tmp_bfd);
1558 goto bkpt_at_symbol;
1559 }
1560
1561 /* We find the dynamic linker's base address by examining the
1562 current pc (which point at the entry point for the dynamic
1563 linker) and subtracting the offset of the entry point. */
1564 load_addr = read_pc () - tmp_bfd->start_address;
1565
7d0a3fc8
DT
1566 /* Record the relocated start and end address of the dynamic linker
1567 text and plt section for in_svr4_dynsym_resolve_code. */
1568 interp_sect = bfd_get_section_by_name (tmp_bfd, ".text");
1569 if (interp_sect)
1570 {
1571 interp_text_sect_low =
1572 bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
1573 interp_text_sect_high =
1574 interp_text_sect_low + bfd_section_size (tmp_bfd, interp_sect);
1575 }
1576 interp_sect = bfd_get_section_by_name (tmp_bfd, ".plt");
1577 if (interp_sect)
1578 {
1579 interp_plt_sect_low =
1580 bfd_section_vma (tmp_bfd, interp_sect) + load_addr;
1581 interp_plt_sect_high =
1582 interp_plt_sect_low + bfd_section_size (tmp_bfd, interp_sect);
1583 }
1584
11be829f
JL
1585 /* Now try to set a breakpoint in the dynamic linker. */
1586 for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++)
464c6c5f 1587 {
11be829f
JL
1588 sym_addr = bfd_lookup_symbol (tmp_bfd, *bkpt_namep);
1589 if (sym_addr != 0)
1590 break;
464c6c5f
JL
1591 }
1592
464c6c5f
JL
1593 /* We're done with the temporary bfd. */
1594 bfd_close (tmp_bfd);
1595
11be829f 1596 if (sym_addr != 0)
464c6c5f 1597 {
11be829f
JL
1598 create_solib_event_breakpoint (load_addr + sym_addr);
1599 return 1;
464c6c5f
JL
1600 }
1601
1602 /* For whatever reason we couldn't set a breakpoint in the dynamic
1603 linker. Warn and drop into the old code. */
1604bkpt_at_symbol:
1605 warning ("Unable to find dynamic linker breakpoint function.");
1606 warning ("GDB will be unable to debug shared library initializers");
1607 warning ("and track explicitly loaded dynamic code.");
1608 }
1609#endif
f8b76e70 1610
a608f919
FF
1611 /* Scan through the list of symbols, trying to look up the symbol and
1612 set a breakpoint there. Terminate loop when we/if we succeed. */
f8b76e70 1613
a608f919
FF
1614 breakpoint_addr = 0;
1615 for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++)
f8b76e70 1616 {
1a494973 1617 msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile);
a608f919
FF
1618 if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
1619 {
464c6c5f
JL
1620 create_solib_event_breakpoint (SYMBOL_VALUE_ADDRESS (msymbol));
1621 return 1;
a608f919 1622 }
f8b76e70
FF
1623 }
1624
464c6c5f 1625 /* Nothing good happened. */
7d0a3fc8 1626 success = 0;
f8b76e70 1627
a608f919 1628#endif /* BKPT_AT_SYMBOL */
f8b76e70 1629
d261ece7 1630#endif /* !SVR4_SHARED_LIBS */
f8b76e70 1631
a608f919 1632 return (success);
f8b76e70
FF
1633}
1634
1635/*
1636
1637GLOBAL FUNCTION
1638
1639 solib_create_inferior_hook -- shared library startup support
1640
1641SYNOPSIS
1642
1643 void solib_create_inferior_hook()
1644
1645DESCRIPTION
1646
1647 When gdb starts up the inferior, it nurses it along (through the
1648 shell) until it is ready to execute it's first instruction. At this
1649 point, this function gets called via expansion of the macro
1650 SOLIB_CREATE_INFERIOR_HOOK.
1651
a608f919
FF
1652 For SunOS executables, this first instruction is typically the
1653 one at "_start", or a similar text label, regardless of whether
1654 the executable is statically or dynamically linked. The runtime
1655 startup code takes care of dynamically linking in any shared
1656 libraries, once gdb allows the inferior to continue.
1657
1658 For SVR4 executables, this first instruction is either the first
1659 instruction in the dynamic linker (for dynamically linked
1660 executables) or the instruction at "start" for statically linked
1661 executables. For dynamically linked executables, the system
1662 first exec's /lib/libc.so.N, which contains the dynamic linker,
1663 and starts it running. The dynamic linker maps in any needed
1664 shared libraries, maps in the actual user executable, and then
1665 jumps to "start" in the user executable.
1666
f8b76e70
FF
1667 For both SunOS shared libraries, and SVR4 shared libraries, we
1668 can arrange to cooperate with the dynamic linker to discover the
1669 names of shared libraries that are dynamically linked, and the
1670 base addresses to which they are linked.
1671
1672 This function is responsible for discovering those names and
1673 addresses, and saving sufficient information about them to allow
1674 their symbols to be read at a later time.
1675
1676FIXME
1677
1678 Between enable_break() and disable_break(), this code does not
1679 properly handle hitting breakpoints which the user might have
1680 set in the startup code or in the dynamic linker itself. Proper
1681 handling will probably have to wait until the implementation is
1682 changed to use the "breakpoint handler function" method.
1683
1684 Also, what if child has exit()ed? Must exit loop somehow.
1685 */
1686
124e64bb 1687void
f8b76e70
FF
1688solib_create_inferior_hook()
1689{
124e64bb
JM
1690 static int dyn_relocated;
1691
ff56144e
JK
1692 /* If we are using the BKPT_AT_SYMBOL code, then we don't need the base
1693 yet. In fact, in the case of a SunOS4 executable being run on
1694 Solaris, we can't get it yet. find_solib will get it when it needs
1695 it. */
1696#if !(defined (SVR4_SHARED_LIBS) && defined (BKPT_AT_SYMBOL))
f8b76e70
FF
1697 if ((debug_base = locate_base ()) == 0)
1698 {
1699 /* Can't find the symbol or the executable is statically linked. */
1700 return;
1701 }
ff56144e 1702#endif
f8b76e70
FF
1703
1704 if (!enable_break ())
1705 {
1706 warning ("shared library handler failed to enable breakpoint");
1707 return;
1708 }
1709
124e64bb
JM
1710 if (!dyn_relocated && exec_bfd->start_address != stop_pc)
1711 {
1712 /* We have to relocate the debug information. */
1713 CORE_ADDR displacement = stop_pc - exec_bfd->start_address;
1714 struct section_offsets *new_offsets;
1715 int i;
1716
1717 new_offsets = alloca (symfile_objfile->num_sections
1718 * sizeof (*new_offsets));
1719
1720 for (i = 0; i < symfile_objfile->num_sections; ++i)
1721 ANOFFSET (new_offsets, i) =
1722 ANOFFSET (symfile_objfile->section_offsets, i);
1723
1724 ANOFFSET (new_offsets, SECT_OFF_TEXT) += displacement;
1725 ANOFFSET (new_offsets, SECT_OFF_DATA) += displacement;
1726 ANOFFSET (new_offsets, SECT_OFF_BSS) += displacement;
1727 ANOFFSET (new_offsets, SECT_OFF_RODATA) += displacement;
1728
1729 objfile_relocate (symfile_objfile, new_offsets);
1730 breakpoint_re_set ();
1731
1732 /* Make sure this relocation is done only once. */
1733 dyn_relocated = 1;
1734 }
1735
13f6c7ea 1736#ifndef SVR4_SHARED_LIBS
464c6c5f
JL
1737 /* Only SunOS needs the loop below, other systems should be using the
1738 special shared library breakpoints and the shared library breakpoint
1739 service routine.
1740
1741 Now run the target. It will eventually hit the breakpoint, at
f8b76e70
FF
1742 which point all of the libraries will have been mapped in and we
1743 can go groveling around in the dynamic linker structures to find
1744 out what we need to know about them. */
bdbd5f50
JG
1745
1746 clear_proceed_status ();
1747 stop_soon_quietly = 1;
4ad0021e 1748 stop_signal = TARGET_SIGNAL_0;
f8b76e70 1749 do
bdbd5f50 1750 {
8d60affd 1751 target_resume (-1, 0, stop_signal);
bdbd5f50
JG
1752 wait_for_inferior ();
1753 }
4ad0021e 1754 while (stop_signal != TARGET_SIGNAL_TRAP);
bdbd5f50 1755 stop_soon_quietly = 0;
f8b76e70
FF
1756
1757 /* We are now either at the "mapping complete" breakpoint (or somewhere
1758 else, a condition we aren't prepared to deal with anyway), so adjust
1759 the PC as necessary after a breakpoint, disable the breakpoint, and
1760 add any shared libraries that were mapped in. */
bdbd5f50 1761
f8b76e70
FF
1762 if (DECR_PC_AFTER_BREAK)
1763 {
1764 stop_pc -= DECR_PC_AFTER_BREAK;
1765 write_register (PC_REGNUM, stop_pc);
1766 }
1767
1768 if (!disable_break ())
1769 {
1770 warning ("shared library handler failed to disable breakpoint");
1771 }
1772
464c6c5f 1773 if (auto_solib_add)
1a494973 1774 solib_add ((char *) 0, 0, (struct target_ops *) 0);
464c6c5f 1775#endif
bdbd5f50
JG
1776}
1777
f8b76e70
FF
1778/*
1779
b0246b3b
FF
1780LOCAL FUNCTION
1781
1782 special_symbol_handling -- additional shared library symbol handling
1783
1784SYNOPSIS
1785
1786 void special_symbol_handling (struct so_list *so)
1787
1788DESCRIPTION
1789
1790 Once the symbols from a shared object have been loaded in the usual
1791 way, we are called to do any system specific symbol handling that
1792 is needed.
1793
1a494973
C
1794 For SunOS4, this consists of grunging around in the dynamic
1795 linkers structures to find symbol definitions for "common" symbols
1796 and adding them to the minimal symbol table for the runtime common
b0246b3b
FF
1797 objfile.
1798
1799*/
1800
1801static void
1802special_symbol_handling (so)
1803struct so_list *so;
1804{
1805#ifndef SVR4_SHARED_LIBS
51b57ded
FF
1806 int j;
1807
1808 if (debug_addr == 0)
1809 {
1810 /* Get link_dynamic structure */
1811
1812 j = target_read_memory (debug_base, (char *) &dynamic_copy,
1813 sizeof (dynamic_copy));
1814 if (j)
1815 {
1816 /* unreadable */
1817 return;
1818 }
1819
1820 /* Calc address of debugger interface structure */
1821 /* FIXME, this needs work for cross-debugging of core files
1822 (byteorder, size, alignment, etc). */
1823
1824 debug_addr = (CORE_ADDR) dynamic_copy.ldd;
1825 }
b0246b3b
FF
1826
1827 /* Read the debugger structure from the inferior, just to make sure
1828 we have a current copy. */
1829
51b57ded
FF
1830 j = target_read_memory (debug_addr, (char *) &debug_copy,
1831 sizeof (debug_copy));
1832 if (j)
1833 return; /* unreadable */
b0246b3b
FF
1834
1835 /* Get common symbol definitions for the loaded object. */
1836
1837 if (debug_copy.ldd_cp)
1838 {
1a494973 1839 solib_add_common_symbols (debug_copy.ldd_cp);
b0246b3b
FF
1840 }
1841
1842#endif /* !SVR4_SHARED_LIBS */
1843}
1844
1845
1846/*
1847
1848LOCAL FUNCTION
f8b76e70
FF
1849
1850 sharedlibrary_command -- handle command to explicitly add library
1851
1852SYNOPSIS
1853
b0246b3b 1854 static void sharedlibrary_command (char *args, int from_tty)
f8b76e70
FF
1855
1856DESCRIPTION
1857
1858*/
1859
b0246b3b 1860static void
bdbd5f50 1861sharedlibrary_command (args, from_tty)
f8b76e70
FF
1862char *args;
1863int from_tty;
bdbd5f50 1864{
f8b76e70
FF
1865 dont_repeat ();
1866 solib_add (args, from_tty, (struct target_ops *) 0);
bd5635a1
RP
1867}
1868
ace4b8d7
FF
1869#endif /* HAVE_LINK_H */
1870
bd5635a1
RP
1871void
1872_initialize_solib()
1873{
ace4b8d7
FF
1874#ifdef HAVE_LINK_H
1875
f8b76e70 1876 add_com ("sharedlibrary", class_files, sharedlibrary_command,
bd5635a1 1877 "Load shared object library symbols for files matching REGEXP.");
f8b76e70
FF
1878 add_info ("sharedlibrary", info_sharedlibrary_command,
1879 "Status of loaded shared object libraries.");
1a494973
C
1880
1881 add_show_from_set
1882 (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
464c6c5f
JL
1883 (char *) &auto_solib_add,
1884 "Set autoloading of shared library symbols.\n\
1a494973 1885If nonzero, symbols from all shared object libraries will be loaded\n\
464c6c5f
JL
1886automatically when the inferior begins execution or when the dynamic linker\n\
1887informs gdb that a new library has been loaded. Otherwise, symbols\n\
1a494973
C
1888must be loaded manually, using `sharedlibrary'.",
1889 &setlist),
1890 &showlist);
ace4b8d7 1891
76420d46
SG
1892 add_show_from_set
1893 (add_set_cmd ("solib-absolute-prefix", class_support, var_filename,
1894 (char *) &solib_absolute_prefix,
7d0a3fc8 1895 "Set prefix for loading absolute shared library symbol files.\n\
76420d46
SG
1896For other (relative) files, you can add values using `set solib-search-path'.",
1897 &setlist),
1898 &showlist);
1899 add_show_from_set
1900 (add_set_cmd ("solib-search-path", class_support, var_string,
1901 (char *) &solib_search_path,
7d0a3fc8 1902 "Set the search path for loading non-absolute shared library symbol files.\n\
76420d46
SG
1903This takes precedence over the environment variables PATH and LD_LIBRARY_PATH.",
1904 &setlist),
1905 &showlist);
1906
ace4b8d7 1907#endif /* HAVE_LINK_H */
bd5635a1 1908}
This page took 0.44774 seconds and 4 git commands to generate.