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