* config/m88k/{tm-delta88.h,tm-delta88v4.h}, m88k-tdep.c:
[deliverable/binutils-gdb.git] / gdb / mipsread.c
CommitLineData
bd5635a1 1/* Read a symbol table in MIPS' format (Third-Eye).
6c2e7392
PS
2 Copyright 1986, 1987, 1989, 1990, 1991, 1992, 1993 Free Software
3 Foundation, Inc.
4 Contributed by Alessandro Forin (af@cs.cmu.edu) at CMU. Major work
5 by Per Bothner, John Gilmore and Ian Lance Taylor at Cygnus Support.
bd5635a1
RP
6
7This file is part of GDB.
8
b8c50f09 9This program is free software; you can redistribute it and/or modify
bd5635a1 10it under the terms of the GNU General Public License as published by
b8c50f09
JG
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
bd5635a1 13
b8c50f09 14This program is distributed in the hope that it will be useful,
bd5635a1
RP
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
b8c50f09
JG
20along with this program; if not, write to the Free Software
21Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
bd5635a1 22
e03c0cc6
ILT
23/* Read symbols from an ECOFF file. Most of the work is done in
24 mdebugread.c. */
d747e0af 25
bd5635a1
RP
26#include "defs.h"
27#include "symtab.h"
bd5635a1 28#include "symfile.h"
5e2e79f8 29#include "objfiles.h"
7e258d18 30#include "buildsym.h"
dac4929a 31#include "stabsread.h"
dac4929a
SG
32#include "gdb-stabs.h"
33
6c2e7392 34#include "coff/internal.h"
e03c0cc6 35#include "coff/ecoff.h"
6c2e7392
PS
36#include "libcoff.h" /* Private BFD COFF information. */
37#include "libecoff.h" /* Private BFD ECOFF information. */
38
d747e0af 39static void
e03c0cc6 40mipscoff_new_init PARAMS ((struct objfile *));
84ffdec2 41
d747e0af 42static void
e03c0cc6 43mipscoff_symfile_init PARAMS ((struct objfile *));
c55e6167 44
84ffdec2 45static void
e03c0cc6
ILT
46mipscoff_symfile_read PARAMS ((struct objfile *, struct section_offsets *,
47 int));
84ffdec2
JG
48
49static void
e03c0cc6 50mipscoff_symfile_finish PARAMS ((struct objfile *));
84ffdec2 51
e03c0cc6
ILT
52static struct section_offsets *
53mipscoff_symfile_offsets PARAMS ((struct objfile *, CORE_ADDR));
84ffdec2 54
e03c0cc6
ILT
55/* Initialize anything that needs initializing when a completely new
56 symbol file is specified (not just adding some symbols from another
57 file, e.g. a shared library). */
bd5635a1 58
e03c0cc6 59extern CORE_ADDR sigtramp_address;
bd5635a1 60
4ad1963e 61static void
84ffdec2
JG
62mipscoff_new_init (ignore)
63 struct objfile *ignore;
bd5635a1 64{
e7ff735c 65 sigtramp_address = 0;
0b0d6c3f
PS
66 stabsread_new_init ();
67 buildsym_new_init ();
bd5635a1
RP
68}
69
e03c0cc6
ILT
70/* Initialize to read a symbol file (nothing to do). */
71
4ad1963e 72static void
80d68b1d
FF
73mipscoff_symfile_init (objfile)
74 struct objfile *objfile;
bd5635a1 75{
bd5635a1
RP
76}
77
e03c0cc6
ILT
78/* Read a symbol file from a file. */
79
4ad1963e 80static void
dac4929a 81mipscoff_symfile_read (objfile, section_offsets, mainline)
80d68b1d 82 struct objfile *objfile;
dac4929a 83 struct section_offsets *section_offsets;
bd5635a1
RP
84 int mainline;
85{
e03c0cc6 86 bfd *abfd = objfile->obfd;
6ac14d25
PS
87 struct cleanup * back_to;
88
021959e2 89 init_minimal_symbol_collection ();
6ac14d25 90 back_to = make_cleanup (discard_minimal_symbols, 0);
bd5635a1
RP
91
92 /* Now that the executable file is positioned at symbol table,
93 process it and define symbols accordingly. */
94
e03c0cc6
ILT
95 if (ecoff_slurp_symbolic_info (abfd) == false)
96 error ("Error reading symbol table: %s", bfd_errmsg (bfd_error));
97
98 mdebug_build_psymtabs (objfile, &ecoff_backend (abfd)->debug_swap,
99 &ecoff_data (abfd)->debug_info, section_offsets);
bd5635a1 100
021959e2
JG
101 /* Install any minimal symbols that have been collected as the current
102 minimal symbols for this objfile. */
bd5635a1 103
80d68b1d 104 install_minimal_symbols (objfile);
6ac14d25
PS
105
106 do_cleanups (back_to);
bd5635a1 107}
817bc7b8 108
e03c0cc6
ILT
109/* Perform any local cleanups required when we are done with a
110 particular objfile. */
80d68b1d
FF
111
112static void
113mipscoff_symfile_finish (objfile)
114 struct objfile *objfile;
115{
bd5635a1
RP
116}
117
e03c0cc6 118/* Fake up identical offsets for all sections. */
bd5635a1 119
e03c0cc6
ILT
120static struct section_offsets *
121mipscoff_symfile_offsets (objfile, addr)
5f7b2142 122 struct objfile *objfile;
e03c0cc6 123 CORE_ADDR addr;
bd5635a1 124{
e03c0cc6
ILT
125 struct section_offsets *section_offsets;
126 int i;
bd5635a1 127
e03c0cc6
ILT
128 objfile->num_sections = SECT_OFF_MAX;
129 section_offsets = ((struct section_offsets *)
130 obstack_alloc (&objfile->psymbol_obstack,
131 (sizeof (struct section_offsets)
132 + (sizeof (section_offsets->offsets)
133 * (SECT_OFF_MAX - 1)))));
bd5635a1 134
e03c0cc6
ILT
135 for (i = 0; i < SECT_OFF_MAX; i++)
136 ANOFFSET (section_offsets, i) = addr;
bd5635a1 137
e03c0cc6 138 return section_offsets;
bd5635a1
RP
139}
140
e03c0cc6 141/* Initialization */
bd5635a1 142
e03c0cc6 143static struct sym_fns ecoff_sym_fns =
5f7b2142 144{
e03c0cc6
ILT
145 bfd_target_ecoff_flavour,
146 mipscoff_new_init, /* sym_new_init: init anything gbl to entire symtab */
147 mipscoff_symfile_init, /* sym_init: read initial info, setup for sym_read() */
148 mipscoff_symfile_read, /* sym_read: read a symbol file into symtab */
149 mipscoff_symfile_finish, /* sym_finish: finished with file, cleanup */
150 mipscoff_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */
151 NULL /* next: pointer to next struct sym_fns */
e7e02420 152};
bd5635a1 153
e03c0cc6
ILT
154void
155_initialize_mipsread ()
bd5635a1 156{
5f7b2142 157 add_symtab_fns (&ecoff_sym_fns);
bd5635a1 158}
This page took 0.181408 seconds and 4 git commands to generate.