Protoization.
[deliverable/binutils-gdb.git] / gdb / irix5-nat.c
CommitLineData
c906108c
SS
1/* Native support for the SGI Iris running IRIX version 5, for GDB.
2 Copyright 1988, 89, 90, 91, 92, 93, 94, 95, 96, 98, 1999
3 Free Software Foundation, Inc.
4 Contributed by Alessandro Forin(af@cs.cmu.edu) at CMU
5 and by Per Bothner(bothner@cs.wisc.edu) at U.Wisconsin.
6 Implemented for Irix 4.x by Garrett A. Wollman.
7 Modified for Irix 5.x by Ian Lance Taylor.
8
c5aa993b 9 This file is part of GDB.
c906108c 10
c5aa993b
JM
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
c906108c 15
c5aa993b
JM
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
c906108c 20
c5aa993b
JM
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA. */
c906108c
SS
25
26#include "defs.h"
27#include "inferior.h"
28#include "gdbcore.h"
29#include "target.h"
30
31#include "gdb_string.h"
32#include <sys/time.h>
33#include <sys/procfs.h>
34#include <setjmp.h> /* For JB_XXX. */
35
c60c0f5f
MS
36/* Prototypes for supply_gregset etc. */
37#include "gregset.h"
38
a14ed312 39static void fetch_core_registers (char *, unsigned int, int, CORE_ADDR);
c906108c
SS
40
41/* Size of elements in jmpbuf */
42
43#define JB_ELEMENT_SIZE 4
44
45/*
46 * See the comment in m68k-tdep.c regarding the utility of these functions.
47 *
48 * These definitions are from the MIPS SVR4 ABI, so they may work for
49 * any MIPS SVR4 target.
50 */
51
c5aa993b 52void
fba45db2 53supply_gregset (gregset_t *gregsetp)
c906108c
SS
54{
55 register int regi;
56 register greg_t *regp = &(*gregsetp)[0];
57 int gregoff = sizeof (greg_t) - MIPS_REGSIZE;
c5aa993b
JM
58 static char zerobuf[MAX_REGISTER_RAW_SIZE] =
59 {0};
c906108c 60
c5aa993b
JM
61 for (regi = 0; regi <= CTX_RA; regi++)
62 supply_register (regi, (char *) (regp + regi) + gregoff);
c906108c 63
c5aa993b
JM
64 supply_register (PC_REGNUM, (char *) (regp + CTX_EPC) + gregoff);
65 supply_register (HI_REGNUM, (char *) (regp + CTX_MDHI) + gregoff);
66 supply_register (LO_REGNUM, (char *) (regp + CTX_MDLO) + gregoff);
67 supply_register (CAUSE_REGNUM, (char *) (regp + CTX_CAUSE) + gregoff);
c906108c
SS
68
69 /* Fill inaccessible registers with zero. */
70 supply_register (BADVADDR_REGNUM, zerobuf);
71}
72
73void
fba45db2 74fill_gregset (gregset_t *gregsetp, int regno)
c906108c
SS
75{
76 int regi;
77 register greg_t *regp = &(*gregsetp)[0];
78
79 /* Under Irix6, if GDB is built with N32 ABI and is debugging an O32
80 executable, we have to sign extend the registers to 64 bits before
81 filling in the gregset structure. */
82
83 for (regi = 0; regi <= CTX_RA; regi++)
84 if ((regno == -1) || (regno == regi))
85 *(regp + regi) =
86 extract_signed_integer (&registers[REGISTER_BYTE (regi)],
87 REGISTER_RAW_SIZE (regi));
88
89 if ((regno == -1) || (regno == PC_REGNUM))
90 *(regp + CTX_EPC) =
91 extract_signed_integer (&registers[REGISTER_BYTE (PC_REGNUM)],
92 REGISTER_RAW_SIZE (PC_REGNUM));
93
94 if ((regno == -1) || (regno == CAUSE_REGNUM))
95 *(regp + CTX_CAUSE) =
96 extract_signed_integer (&registers[REGISTER_BYTE (CAUSE_REGNUM)],
97 REGISTER_RAW_SIZE (CAUSE_REGNUM));
98
99 if ((regno == -1) || (regno == HI_REGNUM))
100 *(regp + CTX_MDHI) =
101 extract_signed_integer (&registers[REGISTER_BYTE (HI_REGNUM)],
102 REGISTER_RAW_SIZE (HI_REGNUM));
103
104 if ((regno == -1) || (regno == LO_REGNUM))
105 *(regp + CTX_MDLO) =
106 extract_signed_integer (&registers[REGISTER_BYTE (LO_REGNUM)],
107 REGISTER_RAW_SIZE (LO_REGNUM));
108}
109
110/*
111 * Now we do the same thing for floating-point registers.
112 * We don't bother to condition on FP0_REGNUM since any
113 * reasonable MIPS configuration has an R3010 in it.
114 *
115 * Again, see the comments in m68k-tdep.c.
116 */
117
118void
fba45db2 119supply_fpregset (fpregset_t *fpregsetp)
c906108c
SS
120{
121 register int regi;
c5aa993b
JM
122 static char zerobuf[MAX_REGISTER_RAW_SIZE] =
123 {0};
c906108c
SS
124
125 /* FIXME, this is wrong for the N32 ABI which has 64 bit FP regs. */
126
127 for (regi = 0; regi < 32; regi++)
128 supply_register (FP0_REGNUM + regi,
c5aa993b 129 (char *) &fpregsetp->fp_r.fp_regs[regi]);
c906108c 130
c5aa993b 131 supply_register (FCRCS_REGNUM, (char *) &fpregsetp->fp_csr);
c906108c
SS
132
133 /* FIXME: how can we supply FCRIR_REGNUM? SGI doesn't tell us. */
134 supply_register (FCRIR_REGNUM, zerobuf);
135}
136
137void
fba45db2 138fill_fpregset (fpregset_t *fpregsetp, int regno)
c906108c
SS
139{
140 int regi;
141 char *from, *to;
142
143 /* FIXME, this is wrong for the N32 ABI which has 64 bit FP regs. */
144
145 for (regi = FP0_REGNUM; regi < FP0_REGNUM + 32; regi++)
146 {
147 if ((regno == -1) || (regno == regi))
148 {
149 from = (char *) &registers[REGISTER_BYTE (regi)];
150 to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]);
c5aa993b 151 memcpy (to, from, REGISTER_RAW_SIZE (regi));
c906108c
SS
152 }
153 }
154
155 if ((regno == -1) || (regno == FCRCS_REGNUM))
c5aa993b 156 fpregsetp->fp_csr = *(unsigned *) &registers[REGISTER_BYTE (FCRCS_REGNUM)];
c906108c
SS
157}
158
159
160/* Figure out where the longjmp will land.
161 We expect the first arg to be a pointer to the jmp_buf structure from which
162 we extract the pc (JB_PC) that we will land at. The pc is copied into PC.
163 This routine returns true on success. */
164
165int
fba45db2 166get_longjmp_target (CORE_ADDR *pc)
c906108c
SS
167{
168 char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
169 CORE_ADDR jb_addr;
170
171 jb_addr = read_register (A0_REGNUM);
172
173 if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
174 TARGET_PTR_BIT / TARGET_CHAR_BIT))
175 return 0;
176
177 *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
178
179 return 1;
180}
181
182static void
183fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
184 char *core_reg_sect;
185 unsigned core_reg_size;
186 int which; /* Unused */
187 CORE_ADDR reg_addr; /* Unused */
188{
189 if (core_reg_size == REGISTER_BYTES)
190 {
c5aa993b 191 memcpy ((char *) registers, core_reg_sect, core_reg_size);
c906108c
SS
192 }
193 else if (MIPS_REGSIZE == 4 &&
194 core_reg_size == (2 * MIPS_REGSIZE) * NUM_REGS)
195 {
196 /* This is a core file from a N32 executable, 64 bits are saved
c5aa993b 197 for all registers. */
c906108c
SS
198 char *srcp = core_reg_sect;
199 char *dstp = registers;
200 int regno;
201
202 for (regno = 0; regno < NUM_REGS; regno++)
203 {
204 if (regno >= FP0_REGNUM && regno < (FP0_REGNUM + 32))
205 {
206 /* FIXME, this is wrong, N32 has 64 bit FP regs, but GDB
c5aa993b 207 currently assumes that they are 32 bit. */
c906108c
SS
208 *dstp++ = *srcp++;
209 *dstp++ = *srcp++;
210 *dstp++ = *srcp++;
211 *dstp++ = *srcp++;
c5aa993b 212 if (REGISTER_RAW_SIZE (regno) == 4)
c906108c
SS
213 {
214 /* copying 4 bytes from eight bytes?
215 I don't see how this can be right... */
c5aa993b 216 srcp += 4;
c906108c
SS
217 }
218 else
219 {
220 /* copy all 8 bytes (sizeof(double)) */
221 *dstp++ = *srcp++;
222 *dstp++ = *srcp++;
223 *dstp++ = *srcp++;
224 *dstp++ = *srcp++;
225 }
226 }
227 else
228 {
229 srcp += 4;
230 *dstp++ = *srcp++;
231 *dstp++ = *srcp++;
232 *dstp++ = *srcp++;
233 *dstp++ = *srcp++;
234 }
235 }
236 }
237 else
238 {
239 warning ("wrong size gregset struct in core file");
240 return;
241 }
242
243 registers_fetched ();
244}
245\f
246/* Irix 5 uses what appears to be a unique form of shared library
247 support. This is a copy of solib.c modified for Irix 5. */
248/* FIXME: Most of this code could be merged with osfsolib.c and solib.c
249 by using next_link_map_member and xfer_link_map_member in solib.c. */
250
251#include <sys/types.h>
252#include <signal.h>
253#include <sys/param.h>
254#include <fcntl.h>
255
256/* <obj.h> includes <sym.h> and <symconst.h>, which causes conflicts
257 with our versions of those files included by tm-mips.h. Prevent
258 <obj.h> from including them with some appropriate defines. */
259#define __SYM_H__
260#define __SYMCONST_H__
261#include <obj.h>
262#ifdef HAVE_OBJLIST_H
263#include <objlist.h>
264#endif
265
266#ifdef NEW_OBJ_INFO_MAGIC
267#define HANDLE_NEW_OBJ_LIST
268#endif
269
270#include "symtab.h"
271#include "bfd.h"
272#include "symfile.h"
273#include "objfiles.h"
274#include "command.h"
275#include "frame.h"
88987551 276#include "gdb_regex.h"
c906108c
SS
277#include "inferior.h"
278#include "language.h"
279#include "gdbcmd.h"
280
281/* The symbol which starts off the list of shared libraries. */
282#define DEBUG_BASE "__rld_obj_head"
283
284/* Irix 6.x introduces a new variant of object lists.
285 To be able to debug O32 executables under Irix 6, we have to handle both
286 variants. */
287
288typedef enum
289{
c5aa993b
JM
290 OBJ_LIST_OLD, /* Pre Irix 6.x object list. */
291 OBJ_LIST_32, /* 32 Bit Elf32_Obj_Info. */
292 OBJ_LIST_64 /* 64 Bit Elf64_Obj_Info, FIXME not yet implemented. */
293}
294obj_list_variant;
c906108c
SS
295
296/* Define our own link_map structure.
297 This will help to share code with osfsolib.c and solib.c. */
298
c5aa993b
JM
299struct link_map
300 {
301 obj_list_variant l_variant; /* which variant of object list */
302 CORE_ADDR l_lladdr; /* addr in inferior list was read from */
303 CORE_ADDR l_next; /* address of next object list entry */
304 };
c906108c
SS
305
306/* Irix 5 shared objects are pre-linked to particular addresses
307 although the dynamic linker may have to relocate them if the
308 address ranges of the libraries used by the main program clash.
309 The offset is the difference between the address where the object
310 is mapped and the binding address of the shared library. */
311#define LM_OFFSET(so) ((so) -> offset)
312/* Loaded address of shared library. */
313#define LM_ADDR(so) ((so) -> lmstart)
314
315char shadow_contents[BREAKPOINT_MAX]; /* Stash old bkpt addr contents */
316
c5aa993b
JM
317struct so_list
318 {
319 struct so_list *next; /* next structure in linked list */
320 struct link_map lm;
321 CORE_ADDR offset; /* prelink to load address offset */
322 char *so_name; /* shared object lib name */
323 CORE_ADDR lmstart; /* lower addr bound of mapped object */
324 CORE_ADDR lmend; /* upper addr bound of mapped object */
325 char symbols_loaded; /* flag: symbols read in yet? */
326 char from_tty; /* flag: print msgs? */
327 struct objfile *objfile; /* objfile for loaded lib */
328 struct section_table *sections;
329 struct section_table *sections_end;
330 struct section_table *textsection;
331 bfd *abfd;
332 };
c906108c
SS
333
334static struct so_list *so_list_head; /* List of known shared objects */
c5aa993b 335static CORE_ADDR debug_base; /* Base of dynamic linker structures */
c906108c
SS
336static CORE_ADDR breakpoint_addr; /* Address where end bkpt is set */
337
338/* Local function prototypes */
339
a14ed312 340static void sharedlibrary_command (char *, int);
c906108c 341
a14ed312 342static int enable_break (void);
c906108c 343
a14ed312 344static int disable_break (void);
c906108c 345
a14ed312 346static void info_sharedlibrary_command (char *, int);
c906108c 347
ac2e2ef7 348static int symbol_add_stub (void *);
c906108c 349
a14ed312 350static struct so_list *find_solib (struct so_list *);
c906108c 351
a14ed312 352static struct link_map *first_link_map_member (void);
c906108c 353
a14ed312 354static struct link_map *next_link_map_member (struct so_list *);
c906108c 355
a14ed312 356static void xfer_link_map_member (struct so_list *, struct link_map *);
c906108c 357
a14ed312 358static CORE_ADDR locate_base (void);
c906108c 359
ac2e2ef7 360static int solib_map_sections (void *);
c906108c
SS
361
362/*
363
c5aa993b 364 LOCAL FUNCTION
c906108c 365
c5aa993b 366 solib_map_sections -- open bfd and build sections for shared lib
c906108c 367
c5aa993b 368 SYNOPSIS
c906108c 369
c5aa993b 370 static int solib_map_sections (struct so_list *so)
c906108c 371
c5aa993b 372 DESCRIPTION
c906108c 373
c5aa993b
JM
374 Given a pointer to one of the shared objects in our list
375 of mapped objects, use the recorded name to open a bfd
376 descriptor for the object, build a section table, and then
377 relocate all the section addresses by the base address at
378 which the shared object was mapped.
c906108c 379
c5aa993b 380 FIXMES
c906108c 381
c5aa993b
JM
382 In most (all?) cases the shared object file name recorded in the
383 dynamic linkage tables will be a fully qualified pathname. For
384 cases where it isn't, do we really mimic the systems search
385 mechanism correctly in the below code (particularly the tilde
386 expansion stuff?).
c906108c
SS
387 */
388
389static int
ac2e2ef7 390solib_map_sections (void *arg)
c906108c
SS
391{
392 struct so_list *so = (struct so_list *) arg; /* catch_errors bogon */
393 char *filename;
394 char *scratch_pathname;
395 int scratch_chan;
396 struct section_table *p;
397 struct cleanup *old_chain;
398 bfd *abfd;
c5aa993b
JM
399
400 filename = tilde_expand (so->so_name);
c906108c 401 old_chain = make_cleanup (free, filename);
c5aa993b 402
c906108c
SS
403 scratch_chan = openp (getenv ("PATH"), 1, filename, O_RDONLY, 0,
404 &scratch_pathname);
405 if (scratch_chan < 0)
406 {
407 scratch_chan = openp (getenv ("LD_LIBRARY_PATH"), 1, filename,
408 O_RDONLY, 0, &scratch_pathname);
409 }
410 if (scratch_chan < 0)
411 {
412 perror_with_name (filename);
413 }
414 /* Leave scratch_pathname allocated. abfd->name will point to it. */
415
416 abfd = bfd_fdopenr (scratch_pathname, gnutarget, scratch_chan);
417 if (!abfd)
418 {
419 close (scratch_chan);
420 error ("Could not open `%s' as an executable file: %s",
421 scratch_pathname, bfd_errmsg (bfd_get_error ()));
422 }
423 /* Leave bfd open, core_xfer_memory and "info files" need it. */
c5aa993b
JM
424 so->abfd = abfd;
425 abfd->cacheable = true;
c906108c
SS
426
427 if (!bfd_check_format (abfd, bfd_object))
428 {
429 error ("\"%s\": not in executable format: %s.",
430 scratch_pathname, bfd_errmsg (bfd_get_error ()));
431 }
c5aa993b 432 if (build_section_table (abfd, &so->sections, &so->sections_end))
c906108c 433 {
c5aa993b 434 error ("Can't find the file sections in `%s': %s",
c906108c
SS
435 bfd_get_filename (exec_bfd), bfd_errmsg (bfd_get_error ()));
436 }
437
c5aa993b 438 for (p = so->sections; p < so->sections_end; p++)
c906108c
SS
439 {
440 /* Relocate the section binding addresses as recorded in the shared
c5aa993b
JM
441 object's file by the offset to get the address to which the
442 object was actually mapped. */
443 p->addr += LM_OFFSET (so);
444 p->endaddr += LM_OFFSET (so);
445 so->lmend = (CORE_ADDR) max (p->endaddr, so->lmend);
446 if (STREQ (p->the_bfd_section->name, ".text"))
c906108c 447 {
c5aa993b 448 so->textsection = p;
c906108c
SS
449 }
450 }
451
452 /* Free the file names, close the file now. */
453 do_cleanups (old_chain);
454
ac2e2ef7 455 /* must be non-zero */
c906108c
SS
456 return (1);
457}
458
459/*
460
c5aa993b 461 LOCAL FUNCTION
c906108c 462
c5aa993b 463 locate_base -- locate the base address of dynamic linker structs
c906108c 464
c5aa993b 465 SYNOPSIS
c906108c 466
c5aa993b 467 CORE_ADDR locate_base (void)
c906108c 468
c5aa993b 469 DESCRIPTION
c906108c 470
c5aa993b
JM
471 For both the SunOS and SVR4 shared library implementations, if the
472 inferior executable has been linked dynamically, there is a single
473 address somewhere in the inferior's data space which is the key to
474 locating all of the dynamic linker's runtime structures. This
475 address is the value of the symbol defined by the macro DEBUG_BASE.
476 The job of this function is to find and return that address, or to
477 return 0 if there is no such address (the executable is statically
478 linked for example).
c906108c 479
c5aa993b
JM
480 For SunOS, the job is almost trivial, since the dynamic linker and
481 all of it's structures are statically linked to the executable at
482 link time. Thus the symbol for the address we are looking for has
483 already been added to the minimal symbol table for the executable's
484 objfile at the time the symbol file's symbols were read, and all we
485 have to do is look it up there. Note that we explicitly do NOT want
486 to find the copies in the shared library.
c906108c 487
c5aa993b
JM
488 The SVR4 version is much more complicated because the dynamic linker
489 and it's structures are located in the shared C library, which gets
490 run as the executable's "interpreter" by the kernel. We have to go
491 to a lot more work to discover the address of DEBUG_BASE. Because
492 of this complexity, we cache the value we find and return that value
493 on subsequent invocations. Note there is no copy in the executable
494 symbol tables.
c906108c 495
c5aa993b 496 Irix 5 is basically like SunOS.
c906108c 497
c5aa993b
JM
498 Note that we can assume nothing about the process state at the time
499 we need to find this address. We may be stopped on the first instruc-
500 tion of the interpreter (C shared library), the first instruction of
501 the executable itself, or somewhere else entirely (if we attached
502 to the process for example).
c906108c
SS
503
504 */
505
506static CORE_ADDR
fba45db2 507locate_base (void)
c906108c
SS
508{
509 struct minimal_symbol *msymbol;
510 CORE_ADDR address = 0;
511
512 msymbol = lookup_minimal_symbol (DEBUG_BASE, NULL, symfile_objfile);
513 if ((msymbol != NULL) && (SYMBOL_VALUE_ADDRESS (msymbol) != 0))
514 {
515 address = SYMBOL_VALUE_ADDRESS (msymbol);
516 }
517 return (address);
518}
519
520/*
521
c5aa993b 522 LOCAL FUNCTION
c906108c 523
c5aa993b 524 first_link_map_member -- locate first member in dynamic linker's map
c906108c 525
c5aa993b 526 SYNOPSIS
c906108c 527
c5aa993b 528 static struct link_map *first_link_map_member (void)
c906108c 529
c5aa993b 530 DESCRIPTION
c906108c 531
c5aa993b
JM
532 Read in a copy of the first member in the inferior's dynamic
533 link map from the inferior's dynamic linker structures, and return
534 a pointer to the link map descriptor.
535 */
c906108c
SS
536
537static struct link_map *
fba45db2 538first_link_map_member (void)
c906108c
SS
539{
540 struct obj_list *listp;
541 struct obj_list list_old;
542 struct link_map *lm;
543 static struct link_map first_lm;
544 CORE_ADDR lladdr;
545 CORE_ADDR next_lladdr;
546
547 /* We have not already read in the dynamic linking structures
548 from the inferior, lookup the address of the base structure. */
549 debug_base = locate_base ();
550 if (debug_base == 0)
551 return NULL;
552
553 /* Get address of first list entry. */
554 read_memory (debug_base, (char *) &listp, sizeof (struct obj_list *));
555
556 if (listp == NULL)
557 return NULL;
558
559 /* Get first list entry. */
ac2e2ef7
AC
560 /* The MIPS Sign extends addresses. */
561 lladdr = host_pointer_to_address (listp);
c906108c
SS
562 read_memory (lladdr, (char *) &list_old, sizeof (struct obj_list));
563
564 /* The first entry in the list is the object file we are debugging,
565 so skip it. */
ac2e2ef7 566 next_lladdr = host_pointer_to_address (list_old.next);
c906108c
SS
567
568#ifdef HANDLE_NEW_OBJ_LIST
569 if (list_old.data == NEW_OBJ_INFO_MAGIC)
570 {
571 Elf32_Obj_Info list_32;
572
573 read_memory (lladdr, (char *) &list_32, sizeof (Elf32_Obj_Info));
574 if (list_32.oi_size != sizeof (Elf32_Obj_Info))
575 return NULL;
c5aa993b 576 next_lladdr = (CORE_ADDR) list_32.oi_next;
c906108c
SS
577 }
578#endif
579
580 if (next_lladdr == 0)
581 return NULL;
582
583 first_lm.l_lladdr = next_lladdr;
584 lm = &first_lm;
585 return lm;
586}
587
588/*
589
c5aa993b 590 LOCAL FUNCTION
c906108c 591
c5aa993b 592 next_link_map_member -- locate next member in dynamic linker's map
c906108c 593
c5aa993b 594 SYNOPSIS
c906108c 595
c5aa993b 596 static struct link_map *next_link_map_member (so_list_ptr)
c906108c 597
c5aa993b 598 DESCRIPTION
c906108c 599
c5aa993b
JM
600 Read in a copy of the next member in the inferior's dynamic
601 link map from the inferior's dynamic linker structures, and return
602 a pointer to the link map descriptor.
603 */
c906108c
SS
604
605static struct link_map *
fba45db2 606next_link_map_member (struct so_list *so_list_ptr)
c906108c 607{
c5aa993b
JM
608 struct link_map *lm = &so_list_ptr->lm;
609 CORE_ADDR next_lladdr = lm->l_next;
c906108c
SS
610 static struct link_map next_lm;
611
612 if (next_lladdr == 0)
613 {
614 /* We have hit the end of the list, so check to see if any were
c5aa993b 615 added, but be quiet if we can't read from the target any more. */
c906108c
SS
616 int status = 0;
617
c5aa993b 618 if (lm->l_variant == OBJ_LIST_OLD)
c906108c
SS
619 {
620 struct obj_list list_old;
621
c5aa993b 622 status = target_read_memory (lm->l_lladdr,
c906108c
SS
623 (char *) &list_old,
624 sizeof (struct obj_list));
ac2e2ef7 625 next_lladdr = host_pointer_to_address (list_old.next);
c906108c
SS
626 }
627#ifdef HANDLE_NEW_OBJ_LIST
c5aa993b 628 else if (lm->l_variant == OBJ_LIST_32)
c906108c
SS
629 {
630 Elf32_Obj_Info list_32;
c5aa993b 631 status = target_read_memory (lm->l_lladdr,
c906108c
SS
632 (char *) &list_32,
633 sizeof (Elf32_Obj_Info));
634 next_lladdr = (CORE_ADDR) list_32.oi_next;
635 }
636#endif
637
638 if (status != 0 || next_lladdr == 0)
639 return NULL;
640 }
641
642 next_lm.l_lladdr = next_lladdr;
643 lm = &next_lm;
644 return lm;
645}
646
647/*
648
c5aa993b 649 LOCAL FUNCTION
c906108c 650
c5aa993b 651 xfer_link_map_member -- set local variables from dynamic linker's map
c906108c 652
c5aa993b 653 SYNOPSIS
c906108c 654
c5aa993b 655 static void xfer_link_map_member (so_list_ptr, lm)
c906108c 656
c5aa993b 657 DESCRIPTION
c906108c 658
c5aa993b
JM
659 Read in a copy of the requested member in the inferior's dynamic
660 link map from the inferior's dynamic linker structures, and fill
661 in the necessary so_list_ptr elements.
662 */
c906108c
SS
663
664static void
fba45db2 665xfer_link_map_member (struct so_list *so_list_ptr, struct link_map *lm)
c906108c
SS
666{
667 struct obj_list list_old;
c5aa993b
JM
668 CORE_ADDR lladdr = lm->l_lladdr;
669 struct link_map *new_lm = &so_list_ptr->lm;
c906108c
SS
670 int errcode;
671
672 read_memory (lladdr, (char *) &list_old, sizeof (struct obj_list));
673
c5aa993b
JM
674 new_lm->l_variant = OBJ_LIST_OLD;
675 new_lm->l_lladdr = lladdr;
ac2e2ef7 676 new_lm->l_next = host_pointer_to_address (list_old.next);
c906108c
SS
677
678#ifdef HANDLE_NEW_OBJ_LIST
679 if (list_old.data == NEW_OBJ_INFO_MAGIC)
680 {
681 Elf32_Obj_Info list_32;
682
683 read_memory (lladdr, (char *) &list_32, sizeof (Elf32_Obj_Info));
684 if (list_32.oi_size != sizeof (Elf32_Obj_Info))
685 return;
c5aa993b
JM
686 new_lm->l_variant = OBJ_LIST_32;
687 new_lm->l_next = (CORE_ADDR) list_32.oi_next;
c906108c
SS
688
689 target_read_string ((CORE_ADDR) list_32.oi_pathname,
c5aa993b 690 &so_list_ptr->so_name,
c906108c
SS
691 list_32.oi_pathname_len + 1, &errcode);
692 if (errcode != 0)
693 memory_error (errcode, (CORE_ADDR) list_32.oi_pathname);
694
695 LM_ADDR (so_list_ptr) = (CORE_ADDR) list_32.oi_ehdr;
696 LM_OFFSET (so_list_ptr) =
697 (CORE_ADDR) list_32.oi_ehdr - (CORE_ADDR) list_32.oi_orig_ehdr;
698 }
699 else
700#endif
701 {
702#if defined (_MIPS_SIM_NABI32) && _MIPS_SIM == _MIPS_SIM_NABI32
703 /* If we are compiling GDB under N32 ABI, the alignments in
c5aa993b
JM
704 the obj struct are different from the O32 ABI and we will get
705 wrong values when accessing the struct.
706 As a workaround we use fixed values which are good for
707 Irix 6.2. */
c906108c
SS
708 char buf[432];
709
710 read_memory ((CORE_ADDR) list_old.data, buf, sizeof (buf));
711
712 target_read_string (extract_address (&buf[236], 4),
c5aa993b 713 &so_list_ptr->so_name,
c906108c
SS
714 INT_MAX, &errcode);
715 if (errcode != 0)
716 memory_error (errcode, extract_address (&buf[236], 4));
717
718 LM_ADDR (so_list_ptr) = extract_address (&buf[196], 4);
719 LM_OFFSET (so_list_ptr) =
720 extract_address (&buf[196], 4) - extract_address (&buf[248], 4);
721#else
722 struct obj obj_old;
723
724 read_memory ((CORE_ADDR) list_old.data, (char *) &obj_old,
725 sizeof (struct obj));
726
727 target_read_string ((CORE_ADDR) obj_old.o_path,
c5aa993b 728 &so_list_ptr->so_name,
c906108c
SS
729 INT_MAX, &errcode);
730 if (errcode != 0)
731 memory_error (errcode, (CORE_ADDR) obj_old.o_path);
732
733 LM_ADDR (so_list_ptr) = (CORE_ADDR) obj_old.o_praw;
734 LM_OFFSET (so_list_ptr) =
735 (CORE_ADDR) obj_old.o_praw - obj_old.o_base_address;
736#endif
737 }
738
739 catch_errors (solib_map_sections, (char *) so_list_ptr,
740 "Error while mapping shared library sections:\n",
741 RETURN_MASK_ALL);
742}
743
744
745/*
746
c5aa993b 747 LOCAL FUNCTION
c906108c 748
c5aa993b 749 find_solib -- step through list of shared objects
c906108c 750
c5aa993b 751 SYNOPSIS
c906108c 752
c5aa993b 753 struct so_list *find_solib (struct so_list *so_list_ptr)
c906108c 754
c5aa993b 755 DESCRIPTION
c906108c 756
c5aa993b
JM
757 This module contains the routine which finds the names of any
758 loaded "images" in the current process. The argument in must be
759 NULL on the first call, and then the returned value must be passed
760 in on subsequent calls. This provides the capability to "step" down
761 the list of loaded objects. On the last object, a NULL value is
762 returned.
c906108c
SS
763 */
764
765static struct so_list *
766find_solib (so_list_ptr)
767 struct so_list *so_list_ptr; /* Last lm or NULL for first one */
768{
769 struct so_list *so_list_next = NULL;
770 struct link_map *lm = NULL;
771 struct so_list *new;
c5aa993b 772
c906108c
SS
773 if (so_list_ptr == NULL)
774 {
775 /* We are setting up for a new scan through the loaded images. */
776 if ((so_list_next = so_list_head) == NULL)
777 {
778 /* Find the first link map list member. */
779 lm = first_link_map_member ();
780 }
781 }
782 else
783 {
784 /* We have been called before, and are in the process of walking
c5aa993b 785 the shared library list. Advance to the next shared object. */
c906108c 786 lm = next_link_map_member (so_list_ptr);
c5aa993b 787 so_list_next = so_list_ptr->next;
c906108c
SS
788 }
789 if ((so_list_next == NULL) && (lm != NULL))
790 {
791 new = (struct so_list *) xmalloc (sizeof (struct so_list));
792 memset ((char *) new, 0, sizeof (struct so_list));
793 /* Add the new node as the next node in the list, or as the root
c5aa993b 794 node if this is the first one. */
c906108c
SS
795 if (so_list_ptr != NULL)
796 {
c5aa993b 797 so_list_ptr->next = new;
c906108c
SS
798 }
799 else
800 {
801 so_list_head = new;
c5aa993b 802 }
c906108c
SS
803 so_list_next = new;
804 xfer_link_map_member (new, lm);
805 }
806 return (so_list_next);
807}
808
809/* A small stub to get us past the arg-passing pinhole of catch_errors. */
810
811static int
ac2e2ef7 812symbol_add_stub (void *arg)
c906108c 813{
c5aa993b 814 register struct so_list *so = (struct so_list *) arg; /* catch_errs bogon */
c906108c 815 CORE_ADDR text_addr = 0;
2acceee2 816 struct section_addr_info section_addrs;
c906108c 817
2acceee2 818 memset (&section_addrs, 0, sizeof (section_addrs));
c5aa993b
JM
819 if (so->textsection)
820 text_addr = so->textsection->addr;
821 else if (so->abfd != NULL)
c906108c
SS
822 {
823 asection *lowest_sect;
824
825 /* If we didn't find a mapped non zero sized .text section, set up
c5aa993b 826 text_addr so that the relocation in symbol_file_add does no harm. */
c906108c 827
c5aa993b 828 lowest_sect = bfd_get_section_by_name (so->abfd, ".text");
c906108c 829 if (lowest_sect == NULL)
c5aa993b 830 bfd_map_over_sections (so->abfd, find_lowest_section,
96baa820 831 (PTR) &lowest_sect);
c906108c 832 if (lowest_sect)
c5aa993b 833 text_addr = bfd_section_vma (so->abfd, lowest_sect) + LM_OFFSET (so);
c906108c 834 }
c5aa993b 835
a034fba4
EZ
836
837 section_addrs.other[0].name = ".text";
838 section_addrs.other[0].addr = text_addr;
c5aa993b 839 so->objfile = symbol_file_add (so->so_name, so->from_tty,
2df3850c 840 &section_addrs, 0, 0);
ac2e2ef7 841 /* must be non-zero */
c906108c
SS
842 return (1);
843}
844
845/*
846
c5aa993b 847 GLOBAL FUNCTION
c906108c 848
c5aa993b 849 solib_add -- add a shared library file to the symtab and section list
c906108c 850
c5aa993b 851 SYNOPSIS
c906108c 852
c5aa993b
JM
853 void solib_add (char *arg_string, int from_tty,
854 struct target_ops *target)
c906108c 855
c5aa993b 856 DESCRIPTION
c906108c 857
c5aa993b 858 */
c906108c
SS
859
860void
fba45db2 861solib_add (char *arg_string, int from_tty, struct target_ops *target)
c5aa993b
JM
862{
863 register struct so_list *so = NULL; /* link map state variable */
c906108c
SS
864
865 /* Last shared library that we read. */
866 struct so_list *so_last = NULL;
867
868 char *re_err;
869 int count;
870 int old;
c5aa993b 871
c906108c
SS
872 if ((re_err = re_comp (arg_string ? arg_string : ".")) != NULL)
873 {
874 error ("Invalid regexp: %s", re_err);
875 }
c5aa993b 876
c906108c
SS
877 /* Add the shared library sections to the section table of the
878 specified target, if any. */
879 if (target)
880 {
881 /* Count how many new section_table entries there are. */
882 so = NULL;
883 count = 0;
884 while ((so = find_solib (so)) != NULL)
885 {
c5aa993b 886 if (so->so_name[0])
c906108c 887 {
c5aa993b 888 count += so->sections_end - so->sections;
c906108c
SS
889 }
890 }
c5aa993b 891
c906108c
SS
892 if (count)
893 {
6426a772
JM
894 old = target_resize_to_sections (target, count);
895
c906108c
SS
896 /* Add these section table entries to the target's table. */
897 while ((so = find_solib (so)) != NULL)
898 {
c5aa993b 899 if (so->so_name[0])
c906108c 900 {
c5aa993b
JM
901 count = so->sections_end - so->sections;
902 memcpy ((char *) (target->to_sections + old),
903 so->sections,
c906108c
SS
904 (sizeof (struct section_table)) * count);
905 old += count;
906 }
907 }
908 }
909 }
c5aa993b 910
c906108c
SS
911 /* Now add the symbol files. */
912 while ((so = find_solib (so)) != NULL)
913 {
c5aa993b 914 if (so->so_name[0] && re_exec (so->so_name))
c906108c 915 {
c5aa993b
JM
916 so->from_tty = from_tty;
917 if (so->symbols_loaded)
c906108c
SS
918 {
919 if (from_tty)
920 {
c5aa993b 921 printf_unfiltered ("Symbols already loaded for %s\n", so->so_name);
c906108c
SS
922 }
923 }
924 else if (catch_errors
925 (symbol_add_stub, (char *) so,
926 "Error while reading shared library symbols:\n",
927 RETURN_MASK_ALL))
928 {
929 so_last = so;
c5aa993b 930 so->symbols_loaded = 1;
c906108c
SS
931 }
932 }
933 }
934
935 /* Getting new symbols may change our opinion about what is
936 frameless. */
937 if (so_last)
938 reinit_frame_cache ();
939}
940
941/*
942
c5aa993b 943 LOCAL FUNCTION
c906108c 944
c5aa993b 945 info_sharedlibrary_command -- code for "info sharedlibrary"
c906108c 946
c5aa993b 947 SYNOPSIS
c906108c 948
c5aa993b 949 static void info_sharedlibrary_command ()
c906108c 950
c5aa993b 951 DESCRIPTION
c906108c 952
c5aa993b
JM
953 Walk through the shared library list and print information
954 about each attached library.
955 */
c906108c
SS
956
957static void
fba45db2 958info_sharedlibrary_command (char *ignore, int from_tty)
c906108c 959{
c5aa993b 960 register struct so_list *so = NULL; /* link map state variable */
c906108c 961 int header_done = 0;
c5aa993b 962
c906108c
SS
963 if (exec_bfd == NULL)
964 {
4ce44c66 965 printf_unfiltered ("No executable file.\n");
c906108c
SS
966 return;
967 }
968 while ((so = find_solib (so)) != NULL)
969 {
c5aa993b 970 if (so->so_name[0])
c906108c
SS
971 {
972 if (!header_done)
973 {
c5aa993b
JM
974 printf_unfiltered ("%-12s%-12s%-12s%s\n", "From", "To", "Syms Read",
975 "Shared Object Library");
c906108c
SS
976 header_done++;
977 }
978 printf_unfiltered ("%-12s",
c5aa993b
JM
979 local_hex_string_custom ((unsigned long) LM_ADDR (so),
980 "08l"));
c906108c 981 printf_unfiltered ("%-12s",
c5aa993b
JM
982 local_hex_string_custom ((unsigned long) so->lmend,
983 "08l"));
984 printf_unfiltered ("%-12s", so->symbols_loaded ? "Yes" : "No");
985 printf_unfiltered ("%s\n", so->so_name);
c906108c
SS
986 }
987 }
988 if (so_list_head == NULL)
989 {
c5aa993b 990 printf_unfiltered ("No shared libraries loaded at this time.\n");
c906108c
SS
991 }
992}
993
994/*
995
c5aa993b 996 GLOBAL FUNCTION
c906108c 997
c5aa993b 998 solib_address -- check to see if an address is in a shared lib
c906108c 999
c5aa993b 1000 SYNOPSIS
c906108c 1001
c5aa993b 1002 char *solib_address (CORE_ADDR address)
c906108c 1003
c5aa993b 1004 DESCRIPTION
c906108c 1005
c5aa993b
JM
1006 Provides a hook for other gdb routines to discover whether or
1007 not a particular address is within the mapped address space of
1008 a shared library. Any address between the base mapping address
1009 and the first address beyond the end of the last mapping, is
1010 considered to be within the shared library address space, for
1011 our purposes.
c906108c 1012
c5aa993b
JM
1013 For example, this routine is called at one point to disable
1014 breakpoints which are in shared libraries that are not currently
1015 mapped in.
c906108c
SS
1016 */
1017
1018char *
fba45db2 1019solib_address (CORE_ADDR address)
c906108c 1020{
c5aa993b
JM
1021 register struct so_list *so = 0; /* link map state variable */
1022
c906108c
SS
1023 while ((so = find_solib (so)) != NULL)
1024 {
c5aa993b 1025 if (so->so_name[0])
c906108c
SS
1026 {
1027 if ((address >= (CORE_ADDR) LM_ADDR (so)) &&
c5aa993b 1028 (address < (CORE_ADDR) so->lmend))
c906108c
SS
1029 return (so->so_name);
1030 }
1031 }
1032 return (0);
1033}
1034
1035/* Called by free_all_symtabs */
1036
c5aa993b 1037void
fba45db2 1038clear_solib (void)
c906108c
SS
1039{
1040 struct so_list *next;
1041 char *bfd_filename;
c5aa993b 1042
c906108c
SS
1043 disable_breakpoints_in_shlibs (1);
1044
1045 while (so_list_head)
1046 {
c5aa993b 1047 if (so_list_head->sections)
c906108c 1048 {
c5aa993b 1049 free ((PTR) so_list_head->sections);
c906108c 1050 }
c5aa993b 1051 if (so_list_head->abfd)
c906108c 1052 {
c5aa993b
JM
1053 bfd_filename = bfd_get_filename (so_list_head->abfd);
1054 if (!bfd_close (so_list_head->abfd))
c906108c
SS
1055 warning ("cannot close \"%s\": %s",
1056 bfd_filename, bfd_errmsg (bfd_get_error ()));
1057 }
1058 else
1059 /* This happens for the executable on SVR4. */
1060 bfd_filename = NULL;
1061
c5aa993b 1062 next = so_list_head->next;
c906108c 1063 if (bfd_filename)
c5aa993b 1064 free ((PTR) bfd_filename);
c906108c 1065 free (so_list_head->so_name);
c5aa993b 1066 free ((PTR) so_list_head);
c906108c
SS
1067 so_list_head = next;
1068 }
1069 debug_base = 0;
1070}
1071
1072/*
1073
c5aa993b 1074 LOCAL FUNCTION
c906108c 1075
c5aa993b 1076 disable_break -- remove the "mapping changed" breakpoint
c906108c 1077
c5aa993b 1078 SYNOPSIS
c906108c 1079
c5aa993b 1080 static int disable_break ()
c906108c 1081
c5aa993b 1082 DESCRIPTION
c906108c 1083
c5aa993b
JM
1084 Removes the breakpoint that gets hit when the dynamic linker
1085 completes a mapping change.
c906108c 1086
c5aa993b 1087 */
c906108c
SS
1088
1089static int
fba45db2 1090disable_break (void)
c906108c
SS
1091{
1092 int status = 1;
1093
1094
1095 /* Note that breakpoint address and original contents are in our address
1096 space, so we just need to write the original contents back. */
1097
1098 if (memory_remove_breakpoint (breakpoint_addr, shadow_contents) != 0)
1099 {
1100 status = 0;
1101 }
1102
1103 /* For the SVR4 version, we always know the breakpoint address. For the
1104 SunOS version we don't know it until the above code is executed.
1105 Grumble if we are stopped anywhere besides the breakpoint address. */
1106
1107 if (stop_pc != breakpoint_addr)
1108 {
1109 warning ("stopped at unknown breakpoint while handling shared libraries");
1110 }
1111
1112 return (status);
1113}
1114
1115/*
1116
c5aa993b 1117 LOCAL FUNCTION
c906108c 1118
c5aa993b 1119 enable_break -- arrange for dynamic linker to hit breakpoint
c906108c 1120
c5aa993b 1121 SYNOPSIS
c906108c 1122
c5aa993b 1123 int enable_break (void)
c906108c 1124
c5aa993b 1125 DESCRIPTION
c906108c 1126
c5aa993b
JM
1127 This functions inserts a breakpoint at the entry point of the
1128 main executable, where all shared libraries are mapped in.
1129 */
c906108c
SS
1130
1131static int
fba45db2 1132enable_break (void)
c906108c
SS
1133{
1134 if (symfile_objfile != NULL
1135 && target_insert_breakpoint (symfile_objfile->ei.entry_point,
1136 shadow_contents) == 0)
1137 {
1138 breakpoint_addr = symfile_objfile->ei.entry_point;
1139 return 1;
1140 }
1141
1142 return 0;
1143}
c5aa993b 1144
c906108c 1145/*
c5aa993b
JM
1146
1147 GLOBAL FUNCTION
1148
1149 solib_create_inferior_hook -- shared library startup support
1150
1151 SYNOPSIS
1152
1153 void solib_create_inferior_hook()
1154
1155 DESCRIPTION
1156
1157 When gdb starts up the inferior, it nurses it along (through the
1158 shell) until it is ready to execute it's first instruction. At this
1159 point, this function gets called via expansion of the macro
1160 SOLIB_CREATE_INFERIOR_HOOK.
1161
1162 For SunOS executables, this first instruction is typically the
1163 one at "_start", or a similar text label, regardless of whether
1164 the executable is statically or dynamically linked. The runtime
1165 startup code takes care of dynamically linking in any shared
1166 libraries, once gdb allows the inferior to continue.
1167
1168 For SVR4 executables, this first instruction is either the first
1169 instruction in the dynamic linker (for dynamically linked
1170 executables) or the instruction at "start" for statically linked
1171 executables. For dynamically linked executables, the system
1172 first exec's /lib/libc.so.N, which contains the dynamic linker,
1173 and starts it running. The dynamic linker maps in any needed
1174 shared libraries, maps in the actual user executable, and then
1175 jumps to "start" in the user executable.
1176
1177 For both SunOS shared libraries, and SVR4 shared libraries, we
1178 can arrange to cooperate with the dynamic linker to discover the
1179 names of shared libraries that are dynamically linked, and the
1180 base addresses to which they are linked.
1181
1182 This function is responsible for discovering those names and
1183 addresses, and saving sufficient information about them to allow
1184 their symbols to be read at a later time.
1185
1186 FIXME
1187
1188 Between enable_break() and disable_break(), this code does not
1189 properly handle hitting breakpoints which the user might have
1190 set in the startup code or in the dynamic linker itself. Proper
1191 handling will probably have to wait until the implementation is
1192 changed to use the "breakpoint handler function" method.
1193
1194 Also, what if child has exit()ed? Must exit loop somehow.
1195 */
1196
1197void
fba45db2 1198solib_create_inferior_hook (void)
c906108c
SS
1199{
1200 if (!enable_break ())
1201 {
1202 warning ("shared library handler failed to enable breakpoint");
1203 return;
1204 }
1205
1206 /* Now run the target. It will eventually hit the breakpoint, at
1207 which point all of the libraries will have been mapped in and we
1208 can go groveling around in the dynamic linker structures to find
1209 out what we need to know about them. */
1210
1211 clear_proceed_status ();
1212 stop_soon_quietly = 1;
1213 stop_signal = TARGET_SIGNAL_0;
1214 do
1215 {
1216 target_resume (-1, 0, stop_signal);
1217 wait_for_inferior ();
1218 }
1219 while (stop_signal != TARGET_SIGNAL_TRAP);
c5aa993b 1220
c906108c
SS
1221 /* We are now either at the "mapping complete" breakpoint (or somewhere
1222 else, a condition we aren't prepared to deal with anyway), so adjust
1223 the PC as necessary after a breakpoint, disable the breakpoint, and
1224 add any shared libraries that were mapped in. */
1225
1226 if (DECR_PC_AFTER_BREAK)
1227 {
1228 stop_pc -= DECR_PC_AFTER_BREAK;
1229 write_register (PC_REGNUM, stop_pc);
1230 }
1231
1232 if (!disable_break ())
1233 {
1234 warning ("shared library handler failed to disable breakpoint");
1235 }
1236
1237 /* solib_add will call reinit_frame_cache.
c5aa993b
JM
1238 But we are stopped in the startup code and we might not have symbols
1239 for the startup code, so heuristic_proc_start could be called
1240 and will put out an annoying warning.
1241 Delaying the resetting of stop_soon_quietly until after symbol loading
1242 suppresses the warning. */
c906108c
SS
1243 if (auto_solib_add)
1244 solib_add ((char *) 0, 0, (struct target_ops *) 0);
1245 stop_soon_quietly = 0;
1246}
1247
1248/*
1249
c5aa993b 1250 LOCAL FUNCTION
c906108c 1251
c5aa993b 1252 sharedlibrary_command -- handle command to explicitly add library
c906108c 1253
c5aa993b 1254 SYNOPSIS
c906108c 1255
c5aa993b 1256 static void sharedlibrary_command (char *args, int from_tty)
c906108c 1257
c5aa993b 1258 DESCRIPTION
c906108c 1259
c5aa993b 1260 */
c906108c
SS
1261
1262static void
fba45db2 1263sharedlibrary_command (char *args, int from_tty)
c906108c
SS
1264{
1265 dont_repeat ();
1266 solib_add (args, from_tty, (struct target_ops *) 0);
1267}
1268
1269void
fba45db2 1270_initialize_solib (void)
c906108c
SS
1271{
1272 add_com ("sharedlibrary", class_files, sharedlibrary_command,
1273 "Load shared object library symbols for files matching REGEXP.");
c5aa993b 1274 add_info ("sharedlibrary", info_sharedlibrary_command,
c906108c
SS
1275 "Status of loaded shared object libraries.");
1276
1277 add_show_from_set
1278 (add_set_cmd ("auto-solib-add", class_support, var_zinteger,
1279 (char *) &auto_solib_add,
1280 "Set autoloading of shared library symbols.\n\
1281If nonzero, symbols from all shared object libraries will be loaded\n\
1282automatically when the inferior begins execution or when the dynamic linker\n\
1283informs gdb that a new library has been loaded. Otherwise, symbols\n\
1284must be loaded manually, using `sharedlibrary'.",
1285 &setlist),
1286 &showlist);
1287}
c906108c 1288\f
c5aa993b 1289
c906108c
SS
1290/* Register that we are able to handle irix5 core file formats.
1291 This really is bfd_target_unknown_flavour */
1292
1293static struct core_fns irix5_core_fns =
1294{
2acceee2
JM
1295 bfd_target_unknown_flavour, /* core_flavour */
1296 default_check_format, /* check_format */
1297 default_core_sniffer, /* core_sniffer */
1298 fetch_core_registers, /* core_read_registers */
1299 NULL /* next */
c906108c
SS
1300};
1301
1302void
fba45db2 1303_initialize_core_irix5 (void)
c906108c
SS
1304{
1305 add_core_fns (&irix5_core_fns);
1306}
This page took 0.121212 seconds and 4 git commands to generate.