Commit | Line | Data |
---|---|---|
c906108c | 1 | /* Read hp debug symbols and convert to internal format, for GDB. |
d7f0b9ce | 2 | Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 |
b6ba6518 | 3 | Free Software Foundation, Inc. |
c906108c SS |
4 | |
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 2 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program; if not, write to the Free Software | |
c5aa993b JM |
19 | Foundation, Inc., 59 Temple Place - Suite 330, |
20 | Boston, MA 02111-1307, USA. | |
c906108c SS |
21 | |
22 | Written by the Center for Software Science at the University of Utah | |
23 | and by Cygnus Support. */ | |
24 | ||
25 | #include "defs.h" | |
26 | #include "bfd.h" | |
27 | #include "gdb_string.h" | |
28 | #include "hp-symtab.h" | |
29 | #include "syms.h" | |
30 | #include "symtab.h" | |
31 | #include "symfile.h" | |
32 | #include "objfiles.h" | |
33 | #include "buildsym.h" | |
34 | #include "complaints.h" | |
35 | #include "gdb-stabs.h" | |
36 | #include "gdbtypes.h" | |
37 | #include "demangle.h" | |
38 | ||
39 | /* Private information attached to an objfile which we use to find | |
40 | and internalize the HP C debug symbols within that objfile. */ | |
41 | ||
42 | struct hpread_symfile_info | |
c5aa993b JM |
43 | { |
44 | /* The contents of each of the debug sections (there are 4 of them). */ | |
45 | char *gntt; | |
46 | char *lntt; | |
47 | char *slt; | |
48 | char *vt; | |
c906108c | 49 | |
c5aa993b JM |
50 | /* We keep the size of the $VT$ section for range checking. */ |
51 | unsigned int vt_size; | |
c906108c | 52 | |
c5aa993b JM |
53 | /* Some routines still need to know the number of symbols in the |
54 | main debug sections ($LNTT$ and $GNTT$). */ | |
55 | unsigned int lntt_symcount; | |
56 | unsigned int gntt_symcount; | |
c906108c | 57 | |
c5aa993b JM |
58 | /* To keep track of all the types we've processed. */ |
59 | struct type **type_vector; | |
60 | int type_vector_length; | |
c906108c | 61 | |
c5aa993b JM |
62 | /* Keeps track of the beginning of a range of source lines. */ |
63 | sltpointer sl_index; | |
c906108c | 64 | |
c5aa993b JM |
65 | /* Some state variables we'll need. */ |
66 | int within_function; | |
c906108c | 67 | |
c5aa993b JM |
68 | /* Keep track of the current function's address. We may need to look |
69 | up something based on this address. */ | |
70 | unsigned int current_function_value; | |
71 | }; | |
c906108c SS |
72 | |
73 | /* Accessor macros to get at the fields. */ | |
74 | #define HPUX_SYMFILE_INFO(o) \ | |
75 | ((struct hpread_symfile_info *)((o)->sym_private)) | |
76 | #define GNTT(o) (HPUX_SYMFILE_INFO(o)->gntt) | |
77 | #define LNTT(o) (HPUX_SYMFILE_INFO(o)->lntt) | |
78 | #define SLT(o) (HPUX_SYMFILE_INFO(o)->slt) | |
79 | #define VT(o) (HPUX_SYMFILE_INFO(o)->vt) | |
80 | #define VT_SIZE(o) (HPUX_SYMFILE_INFO(o)->vt_size) | |
81 | #define LNTT_SYMCOUNT(o) (HPUX_SYMFILE_INFO(o)->lntt_symcount) | |
82 | #define GNTT_SYMCOUNT(o) (HPUX_SYMFILE_INFO(o)->gntt_symcount) | |
83 | #define TYPE_VECTOR(o) (HPUX_SYMFILE_INFO(o)->type_vector) | |
84 | #define TYPE_VECTOR_LENGTH(o) (HPUX_SYMFILE_INFO(o)->type_vector_length) | |
85 | #define SL_INDEX(o) (HPUX_SYMFILE_INFO(o)->sl_index) | |
86 | #define WITHIN_FUNCTION(o) (HPUX_SYMFILE_INFO(o)->within_function) | |
87 | #define CURRENT_FUNCTION_VALUE(o) (HPUX_SYMFILE_INFO(o)->current_function_value) | |
88 | ||
89 | /* Given the native debug symbol SYM, set NAMEP to the name associated | |
90 | with the debug symbol. Note we may be called with a debug symbol which | |
91 | has no associated name, in that case we return an empty string. | |
92 | ||
93 | Also note we "know" that the name for any symbol is always in the | |
94 | same place. Hence we don't have to conditionalize on the symbol type. */ | |
95 | #define SET_NAMESTRING(SYM, NAMEP, OBJFILE) \ | |
96 | if (! hpread_has_name ((SYM)->dblock.kind)) \ | |
97 | *NAMEP = ""; \ | |
98 | else if (((unsigned)(SYM)->dsfile.name) >= VT_SIZE (OBJFILE)) \ | |
99 | { \ | |
100 | complain (&string_table_offset_complaint, (char *) symnum); \ | |
101 | *NAMEP = ""; \ | |
102 | } \ | |
103 | else \ | |
104 | *NAMEP = (SYM)->dsfile.name + VT (OBJFILE) | |
105 | \f | |
106 | /* We put a pointer to this structure in the read_symtab_private field | |
107 | of the psymtab. */ | |
108 | ||
109 | struct symloc | |
c5aa993b JM |
110 | { |
111 | /* The offset within the file symbol table of first local symbol for | |
112 | this file. */ | |
c906108c | 113 | |
c5aa993b | 114 | int ldsymoff; |
c906108c | 115 | |
c5aa993b JM |
116 | /* Length (in bytes) of the section of the symbol table devoted to |
117 | this file's symbols (actually, the section bracketed may contain | |
118 | more than just this file's symbols). If ldsymlen is 0, the only | |
119 | reason for this thing's existence is the dependency list. | |
120 | Nothing else will happen when it is read in. */ | |
c906108c | 121 | |
c5aa993b JM |
122 | int ldsymlen; |
123 | }; | |
c906108c SS |
124 | |
125 | #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff) | |
126 | #define LDSYMLEN(p) (((struct symloc *)((p)->read_symtab_private))->ldsymlen) | |
127 | #define SYMLOC(p) ((struct symloc *)((p)->read_symtab_private)) | |
128 | \f | |
129 | /* FIXME: Shouldn't this stuff be in a .h file somewhere? */ | |
c906108c SS |
130 | /* Complaints about the symbols we have encountered. */ |
131 | extern struct complaint string_table_offset_complaint; | |
132 | extern struct complaint lbrac_unmatched_complaint; | |
133 | extern struct complaint lbrac_mismatch_complaint; | |
c906108c | 134 | \f |
c5aa993b | 135 | |
a14ed312 | 136 | void hpread_symfile_init (struct objfile *); |
c906108c | 137 | |
a14ed312 KB |
138 | static struct type *hpread_read_array_type (dnttpointer, union dnttentry *, |
139 | struct objfile *); | |
c906108c | 140 | |
a14ed312 | 141 | static struct type *hpread_alloc_type (dnttpointer, struct objfile *); |
c906108c | 142 | |
a14ed312 | 143 | static struct type **hpread_lookup_type (dnttpointer, struct objfile *); |
c906108c SS |
144 | |
145 | static struct type *hpread_read_enum_type | |
a14ed312 | 146 | (dnttpointer, union dnttentry *, struct objfile *); |
c906108c SS |
147 | |
148 | static struct type *hpread_read_set_type | |
a14ed312 | 149 | (dnttpointer, union dnttentry *, struct objfile *); |
c906108c SS |
150 | |
151 | static struct type *hpread_read_subrange_type | |
a14ed312 | 152 | (dnttpointer, union dnttentry *, struct objfile *); |
c906108c SS |
153 | |
154 | static struct type *hpread_read_struct_type | |
a14ed312 | 155 | (dnttpointer, union dnttentry *, struct objfile *); |
c906108c | 156 | |
a14ed312 | 157 | void hpread_build_psymtabs (struct objfile *, int); |
c906108c | 158 | |
a14ed312 | 159 | void hpread_symfile_finish (struct objfile *); |
c906108c SS |
160 | |
161 | static struct partial_symtab *hpread_start_psymtab | |
a14ed312 KB |
162 | (struct objfile *, char *, CORE_ADDR, int, |
163 | struct partial_symbol **, struct partial_symbol **); | |
c906108c SS |
164 | |
165 | static struct partial_symtab *hpread_end_psymtab | |
a14ed312 KB |
166 | (struct partial_symtab *, char **, int, int, CORE_ADDR, |
167 | struct partial_symtab **, int); | |
c906108c SS |
168 | |
169 | static struct symtab *hpread_expand_symtab | |
a14ed312 KB |
170 | (struct objfile *, int, int, CORE_ADDR, int, |
171 | struct section_offsets *, char *); | |
c906108c SS |
172 | |
173 | static void hpread_process_one_debug_symbol | |
a14ed312 KB |
174 | (union dnttentry *, char *, struct section_offsets *, |
175 | struct objfile *, CORE_ADDR, int, char *, int); | |
c906108c SS |
176 | |
177 | static sltpointer hpread_record_lines | |
a14ed312 | 178 | (struct subfile *, sltpointer, sltpointer, struct objfile *, CORE_ADDR); |
c906108c SS |
179 | |
180 | static struct type *hpread_read_function_type | |
a14ed312 | 181 | (dnttpointer, union dnttentry *, struct objfile *); |
c906108c | 182 | |
a14ed312 | 183 | static struct type *hpread_type_lookup (dnttpointer, struct objfile *); |
c906108c | 184 | |
a14ed312 | 185 | static unsigned long hpread_get_depth (sltpointer, struct objfile *); |
c906108c | 186 | |
a14ed312 | 187 | static unsigned long hpread_get_line (sltpointer, struct objfile *); |
c906108c | 188 | |
a14ed312 | 189 | static CORE_ADDR hpread_get_location (sltpointer, struct objfile *); |
c906108c | 190 | |
a14ed312 KB |
191 | static int hpread_type_translate (dnttpointer); |
192 | static unsigned long hpread_get_textlow (int, int, struct objfile *); | |
193 | static union dnttentry *hpread_get_gntt (int, struct objfile *); | |
194 | static union dnttentry *hpread_get_lntt (int, struct objfile *); | |
195 | static union sltentry *hpread_get_slt (int, struct objfile *); | |
196 | static void hpread_psymtab_to_symtab (struct partial_symtab *); | |
197 | static void hpread_psymtab_to_symtab_1 (struct partial_symtab *); | |
198 | static int hpread_has_name (enum dntt_entry_type); | |
c906108c | 199 | \f |
c5aa993b | 200 | |
c906108c SS |
201 | /* Initialization for reading native HP C debug symbols from OBJFILE. |
202 | ||
203 | It's only purpose in life is to set up the symbol reader's private | |
204 | per-objfile data structures, and read in the raw contents of the debug | |
205 | sections (attaching pointers to the debug info into the private data | |
206 | structures). | |
207 | ||
208 | Since BFD doesn't know how to read debug symbols in a format-independent | |
209 | way (and may never do so...), we have to do it ourselves. Note we may | |
210 | be called on a file without native HP C debugging symbols. | |
211 | FIXME, there should be a cleaner peephole into the BFD environment here. */ | |
212 | ||
213 | void | |
fba45db2 | 214 | hpread_symfile_init (struct objfile *objfile) |
c906108c SS |
215 | { |
216 | asection *vt_section, *slt_section, *lntt_section, *gntt_section; | |
217 | ||
218 | /* Allocate struct to keep track of the symfile */ | |
219 | objfile->sym_private = (PTR) | |
220 | xmmalloc (objfile->md, sizeof (struct hpread_symfile_info)); | |
221 | memset (objfile->sym_private, 0, sizeof (struct hpread_symfile_info)); | |
222 | ||
223 | /* We haven't read in any types yet. */ | |
224 | TYPE_VECTOR (objfile) = 0; | |
225 | ||
226 | /* Read in data from the $GNTT$ subspace. */ | |
227 | gntt_section = bfd_get_section_by_name (objfile->obfd, "$GNTT$"); | |
228 | if (!gntt_section) | |
229 | return; | |
230 | ||
231 | GNTT (objfile) | |
232 | = obstack_alloc (&objfile->symbol_obstack, | |
233 | bfd_section_size (objfile->obfd, gntt_section)); | |
234 | ||
235 | bfd_get_section_contents (objfile->obfd, gntt_section, GNTT (objfile), | |
c5aa993b | 236 | 0, bfd_section_size (objfile->obfd, gntt_section)); |
c906108c SS |
237 | |
238 | GNTT_SYMCOUNT (objfile) | |
239 | = bfd_section_size (objfile->obfd, gntt_section) | |
c5aa993b | 240 | / sizeof (struct dntt_type_block); |
c906108c SS |
241 | |
242 | /* Read in data from the $LNTT$ subspace. Also keep track of the number | |
243 | of LNTT symbols. */ | |
244 | lntt_section = bfd_get_section_by_name (objfile->obfd, "$LNTT$"); | |
245 | if (!lntt_section) | |
246 | return; | |
247 | ||
248 | LNTT (objfile) | |
249 | = obstack_alloc (&objfile->symbol_obstack, | |
250 | bfd_section_size (objfile->obfd, lntt_section)); | |
251 | ||
252 | bfd_get_section_contents (objfile->obfd, lntt_section, LNTT (objfile), | |
c5aa993b | 253 | 0, bfd_section_size (objfile->obfd, lntt_section)); |
c906108c SS |
254 | |
255 | LNTT_SYMCOUNT (objfile) | |
256 | = bfd_section_size (objfile->obfd, lntt_section) | |
c5aa993b | 257 | / sizeof (struct dntt_type_block); |
c906108c SS |
258 | |
259 | /* Read in data from the $SLT$ subspace. $SLT$ contains information | |
260 | on source line numbers. */ | |
261 | slt_section = bfd_get_section_by_name (objfile->obfd, "$SLT$"); | |
262 | if (!slt_section) | |
263 | return; | |
264 | ||
265 | SLT (objfile) = | |
266 | obstack_alloc (&objfile->symbol_obstack, | |
267 | bfd_section_size (objfile->obfd, slt_section)); | |
268 | ||
269 | bfd_get_section_contents (objfile->obfd, slt_section, SLT (objfile), | |
c5aa993b | 270 | 0, bfd_section_size (objfile->obfd, slt_section)); |
c906108c SS |
271 | |
272 | /* Read in data from the $VT$ subspace. $VT$ contains things like | |
273 | names and constants. Keep track of the number of symbols in the VT. */ | |
274 | vt_section = bfd_get_section_by_name (objfile->obfd, "$VT$"); | |
275 | if (!vt_section) | |
276 | return; | |
277 | ||
278 | VT_SIZE (objfile) = bfd_section_size (objfile->obfd, vt_section); | |
279 | ||
280 | VT (objfile) = | |
281 | (char *) obstack_alloc (&objfile->symbol_obstack, | |
282 | VT_SIZE (objfile)); | |
283 | ||
284 | bfd_get_section_contents (objfile->obfd, vt_section, VT (objfile), | |
285 | 0, VT_SIZE (objfile)); | |
286 | } | |
287 | ||
288 | /* Scan and build partial symbols for a symbol file. | |
289 | ||
290 | The minimal symbol table (either SOM or HP a.out) has already been | |
291 | read in; all we need to do is setup partial symbols based on the | |
292 | native debugging information. | |
293 | ||
294 | We assume hpread_symfile_init has been called to initialize the | |
295 | symbol reader's private data structures. | |
296 | ||
c906108c SS |
297 | MAINLINE is true if we are reading the main symbol |
298 | table (as opposed to a shared lib or dynamically loaded file). */ | |
299 | ||
300 | void | |
fba45db2 | 301 | hpread_build_psymtabs (struct objfile *objfile, int mainline) |
c906108c SS |
302 | { |
303 | char *namestring; | |
304 | int past_first_source_file = 0; | |
305 | struct cleanup *old_chain; | |
306 | ||
307 | int hp_symnum, symcount, i; | |
308 | ||
309 | union dnttentry *dn_bufp; | |
310 | unsigned long valu; | |
311 | char *p; | |
312 | int texthigh = 0; | |
313 | int have_name = 0; | |
314 | ||
315 | /* Current partial symtab */ | |
316 | struct partial_symtab *pst; | |
317 | ||
318 | /* List of current psymtab's include files */ | |
319 | char **psymtab_include_list; | |
320 | int includes_allocated; | |
321 | int includes_used; | |
322 | ||
323 | /* Index within current psymtab dependency list */ | |
324 | struct partial_symtab **dependency_list; | |
325 | int dependencies_used, dependencies_allocated; | |
326 | ||
327 | /* Just in case the stabs reader left turds lying around. */ | |
328 | free_pending_blocks (); | |
329 | make_cleanup (really_free_pendings, 0); | |
330 | ||
331 | pst = (struct partial_symtab *) 0; | |
332 | ||
333 | /* We shouldn't use alloca, instead use malloc/free. Doing so avoids | |
334 | a number of problems with cross compilation and creating useless holes | |
335 | in the stack when we have to allocate new entries. FIXME. */ | |
336 | ||
337 | includes_allocated = 30; | |
338 | includes_used = 0; | |
339 | psymtab_include_list = (char **) alloca (includes_allocated * | |
340 | sizeof (char *)); | |
341 | ||
342 | dependencies_allocated = 30; | |
343 | dependencies_used = 0; | |
344 | dependency_list = | |
345 | (struct partial_symtab **) alloca (dependencies_allocated * | |
346 | sizeof (struct partial_symtab *)); | |
347 | ||
74b7792f | 348 | old_chain = make_cleanup_free_objfile (objfile); |
c906108c SS |
349 | |
350 | last_source_file = 0; | |
351 | ||
352 | /* Make two passes, one ofr the GNTT symbols, the other for the | |
353 | LNTT symbols. */ | |
354 | for (i = 0; i < 1; i++) | |
355 | { | |
356 | int within_function = 0; | |
357 | ||
358 | if (i) | |
359 | symcount = GNTT_SYMCOUNT (objfile); | |
360 | else | |
361 | symcount = LNTT_SYMCOUNT (objfile); | |
362 | ||
363 | for (hp_symnum = 0; hp_symnum < symcount; hp_symnum++) | |
364 | { | |
365 | QUIT; | |
366 | if (i) | |
367 | dn_bufp = hpread_get_gntt (hp_symnum, objfile); | |
368 | else | |
369 | dn_bufp = hpread_get_lntt (hp_symnum, objfile); | |
370 | ||
371 | if (dn_bufp->dblock.extension) | |
372 | continue; | |
373 | ||
374 | /* Only handle things which are necessary for minimal symbols. | |
375 | everything else is ignored. */ | |
376 | switch (dn_bufp->dblock.kind) | |
377 | { | |
378 | case DNTT_TYPE_SRCFILE: | |
379 | { | |
380 | /* A source file of some kind. Note this may simply | |
381 | be an included file. */ | |
382 | SET_NAMESTRING (dn_bufp, &namestring, objfile); | |
383 | ||
384 | /* Check if this is the source file we are already working | |
385 | with. */ | |
386 | if (pst && !strcmp (namestring, pst->filename)) | |
387 | continue; | |
388 | ||
389 | /* Check if this is an include file, if so check if we have | |
390 | already seen it. Add it to the include list */ | |
391 | p = strrchr (namestring, '.'); | |
392 | if (!strcmp (p, ".h")) | |
393 | { | |
394 | int j, found; | |
395 | ||
396 | found = 0; | |
397 | for (j = 0; j < includes_used; j++) | |
398 | if (!strcmp (namestring, psymtab_include_list[j])) | |
399 | { | |
400 | found = 1; | |
401 | break; | |
402 | } | |
403 | if (found) | |
404 | continue; | |
405 | ||
406 | /* Add it to the list of includes seen so far and | |
407 | allocate more include space if necessary. */ | |
408 | psymtab_include_list[includes_used++] = namestring; | |
409 | if (includes_used >= includes_allocated) | |
410 | { | |
411 | char **orig = psymtab_include_list; | |
412 | ||
413 | psymtab_include_list = (char **) | |
414 | alloca ((includes_allocated *= 2) * | |
415 | sizeof (char *)); | |
416 | memcpy ((PTR) psymtab_include_list, (PTR) orig, | |
417 | includes_used * sizeof (char *)); | |
418 | } | |
419 | continue; | |
420 | } | |
421 | ||
422 | ||
423 | if (pst) | |
424 | { | |
425 | if (!have_name) | |
426 | { | |
427 | pst->filename = (char *) | |
428 | obstack_alloc (&pst->objfile->psymbol_obstack, | |
429 | strlen (namestring) + 1); | |
430 | strcpy (pst->filename, namestring); | |
431 | have_name = 1; | |
432 | continue; | |
433 | } | |
434 | continue; | |
435 | } | |
436 | ||
437 | /* This is a bonafide new source file. | |
438 | End the current partial symtab and start a new one. */ | |
439 | ||
440 | if (pst && past_first_source_file) | |
441 | { | |
442 | hpread_end_psymtab (pst, psymtab_include_list, | |
443 | includes_used, | |
444 | (hp_symnum | |
445 | * sizeof (struct dntt_type_block)), | |
446 | texthigh, | |
447 | dependency_list, dependencies_used); | |
448 | pst = (struct partial_symtab *) 0; | |
449 | includes_used = 0; | |
450 | dependencies_used = 0; | |
451 | } | |
452 | else | |
453 | past_first_source_file = 1; | |
454 | ||
455 | valu = hpread_get_textlow (i, hp_symnum, objfile); | |
b8fbeb18 | 456 | valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); |
d4f3574e | 457 | pst = hpread_start_psymtab (objfile, |
c906108c SS |
458 | namestring, valu, |
459 | (hp_symnum | |
c5aa993b | 460 | * sizeof (struct dntt_type_block)), |
c906108c SS |
461 | objfile->global_psymbols.next, |
462 | objfile->static_psymbols.next); | |
463 | texthigh = valu; | |
464 | have_name = 1; | |
465 | continue; | |
466 | } | |
467 | ||
468 | case DNTT_TYPE_MODULE: | |
469 | /* A source file. It's still unclear to me what the | |
c5aa993b JM |
470 | real difference between a DNTT_TYPE_SRCFILE and DNTT_TYPE_MODULE |
471 | is supposed to be. */ | |
c906108c SS |
472 | SET_NAMESTRING (dn_bufp, &namestring, objfile); |
473 | valu = hpread_get_textlow (i, hp_symnum, objfile); | |
b8fbeb18 | 474 | valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); |
c906108c SS |
475 | if (!pst) |
476 | { | |
d4f3574e | 477 | pst = hpread_start_psymtab (objfile, |
c906108c SS |
478 | namestring, valu, |
479 | (hp_symnum | |
c5aa993b | 480 | * sizeof (struct dntt_type_block)), |
c906108c SS |
481 | objfile->global_psymbols.next, |
482 | objfile->static_psymbols.next); | |
483 | texthigh = valu; | |
484 | have_name = 0; | |
485 | } | |
486 | continue; | |
487 | case DNTT_TYPE_FUNCTION: | |
488 | case DNTT_TYPE_ENTRY: | |
489 | /* The beginning of a function. DNTT_TYPE_ENTRY may also denote | |
c5aa993b | 490 | a secondary entry point. */ |
d4f3574e | 491 | valu = dn_bufp->dfunc.hiaddr + ANOFFSET (objfile->section_offsets, |
b8fbeb18 | 492 | SECT_OFF_TEXT (objfile)); |
c906108c SS |
493 | if (valu > texthigh) |
494 | texthigh = valu; | |
495 | valu = dn_bufp->dfunc.lowaddr + | |
b8fbeb18 | 496 | ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile)); |
c906108c SS |
497 | SET_NAMESTRING (dn_bufp, &namestring, objfile); |
498 | add_psymbol_to_list (namestring, strlen (namestring), | |
499 | VAR_NAMESPACE, LOC_BLOCK, | |
500 | &objfile->static_psymbols, valu, | |
501 | 0, language_unknown, objfile); | |
502 | within_function = 1; | |
503 | continue; | |
504 | case DNTT_TYPE_BEGIN: | |
505 | case DNTT_TYPE_END: | |
506 | /* Scope block begin/end. We only care about function | |
c5aa993b | 507 | and file blocks right now. */ |
c906108c SS |
508 | if (dn_bufp->dend.endkind == DNTT_TYPE_MODULE) |
509 | { | |
510 | hpread_end_psymtab (pst, psymtab_include_list, includes_used, | |
511 | (hp_symnum | |
512 | * sizeof (struct dntt_type_block)), | |
513 | texthigh, | |
514 | dependency_list, dependencies_used); | |
515 | pst = (struct partial_symtab *) 0; | |
516 | includes_used = 0; | |
517 | dependencies_used = 0; | |
518 | have_name = 0; | |
519 | } | |
520 | if (dn_bufp->dend.endkind == DNTT_TYPE_FUNCTION) | |
521 | within_function = 0; | |
522 | continue; | |
523 | case DNTT_TYPE_SVAR: | |
524 | case DNTT_TYPE_DVAR: | |
525 | case DNTT_TYPE_TYPEDEF: | |
526 | case DNTT_TYPE_TAGDEF: | |
527 | { | |
528 | /* Variables, typedefs an the like. */ | |
529 | enum address_class storage; | |
530 | namespace_enum namespace; | |
531 | ||
532 | /* Don't add locals to the partial symbol table. */ | |
533 | if (within_function | |
534 | && (dn_bufp->dblock.kind == DNTT_TYPE_SVAR | |
535 | || dn_bufp->dblock.kind == DNTT_TYPE_DVAR)) | |
536 | continue; | |
537 | ||
538 | /* TAGDEFs go into the structure namespace. */ | |
539 | if (dn_bufp->dblock.kind == DNTT_TYPE_TAGDEF) | |
540 | namespace = STRUCT_NAMESPACE; | |
541 | else | |
542 | namespace = VAR_NAMESPACE; | |
543 | ||
544 | /* What kind of "storage" does this use? */ | |
545 | if (dn_bufp->dblock.kind == DNTT_TYPE_SVAR) | |
546 | storage = LOC_STATIC; | |
547 | else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR | |
548 | && dn_bufp->ddvar.regvar) | |
549 | storage = LOC_REGISTER; | |
550 | else if (dn_bufp->dblock.kind == DNTT_TYPE_DVAR) | |
551 | storage = LOC_LOCAL; | |
552 | else | |
553 | storage = LOC_UNDEF; | |
554 | ||
555 | SET_NAMESTRING (dn_bufp, &namestring, objfile); | |
556 | if (!pst) | |
557 | { | |
d4f3574e | 558 | pst = hpread_start_psymtab (objfile, |
c906108c SS |
559 | "globals", 0, |
560 | (hp_symnum | |
c5aa993b JM |
561 | * sizeof (struct dntt_type_block)), |
562 | objfile->global_psymbols.next, | |
563 | objfile->static_psymbols.next); | |
c906108c SS |
564 | } |
565 | if (dn_bufp->dsvar.global) | |
566 | { | |
567 | add_psymbol_to_list (namestring, strlen (namestring), | |
568 | namespace, storage, | |
569 | &objfile->global_psymbols, | |
570 | dn_bufp->dsvar.location, | |
571 | 0, language_unknown, objfile); | |
572 | } | |
573 | else | |
574 | { | |
575 | add_psymbol_to_list (namestring, strlen (namestring), | |
576 | namespace, storage, | |
577 | &objfile->static_psymbols, | |
578 | dn_bufp->dsvar.location, | |
579 | 0, language_unknown, objfile); | |
580 | } | |
581 | continue; | |
582 | } | |
583 | case DNTT_TYPE_MEMENUM: | |
584 | case DNTT_TYPE_CONST: | |
585 | /* Constants and members of enumerated types. */ | |
586 | SET_NAMESTRING (dn_bufp, &namestring, objfile); | |
587 | if (!pst) | |
588 | { | |
d4f3574e | 589 | pst = hpread_start_psymtab (objfile, |
c906108c | 590 | "globals", 0, |
c5aa993b JM |
591 | (hp_symnum |
592 | * sizeof (struct dntt_type_block)), | |
c906108c SS |
593 | objfile->global_psymbols.next, |
594 | objfile->static_psymbols.next); | |
595 | } | |
596 | add_psymbol_to_list (namestring, strlen (namestring), | |
597 | VAR_NAMESPACE, LOC_CONST, | |
598 | &objfile->static_psymbols, 0, | |
599 | 0, language_unknown, objfile); | |
600 | continue; | |
601 | default: | |
602 | continue; | |
603 | } | |
604 | } | |
605 | } | |
606 | ||
607 | /* End any pending partial symbol table. */ | |
608 | if (pst) | |
609 | { | |
610 | hpread_end_psymtab (pst, psymtab_include_list, includes_used, | |
611 | hp_symnum * sizeof (struct dntt_type_block), | |
612 | 0, dependency_list, dependencies_used); | |
613 | } | |
614 | ||
615 | discard_cleanups (old_chain); | |
616 | } | |
617 | ||
618 | /* Perform any local cleanups required when we are done with a particular | |
619 | objfile. I.E, we are in the process of discarding all symbol information | |
620 | for an objfile, freeing up all memory held for it, and unlinking the | |
621 | objfile struct from the global list of known objfiles. */ | |
622 | ||
623 | void | |
fba45db2 | 624 | hpread_symfile_finish (struct objfile *objfile) |
c906108c SS |
625 | { |
626 | if (objfile->sym_private != NULL) | |
627 | { | |
aac7f4ea | 628 | xmfree (objfile->md, objfile->sym_private); |
c906108c SS |
629 | } |
630 | } | |
631 | \f | |
632 | ||
633 | /* The remaining functions are all for internal use only. */ | |
634 | ||
635 | /* Various small functions to get entries in the debug symbol sections. */ | |
636 | ||
637 | static union dnttentry * | |
fba45db2 | 638 | hpread_get_lntt (int index, struct objfile *objfile) |
c906108c SS |
639 | { |
640 | return (union dnttentry *) | |
641 | &(LNTT (objfile)[(index * sizeof (struct dntt_type_block))]); | |
642 | } | |
643 | ||
644 | static union dnttentry * | |
fba45db2 | 645 | hpread_get_gntt (int index, struct objfile *objfile) |
c906108c SS |
646 | { |
647 | return (union dnttentry *) | |
648 | &(GNTT (objfile)[(index * sizeof (struct dntt_type_block))]); | |
649 | } | |
650 | ||
651 | static union sltentry * | |
fba45db2 | 652 | hpread_get_slt (int index, struct objfile *objfile) |
c906108c | 653 | { |
c5aa993b | 654 | return (union sltentry *) &(SLT (objfile)[index * sizeof (union sltentry)]); |
c906108c SS |
655 | } |
656 | ||
657 | /* Get the low address associated with some symbol (typically the start | |
658 | of a particular source file or module). Since that information is not | |
8e1a459b C |
659 | stored as part of the DNTT_TYPE_MODULE or DNTT_TYPE_SRCFILE symbol we |
660 | must infer it from the existence of DNTT_TYPE_FUNCTION symbols. */ | |
c906108c SS |
661 | |
662 | static unsigned long | |
fba45db2 | 663 | hpread_get_textlow (int global, int index, struct objfile *objfile) |
c906108c SS |
664 | { |
665 | union dnttentry *dn_bufp; | |
666 | struct minimal_symbol *msymbol; | |
667 | ||
668 | /* Look for a DNTT_TYPE_FUNCTION symbol. */ | |
669 | do | |
670 | { | |
671 | if (global) | |
672 | dn_bufp = hpread_get_gntt (index++, objfile); | |
673 | else | |
674 | dn_bufp = hpread_get_lntt (index++, objfile); | |
c5aa993b JM |
675 | } |
676 | while (dn_bufp->dblock.kind != DNTT_TYPE_FUNCTION | |
677 | && dn_bufp->dblock.kind != DNTT_TYPE_END); | |
c906108c SS |
678 | |
679 | /* Avoid going past a DNTT_TYPE_END when looking for a DNTT_TYPE_FUNCTION. This | |
680 | might happen when a sourcefile has no functions. */ | |
681 | if (dn_bufp->dblock.kind == DNTT_TYPE_END) | |
682 | return 0; | |
683 | ||
684 | /* The minimal symbols are typically more accurate for some reason. */ | |
685 | msymbol = lookup_minimal_symbol (dn_bufp->dfunc.name + VT (objfile), NULL, | |
686 | objfile); | |
687 | if (msymbol) | |
688 | return SYMBOL_VALUE_ADDRESS (msymbol); | |
689 | else | |
690 | return dn_bufp->dfunc.lowaddr; | |
691 | } | |
692 | ||
693 | /* Get the nesting depth for the source line identified by INDEX. */ | |
694 | ||
695 | static unsigned long | |
fba45db2 | 696 | hpread_get_depth (sltpointer index, struct objfile *objfile) |
c906108c SS |
697 | { |
698 | union sltentry *sl_bufp; | |
699 | ||
700 | sl_bufp = hpread_get_slt (index, objfile); | |
701 | return sl_bufp->sspec.backptr.dnttp.index; | |
702 | } | |
703 | ||
704 | /* Get the source line number the the line identified by INDEX. */ | |
705 | ||
706 | static unsigned long | |
fba45db2 | 707 | hpread_get_line (sltpointer index, struct objfile *objfile) |
c906108c SS |
708 | { |
709 | union sltentry *sl_bufp; | |
710 | ||
711 | sl_bufp = hpread_get_slt (index, objfile); | |
712 | return sl_bufp->snorm.line; | |
713 | } | |
714 | ||
715 | static CORE_ADDR | |
fba45db2 | 716 | hpread_get_location (sltpointer index, struct objfile *objfile) |
c906108c SS |
717 | { |
718 | union sltentry *sl_bufp; | |
719 | int i; | |
720 | ||
721 | /* code location of special sltentrys is determined from context */ | |
722 | sl_bufp = hpread_get_slt (index, objfile); | |
723 | ||
724 | if (sl_bufp->snorm.sltdesc == SLT_END) | |
725 | { | |
726 | /* find previous normal sltentry and get address */ | |
727 | for (i = 0; ((sl_bufp->snorm.sltdesc != SLT_NORMAL) && | |
728 | (sl_bufp->snorm.sltdesc != SLT_EXIT)); i++) | |
729 | sl_bufp = hpread_get_slt (index - i, objfile); | |
730 | return sl_bufp->snorm.address; | |
731 | } | |
732 | ||
733 | /* find next normal sltentry and get address */ | |
734 | for (i = 0; ((sl_bufp->snorm.sltdesc != SLT_NORMAL) && | |
735 | (sl_bufp->snorm.sltdesc != SLT_EXIT)); i++) | |
736 | sl_bufp = hpread_get_slt (index + i, objfile); | |
737 | return sl_bufp->snorm.address; | |
738 | } | |
739 | \f | |
740 | ||
741 | /* Return 1 if an HP debug symbol of type KIND has a name associated with | |
742 | it, else return 0. */ | |
743 | ||
744 | static int | |
fba45db2 | 745 | hpread_has_name (enum dntt_entry_type kind) |
c906108c SS |
746 | { |
747 | switch (kind) | |
748 | { | |
749 | case DNTT_TYPE_SRCFILE: | |
750 | case DNTT_TYPE_MODULE: | |
751 | case DNTT_TYPE_FUNCTION: | |
752 | case DNTT_TYPE_ENTRY: | |
753 | case DNTT_TYPE_IMPORT: | |
754 | case DNTT_TYPE_LABEL: | |
755 | case DNTT_TYPE_FPARAM: | |
756 | case DNTT_TYPE_SVAR: | |
757 | case DNTT_TYPE_DVAR: | |
758 | case DNTT_TYPE_CONST: | |
759 | case DNTT_TYPE_TYPEDEF: | |
760 | case DNTT_TYPE_TAGDEF: | |
761 | case DNTT_TYPE_MEMENUM: | |
762 | case DNTT_TYPE_FIELD: | |
763 | case DNTT_TYPE_SA: | |
764 | return 1; | |
765 | ||
766 | case DNTT_TYPE_BEGIN: | |
767 | case DNTT_TYPE_END: | |
768 | case DNTT_TYPE_WITH: | |
769 | case DNTT_TYPE_COMMON: | |
770 | case DNTT_TYPE_POINTER: | |
771 | case DNTT_TYPE_ENUM: | |
772 | case DNTT_TYPE_SET: | |
773 | case DNTT_TYPE_SUBRANGE: | |
774 | case DNTT_TYPE_ARRAY: | |
775 | case DNTT_TYPE_STRUCT: | |
776 | case DNTT_TYPE_UNION: | |
777 | case DNTT_TYPE_VARIANT: | |
778 | case DNTT_TYPE_FILE: | |
779 | case DNTT_TYPE_FUNCTYPE: | |
780 | case DNTT_TYPE_COBSTRUCT: | |
781 | case DNTT_TYPE_XREF: | |
782 | case DNTT_TYPE_MACRO: | |
783 | default: | |
784 | return 0; | |
785 | } | |
786 | } | |
787 | ||
788 | /* Allocate and partially fill a partial symtab. It will be | |
789 | completely filled at the end of the symbol list. | |
790 | ||
791 | SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR | |
792 | is the address relative to which its symbols are (incremental) or 0 | |
793 | (normal). */ | |
794 | ||
795 | static struct partial_symtab * | |
fba45db2 KB |
796 | hpread_start_psymtab (struct objfile *objfile, char *filename, |
797 | CORE_ADDR textlow, int ldsymoff, | |
798 | struct partial_symbol **global_syms, | |
799 | struct partial_symbol **static_syms) | |
c906108c SS |
800 | { |
801 | struct partial_symtab *result = | |
802 | start_psymtab_common (objfile, section_offsets, | |
803 | filename, textlow, global_syms, static_syms); | |
804 | ||
805 | result->read_symtab_private = (char *) | |
806 | obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc)); | |
807 | LDSYMOFF (result) = ldsymoff; | |
808 | result->read_symtab = hpread_psymtab_to_symtab; | |
809 | ||
810 | return result; | |
811 | } | |
812 | \f | |
813 | ||
814 | /* Close off the current usage of PST. | |
815 | Returns PST or NULL if the partial symtab was empty and thrown away. | |
816 | ||
817 | FIXME: List variables and peculiarities of same. */ | |
818 | ||
819 | static struct partial_symtab * | |
fba45db2 KB |
820 | hpread_end_psymtab (struct partial_symtab *pst, char **include_list, |
821 | int num_includes, int capping_symbol_offset, | |
822 | CORE_ADDR capping_text, | |
823 | struct partial_symtab **dependency_list, | |
824 | int number_dependencies) | |
c906108c SS |
825 | { |
826 | int i; | |
c5aa993b | 827 | struct objfile *objfile = pst->objfile; |
c906108c SS |
828 | |
829 | if (capping_symbol_offset != -1) | |
c5aa993b | 830 | LDSYMLEN (pst) = capping_symbol_offset - LDSYMOFF (pst); |
c906108c SS |
831 | pst->texthigh = capping_text; |
832 | ||
833 | pst->n_global_syms = | |
834 | objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset); | |
835 | pst->n_static_syms = | |
836 | objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset); | |
837 | ||
838 | pst->number_of_dependencies = number_dependencies; | |
839 | if (number_dependencies) | |
840 | { | |
841 | pst->dependencies = (struct partial_symtab **) | |
842 | obstack_alloc (&objfile->psymbol_obstack, | |
c5aa993b | 843 | number_dependencies * sizeof (struct partial_symtab *)); |
c906108c | 844 | memcpy (pst->dependencies, dependency_list, |
c5aa993b | 845 | number_dependencies * sizeof (struct partial_symtab *)); |
c906108c SS |
846 | } |
847 | else | |
848 | pst->dependencies = 0; | |
849 | ||
850 | for (i = 0; i < num_includes; i++) | |
851 | { | |
852 | struct partial_symtab *subpst = | |
c5aa993b | 853 | allocate_psymtab (include_list[i], objfile); |
c906108c SS |
854 | |
855 | subpst->section_offsets = pst->section_offsets; | |
856 | subpst->read_symtab_private = | |
c5aa993b JM |
857 | (char *) obstack_alloc (&objfile->psymbol_obstack, |
858 | sizeof (struct symloc)); | |
859 | LDSYMOFF (subpst) = | |
860 | LDSYMLEN (subpst) = | |
861 | subpst->textlow = | |
862 | subpst->texthigh = 0; | |
c906108c SS |
863 | |
864 | /* We could save slight bits of space by only making one of these, | |
c5aa993b | 865 | shared by the entire set of include files. FIXME-someday. */ |
c906108c SS |
866 | subpst->dependencies = (struct partial_symtab **) |
867 | obstack_alloc (&objfile->psymbol_obstack, | |
868 | sizeof (struct partial_symtab *)); | |
869 | subpst->dependencies[0] = pst; | |
870 | subpst->number_of_dependencies = 1; | |
871 | ||
872 | subpst->globals_offset = | |
873 | subpst->n_global_syms = | |
c5aa993b JM |
874 | subpst->statics_offset = |
875 | subpst->n_static_syms = 0; | |
c906108c SS |
876 | |
877 | subpst->readin = 0; | |
878 | subpst->symtab = 0; | |
879 | subpst->read_symtab = pst->read_symtab; | |
880 | } | |
881 | ||
882 | sort_pst_symbols (pst); | |
883 | ||
884 | /* If there is already a psymtab or symtab for a file of this name, remove it. | |
885 | (If there is a symtab, more drastic things also happen.) | |
886 | This happens in VxWorks. */ | |
887 | free_named_symtabs (pst->filename); | |
888 | ||
889 | if (num_includes == 0 | |
890 | && number_dependencies == 0 | |
891 | && pst->n_global_syms == 0 | |
892 | && pst->n_static_syms == 0) | |
893 | { | |
894 | /* Throw away this psymtab, it's empty. We can't deallocate it, since | |
c5aa993b | 895 | it is on the obstack, but we can forget to chain it on the list. */ |
c906108c | 896 | /* Empty psymtabs happen as a result of header files which don't have |
c5aa993b JM |
897 | any symbols in them. There can be a lot of them. But this check |
898 | is wrong, in that a psymtab with N_SLINE entries but nothing else | |
899 | is not empty, but we don't realize that. Fixing that without slowing | |
900 | things down might be tricky. */ | |
c906108c SS |
901 | |
902 | discard_psymtab (pst); | |
903 | ||
904 | /* Indicate that psymtab was thrown away. */ | |
c5aa993b | 905 | pst = (struct partial_symtab *) NULL; |
c906108c SS |
906 | } |
907 | return pst; | |
908 | } | |
909 | \f | |
910 | /* Do the dirty work of reading in the full symbol from a partial symbol | |
911 | table. */ | |
912 | ||
913 | static void | |
fba45db2 | 914 | hpread_psymtab_to_symtab_1 (struct partial_symtab *pst) |
c906108c SS |
915 | { |
916 | struct cleanup *old_chain; | |
917 | int i; | |
918 | ||
919 | /* Get out quick if passed junk. */ | |
920 | if (!pst) | |
921 | return; | |
922 | ||
923 | /* Complain if we've already read in this symbol table. */ | |
924 | if (pst->readin) | |
925 | { | |
926 | fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n", | |
927 | pst->filename); | |
928 | return; | |
929 | } | |
930 | ||
931 | /* Read in all partial symtabs on which this one is dependent */ | |
932 | for (i = 0; i < pst->number_of_dependencies; i++) | |
933 | if (!pst->dependencies[i]->readin) | |
934 | { | |
935 | /* Inform about additional files that need to be read in. */ | |
936 | if (info_verbose) | |
937 | { | |
938 | fputs_filtered (" ", gdb_stdout); | |
939 | wrap_here (""); | |
940 | fputs_filtered ("and ", gdb_stdout); | |
941 | wrap_here (""); | |
942 | printf_filtered ("%s...", pst->dependencies[i]->filename); | |
943 | wrap_here (""); /* Flush output */ | |
944 | gdb_flush (gdb_stdout); | |
945 | } | |
946 | hpread_psymtab_to_symtab_1 (pst->dependencies[i]); | |
947 | } | |
948 | ||
949 | /* If it's real... */ | |
950 | if (LDSYMLEN (pst)) | |
951 | { | |
952 | /* Init stuff necessary for reading in symbols */ | |
953 | buildsym_init (); | |
954 | old_chain = make_cleanup (really_free_pendings, 0); | |
955 | ||
956 | pst->symtab = | |
957 | hpread_expand_symtab (pst->objfile, LDSYMOFF (pst), LDSYMLEN (pst), | |
958 | pst->textlow, pst->texthigh - pst->textlow, | |
959 | pst->section_offsets, pst->filename); | |
960 | sort_symtab_syms (pst->symtab); | |
961 | ||
962 | do_cleanups (old_chain); | |
963 | } | |
964 | ||
965 | pst->readin = 1; | |
966 | } | |
967 | ||
968 | /* Read in all of the symbols for a given psymtab for real. | |
969 | Be verbose about it if the user wants that. */ | |
970 | ||
971 | static void | |
fba45db2 | 972 | hpread_psymtab_to_symtab (struct partial_symtab *pst) |
c906108c SS |
973 | { |
974 | /* Get out quick if given junk. */ | |
975 | if (!pst) | |
976 | return; | |
977 | ||
978 | /* Sanity check. */ | |
979 | if (pst->readin) | |
980 | { | |
981 | fprintf (stderr, "Psymtab for %s already read in. Shouldn't happen.\n", | |
982 | pst->filename); | |
983 | return; | |
984 | } | |
985 | ||
986 | if (LDSYMLEN (pst) || pst->number_of_dependencies) | |
987 | { | |
988 | /* Print the message now, before reading the string table, | |
989 | to avoid disconcerting pauses. */ | |
990 | if (info_verbose) | |
991 | { | |
992 | printf_filtered ("Reading in symbols for %s...", pst->filename); | |
993 | gdb_flush (gdb_stdout); | |
994 | } | |
995 | ||
996 | hpread_psymtab_to_symtab_1 (pst); | |
997 | ||
998 | /* Match with global symbols. This only needs to be done once, | |
999 | after all of the symtabs and dependencies have been read in. */ | |
1000 | scan_file_globals (pst->objfile); | |
1001 | ||
1002 | /* Finish up the debug error message. */ | |
1003 | if (info_verbose) | |
1004 | printf_filtered ("done.\n"); | |
1005 | } | |
1006 | } | |
1007 | /* Read in a defined section of a specific object file's symbols. | |
1008 | ||
1009 | DESC is the file descriptor for the file, positioned at the | |
1010 | beginning of the symtab | |
1011 | SYM_OFFSET is the offset within the file of | |
1012 | the beginning of the symbols we want to read | |
1013 | SYM_SIZE is the size of the symbol info to read in. | |
1014 | TEXT_OFFSET is the beginning of the text segment we are reading symbols for | |
1015 | TEXT_SIZE is the size of the text segment read in. | |
1016 | SECTION_OFFSETS are the relocation offsets which get added to each symbol. */ | |
1017 | ||
1018 | static struct symtab * | |
fba45db2 KB |
1019 | hpread_expand_symtab (struct objfile *objfile, int sym_offset, int sym_size, |
1020 | CORE_ADDR text_offset, int text_size, | |
1021 | struct section_offsets *section_offsets, char *filename) | |
c906108c SS |
1022 | { |
1023 | char *namestring; | |
1024 | union dnttentry *dn_bufp; | |
1025 | unsigned max_symnum; | |
1026 | ||
1027 | int sym_index = sym_offset / sizeof (struct dntt_type_block); | |
1028 | ||
1029 | current_objfile = objfile; | |
1030 | subfile_stack = 0; | |
1031 | ||
1032 | last_source_file = 0; | |
1033 | ||
1034 | dn_bufp = hpread_get_lntt (sym_index, objfile); | |
1035 | if (!((dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_SRCFILE) || | |
1036 | (dn_bufp->dblock.kind == (unsigned char) DNTT_TYPE_MODULE))) | |
1037 | { | |
1038 | start_symtab ("globals", NULL, 0); | |
1039 | record_debugformat ("HP"); | |
1040 | } | |
1041 | ||
1042 | max_symnum = sym_size / sizeof (struct dntt_type_block); | |
1043 | ||
1044 | /* Read in and process each debug symbol within the specified range. */ | |
1045 | for (symnum = 0; | |
1046 | symnum < max_symnum; | |
1047 | symnum++) | |
1048 | { | |
1049 | QUIT; /* Allow this to be interruptable */ | |
1050 | dn_bufp = hpread_get_lntt (sym_index + symnum, objfile); | |
1051 | ||
1052 | if (dn_bufp->dblock.extension) | |
1053 | continue; | |
1054 | ||
1055 | /* Yow! We call SET_NAMESTRING on things without names! */ | |
1056 | SET_NAMESTRING (dn_bufp, &namestring, objfile); | |
1057 | ||
1058 | hpread_process_one_debug_symbol (dn_bufp, namestring, section_offsets, | |
1059 | objfile, text_offset, text_size, | |
1060 | filename, symnum + sym_index); | |
1061 | } | |
1062 | ||
1063 | current_objfile = NULL; | |
1064 | ||
44c75fb3 | 1065 | return end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile)); |
c906108c SS |
1066 | } |
1067 | \f | |
1068 | ||
1069 | /* Convert basic types from HP debug format into GDB internal format. */ | |
1070 | ||
1071 | static int | |
fba45db2 | 1072 | hpread_type_translate (dnttpointer typep) |
c906108c SS |
1073 | { |
1074 | if (!typep.dntti.immediate) | |
e1e9e218 | 1075 | internal_error (__FILE__, __LINE__, "failed internal consistency check"); |
c906108c SS |
1076 | |
1077 | switch (typep.dntti.type) | |
1078 | { | |
1079 | case HP_TYPE_BOOLEAN: | |
1080 | case HP_TYPE_BOOLEAN_S300_COMPAT: | |
1081 | case HP_TYPE_BOOLEAN_VAX_COMPAT: | |
1082 | return FT_BOOLEAN; | |
1083 | /* Ugh. No way to distinguish between signed and unsigned chars. */ | |
1084 | case HP_TYPE_CHAR: | |
1085 | case HP_TYPE_WIDE_CHAR: | |
1086 | return FT_CHAR; | |
1087 | case HP_TYPE_INT: | |
1088 | if (typep.dntti.bitlength <= 8) | |
1089 | return FT_CHAR; | |
1090 | if (typep.dntti.bitlength <= 16) | |
1091 | return FT_SHORT; | |
1092 | if (typep.dntti.bitlength <= 32) | |
1093 | return FT_INTEGER; | |
1094 | return FT_LONG_LONG; | |
1095 | case HP_TYPE_LONG: | |
1096 | return FT_LONG; | |
1097 | case HP_TYPE_UNSIGNED_LONG: | |
1098 | if (typep.dntti.bitlength <= 8) | |
1099 | return FT_UNSIGNED_CHAR; | |
1100 | if (typep.dntti.bitlength <= 16) | |
1101 | return FT_UNSIGNED_SHORT; | |
1102 | if (typep.dntti.bitlength <= 32) | |
1103 | return FT_UNSIGNED_LONG; | |
1104 | return FT_UNSIGNED_LONG_LONG; | |
1105 | case HP_TYPE_UNSIGNED_INT: | |
1106 | if (typep.dntti.bitlength <= 8) | |
1107 | return FT_UNSIGNED_CHAR; | |
1108 | if (typep.dntti.bitlength <= 16) | |
1109 | return FT_UNSIGNED_SHORT; | |
1110 | if (typep.dntti.bitlength <= 32) | |
1111 | return FT_UNSIGNED_INTEGER; | |
1112 | return FT_UNSIGNED_LONG_LONG; | |
1113 | case HP_TYPE_REAL: | |
1114 | case HP_TYPE_REAL_3000: | |
1115 | case HP_TYPE_DOUBLE: | |
1116 | if (typep.dntti.bitlength == 64) | |
1117 | return FT_DBL_PREC_FLOAT; | |
1118 | if (typep.dntti.bitlength == 128) | |
1119 | return FT_EXT_PREC_FLOAT; | |
1120 | return FT_FLOAT; | |
1121 | case HP_TYPE_COMPLEX: | |
1122 | case HP_TYPE_COMPLEXS3000: | |
1123 | if (typep.dntti.bitlength == 128) | |
1124 | return FT_DBL_PREC_COMPLEX; | |
1125 | if (typep.dntti.bitlength == 192) | |
1126 | return FT_EXT_PREC_COMPLEX; | |
1127 | return FT_COMPLEX; | |
1128 | case HP_TYPE_STRING200: | |
1129 | case HP_TYPE_LONGSTRING200: | |
1130 | case HP_TYPE_FTN_STRING_SPEC: | |
1131 | case HP_TYPE_MOD_STRING_SPEC: | |
1132 | case HP_TYPE_MOD_STRING_3000: | |
1133 | case HP_TYPE_FTN_STRING_S300_COMPAT: | |
1134 | case HP_TYPE_FTN_STRING_VAX_COMPAT: | |
1135 | return FT_STRING; | |
1136 | default: | |
e1e9e218 | 1137 | internal_error (__FILE__, __LINE__, "failed internal consistency check"); |
c906108c SS |
1138 | } |
1139 | } | |
1140 | ||
1141 | /* Return the type associated with the index found in HP_TYPE. */ | |
1142 | ||
1143 | static struct type ** | |
fba45db2 | 1144 | hpread_lookup_type (dnttpointer hp_type, struct objfile *objfile) |
c906108c SS |
1145 | { |
1146 | unsigned old_len; | |
1147 | int index = hp_type.dnttp.index; | |
1148 | ||
1149 | if (hp_type.dntti.immediate) | |
1150 | return NULL; | |
1151 | ||
1152 | if (index < LNTT_SYMCOUNT (objfile)) | |
1153 | { | |
1154 | if (index >= TYPE_VECTOR_LENGTH (objfile)) | |
1155 | { | |
1156 | old_len = TYPE_VECTOR_LENGTH (objfile); | |
1157 | if (old_len == 0) | |
1158 | { | |
1159 | TYPE_VECTOR_LENGTH (objfile) = 100; | |
1160 | TYPE_VECTOR (objfile) = (struct type **) | |
c5aa993b JM |
1161 | xmmalloc (objfile->md, |
1162 | TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *)); | |
c906108c SS |
1163 | } |
1164 | while (index >= TYPE_VECTOR_LENGTH (objfile)) | |
1165 | TYPE_VECTOR_LENGTH (objfile) *= 2; | |
1166 | TYPE_VECTOR (objfile) = (struct type **) | |
c5aa993b | 1167 | xmrealloc (objfile->md, |
c906108c | 1168 | (char *) TYPE_VECTOR (objfile), |
c5aa993b | 1169 | (TYPE_VECTOR_LENGTH (objfile) * sizeof (struct type *))); |
c906108c SS |
1170 | memset (&TYPE_VECTOR (objfile)[old_len], 0, |
1171 | (TYPE_VECTOR_LENGTH (objfile) - old_len) * | |
1172 | sizeof (struct type *)); | |
1173 | } | |
1174 | return &TYPE_VECTOR (objfile)[index]; | |
1175 | } | |
1176 | else | |
1177 | return NULL; | |
1178 | } | |
1179 | ||
1180 | /* Possibly allocate a GDB internal type so we can internalize HP_TYPE. | |
1181 | Note we'll just return the address of a GDB internal type if we already | |
1182 | have it lying around. */ | |
1183 | ||
1184 | static struct type * | |
fba45db2 | 1185 | hpread_alloc_type (dnttpointer hp_type, struct objfile *objfile) |
c906108c SS |
1186 | { |
1187 | struct type **type_addr; | |
1188 | ||
1189 | type_addr = hpread_lookup_type (hp_type, objfile); | |
1190 | if (*type_addr == 0) | |
1191 | *type_addr = alloc_type (objfile); | |
1192 | ||
1193 | TYPE_CPLUS_SPECIFIC (*type_addr) | |
1194 | = (struct cplus_struct_type *) &cplus_struct_default; | |
1195 | return *type_addr; | |
1196 | } | |
1197 | ||
1198 | /* Read a native enumerated type and return it in GDB internal form. */ | |
1199 | ||
1200 | static struct type * | |
fba45db2 KB |
1201 | hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp, |
1202 | struct objfile *objfile) | |
c906108c SS |
1203 | { |
1204 | struct type *type; | |
1205 | struct pending **symlist, *osyms, *syms; | |
1206 | int o_nsyms, nsyms = 0; | |
1207 | dnttpointer mem; | |
1208 | union dnttentry *memp; | |
1209 | char *name; | |
1210 | long n; | |
1211 | struct symbol *sym; | |
1212 | ||
1213 | type = hpread_alloc_type (hp_type, objfile); | |
1214 | TYPE_LENGTH (type) = 4; | |
1215 | ||
1216 | symlist = &file_symbols; | |
1217 | osyms = *symlist; | |
1218 | o_nsyms = osyms ? osyms->nsyms : 0; | |
1219 | ||
1220 | /* Get a name for each member and add it to our list of members. */ | |
1221 | mem = dn_bufp->denum.firstmem; | |
1222 | while (mem.dnttp.extension && mem.word != DNTTNIL) | |
1223 | { | |
1224 | memp = hpread_get_lntt (mem.dnttp.index, objfile); | |
1225 | ||
1226 | name = VT (objfile) + memp->dmember.name; | |
1227 | sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, | |
1228 | sizeof (struct symbol)); | |
1229 | memset (sym, 0, sizeof (struct symbol)); | |
c5aa993b | 1230 | SYMBOL_NAME (sym) = obsavestring (name, strlen (name), |
c906108c SS |
1231 | &objfile->symbol_obstack); |
1232 | SYMBOL_CLASS (sym) = LOC_CONST; | |
1233 | SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; | |
1234 | SYMBOL_VALUE (sym) = memp->dmember.value; | |
1235 | add_symbol_to_list (sym, symlist); | |
1236 | nsyms++; | |
1237 | mem = memp->dmember.nextmem; | |
1238 | } | |
1239 | ||
1240 | /* Now that we know more about the enum, fill in more info. */ | |
1241 | TYPE_CODE (type) = TYPE_CODE_ENUM; | |
1242 | TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; | |
1243 | TYPE_NFIELDS (type) = nsyms; | |
1244 | TYPE_FIELDS (type) = (struct field *) | |
1245 | obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nsyms); | |
1246 | ||
1247 | /* Find the symbols for the members and put them into the type. | |
1248 | The symbols can be found in the symlist that we put them on | |
1249 | to cause them to be defined. osyms contains the old value | |
1250 | of that symlist; everything up to there was defined by us. | |
1251 | ||
1252 | Note that we preserve the order of the enum constants, so | |
1253 | that in something like "enum {FOO, LAST_THING=FOO}" we print | |
1254 | FOO, not LAST_THING. */ | |
1255 | for (syms = *symlist, n = 0; syms; syms = syms->next) | |
1256 | { | |
1257 | int j = 0; | |
1258 | if (syms == osyms) | |
1259 | j = o_nsyms; | |
1260 | for (; j < syms->nsyms; j++, n++) | |
1261 | { | |
1262 | struct symbol *xsym = syms->symbol[j]; | |
1263 | SYMBOL_TYPE (xsym) = type; | |
1264 | TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym); | |
1265 | TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym); | |
1266 | TYPE_FIELD_BITSIZE (type, n) = 0; | |
1267 | } | |
1268 | if (syms == osyms) | |
1269 | break; | |
1270 | } | |
1271 | ||
1272 | return type; | |
1273 | } | |
1274 | ||
1275 | /* Read and internalize a native function debug symbol. */ | |
1276 | ||
1277 | static struct type * | |
fba45db2 KB |
1278 | hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp, |
1279 | struct objfile *objfile) | |
c906108c SS |
1280 | { |
1281 | struct type *type, *type1; | |
1282 | struct pending **symlist, *osyms, *syms; | |
1283 | int o_nsyms, nsyms = 0; | |
1284 | dnttpointer param; | |
1285 | union dnttentry *paramp; | |
1286 | char *name; | |
1287 | long n; | |
1288 | struct symbol *sym; | |
1289 | ||
1290 | param = dn_bufp->dfunc.firstparam; | |
1291 | ||
1292 | /* See if we've already read in this type. */ | |
1293 | type = hpread_alloc_type (hp_type, objfile); | |
1294 | if (TYPE_CODE (type) == TYPE_CODE_FUNC) | |
1295 | return type; | |
1296 | ||
1297 | /* Nope, so read it in and store it away. */ | |
1298 | type1 = lookup_function_type (hpread_type_lookup (dn_bufp->dfunc.retval, | |
1299 | objfile)); | |
1300 | memcpy ((char *) type, (char *) type1, sizeof (struct type)); | |
1301 | ||
1302 | symlist = &local_symbols; | |
1303 | osyms = *symlist; | |
1304 | o_nsyms = osyms ? osyms->nsyms : 0; | |
1305 | ||
1306 | /* Now examine each parameter noting its type, location, and a | |
1307 | wealth of other information. */ | |
1308 | while (param.word && param.word != DNTTNIL) | |
1309 | { | |
1310 | paramp = hpread_get_lntt (param.dnttp.index, objfile); | |
1311 | nsyms++; | |
1312 | param = paramp->dfparam.nextparam; | |
1313 | ||
1314 | /* Get the name. */ | |
1315 | name = VT (objfile) + paramp->dfparam.name; | |
1316 | sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, | |
1317 | sizeof (struct symbol)); | |
1318 | (void) memset (sym, 0, sizeof (struct symbol)); | |
1319 | SYMBOL_NAME (sym) = obsavestring (name, strlen (name), | |
1320 | &objfile->symbol_obstack); | |
1321 | ||
1322 | /* Figure out where it lives. */ | |
1323 | if (paramp->dfparam.regparam) | |
1324 | SYMBOL_CLASS (sym) = LOC_REGPARM; | |
1325 | else if (paramp->dfparam.indirect) | |
1326 | SYMBOL_CLASS (sym) = LOC_REF_ARG; | |
1327 | else | |
1328 | SYMBOL_CLASS (sym) = LOC_ARG; | |
1329 | SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; | |
1330 | if (paramp->dfparam.copyparam) | |
1331 | { | |
c5aa993b | 1332 | SYMBOL_VALUE (sym) = paramp->dfparam.location; |
c906108c SS |
1333 | #ifdef HPREAD_ADJUST_STACK_ADDRESS |
1334 | SYMBOL_VALUE (sym) | |
1335 | += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile)); | |
1336 | #endif | |
1337 | /* This is likely a pass-by-invisible reference parameter, | |
1338 | Hack on the symbol class to make GDB happy. */ | |
1339 | SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR; | |
1340 | } | |
1341 | else | |
1342 | SYMBOL_VALUE (sym) = paramp->dfparam.location; | |
1343 | ||
1344 | /* Get its type. */ | |
1345 | SYMBOL_TYPE (sym) = hpread_type_lookup (paramp->dfparam.type, objfile); | |
1346 | ||
1347 | /* Add it to the list. */ | |
1348 | add_symbol_to_list (sym, symlist); | |
1349 | } | |
1350 | ||
1351 | /* Note how many parameters we found. */ | |
1352 | TYPE_NFIELDS (type) = nsyms; | |
1353 | TYPE_FIELDS (type) = (struct field *) | |
1354 | obstack_alloc (&objfile->type_obstack, | |
1355 | sizeof (struct field) * nsyms); | |
1356 | ||
1357 | /* Find the symbols for the values and put them into the type. | |
1358 | The symbols can be found in the symlist that we put them on | |
1359 | to cause them to be defined. osyms contains the old value | |
1360 | of that symlist; everything up to there was defined by us. */ | |
1361 | /* Note that we preserve the order of the parameters, so | |
1362 | that in something like "enum {FOO, LAST_THING=FOO}" we print | |
1363 | FOO, not LAST_THING. */ | |
1364 | for (syms = *symlist, n = 0; syms; syms = syms->next) | |
1365 | { | |
1366 | int j = 0; | |
1367 | if (syms == osyms) | |
1368 | j = o_nsyms; | |
1369 | for (; j < syms->nsyms; j++, n++) | |
1370 | { | |
1371 | struct symbol *xsym = syms->symbol[j]; | |
1372 | TYPE_FIELD_NAME (type, n) = SYMBOL_NAME (xsym); | |
1373 | TYPE_FIELD_TYPE (type, n) = SYMBOL_TYPE (xsym); | |
8176bb6d | 1374 | TYPE_FIELD_ARTIFICIAL (type, n) = 0; |
c906108c SS |
1375 | TYPE_FIELD_BITSIZE (type, n) = 0; |
1376 | } | |
1377 | if (syms == osyms) | |
1378 | break; | |
1379 | } | |
1380 | return type; | |
1381 | } | |
1382 | ||
1383 | /* Read in and internalize a structure definition. */ | |
1384 | ||
1385 | static struct type * | |
fba45db2 KB |
1386 | hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, |
1387 | struct objfile *objfile) | |
c906108c SS |
1388 | { |
1389 | struct nextfield | |
1390 | { | |
1391 | struct nextfield *next; | |
1392 | struct field field; | |
1393 | }; | |
1394 | ||
1395 | struct type *type; | |
1396 | struct nextfield *list = 0; | |
1397 | struct nextfield *new; | |
1398 | int n, nfields = 0; | |
1399 | dnttpointer field; | |
1400 | union dnttentry *fieldp; | |
1401 | ||
1402 | /* Is it something we've already dealt with? */ | |
1403 | type = hpread_alloc_type (hp_type, objfile); | |
1404 | if ((TYPE_CODE (type) == TYPE_CODE_STRUCT) || | |
1405 | (TYPE_CODE (type) == TYPE_CODE_UNION)) | |
c5aa993b | 1406 | return type; |
c906108c SS |
1407 | |
1408 | /* Get the basic type correct. */ | |
1409 | if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT) | |
1410 | { | |
1411 | TYPE_CODE (type) = TYPE_CODE_STRUCT; | |
1412 | TYPE_LENGTH (type) = dn_bufp->dstruct.bitlength / 8; | |
1413 | } | |
1414 | else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION) | |
1415 | { | |
1416 | TYPE_CODE (type) = TYPE_CODE_UNION; | |
1417 | TYPE_LENGTH (type) = dn_bufp->dunion.bitlength / 8; | |
1418 | } | |
1419 | else | |
1420 | return type; | |
1421 | ||
1422 | ||
1423 | TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; | |
1424 | ||
1425 | /* Read in and internalize all the fields. */ | |
1426 | field = dn_bufp->dstruct.firstfield; | |
1427 | while (field.word != DNTTNIL && field.dnttp.extension) | |
1428 | { | |
1429 | fieldp = hpread_get_lntt (field.dnttp.index, objfile); | |
1430 | ||
1431 | /* Get space to record the next field's data. */ | |
1432 | new = (struct nextfield *) alloca (sizeof (struct nextfield)); | |
1433 | new->next = list; | |
1434 | list = new; | |
1435 | ||
1436 | list->field.name = VT (objfile) + fieldp->dfield.name; | |
1437 | FIELD_BITPOS (list->field) = fieldp->dfield.bitoffset; | |
1438 | if (fieldp->dfield.bitlength % 8) | |
1439 | FIELD_BITSIZE (list->field) = fieldp->dfield.bitlength; | |
1440 | else | |
1441 | FIELD_BITSIZE (list->field) = 0; | |
1442 | nfields++; | |
1443 | field = fieldp->dfield.nextfield; | |
1444 | FIELD_TYPE (list->field) = hpread_type_lookup (fieldp->dfield.type, | |
1445 | objfile); | |
1446 | } | |
1447 | ||
1448 | TYPE_NFIELDS (type) = nfields; | |
1449 | TYPE_FIELDS (type) = (struct field *) | |
1450 | obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields); | |
1451 | ||
1452 | /* Copy the saved-up fields into the field vector. */ | |
1453 | for (n = nfields; list; list = list->next) | |
1454 | { | |
1455 | n -= 1; | |
1456 | TYPE_FIELD (type, n) = list->field; | |
1457 | } | |
1458 | return type; | |
1459 | } | |
1460 | ||
1461 | /* Read in and internalize a set debug symbol. */ | |
1462 | ||
1463 | static struct type * | |
fba45db2 KB |
1464 | hpread_read_set_type (dnttpointer hp_type, union dnttentry *dn_bufp, |
1465 | struct objfile *objfile) | |
c906108c SS |
1466 | { |
1467 | struct type *type; | |
1468 | ||
1469 | /* See if it's something we've already deal with. */ | |
1470 | type = hpread_alloc_type (hp_type, objfile); | |
1471 | if (TYPE_CODE (type) == TYPE_CODE_SET) | |
1472 | return type; | |
1473 | ||
1474 | /* Nope. Fill in the appropriate fields. */ | |
1475 | TYPE_CODE (type) = TYPE_CODE_SET; | |
1476 | TYPE_LENGTH (type) = dn_bufp->dset.bitlength / 8; | |
1477 | TYPE_NFIELDS (type) = 0; | |
1478 | TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dset.subtype, | |
1479 | objfile); | |
1480 | return type; | |
1481 | } | |
1482 | ||
1483 | /* Read in and internalize an array debug symbol. */ | |
1484 | ||
1485 | static struct type * | |
fba45db2 KB |
1486 | hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp, |
1487 | struct objfile *objfile) | |
c906108c SS |
1488 | { |
1489 | struct type *type; | |
1490 | union dnttentry save; | |
1491 | save = *dn_bufp; | |
1492 | ||
1493 | /* Why no check here? Because it kept us from properly determining | |
1494 | the size of the array! */ | |
1495 | type = hpread_alloc_type (hp_type, objfile); | |
1496 | ||
1497 | TYPE_CODE (type) = TYPE_CODE_ARRAY; | |
1498 | ||
1499 | /* values are not normalized. */ | |
1500 | if (!((dn_bufp->darray.arrayisbytes && dn_bufp->darray.elemisbytes) | |
1501 | || (!dn_bufp->darray.arrayisbytes && !dn_bufp->darray.elemisbytes))) | |
e1e9e218 | 1502 | internal_error (__FILE__, __LINE__, "failed internal consistency check"); |
c906108c SS |
1503 | else if (dn_bufp->darray.arraylength == 0x7fffffff) |
1504 | { | |
1505 | /* The HP debug format represents char foo[]; as an array with | |
c5aa993b JM |
1506 | length 0x7fffffff. Internally GDB wants to represent this |
1507 | as an array of length zero. */ | |
1508 | TYPE_LENGTH (type) = 0; | |
c906108c SS |
1509 | } |
1510 | else | |
1511 | TYPE_LENGTH (type) = dn_bufp->darray.arraylength / 8; | |
1512 | ||
1513 | TYPE_NFIELDS (type) = 1; | |
1514 | TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->darray.elemtype, | |
1515 | objfile); | |
1516 | dn_bufp = &save; | |
1517 | TYPE_FIELDS (type) = (struct field *) | |
1518 | obstack_alloc (&objfile->type_obstack, sizeof (struct field)); | |
1519 | TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype, | |
1520 | objfile); | |
1521 | return type; | |
1522 | } | |
1523 | ||
1524 | /* Read in and internalize a subrange debug symbol. */ | |
1525 | static struct type * | |
fba45db2 KB |
1526 | hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp, |
1527 | struct objfile *objfile) | |
c906108c SS |
1528 | { |
1529 | struct type *type; | |
1530 | ||
1531 | /* Is it something we've already dealt with. */ | |
1532 | type = hpread_alloc_type (hp_type, objfile); | |
1533 | if (TYPE_CODE (type) == TYPE_CODE_RANGE) | |
1534 | return type; | |
1535 | ||
1536 | /* Nope, internalize it. */ | |
1537 | TYPE_CODE (type) = TYPE_CODE_RANGE; | |
1538 | TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8; | |
1539 | TYPE_NFIELDS (type) = 2; | |
1540 | TYPE_FIELDS (type) | |
1541 | = (struct field *) obstack_alloc (&objfile->type_obstack, | |
1542 | 2 * sizeof (struct field)); | |
1543 | ||
1544 | if (dn_bufp->dsubr.dyn_low) | |
1545 | TYPE_FIELD_BITPOS (type, 0) = 0; | |
1546 | else | |
1547 | TYPE_FIELD_BITPOS (type, 0) = dn_bufp->dsubr.lowbound; | |
1548 | ||
1549 | if (dn_bufp->dsubr.dyn_high) | |
1550 | TYPE_FIELD_BITPOS (type, 1) = -1; | |
1551 | else | |
1552 | TYPE_FIELD_BITPOS (type, 1) = dn_bufp->dsubr.highbound; | |
1553 | TYPE_TARGET_TYPE (type) = hpread_type_lookup (dn_bufp->dsubr.subtype, | |
1554 | objfile); | |
1555 | return type; | |
1556 | } | |
1557 | ||
1558 | static struct type * | |
fba45db2 | 1559 | hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) |
c906108c SS |
1560 | { |
1561 | union dnttentry *dn_bufp; | |
1562 | ||
1563 | /* First see if it's a simple builtin type. */ | |
1564 | if (hp_type.dntti.immediate) | |
1565 | return lookup_fundamental_type (objfile, hpread_type_translate (hp_type)); | |
1566 | ||
1567 | /* Not a builtin type. We'll have to read it in. */ | |
1568 | if (hp_type.dnttp.index < LNTT_SYMCOUNT (objfile)) | |
1569 | dn_bufp = hpread_get_lntt (hp_type.dnttp.index, objfile); | |
1570 | else | |
1571 | return lookup_fundamental_type (objfile, FT_VOID); | |
1572 | ||
1573 | switch (dn_bufp->dblock.kind) | |
1574 | { | |
1575 | case DNTT_TYPE_SRCFILE: | |
1576 | case DNTT_TYPE_MODULE: | |
1577 | case DNTT_TYPE_FUNCTION: | |
1578 | case DNTT_TYPE_ENTRY: | |
1579 | case DNTT_TYPE_BEGIN: | |
1580 | case DNTT_TYPE_END: | |
1581 | case DNTT_TYPE_IMPORT: | |
1582 | case DNTT_TYPE_LABEL: | |
1583 | case DNTT_TYPE_WITH: | |
1584 | case DNTT_TYPE_COMMON: | |
1585 | case DNTT_TYPE_FPARAM: | |
1586 | case DNTT_TYPE_SVAR: | |
1587 | case DNTT_TYPE_DVAR: | |
1588 | case DNTT_TYPE_CONST: | |
1589 | /* Opps. Something went very wrong. */ | |
1590 | return lookup_fundamental_type (objfile, FT_VOID); | |
1591 | ||
1592 | case DNTT_TYPE_TYPEDEF: | |
1593 | { | |
1594 | struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type, | |
1595 | objfile); | |
1596 | char *suffix; | |
1597 | suffix = VT (objfile) + dn_bufp->dtype.name; | |
1598 | ||
1599 | TYPE_CPLUS_SPECIFIC (structtype) | |
1600 | = (struct cplus_struct_type *) &cplus_struct_default; | |
c5aa993b | 1601 | TYPE_NAME (structtype) = suffix; |
c906108c SS |
1602 | return structtype; |
1603 | } | |
1604 | ||
1605 | case DNTT_TYPE_TAGDEF: | |
1606 | { | |
1607 | /* Just a little different from above. We have to tack on | |
1608 | an identifier of some kind (struct, union, enum, etc). */ | |
1609 | struct type *structtype = hpread_type_lookup (dn_bufp->dtype.type, | |
1610 | objfile); | |
1611 | char *prefix, *suffix; | |
1612 | suffix = VT (objfile) + dn_bufp->dtype.name; | |
1613 | ||
1614 | /* Lookup the next type in the list. It should be a structure, | |
1615 | union, or enum type. We will need to attach that to our name. */ | |
1616 | if (dn_bufp->dtype.type.dnttp.index < LNTT_SYMCOUNT (objfile)) | |
1617 | dn_bufp = hpread_get_lntt (dn_bufp->dtype.type.dnttp.index, objfile); | |
1618 | else | |
e1e9e218 | 1619 | internal_error (__FILE__, __LINE__, "failed internal consistency check"); |
c906108c SS |
1620 | |
1621 | if (dn_bufp->dblock.kind == DNTT_TYPE_STRUCT) | |
1622 | prefix = "struct "; | |
1623 | else if (dn_bufp->dblock.kind == DNTT_TYPE_UNION) | |
1624 | prefix = "union "; | |
1625 | else | |
1626 | prefix = "enum "; | |
1627 | ||
1628 | /* Build the correct name. */ | |
1629 | structtype->name | |
1630 | = (char *) obstack_alloc (&objfile->type_obstack, | |
1631 | strlen (prefix) + strlen (suffix) + 1); | |
1632 | TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix); | |
1633 | TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix); | |
1634 | TYPE_TAG_NAME (structtype) = suffix; | |
1635 | ||
1636 | TYPE_CPLUS_SPECIFIC (structtype) | |
1637 | = (struct cplus_struct_type *) &cplus_struct_default; | |
1638 | ||
1639 | return structtype; | |
1640 | } | |
1641 | case DNTT_TYPE_POINTER: | |
1642 | return lookup_pointer_type (hpread_type_lookup (dn_bufp->dptr.pointsto, | |
1643 | objfile)); | |
1644 | case DNTT_TYPE_ENUM: | |
1645 | return hpread_read_enum_type (hp_type, dn_bufp, objfile); | |
1646 | case DNTT_TYPE_MEMENUM: | |
1647 | return lookup_fundamental_type (objfile, FT_VOID); | |
1648 | case DNTT_TYPE_SET: | |
1649 | return hpread_read_set_type (hp_type, dn_bufp, objfile); | |
1650 | case DNTT_TYPE_SUBRANGE: | |
1651 | return hpread_read_subrange_type (hp_type, dn_bufp, objfile); | |
1652 | case DNTT_TYPE_ARRAY: | |
1653 | return hpread_read_array_type (hp_type, dn_bufp, objfile); | |
1654 | case DNTT_TYPE_STRUCT: | |
1655 | case DNTT_TYPE_UNION: | |
1656 | return hpread_read_struct_type (hp_type, dn_bufp, objfile); | |
1657 | case DNTT_TYPE_FIELD: | |
1658 | return hpread_type_lookup (dn_bufp->dfield.type, objfile); | |
1659 | case DNTT_TYPE_VARIANT: | |
1660 | case DNTT_TYPE_FILE: | |
1661 | return lookup_fundamental_type (objfile, FT_VOID); | |
1662 | case DNTT_TYPE_FUNCTYPE: | |
1663 | return lookup_function_type (hpread_type_lookup (dn_bufp->dfunctype.retval, | |
1664 | objfile)); | |
1665 | case DNTT_TYPE_COBSTRUCT: | |
1666 | case DNTT_TYPE_XREF: | |
1667 | case DNTT_TYPE_SA: | |
1668 | case DNTT_TYPE_MACRO: | |
1669 | default: | |
1670 | return lookup_fundamental_type (objfile, FT_VOID); | |
1671 | } | |
1672 | } | |
1673 | ||
1674 | static sltpointer | |
fba45db2 KB |
1675 | hpread_record_lines (struct subfile *subfile, sltpointer s_idx, |
1676 | sltpointer e_idx, struct objfile *objfile, | |
1677 | CORE_ADDR offset) | |
c906108c SS |
1678 | { |
1679 | union sltentry *sl_bufp; | |
1680 | ||
1681 | while (s_idx <= e_idx) | |
1682 | { | |
1683 | sl_bufp = hpread_get_slt (s_idx, objfile); | |
1684 | /* Only record "normal" entries in the SLT. */ | |
1685 | if (sl_bufp->snorm.sltdesc == SLT_NORMAL | |
1686 | || sl_bufp->snorm.sltdesc == SLT_EXIT) | |
1687 | record_line (subfile, sl_bufp->snorm.line, | |
1688 | sl_bufp->snorm.address + offset); | |
1689 | s_idx++; | |
1690 | } | |
1691 | return e_idx; | |
1692 | } | |
1693 | ||
1694 | /* Internalize one native debug symbol. */ | |
1695 | ||
1696 | static void | |
fba45db2 KB |
1697 | hpread_process_one_debug_symbol (union dnttentry *dn_bufp, char *name, |
1698 | struct section_offsets *section_offsets, | |
1699 | struct objfile *objfile, CORE_ADDR text_offset, | |
1700 | int text_size, char *filename, int index) | |
c906108c SS |
1701 | { |
1702 | unsigned long desc; | |
1703 | int type; | |
1704 | CORE_ADDR valu; | |
b8fbeb18 | 1705 | int offset = ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile)); |
c906108c SS |
1706 | union dnttentry *dn_temp; |
1707 | dnttpointer hp_type; | |
1708 | struct symbol *sym; | |
1709 | struct context_stack *new; | |
1710 | ||
1711 | /* Allocate one GDB debug symbol and fill in some default values. */ | |
1712 | sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack, | |
1713 | sizeof (struct symbol)); | |
1714 | memset (sym, 0, sizeof (struct symbol)); | |
1715 | SYMBOL_NAME (sym) = obsavestring (name, strlen (name), &objfile->symbol_obstack); | |
1716 | SYMBOL_LANGUAGE (sym) = language_auto; | |
1717 | SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile->symbol_obstack); | |
1718 | SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; | |
1719 | SYMBOL_LINE (sym) = 0; | |
1720 | SYMBOL_VALUE (sym) = 0; | |
1721 | SYMBOL_CLASS (sym) = LOC_TYPEDEF; | |
1722 | ||
1723 | hp_type.dnttp.extension = 1; | |
1724 | hp_type.dnttp.immediate = 0; | |
1725 | hp_type.dnttp.global = 0; | |
1726 | hp_type.dnttp.index = index; | |
1727 | ||
1728 | type = dn_bufp->dblock.kind; | |
1729 | ||
1730 | switch (type) | |
1731 | { | |
1732 | case DNTT_TYPE_SRCFILE: | |
1733 | /* This type of symbol indicates from which source file or include file | |
1734 | the following data comes. If there are no modules it also may | |
1735 | indicate the start of a new source file, in which case we must | |
1736 | finish the symbol table of the previous source file | |
1737 | (if any) and start accumulating a new symbol table. */ | |
1738 | ||
1739 | valu = text_offset; | |
1740 | if (!last_source_file) | |
1741 | { | |
1742 | start_symtab (name, NULL, valu); | |
1743 | record_debugformat ("HP"); | |
1744 | SL_INDEX (objfile) = dn_bufp->dsfile.address; | |
1745 | } | |
1746 | else | |
1747 | { | |
1748 | SL_INDEX (objfile) = hpread_record_lines (current_subfile, | |
1749 | SL_INDEX (objfile), | |
1750 | dn_bufp->dsfile.address, | |
1751 | objfile, offset); | |
1752 | } | |
1753 | start_subfile (name, NULL); | |
1754 | break; | |
c5aa993b | 1755 | |
c906108c SS |
1756 | case DNTT_TYPE_MODULE: |
1757 | /* No need to do anything with these DNTT_TYPE_MODULE symbols anymore. */ | |
1758 | break; | |
1759 | ||
1760 | case DNTT_TYPE_FUNCTION: | |
1761 | case DNTT_TYPE_ENTRY: | |
1762 | /* A function or secondary entry point. */ | |
1763 | valu = dn_bufp->dfunc.lowaddr + offset; | |
1764 | SL_INDEX (objfile) = hpread_record_lines (current_subfile, | |
1765 | SL_INDEX (objfile), | |
1766 | dn_bufp->dfunc.address, | |
1767 | objfile, offset); | |
c5aa993b | 1768 | |
c906108c SS |
1769 | WITHIN_FUNCTION (objfile) = 1; |
1770 | CURRENT_FUNCTION_VALUE (objfile) = valu; | |
1771 | ||
1772 | /* Stack must be empty now. */ | |
1773 | if (context_stack_depth != 0) | |
1774 | complain (&lbrac_unmatched_complaint, (char *) symnum); | |
1775 | new = push_context (0, valu); | |
1776 | ||
1777 | SYMBOL_CLASS (sym) = LOC_BLOCK; | |
1778 | SYMBOL_TYPE (sym) = hpread_read_function_type (hp_type, dn_bufp, objfile); | |
1779 | if (dn_bufp->dfunc.global) | |
1780 | add_symbol_to_list (sym, &global_symbols); | |
1781 | else | |
1782 | add_symbol_to_list (sym, &file_symbols); | |
1783 | new->name = sym; | |
1784 | ||
1785 | /* Search forward to the next scope beginning. */ | |
1786 | while (dn_bufp->dblock.kind != DNTT_TYPE_BEGIN) | |
1787 | { | |
1788 | dn_bufp = hpread_get_lntt (++index, objfile); | |
1789 | if (dn_bufp->dblock.extension) | |
1790 | continue; | |
1791 | } | |
1792 | SL_INDEX (objfile) = hpread_record_lines (current_subfile, | |
1793 | SL_INDEX (objfile), | |
1794 | dn_bufp->dbegin.address, | |
1795 | objfile, offset); | |
1796 | SYMBOL_LINE (sym) = hpread_get_line (dn_bufp->dbegin.address, objfile); | |
1797 | record_line (current_subfile, SYMBOL_LINE (sym), valu); | |
1798 | break; | |
1799 | ||
1800 | case DNTT_TYPE_BEGIN: | |
1801 | /* Begin a new scope. */ | |
1802 | SL_INDEX (objfile) = hpread_record_lines (current_subfile, | |
1803 | SL_INDEX (objfile), | |
1804 | dn_bufp->dbegin.address, | |
1805 | objfile, offset); | |
1806 | valu = hpread_get_location (dn_bufp->dbegin.address, objfile); | |
1807 | valu += offset; /* Relocate for dynamic loading */ | |
1808 | desc = hpread_get_depth (dn_bufp->dbegin.address, objfile); | |
1809 | new = push_context (desc, valu); | |
1810 | break; | |
1811 | ||
1812 | case DNTT_TYPE_END: | |
1813 | /* End a scope. */ | |
1814 | SL_INDEX (objfile) = hpread_record_lines (current_subfile, | |
1815 | SL_INDEX (objfile), | |
1816 | dn_bufp->dend.address + 1, | |
1817 | objfile, offset); | |
1818 | switch (dn_bufp->dend.endkind) | |
1819 | { | |
1820 | case DNTT_TYPE_MODULE: | |
1821 | /* Ending a module ends the symbol table for that module. */ | |
1822 | valu = text_offset + text_size + offset; | |
44c75fb3 | 1823 | (void) end_symtab (valu, objfile, SECT_OFF_TEXT (objfile)); |
c906108c SS |
1824 | break; |
1825 | ||
1826 | case DNTT_TYPE_FUNCTION: | |
1827 | /* Ending a function, well, ends the function's scope. */ | |
1828 | dn_temp = hpread_get_lntt (dn_bufp->dend.beginscope.dnttp.index, | |
1829 | objfile); | |
1830 | valu = dn_temp->dfunc.hiaddr + offset; | |
1831 | new = pop_context (); | |
1832 | /* Make a block for the local symbols within. */ | |
1833 | finish_block (new->name, &local_symbols, new->old_blocks, | |
1834 | new->start_addr, valu, objfile); | |
1835 | WITHIN_FUNCTION (objfile) = 0; | |
1836 | break; | |
1837 | case DNTT_TYPE_BEGIN: | |
1838 | /* Just ending a local scope. */ | |
1839 | valu = hpread_get_location (dn_bufp->dend.address, objfile); | |
1840 | /* Why in the hell is this needed? */ | |
1841 | valu += offset + 9; /* Relocate for dynamic loading */ | |
1842 | new = pop_context (); | |
1843 | desc = dn_bufp->dend.beginscope.dnttp.index; | |
1844 | if (desc != new->depth) | |
1845 | complain (&lbrac_mismatch_complaint, (char *) symnum); | |
1846 | /* Make a block for the local symbols within. */ | |
1847 | finish_block (new->name, &local_symbols, new->old_blocks, | |
1848 | new->start_addr, valu, objfile); | |
1849 | local_symbols = new->locals; | |
1850 | break; | |
1851 | } | |
1852 | break; | |
1853 | case DNTT_TYPE_LABEL: | |
1854 | SYMBOL_NAMESPACE (sym) = LABEL_NAMESPACE; | |
1855 | break; | |
1856 | case DNTT_TYPE_FPARAM: | |
1857 | /* Function parameters. */ | |
1858 | if (dn_bufp->dfparam.regparam) | |
1859 | SYMBOL_CLASS (sym) = LOC_REGISTER; | |
1860 | else | |
1861 | SYMBOL_CLASS (sym) = LOC_LOCAL; | |
1862 | if (dn_bufp->dfparam.copyparam) | |
1863 | { | |
1864 | SYMBOL_VALUE (sym) = dn_bufp->dfparam.location; | |
1865 | #ifdef HPREAD_ADJUST_STACK_ADDRESS | |
1866 | SYMBOL_VALUE (sym) | |
1867 | += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile)); | |
1868 | #endif | |
1869 | } | |
1870 | else | |
1871 | SYMBOL_VALUE (sym) = dn_bufp->dfparam.location; | |
1872 | SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dfparam.type, objfile); | |
1873 | add_symbol_to_list (sym, &local_symbols); | |
1874 | break; | |
1875 | case DNTT_TYPE_SVAR: | |
1876 | /* Static variables. */ | |
1877 | SYMBOL_CLASS (sym) = LOC_STATIC; | |
1878 | SYMBOL_VALUE_ADDRESS (sym) = dn_bufp->dsvar.location; | |
1879 | SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dsvar.type, objfile); | |
1880 | if (dn_bufp->dsvar.global) | |
1881 | add_symbol_to_list (sym, &global_symbols); | |
1882 | else if (WITHIN_FUNCTION (objfile)) | |
1883 | add_symbol_to_list (sym, &local_symbols); | |
1884 | else | |
1885 | add_symbol_to_list (sym, &file_symbols); | |
1886 | break; | |
1887 | case DNTT_TYPE_DVAR: | |
1888 | /* Dynamic variables. */ | |
1889 | if (dn_bufp->ddvar.regvar) | |
1890 | SYMBOL_CLASS (sym) = LOC_REGISTER; | |
1891 | else | |
1892 | SYMBOL_CLASS (sym) = LOC_LOCAL; | |
1893 | SYMBOL_VALUE (sym) = dn_bufp->ddvar.location; | |
1894 | #ifdef HPREAD_ADJUST_STACK_ADDRESS | |
1895 | SYMBOL_VALUE (sym) | |
1896 | += HPREAD_ADJUST_STACK_ADDRESS (CURRENT_FUNCTION_VALUE (objfile)); | |
1897 | #endif | |
1898 | SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->ddvar.type, objfile); | |
1899 | if (dn_bufp->ddvar.global) | |
1900 | add_symbol_to_list (sym, &global_symbols); | |
1901 | else if (WITHIN_FUNCTION (objfile)) | |
1902 | add_symbol_to_list (sym, &local_symbols); | |
1903 | else | |
1904 | add_symbol_to_list (sym, &file_symbols); | |
1905 | break; | |
1906 | case DNTT_TYPE_CONST: | |
1907 | /* A constant (pascal?). */ | |
1908 | SYMBOL_CLASS (sym) = LOC_CONST; | |
1909 | SYMBOL_VALUE (sym) = dn_bufp->dconst.location; | |
1910 | SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dconst.type, objfile); | |
1911 | if (dn_bufp->dconst.global) | |
1912 | add_symbol_to_list (sym, &global_symbols); | |
1913 | else if (WITHIN_FUNCTION (objfile)) | |
1914 | add_symbol_to_list (sym, &local_symbols); | |
1915 | else | |
1916 | add_symbol_to_list (sym, &file_symbols); | |
1917 | break; | |
1918 | case DNTT_TYPE_TYPEDEF: | |
1919 | SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE; | |
1920 | SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile); | |
1921 | if (dn_bufp->dtype.global) | |
1922 | add_symbol_to_list (sym, &global_symbols); | |
1923 | else if (WITHIN_FUNCTION (objfile)) | |
1924 | add_symbol_to_list (sym, &local_symbols); | |
1925 | else | |
1926 | add_symbol_to_list (sym, &file_symbols); | |
1927 | break; | |
1928 | case DNTT_TYPE_TAGDEF: | |
1929 | SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE; | |
1930 | SYMBOL_TYPE (sym) = hpread_type_lookup (dn_bufp->dtype.type, objfile); | |
1931 | TYPE_NAME (sym->type) = SYMBOL_NAME (sym); | |
1932 | TYPE_TAG_NAME (sym->type) = SYMBOL_NAME (sym); | |
1933 | if (dn_bufp->dtype.global) | |
1934 | add_symbol_to_list (sym, &global_symbols); | |
1935 | else if (WITHIN_FUNCTION (objfile)) | |
1936 | add_symbol_to_list (sym, &local_symbols); | |
1937 | else | |
1938 | add_symbol_to_list (sym, &file_symbols); | |
1939 | break; | |
1940 | case DNTT_TYPE_POINTER: | |
1941 | SYMBOL_TYPE (sym) = lookup_pointer_type (hpread_type_lookup | |
1942 | (dn_bufp->dptr.pointsto, | |
1943 | objfile)); | |
1944 | add_symbol_to_list (sym, &file_symbols); | |
1945 | break; | |
1946 | case DNTT_TYPE_ENUM: | |
1947 | SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE; | |
1948 | SYMBOL_TYPE (sym) = hpread_read_enum_type (hp_type, dn_bufp, objfile); | |
1949 | add_symbol_to_list (sym, &file_symbols); | |
1950 | break; | |
1951 | case DNTT_TYPE_MEMENUM: | |
1952 | break; | |
1953 | case DNTT_TYPE_SET: | |
1954 | SYMBOL_TYPE (sym) = hpread_read_set_type (hp_type, dn_bufp, objfile); | |
1955 | add_symbol_to_list (sym, &file_symbols); | |
1956 | break; | |
1957 | case DNTT_TYPE_SUBRANGE: | |
1958 | SYMBOL_TYPE (sym) = hpread_read_subrange_type (hp_type, dn_bufp, | |
1959 | objfile); | |
1960 | add_symbol_to_list (sym, &file_symbols); | |
1961 | break; | |
1962 | case DNTT_TYPE_ARRAY: | |
1963 | SYMBOL_TYPE (sym) = hpread_read_array_type (hp_type, dn_bufp, objfile); | |
1964 | add_symbol_to_list (sym, &file_symbols); | |
1965 | break; | |
1966 | case DNTT_TYPE_STRUCT: | |
1967 | case DNTT_TYPE_UNION: | |
1968 | SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE; | |
1969 | SYMBOL_TYPE (sym) = hpread_read_struct_type (hp_type, dn_bufp, objfile); | |
1970 | add_symbol_to_list (sym, &file_symbols); | |
1971 | break; | |
1972 | default: | |
1973 | break; | |
1974 | } | |
1975 | } |