1 // OBSOLETE /* Read apollo DST symbol tables and convert to internal format, for GDB.
2 // OBSOLETE Contributed by Troy Rollo, University of NSW (troy@cbme.unsw.edu.au).
3 // OBSOLETE Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
4 // OBSOLETE Free Software Foundation, Inc.
6 // OBSOLETE This file is part of GDB.
8 // OBSOLETE This program is free software; you can redistribute it and/or modify
9 // OBSOLETE it under the terms of the GNU General Public License as published by
10 // OBSOLETE the Free Software Foundation; either version 2 of the License, or
11 // OBSOLETE (at your option) any later version.
13 // OBSOLETE This program is distributed in the hope that it will be useful,
14 // OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // OBSOLETE GNU General Public License for more details.
18 // OBSOLETE You should have received a copy of the GNU General Public License
19 // OBSOLETE along with this program; if not, write to the Free Software
20 // OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330,
21 // OBSOLETE Boston, MA 02111-1307, USA. */
23 // OBSOLETE #include "defs.h"
24 // OBSOLETE #include "symtab.h"
25 // OBSOLETE #include "gdbtypes.h"
26 // OBSOLETE #include "breakpoint.h"
27 // OBSOLETE #include "bfd.h"
28 // OBSOLETE #include "symfile.h"
29 // OBSOLETE #include "objfiles.h"
30 // OBSOLETE #include "buildsym.h"
31 // OBSOLETE #include "gdb_obstack.h"
33 // OBSOLETE #include "gdb_string.h"
35 // OBSOLETE #include "dst.h"
37 // OBSOLETE CORE_ADDR cur_src_start_addr, cur_src_end_addr;
38 // OBSOLETE dst_sec blocks_info, lines_info, symbols_info;
40 // OBSOLETE /* Vector of line number information. */
42 // OBSOLETE static struct linetable *line_vector;
44 // OBSOLETE /* Index of next entry to go in line_vector_index. */
46 // OBSOLETE static int line_vector_index;
48 // OBSOLETE /* Last line number recorded in the line vector. */
50 // OBSOLETE static int prev_line_number;
52 // OBSOLETE /* Number of elements allocated for line_vector currently. */
54 // OBSOLETE static int line_vector_length;
56 // OBSOLETE static int init_dst_sections (int);
58 // OBSOLETE static void read_dst_symtab (struct objfile *);
60 // OBSOLETE static void find_dst_sections (bfd *, sec_ptr, PTR);
62 // OBSOLETE static void dst_symfile_init (struct objfile *);
64 // OBSOLETE static void dst_new_init (struct objfile *);
66 // OBSOLETE static void dst_symfile_read (struct objfile *, int);
68 // OBSOLETE static void dst_symfile_finish (struct objfile *);
70 // OBSOLETE static void dst_end_symtab (struct objfile *);
72 // OBSOLETE static void complete_symtab (char *, CORE_ADDR, unsigned int);
74 // OBSOLETE static void dst_start_symtab (void);
76 // OBSOLETE static void dst_record_line (int, CORE_ADDR);
78 // OBSOLETE /* Manage the vector of line numbers. */
79 // OBSOLETE /* FIXME: Use record_line instead. */
81 // OBSOLETE static void
82 // OBSOLETE dst_record_line (int line, CORE_ADDR pc)
84 // OBSOLETE struct linetable_entry *e;
85 // OBSOLETE /* Make sure line vector is big enough. */
87 // OBSOLETE if (line_vector_index + 2 >= line_vector_length)
89 // OBSOLETE line_vector_length *= 2;
90 // OBSOLETE line_vector = (struct linetable *)
91 // OBSOLETE xrealloc ((char *) line_vector, sizeof (struct linetable)
92 // OBSOLETE + (line_vector_length
93 // OBSOLETE * sizeof (struct linetable_entry)));
96 // OBSOLETE e = line_vector->item + line_vector_index++;
97 // OBSOLETE e->line = line;
98 // OBSOLETE e->pc = pc;
101 // OBSOLETE /* Start a new symtab for a new source file.
102 // OBSOLETE It indicates the start of data for one original source file. */
103 // OBSOLETE /* FIXME: use start_symtab, like coffread.c now does. */
105 // OBSOLETE static void
106 // OBSOLETE dst_start_symtab (void)
108 // OBSOLETE /* Initialize the source file line number information for this file. */
110 // OBSOLETE if (line_vector) /* Unlikely, but maybe possible? */
111 // OBSOLETE xfree (line_vector);
112 // OBSOLETE line_vector_index = 0;
113 // OBSOLETE line_vector_length = 1000;
114 // OBSOLETE prev_line_number = -2; /* Force first line number to be explicit */
115 // OBSOLETE line_vector = (struct linetable *)
116 // OBSOLETE xmalloc (sizeof (struct linetable)
117 // OBSOLETE + line_vector_length * sizeof (struct linetable_entry));
120 // OBSOLETE /* Save the vital information from when starting to read a file,
121 // OBSOLETE for use when closing off the current file.
122 // OBSOLETE NAME is the file name the symbols came from, START_ADDR is the first
123 // OBSOLETE text address for the file, and SIZE is the number of bytes of text. */
125 // OBSOLETE static void
126 // OBSOLETE complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
128 // OBSOLETE last_source_file = savestring (name, strlen (name));
129 // OBSOLETE cur_src_start_addr = start_addr;
130 // OBSOLETE cur_src_end_addr = start_addr + size;
132 // OBSOLETE if (current_objfile->ei.entry_point >= cur_src_start_addr &&
133 // OBSOLETE current_objfile->ei.entry_point < cur_src_end_addr)
135 // OBSOLETE current_objfile->ei.entry_file_lowpc = cur_src_start_addr;
136 // OBSOLETE current_objfile->ei.entry_file_highpc = cur_src_end_addr;
140 // OBSOLETE /* Finish the symbol definitions for one main source file,
141 // OBSOLETE close off all the lexical contexts for that file
142 // OBSOLETE (creating struct block's for them), then make the
143 // OBSOLETE struct symtab for that file and put it in the list of all such. */
144 // OBSOLETE /* FIXME: Use end_symtab, like coffread.c now does. */
146 // OBSOLETE static void
147 // OBSOLETE dst_end_symtab (struct objfile *objfile)
149 // OBSOLETE register struct symtab *symtab;
150 // OBSOLETE register struct blockvector *blockvector;
151 // OBSOLETE register struct linetable *lv;
153 // OBSOLETE /* Create the blockvector that points to all the file's blocks. */
155 // OBSOLETE blockvector = make_blockvector (objfile);
157 // OBSOLETE /* Now create the symtab object for this source file. */
158 // OBSOLETE symtab = allocate_symtab (last_source_file, objfile);
160 // OBSOLETE /* Fill in its components. */
161 // OBSOLETE symtab->blockvector = blockvector;
162 // OBSOLETE symtab->free_code = free_linetable;
163 // OBSOLETE symtab->free_ptr = 0;
164 // OBSOLETE symtab->filename = last_source_file;
165 // OBSOLETE symtab->dirname = NULL;
166 // OBSOLETE symtab->debugformat = obsavestring ("Apollo DST", 10,
167 // OBSOLETE &objfile->symbol_obstack);
168 // OBSOLETE lv = line_vector;
169 // OBSOLETE lv->nitems = line_vector_index;
170 // OBSOLETE symtab->linetable = (struct linetable *)
171 // OBSOLETE xrealloc ((char *) lv, (sizeof (struct linetable)
172 // OBSOLETE + lv->nitems * sizeof (struct linetable_entry)));
174 // OBSOLETE free_named_symtabs (symtab->filename);
176 // OBSOLETE /* Reinitialize for beginning of new file. */
177 // OBSOLETE line_vector = 0;
178 // OBSOLETE line_vector_length = -1;
179 // OBSOLETE last_source_file = NULL;
182 // OBSOLETE /* dst_symfile_init ()
183 // OBSOLETE is the dst-specific initialization routine for reading symbols.
185 // OBSOLETE We will only be called if this is a DST or DST-like file.
186 // OBSOLETE BFD handles figuring out the format of the file, and code in symtab.c
187 // OBSOLETE uses BFD's determination to vector to us.
189 // OBSOLETE The ultimate result is a new symtab (or, FIXME, eventually a psymtab). */
191 // OBSOLETE static void
192 // OBSOLETE dst_symfile_init (struct objfile *objfile)
194 // OBSOLETE asection *section;
195 // OBSOLETE bfd *abfd = objfile->obfd;
197 // OBSOLETE init_entry_point_info (objfile);
201 // OBSOLETE /* This function is called for every section; it finds the outer limits
202 // OBSOLETE of the line table (minimum and maximum file offset) so that the
203 // OBSOLETE mainline code can read the whole thing for efficiency. */
205 // OBSOLETE /* ARGSUSED */
206 // OBSOLETE static void
207 // OBSOLETE find_dst_sections (bfd *abfd, sec_ptr asect, PTR vpinfo)
209 // OBSOLETE int size, count;
210 // OBSOLETE long base;
211 // OBSOLETE file_ptr offset, maxoff;
212 // OBSOLETE dst_sec *section;
214 // OBSOLETE /* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
215 // OBSOLETE size = asect->_raw_size;
216 // OBSOLETE offset = asect->filepos;
217 // OBSOLETE base = asect->vma;
218 // OBSOLETE /* End of warning */
220 // OBSOLETE section = NULL;
221 // OBSOLETE if (!strcmp (asect->name, ".blocks"))
222 // OBSOLETE section = &blocks_info;
223 // OBSOLETE else if (!strcmp (asect->name, ".lines"))
224 // OBSOLETE section = &lines_info;
225 // OBSOLETE else if (!strcmp (asect->name, ".symbols"))
226 // OBSOLETE section = &symbols_info;
227 // OBSOLETE if (!section)
229 // OBSOLETE section->size = size;
230 // OBSOLETE section->position = offset;
231 // OBSOLETE section->base = base;
235 // OBSOLETE /* The BFD for this file -- only good while we're actively reading
236 // OBSOLETE symbols into a psymtab or a symtab. */
238 // OBSOLETE static bfd *symfile_bfd;
240 // OBSOLETE /* Read a symbol file, after initialization by dst_symfile_init. */
241 // OBSOLETE /* FIXME! Addr and Mainline are not used yet -- this will not work for
242 // OBSOLETE shared libraries or add_file! */
244 // OBSOLETE /* ARGSUSED */
245 // OBSOLETE static void
246 // OBSOLETE dst_symfile_read (struct objfile *objfile, int mainline)
248 // OBSOLETE bfd *abfd = objfile->obfd;
249 // OBSOLETE char *name = bfd_get_filename (abfd);
250 // OBSOLETE int desc;
251 // OBSOLETE register int val;
252 // OBSOLETE int num_symbols;
253 // OBSOLETE int symtab_offset;
254 // OBSOLETE int stringtab_offset;
256 // OBSOLETE symfile_bfd = abfd; /* Kludge for swap routines */
258 // OBSOLETE /* WARNING WILL ROBINSON! ACCESSING BFD-PRIVATE DATA HERE! FIXME! */
259 // OBSOLETE desc = fileno ((FILE *) (abfd->iostream)); /* File descriptor */
261 // OBSOLETE /* Read the line number table, all at once. */
262 // OBSOLETE bfd_map_over_sections (abfd, find_dst_sections, (PTR) NULL);
264 // OBSOLETE val = init_dst_sections (desc);
265 // OBSOLETE if (val < 0)
266 // OBSOLETE error ("\"%s\": error reading debugging symbol tables\n", name);
268 // OBSOLETE init_minimal_symbol_collection ();
269 // OBSOLETE make_cleanup_discard_minimal_symbols ();
271 // OBSOLETE /* Now that the executable file is positioned at symbol table,
272 // OBSOLETE process it and define symbols accordingly. */
274 // OBSOLETE read_dst_symtab (objfile);
276 // OBSOLETE /* Sort symbols alphabetically within each block. */
279 // OBSOLETE struct symtab *s;
280 // OBSOLETE for (s = objfile->symtabs; s != NULL; s = s->next)
282 // OBSOLETE sort_symtab_syms (s);
286 // OBSOLETE /* Install any minimal symbols that have been collected as the current
287 // OBSOLETE minimal symbols for this objfile. */
289 // OBSOLETE install_minimal_symbols (objfile);
292 // OBSOLETE static void
293 // OBSOLETE dst_new_init (struct objfile *ignore)
295 // OBSOLETE /* Nothin' to do */
298 // OBSOLETE /* Perform any local cleanups required when we are done with a particular
299 // OBSOLETE objfile. I.E, we are in the process of discarding all symbol information
300 // OBSOLETE for an objfile, freeing up all memory held for it, and unlinking the
301 // OBSOLETE objfile struct from the global list of known objfiles. */
303 // OBSOLETE static void
304 // OBSOLETE dst_symfile_finish (struct objfile *objfile)
306 // OBSOLETE /* Nothing to do */
310 // OBSOLETE /* Get the next line number from the DST. Returns 0 when we hit an
311 // OBSOLETE * end directive or cannot continue for any other reason.
313 // OBSOLETE * Note that ordinary pc deltas are multiplied by two. Apparently
314 // OBSOLETE * this is what was really intended.
316 // OBSOLETE static int
317 // OBSOLETE get_dst_line (signed char **buffer, long *pc)
319 // OBSOLETE static last_pc = 0;
320 // OBSOLETE static long last_line = 0;
321 // OBSOLETE static int last_file = 0;
322 // OBSOLETE dst_ln_entry_ptr_t entry;
323 // OBSOLETE int size;
324 // OBSOLETE dst_src_loc_t *src_loc;
326 // OBSOLETE if (*pc != -1)
328 // OBSOLETE last_pc = *pc;
329 // OBSOLETE *pc = -1;
331 // OBSOLETE entry = (dst_ln_entry_ptr_t) * buffer;
333 // OBSOLETE while (dst_ln_ln_delta (*entry) == dst_ln_escape_flag)
335 // OBSOLETE switch (entry->esc.esc_code)
337 // OBSOLETE case dst_ln_pad:
338 // OBSOLETE size = 1; /* pad byte */
340 // OBSOLETE case dst_ln_file:
341 // OBSOLETE /* file escape. Next 4 bytes are a dst_src_loc_t */
342 // OBSOLETE size = 5;
343 // OBSOLETE src_loc = (dst_src_loc_t *) (*buffer + 1);
344 // OBSOLETE last_line = src_loc->line_number;
345 // OBSOLETE last_file = src_loc->file_index;
347 // OBSOLETE case dst_ln_dln1_dpc1:
348 // OBSOLETE /* 1 byte line delta, 1 byte pc delta */
349 // OBSOLETE last_line += (*buffer)[1];
350 // OBSOLETE last_pc += 2 * (unsigned char) (*buffer)[2];
351 // OBSOLETE dst_record_line (last_line, last_pc);
352 // OBSOLETE size = 3;
354 // OBSOLETE case dst_ln_dln2_dpc2:
355 // OBSOLETE /* 2 bytes line delta, 2 bytes pc delta */
356 // OBSOLETE last_line += *(short *) (*buffer + 1);
357 // OBSOLETE last_pc += 2 * (*(short *) (*buffer + 3));
358 // OBSOLETE size = 5;
359 // OBSOLETE dst_record_line (last_line, last_pc);
361 // OBSOLETE case dst_ln_ln4_pc4:
362 // OBSOLETE /* 4 bytes ABSOLUTE line number, 4 bytes ABSOLUTE pc */
363 // OBSOLETE last_line = *(unsigned long *) (*buffer + 1);
364 // OBSOLETE last_pc = *(unsigned long *) (*buffer + 5);
365 // OBSOLETE size = 9;
366 // OBSOLETE dst_record_line (last_line, last_pc);
368 // OBSOLETE case dst_ln_dln1_dpc0:
369 // OBSOLETE /* 1 byte line delta, pc delta = 0 */
370 // OBSOLETE size = 2;
371 // OBSOLETE last_line += (*buffer)[1];
373 // OBSOLETE case dst_ln_ln_off_1:
374 // OBSOLETE /* statement escape, stmt # = 1 (2nd stmt on line) */
375 // OBSOLETE size = 1;
377 // OBSOLETE case dst_ln_ln_off:
378 // OBSOLETE /* statement escape, stmt # = next byte */
379 // OBSOLETE size = 2;
381 // OBSOLETE case dst_ln_entry:
382 // OBSOLETE /* entry escape, next byte is entry number */
383 // OBSOLETE size = 2;
385 // OBSOLETE case dst_ln_exit:
386 // OBSOLETE /* exit escape */
387 // OBSOLETE size = 1;
389 // OBSOLETE case dst_ln_stmt_end:
390 // OBSOLETE /* gap escape, 4 bytes pc delta */
391 // OBSOLETE size = 5;
392 // OBSOLETE /* last_pc += 2 * (*(long *) (*buffer + 1)); */
393 // OBSOLETE /* Apparently this isn't supposed to actually modify
394 // OBSOLETE * the pc value. Totally weird.
397 // OBSOLETE case dst_ln_escape_11:
398 // OBSOLETE case dst_ln_escape_12:
399 // OBSOLETE case dst_ln_escape_13:
400 // OBSOLETE size = 1;
402 // OBSOLETE case dst_ln_nxt_byte:
403 // OBSOLETE /* This shouldn't happen. If it does, we're SOL */
404 // OBSOLETE return 0;
406 // OBSOLETE case dst_ln_end:
407 // OBSOLETE /* end escape, final entry follows */
408 // OBSOLETE return 0;
410 // OBSOLETE *buffer += (size < 0) ? -size : size;
411 // OBSOLETE entry = (dst_ln_entry_ptr_t) * buffer;
413 // OBSOLETE last_line += dst_ln_ln_delta (*entry);
414 // OBSOLETE last_pc += entry->delta.pc_delta * 2;
415 // OBSOLETE (*buffer)++;
416 // OBSOLETE dst_record_line (last_line, last_pc);
417 // OBSOLETE return 1;
420 // OBSOLETE static void
421 // OBSOLETE enter_all_lines (char *buffer, long address)
423 // OBSOLETE if (buffer)
424 // OBSOLETE while (get_dst_line (&buffer, &address));
427 // OBSOLETE static int
428 // OBSOLETE get_dst_entry (char *buffer, dst_rec_ptr_t *ret_entry)
430 // OBSOLETE int size;
431 // OBSOLETE dst_rec_ptr_t entry;
432 // OBSOLETE static int last_type;
433 // OBSOLETE int ar_size;
434 // OBSOLETE static unsigned lu3;
436 // OBSOLETE entry = (dst_rec_ptr_t) buffer;
437 // OBSOLETE switch (entry->rec_type)
439 // OBSOLETE case dst_typ_pad:
440 // OBSOLETE size = 0;
442 // OBSOLETE case dst_typ_comp_unit:
443 // OBSOLETE size = sizeof (DST_comp_unit (entry));
445 // OBSOLETE case dst_typ_section_tab:
446 // OBSOLETE size = sizeof (DST_section_tab (entry))
447 // OBSOLETE + ((int) DST_section_tab (entry).number_of_sections
448 // OBSOLETE - dst_dummy_array_size) * sizeof (long);
450 // OBSOLETE case dst_typ_file_tab:
451 // OBSOLETE size = sizeof (DST_file_tab (entry))
452 // OBSOLETE + ((int) DST_file_tab (entry).number_of_files
453 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_file_desc_t);
455 // OBSOLETE case dst_typ_block:
456 // OBSOLETE size = sizeof (DST_block (entry))
457 // OBSOLETE + ((int) DST_block (entry).n_of_code_ranges
458 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_code_range_t);
460 // OBSOLETE case dst_typ_5:
461 // OBSOLETE size = -1;
463 // OBSOLETE case dst_typ_var:
464 // OBSOLETE size = sizeof (DST_var (entry)) -
465 // OBSOLETE sizeof (dst_var_loc_long_t) * dst_dummy_array_size +
466 // OBSOLETE DST_var (entry).no_of_locs *
467 // OBSOLETE (DST_var (entry).short_locs ?
468 // OBSOLETE sizeof (dst_var_loc_short_t) :
469 // OBSOLETE sizeof (dst_var_loc_long_t));
471 // OBSOLETE case dst_typ_pointer:
472 // OBSOLETE size = sizeof (DST_pointer (entry));
474 // OBSOLETE case dst_typ_array:
475 // OBSOLETE size = sizeof (DST_array (entry));
477 // OBSOLETE case dst_typ_subrange:
478 // OBSOLETE size = sizeof (DST_subrange (entry));
480 // OBSOLETE case dst_typ_set:
481 // OBSOLETE size = sizeof (DST_set (entry));
483 // OBSOLETE case dst_typ_implicit_enum:
484 // OBSOLETE size = sizeof (DST_implicit_enum (entry))
485 // OBSOLETE + ((int) DST_implicit_enum (entry).nelems
486 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_rel_offset_t);
488 // OBSOLETE case dst_typ_explicit_enum:
489 // OBSOLETE size = sizeof (DST_explicit_enum (entry))
490 // OBSOLETE + ((int) DST_explicit_enum (entry).nelems
491 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_enum_elem_t);
493 // OBSOLETE case dst_typ_short_rec:
494 // OBSOLETE size = sizeof (DST_short_rec (entry))
495 // OBSOLETE + DST_short_rec (entry).nfields * sizeof (dst_short_field_t)
496 // OBSOLETE - dst_dummy_array_size * sizeof (dst_field_t);
498 // OBSOLETE case dst_typ_short_union:
499 // OBSOLETE size = sizeof (DST_short_union (entry))
500 // OBSOLETE + DST_short_union (entry).nfields * sizeof (dst_short_field_t)
501 // OBSOLETE - dst_dummy_array_size * sizeof (dst_field_t);
503 // OBSOLETE case dst_typ_file:
504 // OBSOLETE size = sizeof (DST_file (entry));
506 // OBSOLETE case dst_typ_offset:
507 // OBSOLETE size = sizeof (DST_offset (entry));
509 // OBSOLETE case dst_typ_alias:
510 // OBSOLETE size = sizeof (DST_alias (entry));
512 // OBSOLETE case dst_typ_signature:
513 // OBSOLETE size = sizeof (DST_signature (entry)) +
514 // OBSOLETE ((int) DST_signature (entry).nargs -
515 // OBSOLETE dst_dummy_array_size) * sizeof (dst_arg_t);
517 // OBSOLETE case dst_typ_21:
518 // OBSOLETE size = -1;
520 // OBSOLETE case dst_typ_old_label:
521 // OBSOLETE size = sizeof (DST_old_label (entry));
523 // OBSOLETE case dst_typ_scope:
524 // OBSOLETE size = sizeof (DST_scope (entry));
526 // OBSOLETE case dst_typ_end_scope:
527 // OBSOLETE size = 0;
529 // OBSOLETE case dst_typ_25:
530 // OBSOLETE case dst_typ_26:
531 // OBSOLETE size = -1;
533 // OBSOLETE case dst_typ_string_tab:
534 // OBSOLETE case dst_typ_global_name_tab:
535 // OBSOLETE size = sizeof (DST_string_tab (entry))
536 // OBSOLETE + DST_string_tab (entry).length
537 // OBSOLETE - dst_dummy_array_size;
539 // OBSOLETE case dst_typ_forward:
540 // OBSOLETE size = sizeof (DST_forward (entry));
541 // OBSOLETE get_dst_entry ((char *) entry + DST_forward (entry).rec_off, &entry);
543 // OBSOLETE case dst_typ_aux_size:
544 // OBSOLETE size = sizeof (DST_aux_size (entry));
546 // OBSOLETE case dst_typ_aux_align:
547 // OBSOLETE size = sizeof (DST_aux_align (entry));
549 // OBSOLETE case dst_typ_aux_field_size:
550 // OBSOLETE size = sizeof (DST_aux_field_size (entry));
552 // OBSOLETE case dst_typ_aux_field_off:
553 // OBSOLETE size = sizeof (DST_aux_field_off (entry));
555 // OBSOLETE case dst_typ_aux_field_align:
556 // OBSOLETE size = sizeof (DST_aux_field_align (entry));
558 // OBSOLETE case dst_typ_aux_qual:
559 // OBSOLETE size = sizeof (DST_aux_qual (entry));
561 // OBSOLETE case dst_typ_aux_var_bound:
562 // OBSOLETE size = sizeof (DST_aux_var_bound (entry));
564 // OBSOLETE case dst_typ_extension:
565 // OBSOLETE size = DST_extension (entry).rec_size;
567 // OBSOLETE case dst_typ_string:
568 // OBSOLETE size = sizeof (DST_string (entry));
570 // OBSOLETE case dst_typ_old_entry:
571 // OBSOLETE size = 48; /* Obsolete entry type */
573 // OBSOLETE case dst_typ_const:
574 // OBSOLETE size = sizeof (DST_const (entry))
575 // OBSOLETE + DST_const (entry).value.length
576 // OBSOLETE - sizeof (DST_const (entry).value.val);
578 // OBSOLETE case dst_typ_reference:
579 // OBSOLETE size = sizeof (DST_reference (entry));
581 // OBSOLETE case dst_typ_old_record:
582 // OBSOLETE case dst_typ_old_union:
583 // OBSOLETE case dst_typ_record:
584 // OBSOLETE case dst_typ_union:
585 // OBSOLETE size = sizeof (DST_record (entry))
586 // OBSOLETE + ((int) DST_record (entry).nfields
587 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_field_t);
589 // OBSOLETE case dst_typ_aux_type_deriv:
590 // OBSOLETE size = sizeof (DST_aux_type_deriv (entry));
592 // OBSOLETE case dst_typ_locpool:
593 // OBSOLETE size = sizeof (DST_locpool (entry))
594 // OBSOLETE + ((int) DST_locpool (entry).length -
595 // OBSOLETE dst_dummy_array_size);
597 // OBSOLETE case dst_typ_variable:
598 // OBSOLETE size = sizeof (DST_variable (entry));
600 // OBSOLETE case dst_typ_label:
601 // OBSOLETE size = sizeof (DST_label (entry));
603 // OBSOLETE case dst_typ_entry:
604 // OBSOLETE size = sizeof (DST_entry (entry));
606 // OBSOLETE case dst_typ_aux_lifetime:
607 // OBSOLETE size = sizeof (DST_aux_lifetime (entry));
609 // OBSOLETE case dst_typ_aux_ptr_base:
610 // OBSOLETE size = sizeof (DST_aux_ptr_base (entry));
612 // OBSOLETE case dst_typ_aux_src_range:
613 // OBSOLETE size = sizeof (DST_aux_src_range (entry));
615 // OBSOLETE case dst_typ_aux_reg_val:
616 // OBSOLETE size = sizeof (DST_aux_reg_val (entry));
618 // OBSOLETE case dst_typ_aux_unit_names:
619 // OBSOLETE size = sizeof (DST_aux_unit_names (entry))
620 // OBSOLETE + ((int) DST_aux_unit_names (entry).number_of_names
621 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_rel_offset_t);
623 // OBSOLETE case dst_typ_aux_sect_info:
624 // OBSOLETE size = sizeof (DST_aux_sect_info (entry))
625 // OBSOLETE + ((int) DST_aux_sect_info (entry).number_of_refs
626 // OBSOLETE - dst_dummy_array_size) * sizeof (dst_sect_ref_t);
629 // OBSOLETE size = -1;
632 // OBSOLETE if (size == -1)
634 // OBSOLETE fprintf_unfiltered (gdb_stderr, "Warning: unexpected DST entry type (%d) found\nLast valid entry was of type: %d\n",
635 // OBSOLETE (int) entry->rec_type,
636 // OBSOLETE last_type);
637 // OBSOLETE fprintf_unfiltered (gdb_stderr, "Last unknown_3 value: %d\n", lu3);
638 // OBSOLETE size = 0;
641 // OBSOLETE last_type = entry->rec_type;
642 // OBSOLETE if (size & 1) /* Align on a word boundary */
644 // OBSOLETE size += 2;
645 // OBSOLETE *ret_entry = entry;
646 // OBSOLETE return size;
649 // OBSOLETE static int
650 // OBSOLETE next_dst_entry (char **buffer, dst_rec_ptr_t *entry, dst_sec *table)
652 // OBSOLETE if (*buffer - table->buffer >= table->size)
654 // OBSOLETE *entry = NULL;
655 // OBSOLETE return 0;
657 // OBSOLETE *buffer += get_dst_entry (*buffer, entry);
658 // OBSOLETE return 1;
661 // OBSOLETE #define NEXT_BLK(a, b) next_dst_entry(a, b, &blocks_info)
662 // OBSOLETE #define NEXT_SYM(a, b) next_dst_entry(a, b, &symbols_info)
663 // OBSOLETE #define DST_OFFSET(a, b) ((char *) (a) + (b))
665 // OBSOLETE static dst_rec_ptr_t section_table = NULL;
668 // OBSOLETE get_sec_ref (dst_sect_ref_t *ref)
670 // OBSOLETE dst_sec *section = NULL;
671 // OBSOLETE long offset;
673 // OBSOLETE if (!section_table || !ref->sect_index)
674 // OBSOLETE return NULL;
675 // OBSOLETE offset = DST_section_tab (section_table).section_base[ref->sect_index - 1]
676 // OBSOLETE + ref->sect_offset;
677 // OBSOLETE if (offset >= blocks_info.base &&
678 // OBSOLETE offset < blocks_info.base + blocks_info.size)
679 // OBSOLETE section = &blocks_info;
680 // OBSOLETE else if (offset >= symbols_info.base &&
681 // OBSOLETE offset < symbols_info.base + symbols_info.size)
682 // OBSOLETE section = &symbols_info;
683 // OBSOLETE else if (offset >= lines_info.base &&
684 // OBSOLETE offset < lines_info.base + lines_info.size)
685 // OBSOLETE section = &lines_info;
686 // OBSOLETE if (!section)
687 // OBSOLETE return NULL;
688 // OBSOLETE return section->buffer + (offset - section->base);
691 // OBSOLETE CORE_ADDR
692 // OBSOLETE dst_get_addr (int section, long offset)
694 // OBSOLETE if (!section_table || !section)
695 // OBSOLETE return 0;
696 // OBSOLETE return DST_section_tab (section_table).section_base[section - 1] + offset;
699 // OBSOLETE CORE_ADDR
700 // OBSOLETE dst_sym_addr (dst_sect_ref_t *ref)
702 // OBSOLETE if (!section_table || !ref->sect_index)
703 // OBSOLETE return 0;
704 // OBSOLETE return DST_section_tab (section_table).section_base[ref->sect_index - 1]
705 // OBSOLETE + ref->sect_offset;
708 // OBSOLETE static struct symbol *
709 // OBSOLETE create_new_symbol (struct objfile *objfile, char *name)
711 // OBSOLETE struct symbol *sym = (struct symbol *)
712 // OBSOLETE obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol));
713 // OBSOLETE memset (sym, 0, sizeof (struct symbol));
714 // OBSOLETE SYMBOL_NAME (sym) = obsavestring (name, strlen (name),
715 // OBSOLETE &objfile->symbol_obstack);
716 // OBSOLETE SYMBOL_VALUE (sym) = 0;
717 // OBSOLETE SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
719 // OBSOLETE SYMBOL_CLASS (sym) = LOC_BLOCK;
720 // OBSOLETE return sym;
723 // OBSOLETE static struct type *decode_dst_type (struct objfile *, dst_rec_ptr_t);
725 // OBSOLETE static struct type *
726 // OBSOLETE decode_type_desc (struct objfile *objfile, dst_type_t *type_desc,
727 // OBSOLETE dst_rec_ptr_t base)
729 // OBSOLETE struct type *type;
730 // OBSOLETE dst_rec_ptr_t entry;
731 // OBSOLETE if (type_desc->std_type.user_defined_type)
733 // OBSOLETE entry = (dst_rec_ptr_t) DST_OFFSET (base,
734 // OBSOLETE dst_user_type_offset (*type_desc));
735 // OBSOLETE type = decode_dst_type (objfile, entry);
739 // OBSOLETE switch (type_desc->std_type.dtc)
741 // OBSOLETE case dst_int8_type:
742 // OBSOLETE type = builtin_type_signed_char;
744 // OBSOLETE case dst_int16_type:
745 // OBSOLETE type = builtin_type_short;
747 // OBSOLETE case dst_int32_type:
748 // OBSOLETE type = builtin_type_long;
750 // OBSOLETE case dst_uint8_type:
751 // OBSOLETE type = builtin_type_unsigned_char;
753 // OBSOLETE case dst_uint16_type:
754 // OBSOLETE type = builtin_type_unsigned_short;
756 // OBSOLETE case dst_uint32_type:
757 // OBSOLETE type = builtin_type_unsigned_long;
759 // OBSOLETE case dst_real32_type:
760 // OBSOLETE type = builtin_type_float;
762 // OBSOLETE case dst_real64_type:
763 // OBSOLETE type = builtin_type_double;
765 // OBSOLETE case dst_complex_type:
766 // OBSOLETE type = builtin_type_complex;
768 // OBSOLETE case dst_dcomplex_type:
769 // OBSOLETE type = builtin_type_double_complex;
771 // OBSOLETE case dst_bool8_type:
772 // OBSOLETE type = builtin_type_char;
774 // OBSOLETE case dst_bool16_type:
775 // OBSOLETE type = builtin_type_short;
777 // OBSOLETE case dst_bool32_type:
778 // OBSOLETE type = builtin_type_long;
780 // OBSOLETE case dst_char_type:
781 // OBSOLETE type = builtin_type_char;
783 // OBSOLETE /* The next few are more complex. I will take care
784 // OBSOLETE * of them properly at a later point.
786 // OBSOLETE case dst_string_type:
787 // OBSOLETE type = builtin_type_void;
789 // OBSOLETE case dst_ptr_type:
790 // OBSOLETE type = builtin_type_void;
792 // OBSOLETE case dst_set_type:
793 // OBSOLETE type = builtin_type_void;
795 // OBSOLETE case dst_proc_type:
796 // OBSOLETE type = builtin_type_void;
798 // OBSOLETE case dst_func_type:
799 // OBSOLETE type = builtin_type_void;
801 // OBSOLETE /* Back tto some ordinary ones */
802 // OBSOLETE case dst_void_type:
803 // OBSOLETE type = builtin_type_void;
805 // OBSOLETE case dst_uchar_type:
806 // OBSOLETE type = builtin_type_unsigned_char;
809 // OBSOLETE type = builtin_type_void;
813 // OBSOLETE return type;
816 // OBSOLETE struct structure_list
818 // OBSOLETE struct structure_list *next;
819 // OBSOLETE struct type *type;
822 // OBSOLETE static struct structure_list *struct_list = NULL;
824 // OBSOLETE static struct type *
825 // OBSOLETE find_dst_structure (char *name)
827 // OBSOLETE struct structure_list *element;
829 // OBSOLETE for (element = struct_list; element; element = element->next)
830 // OBSOLETE if (!strcmp (name, TYPE_NAME (element->type)))
831 // OBSOLETE return element->type;
832 // OBSOLETE return NULL;
836 // OBSOLETE static struct type *
837 // OBSOLETE decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code,
838 // OBSOLETE int version)
840 // OBSOLETE struct type *type, *child_type;
841 // OBSOLETE char *struct_name;
842 // OBSOLETE char *name, *field_name;
844 // OBSOLETE int fieldoffset, fieldsize;
845 // OBSOLETE dst_type_t type_desc;
846 // OBSOLETE struct structure_list *element;
848 // OBSOLETE struct_name = DST_OFFSET (entry, DST_record (entry).noffset);
849 // OBSOLETE name = concat ((code == TYPE_CODE_UNION) ? "union " : "struct ",
850 // OBSOLETE struct_name, NULL);
851 // OBSOLETE type = find_dst_structure (name);
852 // OBSOLETE if (type)
854 // OBSOLETE xfree (name);
855 // OBSOLETE return type;
857 // OBSOLETE type = alloc_type (objfile);
858 // OBSOLETE TYPE_NAME (type) = obstack_copy0 (&objfile->symbol_obstack,
859 // OBSOLETE name, strlen (name));
860 // OBSOLETE xfree (name);
861 // OBSOLETE TYPE_CODE (type) = code;
862 // OBSOLETE TYPE_LENGTH (type) = DST_record (entry).size;
863 // OBSOLETE TYPE_NFIELDS (type) = DST_record (entry).nfields;
864 // OBSOLETE TYPE_FIELDS (type) = (struct field *)
865 // OBSOLETE obstack_alloc (&objfile->symbol_obstack, sizeof (struct field) *
866 // OBSOLETE DST_record (entry).nfields);
867 // OBSOLETE fieldoffset = fieldsize = 0;
868 // OBSOLETE INIT_CPLUS_SPECIFIC (type);
869 // OBSOLETE element = (struct structure_list *)
870 // OBSOLETE xmalloc (sizeof (struct structure_list));
871 // OBSOLETE element->type = type;
872 // OBSOLETE element->next = struct_list;
873 // OBSOLETE struct_list = element;
874 // OBSOLETE for (i = 0; i < DST_record (entry).nfields; i++)
876 // OBSOLETE switch (version)
879 // OBSOLETE field_name = DST_OFFSET (entry,
880 // OBSOLETE DST_record (entry).f.ofields[i].noffset);
881 // OBSOLETE fieldoffset = DST_record (entry).f.ofields[i].foffset * 8 +
882 // OBSOLETE DST_record (entry).f.ofields[i].bit_offset;
883 // OBSOLETE fieldsize = DST_record (entry).f.ofields[i].size;
884 // OBSOLETE type_desc = DST_record (entry).f.ofields[i].type_desc;
887 // OBSOLETE field_name = DST_OFFSET (entry,
888 // OBSOLETE DST_record (entry).f.fields[i].noffset);
889 // OBSOLETE type_desc = DST_record (entry).f.fields[i].type_desc;
890 // OBSOLETE switch (DST_record (entry).f.fields[i].f.field_loc.format_tag)
892 // OBSOLETE case dst_field_byte:
893 // OBSOLETE fieldoffset = DST_record (entry).f.
894 // OBSOLETE fields[i].f.field_byte.offset * 8;
895 // OBSOLETE fieldsize = -1;
897 // OBSOLETE case dst_field_bit:
898 // OBSOLETE fieldoffset = DST_record (entry).f.
899 // OBSOLETE fields[i].f.field_bit.byte_offset * 8 +
900 // OBSOLETE DST_record (entry).f.
901 // OBSOLETE fields[i].f.field_bit.bit_offset;
902 // OBSOLETE fieldsize = DST_record (entry).f.
903 // OBSOLETE fields[i].f.field_bit.nbits;
905 // OBSOLETE case dst_field_loc:
906 // OBSOLETE fieldoffset += fieldsize;
907 // OBSOLETE fieldsize = -1;
912 // OBSOLETE field_name = DST_OFFSET (entry,
913 // OBSOLETE DST_record (entry).f.sfields[i].noffset);
914 // OBSOLETE fieldoffset = DST_record (entry).f.sfields[i].foffset;
915 // OBSOLETE type_desc = DST_record (entry).f.sfields[i].type_desc;
916 // OBSOLETE if (i < DST_record (entry).nfields - 1)
917 // OBSOLETE fieldsize = DST_record (entry).f.sfields[i + 1].foffset;
919 // OBSOLETE fieldsize = DST_record (entry).size;
920 // OBSOLETE fieldsize -= fieldoffset;
921 // OBSOLETE fieldoffset *= 8;
922 // OBSOLETE fieldsize *= 8;
924 // OBSOLETE TYPE_FIELDS (type)[i].name =
925 // OBSOLETE obstack_copy0 (&objfile->symbol_obstack,
926 // OBSOLETE field_name, strlen (field_name));
927 // OBSOLETE TYPE_FIELDS (type)[i].type = decode_type_desc (objfile,
928 // OBSOLETE &type_desc,
930 // OBSOLETE if (fieldsize == -1)
931 // OBSOLETE fieldsize = TYPE_LENGTH (TYPE_FIELDS (type)[i].type) *
933 // OBSOLETE TYPE_FIELDS (type)[i].bitsize = fieldsize;
934 // OBSOLETE TYPE_FIELDS (type)[i].bitpos = fieldoffset;
936 // OBSOLETE return type;
939 // OBSOLETE static struct type *
940 // OBSOLETE decode_dst_type (struct objfile *objfile, dst_rec_ptr_t entry)
942 // OBSOLETE struct type *child_type, *type, *range_type, *index_type;
944 // OBSOLETE switch (entry->rec_type)
946 // OBSOLETE case dst_typ_var:
947 // OBSOLETE return decode_type_desc (objfile,
948 // OBSOLETE &DST_var (entry).type_desc,
951 // OBSOLETE case dst_typ_variable:
952 // OBSOLETE return decode_type_desc (objfile,
953 // OBSOLETE &DST_variable (entry).type_desc,
956 // OBSOLETE case dst_typ_short_rec:
957 // OBSOLETE return decode_dst_structure (objfile, entry, TYPE_CODE_STRUCT, 0);
958 // OBSOLETE case dst_typ_short_union:
959 // OBSOLETE return decode_dst_structure (objfile, entry, TYPE_CODE_UNION, 0);
960 // OBSOLETE case dst_typ_union:
961 // OBSOLETE return decode_dst_structure (objfile, entry, TYPE_CODE_UNION, 1);
962 // OBSOLETE case dst_typ_record:
963 // OBSOLETE return decode_dst_structure (objfile, entry, TYPE_CODE_STRUCT, 1);
964 // OBSOLETE case dst_typ_old_union:
965 // OBSOLETE return decode_dst_structure (objfile, entry, TYPE_CODE_UNION, 2);
966 // OBSOLETE case dst_typ_old_record:
967 // OBSOLETE return decode_dst_structure (objfile, entry, TYPE_CODE_STRUCT, 2);
968 // OBSOLETE case dst_typ_pointer:
969 // OBSOLETE return make_pointer_type (
970 // OBSOLETE decode_type_desc (objfile,
971 // OBSOLETE &DST_pointer (entry).type_desc,
974 // OBSOLETE case dst_typ_array:
975 // OBSOLETE child_type = decode_type_desc (objfile,
976 // OBSOLETE &DST_pointer (entry).type_desc,
978 // OBSOLETE index_type = lookup_fundamental_type (objfile,
979 // OBSOLETE FT_INTEGER);
980 // OBSOLETE range_type = create_range_type ((struct type *) NULL,
981 // OBSOLETE index_type, DST_array (entry).lo_bound,
982 // OBSOLETE DST_array (entry).hi_bound);
983 // OBSOLETE return create_array_type ((struct type *) NULL, child_type,
984 // OBSOLETE range_type);
985 // OBSOLETE case dst_typ_alias:
986 // OBSOLETE return decode_type_desc (objfile,
987 // OBSOLETE &DST_alias (entry).type_desc,
990 // OBSOLETE return builtin_type_int;
994 // OBSOLETE struct symbol_list
996 // OBSOLETE struct symbol_list *next;
997 // OBSOLETE struct symbol *symbol;
1000 // OBSOLETE static struct symbol_list *dst_global_symbols = NULL;
1001 // OBSOLETE static int total_globals = 0;
1003 // OBSOLETE static void
1004 // OBSOLETE decode_dst_locstring (char *locstr, struct symbol *sym)
1006 // OBSOLETE dst_loc_entry_t *entry, *next_entry;
1007 // OBSOLETE CORE_ADDR temp;
1008 // OBSOLETE int count = 0;
1010 // OBSOLETE while (1)
1012 // OBSOLETE if (count++ == 100)
1014 // OBSOLETE fprintf_unfiltered (gdb_stderr, "Error reading locstring\n");
1017 // OBSOLETE entry = (dst_loc_entry_t *) locstr;
1018 // OBSOLETE next_entry = (dst_loc_entry_t *) (locstr + 1);
1019 // OBSOLETE switch (entry->header.code)
1021 // OBSOLETE case dst_lsc_end: /* End of string */
1023 // OBSOLETE case dst_lsc_indirect: /* Indirect through previous. Arg == 6 */
1024 // OBSOLETE /* Or register ax x == arg */
1025 // OBSOLETE if (entry->header.arg < 6)
1027 // OBSOLETE SYMBOL_CLASS (sym) = LOC_REGISTER;
1028 // OBSOLETE SYMBOL_VALUE (sym) = entry->header.arg + 8;
1030 // OBSOLETE /* We predict indirects */
1031 // OBSOLETE locstr++;
1033 // OBSOLETE case dst_lsc_dreg:
1034 // OBSOLETE SYMBOL_CLASS (sym) = LOC_REGISTER;
1035 // OBSOLETE SYMBOL_VALUE (sym) = entry->header.arg;
1036 // OBSOLETE locstr++;
1038 // OBSOLETE case dst_lsc_section: /* Section (arg+1) */
1039 // OBSOLETE SYMBOL_VALUE (sym) = dst_get_addr (entry->header.arg + 1, 0);
1040 // OBSOLETE locstr++;
1042 // OBSOLETE case dst_lsc_sec_byte: /* Section (next_byte+1) */
1043 // OBSOLETE SYMBOL_VALUE (sym) = dst_get_addr (locstr[1] + 1, 0);
1044 // OBSOLETE locstr += 2;
1046 // OBSOLETE case dst_lsc_add: /* Add (arg+1)*2 */
1047 // OBSOLETE case dst_lsc_sub: /* Subtract (arg+1)*2 */
1048 // OBSOLETE temp = (entry->header.arg + 1) * 2;
1049 // OBSOLETE locstr++;
1050 // OBSOLETE if (*locstr == dst_multiply_256)
1052 // OBSOLETE temp <<= 8;
1053 // OBSOLETE locstr++;
1055 // OBSOLETE switch (entry->header.code)
1057 // OBSOLETE case dst_lsc_add:
1058 // OBSOLETE if (SYMBOL_CLASS (sym) == LOC_LOCAL)
1059 // OBSOLETE SYMBOL_CLASS (sym) = LOC_ARG;
1060 // OBSOLETE SYMBOL_VALUE (sym) += temp;
1062 // OBSOLETE case dst_lsc_sub:
1063 // OBSOLETE SYMBOL_VALUE (sym) -= temp;
1067 // OBSOLETE case dst_lsc_add_byte:
1068 // OBSOLETE case dst_lsc_sub_byte:
1069 // OBSOLETE switch (entry->header.arg & 0x03)
1072 // OBSOLETE temp = (unsigned char) locstr[1];
1073 // OBSOLETE locstr += 2;
1076 // OBSOLETE temp = *(unsigned short *) (locstr + 1);
1077 // OBSOLETE locstr += 3;
1080 // OBSOLETE temp = *(unsigned long *) (locstr + 1);
1081 // OBSOLETE locstr += 5;
1084 // OBSOLETE if (*locstr == dst_multiply_256)
1086 // OBSOLETE temp <<= 8;
1087 // OBSOLETE locstr++;
1089 // OBSOLETE switch (entry->header.code)
1091 // OBSOLETE case dst_lsc_add_byte:
1092 // OBSOLETE if (SYMBOL_CLASS (sym) == LOC_LOCAL)
1093 // OBSOLETE SYMBOL_CLASS (sym) = LOC_ARG;
1094 // OBSOLETE SYMBOL_VALUE (sym) += temp;
1096 // OBSOLETE case dst_lsc_sub_byte:
1097 // OBSOLETE SYMBOL_VALUE (sym) -= temp;
1101 // OBSOLETE case dst_lsc_sbreg: /* Stack base register (frame pointer). Arg==0 */
1102 // OBSOLETE if (next_entry->header.code != dst_lsc_indirect)
1104 // OBSOLETE SYMBOL_VALUE (sym) = 0;
1105 // OBSOLETE SYMBOL_CLASS (sym) = LOC_STATIC;
1108 // OBSOLETE SYMBOL_VALUE (sym) = 0;
1109 // OBSOLETE SYMBOL_CLASS (sym) = LOC_LOCAL;
1110 // OBSOLETE locstr++;
1112 // OBSOLETE default:
1113 // OBSOLETE SYMBOL_VALUE (sym) = 0;
1114 // OBSOLETE SYMBOL_CLASS (sym) = LOC_STATIC;
1120 // OBSOLETE static struct symbol_list *
1121 // OBSOLETE process_dst_symbols (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
1122 // OBSOLETE int *nsyms_ret)
1124 // OBSOLETE struct symbol_list *list = NULL, *element;
1125 // OBSOLETE struct symbol *sym;
1126 // OBSOLETE char *symname;
1127 // OBSOLETE int nsyms = 0;
1128 // OBSOLETE char *location;
1129 // OBSOLETE long line;
1130 // OBSOLETE dst_type_t symtype;
1131 // OBSOLETE struct type *type;
1132 // OBSOLETE dst_var_attr_t attr;
1133 // OBSOLETE dst_var_loc_t loc_type;
1134 // OBSOLETE unsigned loc_index;
1135 // OBSOLETE long loc_value;
1137 // OBSOLETE if (!entry)
1139 // OBSOLETE *nsyms_ret = 0;
1140 // OBSOLETE return NULL;
1142 // OBSOLETE location = (char *) entry;
1143 // OBSOLETE while (NEXT_SYM (&location, &entry) &&
1144 // OBSOLETE entry->rec_type != dst_typ_end_scope)
1146 // OBSOLETE if (entry->rec_type == dst_typ_var)
1148 // OBSOLETE if (DST_var (entry).short_locs)
1150 // OBSOLETE loc_type = DST_var (entry).locs.shorts[0].loc_type;
1151 // OBSOLETE loc_index = DST_var (entry).locs.shorts[0].loc_index;
1152 // OBSOLETE loc_value = DST_var (entry).locs.shorts[0].location;
1156 // OBSOLETE loc_type = DST_var (entry).locs.longs[0].loc_type;
1157 // OBSOLETE loc_index = DST_var (entry).locs.longs[0].loc_index;
1158 // OBSOLETE loc_value = DST_var (entry).locs.longs[0].location;
1160 // OBSOLETE if (loc_type == dst_var_loc_external)
1161 // OBSOLETE continue;
1162 // OBSOLETE symname = DST_OFFSET (entry, DST_var (entry).noffset);
1163 // OBSOLETE line = DST_var (entry).src_loc.line_number;
1164 // OBSOLETE symtype = DST_var (entry).type_desc;
1165 // OBSOLETE attr = DST_var (entry).attributes;
1167 // OBSOLETE else if (entry->rec_type == dst_typ_variable)
1169 // OBSOLETE symname = DST_OFFSET (entry,
1170 // OBSOLETE DST_variable (entry).noffset);
1171 // OBSOLETE line = DST_variable (entry).src_loc.line_number;
1172 // OBSOLETE symtype = DST_variable (entry).type_desc;
1173 // OBSOLETE attr = DST_variable (entry).attributes;
1177 // OBSOLETE continue;
1179 // OBSOLETE if (symname && name && !strcmp (symname, name))
1180 // OBSOLETE /* It's the function return value */
1181 // OBSOLETE continue;
1182 // OBSOLETE sym = create_new_symbol (objfile, symname);
1184 // OBSOLETE if ((attr & (1 << dst_var_attr_global)) ||
1185 // OBSOLETE (attr & (1 << dst_var_attr_static)))
1186 // OBSOLETE SYMBOL_CLASS (sym) = LOC_STATIC;
1188 // OBSOLETE SYMBOL_CLASS (sym) = LOC_LOCAL;
1189 // OBSOLETE SYMBOL_LINE (sym) = line;
1190 // OBSOLETE SYMBOL_TYPE (sym) = decode_type_desc (objfile, &symtype,
1192 // OBSOLETE SYMBOL_VALUE (sym) = 0;
1193 // OBSOLETE switch (entry->rec_type)
1195 // OBSOLETE case dst_typ_var:
1196 // OBSOLETE switch (loc_type)
1198 // OBSOLETE case dst_var_loc_abs:
1199 // OBSOLETE SYMBOL_VALUE_ADDRESS (sym) = loc_value;
1201 // OBSOLETE case dst_var_loc_sect_off:
1202 // OBSOLETE case dst_var_loc_ind_sect_off: /* What is this? */
1203 // OBSOLETE SYMBOL_VALUE_ADDRESS (sym) = dst_get_addr (
1204 // OBSOLETE loc_index,
1205 // OBSOLETE loc_value);
1207 // OBSOLETE case dst_var_loc_ind_reg_rel: /* What is this? */
1208 // OBSOLETE case dst_var_loc_reg_rel:
1209 // OBSOLETE /* If it isn't fp relative, specify the
1210 // OBSOLETE * register it's relative to.
1212 // OBSOLETE if (loc_index)
1214 // OBSOLETE sym->aux_value.basereg = loc_index;
1216 // OBSOLETE SYMBOL_VALUE (sym) = loc_value;
1217 // OBSOLETE if (loc_value > 0 &&
1218 // OBSOLETE SYMBOL_CLASS (sym) == LOC_BASEREG)
1219 // OBSOLETE SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
1221 // OBSOLETE case dst_var_loc_reg:
1222 // OBSOLETE SYMBOL_VALUE (sym) = loc_index;
1223 // OBSOLETE SYMBOL_CLASS (sym) = LOC_REGISTER;
1227 // OBSOLETE case dst_typ_variable:
1228 // OBSOLETE /* External variable..... don't try to interpret
1229 // OBSOLETE * its nonexistant locstring.
1231 // OBSOLETE if (DST_variable (entry).loffset == -1)
1232 // OBSOLETE continue;
1233 // OBSOLETE decode_dst_locstring (DST_OFFSET (entry,
1234 // OBSOLETE DST_variable (entry).loffset),
1237 // OBSOLETE element = (struct symbol_list *)
1238 // OBSOLETE xmalloc (sizeof (struct symbol_list));
1240 // OBSOLETE if (attr & (1 << dst_var_attr_global))
1242 // OBSOLETE element->next = dst_global_symbols;
1243 // OBSOLETE dst_global_symbols = element;
1244 // OBSOLETE total_globals++;
1248 // OBSOLETE element->next = list;
1249 // OBSOLETE list = element;
1250 // OBSOLETE nsyms++;
1252 // OBSOLETE element->symbol = sym;
1254 // OBSOLETE *nsyms_ret = nsyms;
1255 // OBSOLETE return list;
1259 // OBSOLETE static struct symbol *
1260 // OBSOLETE process_dst_function (struct objfile *objfile, dst_rec_ptr_t entry, char *name,
1261 // OBSOLETE CORE_ADDR address)
1263 // OBSOLETE struct symbol *sym;
1264 // OBSOLETE struct type *type, *ftype;
1265 // OBSOLETE dst_rec_ptr_t sym_entry, typ_entry;
1266 // OBSOLETE char *location;
1267 // OBSOLETE struct symbol_list *element;
1269 // OBSOLETE type = builtin_type_int;
1270 // OBSOLETE sym = create_new_symbol (objfile, name);
1271 // OBSOLETE SYMBOL_CLASS (sym) = LOC_BLOCK;
1273 // OBSOLETE if (entry)
1275 // OBSOLETE location = (char *) entry;
1278 // OBSOLETE NEXT_SYM (&location, &sym_entry);
1280 // OBSOLETE while (sym_entry && sym_entry->rec_type != dst_typ_signature);
1282 // OBSOLETE if (sym_entry)
1284 // OBSOLETE SYMBOL_LINE (sym) =
1285 // OBSOLETE DST_signature (sym_entry).src_loc.line_number;
1286 // OBSOLETE if (DST_signature (sym_entry).result)
1288 // OBSOLETE typ_entry = (dst_rec_ptr_t)
1289 // OBSOLETE DST_OFFSET (sym_entry,
1290 // OBSOLETE DST_signature (sym_entry).result);
1291 // OBSOLETE type = decode_dst_type (objfile, typ_entry);
1296 // OBSOLETE if (!type->function_type)
1298 // OBSOLETE ftype = alloc_type (objfile);
1299 // OBSOLETE type->function_type = ftype;
1300 // OBSOLETE TYPE_TARGET_TYPE (ftype) = type;
1301 // OBSOLETE TYPE_CODE (ftype) = TYPE_CODE_FUNC;
1303 // OBSOLETE SYMBOL_TYPE (sym) = type->function_type;
1305 // OBSOLETE /* Now add ourselves to the global symbols list */
1306 // OBSOLETE element = (struct symbol_list *)
1307 // OBSOLETE xmalloc (sizeof (struct symbol_list));
1309 // OBSOLETE element->next = dst_global_symbols;
1310 // OBSOLETE dst_global_symbols = element;
1311 // OBSOLETE total_globals++;
1312 // OBSOLETE element->symbol = sym;
1314 // OBSOLETE return sym;
1317 // OBSOLETE static struct block *
1318 // OBSOLETE process_dst_block (struct objfile *objfile, dst_rec_ptr_t entry)
1320 // OBSOLETE struct block *block;
1321 // OBSOLETE struct symbol *function = NULL;
1322 // OBSOLETE CORE_ADDR address;
1323 // OBSOLETE long size;
1324 // OBSOLETE char *name;
1325 // OBSOLETE dst_rec_ptr_t child_entry, symbol_entry;
1326 // OBSOLETE struct block *child_block;
1327 // OBSOLETE int total_symbols = 0;
1328 // OBSOLETE char fake_name[20];
1329 // OBSOLETE static long fake_seq = 0;
1330 // OBSOLETE struct symbol_list *symlist, *nextsym;
1331 // OBSOLETE int symnum;
1333 // OBSOLETE if (DST_block (entry).noffset)
1334 // OBSOLETE name = DST_OFFSET (entry, DST_block (entry).noffset);
1336 // OBSOLETE name = NULL;
1337 // OBSOLETE if (DST_block (entry).n_of_code_ranges)
1339 // OBSOLETE address = dst_sym_addr (
1340 // OBSOLETE &DST_block (entry).code_ranges[0].code_start);
1341 // OBSOLETE size = DST_block (entry).code_ranges[0].code_size;
1345 // OBSOLETE address = -1;
1346 // OBSOLETE size = 0;
1348 // OBSOLETE symbol_entry = (dst_rec_ptr_t) get_sec_ref (&DST_block (entry).symbols_start);
1349 // OBSOLETE switch (DST_block (entry).block_type)
1351 // OBSOLETE /* These are all really functions. Even the "program" type.
1352 // OBSOLETE * This is because the Apollo OS was written in Pascal, and
1353 // OBSOLETE * in Pascal, the main procedure is described as the Program.
1354 // OBSOLETE * Cute, huh?
1356 // OBSOLETE case dst_block_procedure:
1357 // OBSOLETE case dst_block_function:
1358 // OBSOLETE case dst_block_subroutine:
1359 // OBSOLETE case dst_block_program:
1360 // OBSOLETE prim_record_minimal_symbol (name, address, mst_text, objfile);
1361 // OBSOLETE function = process_dst_function (
1362 // OBSOLETE objfile,
1363 // OBSOLETE symbol_entry,
1365 // OBSOLETE address);
1366 // OBSOLETE enter_all_lines (get_sec_ref (&DST_block (entry).code_ranges[0].lines_start), address);
1368 // OBSOLETE case dst_block_block_data:
1371 // OBSOLETE default:
1372 // OBSOLETE /* GDB has to call it something, and the module name
1373 // OBSOLETE * won't cut it
1375 // OBSOLETE sprintf (fake_name, "block_%08lx", fake_seq++);
1376 // OBSOLETE function = process_dst_function (
1377 // OBSOLETE objfile, NULL, fake_name, address);
1380 // OBSOLETE symlist = process_dst_symbols (objfile, symbol_entry,
1381 // OBSOLETE name, &total_symbols);
1382 // OBSOLETE block = (struct block *)
1383 // OBSOLETE obstack_alloc (&objfile->symbol_obstack,
1384 // OBSOLETE sizeof (struct block) +
1385 // OBSOLETE (total_symbols - 1) * sizeof (struct symbol *));
1387 // OBSOLETE symnum = 0;
1388 // OBSOLETE while (symlist)
1390 // OBSOLETE nextsym = symlist->next;
1392 // OBSOLETE block->sym[symnum] = symlist->symbol;
1394 // OBSOLETE xfree (symlist);
1395 // OBSOLETE symlist = nextsym;
1396 // OBSOLETE symnum++;
1398 // OBSOLETE BLOCK_NSYMS (block) = total_symbols;
1399 // OBSOLETE BLOCK_HASHTABLE (block) = 0;
1400 // OBSOLETE BLOCK_START (block) = address;
1401 // OBSOLETE BLOCK_END (block) = address + size;
1402 // OBSOLETE BLOCK_SUPERBLOCK (block) = 0;
1403 // OBSOLETE if (function)
1405 // OBSOLETE SYMBOL_BLOCK_VALUE (function) = block;
1406 // OBSOLETE BLOCK_FUNCTION (block) = function;
1409 // OBSOLETE BLOCK_FUNCTION (block) = 0;
1411 // OBSOLETE if (DST_block (entry).child_block_off)
1413 // OBSOLETE child_entry = (dst_rec_ptr_t) DST_OFFSET (entry,
1414 // OBSOLETE DST_block (entry).child_block_off);
1415 // OBSOLETE while (child_entry)
1417 // OBSOLETE child_block = process_dst_block (objfile, child_entry);
1418 // OBSOLETE if (child_block)
1420 // OBSOLETE if (BLOCK_START (child_block) <
1421 // OBSOLETE BLOCK_START (block) ||
1422 // OBSOLETE BLOCK_START (block) == -1)
1423 // OBSOLETE BLOCK_START (block) =
1424 // OBSOLETE BLOCK_START (child_block);
1425 // OBSOLETE if (BLOCK_END (child_block) >
1426 // OBSOLETE BLOCK_END (block) ||
1427 // OBSOLETE BLOCK_END (block) == -1)
1428 // OBSOLETE BLOCK_END (block) =
1429 // OBSOLETE BLOCK_END (child_block);
1430 // OBSOLETE BLOCK_SUPERBLOCK (child_block) = block;
1432 // OBSOLETE if (DST_block (child_entry).sibling_block_off)
1433 // OBSOLETE child_entry = (dst_rec_ptr_t) DST_OFFSET (
1434 // OBSOLETE child_entry,
1435 // OBSOLETE DST_block (child_entry).sibling_block_off);
1437 // OBSOLETE child_entry = NULL;
1440 // OBSOLETE record_pending_block (objfile, block, NULL);
1441 // OBSOLETE return block;
1445 // OBSOLETE static void
1446 // OBSOLETE read_dst_symtab (struct objfile *objfile)
1448 // OBSOLETE char *buffer;
1449 // OBSOLETE dst_rec_ptr_t entry, file_table, root_block;
1450 // OBSOLETE char *source_file;
1451 // OBSOLETE struct block *block, *global_block;
1452 // OBSOLETE int symnum;
1453 // OBSOLETE struct symbol_list *nextsym;
1454 // OBSOLETE int module_num = 0;
1455 // OBSOLETE struct structure_list *element;
1457 // OBSOLETE current_objfile = objfile;
1458 // OBSOLETE buffer = blocks_info.buffer;
1459 // OBSOLETE while (NEXT_BLK (&buffer, &entry))
1461 // OBSOLETE if (entry->rec_type == dst_typ_comp_unit)
1463 // OBSOLETE file_table = (dst_rec_ptr_t) DST_OFFSET (entry,
1464 // OBSOLETE DST_comp_unit (entry).file_table);
1465 // OBSOLETE section_table = (dst_rec_ptr_t) DST_OFFSET (entry,
1466 // OBSOLETE DST_comp_unit (entry).section_table);
1467 // OBSOLETE root_block = (dst_rec_ptr_t) DST_OFFSET (entry,
1468 // OBSOLETE DST_comp_unit (entry).root_block_offset);
1469 // OBSOLETE source_file = DST_OFFSET (file_table,
1470 // OBSOLETE DST_file_tab (file_table).files[0].noffset);
1471 // OBSOLETE /* Point buffer to the start of the next comp_unit */
1472 // OBSOLETE buffer = DST_OFFSET (entry,
1473 // OBSOLETE DST_comp_unit (entry).data_size);
1474 // OBSOLETE dst_start_symtab ();
1476 // OBSOLETE block = process_dst_block (objfile, root_block);
1478 // OBSOLETE global_block = (struct block *)
1479 // OBSOLETE obstack_alloc (&objfile->symbol_obstack,
1480 // OBSOLETE sizeof (struct block) +
1481 // OBSOLETE (total_globals - 1) *
1482 // OBSOLETE sizeof (struct symbol *));
1483 // OBSOLETE BLOCK_NSYMS (global_block) = total_globals;
1484 // OBSOLETE BLOCK_HASHTABLE (global_block) = 0;
1485 // OBSOLETE for (symnum = 0; symnum < total_globals; symnum++)
1487 // OBSOLETE nextsym = dst_global_symbols->next;
1489 // OBSOLETE global_block->sym[symnum] =
1490 // OBSOLETE dst_global_symbols->symbol;
1492 // OBSOLETE xfree (dst_global_symbols);
1493 // OBSOLETE dst_global_symbols = nextsym;
1495 // OBSOLETE dst_global_symbols = NULL;
1496 // OBSOLETE total_globals = 0;
1497 // OBSOLETE BLOCK_FUNCTION (global_block) = 0;
1498 // OBSOLETE BLOCK_START (global_block) = BLOCK_START (block);
1499 // OBSOLETE BLOCK_END (global_block) = BLOCK_END (block);
1500 // OBSOLETE BLOCK_SUPERBLOCK (global_block) = 0;
1501 // OBSOLETE BLOCK_SUPERBLOCK (block) = global_block;
1502 // OBSOLETE record_pending_block (objfile, global_block, NULL);
1504 // OBSOLETE complete_symtab (source_file,
1505 // OBSOLETE BLOCK_START (block),
1506 // OBSOLETE BLOCK_END (block) - BLOCK_START (block));
1507 // OBSOLETE module_num++;
1508 // OBSOLETE dst_end_symtab (objfile);
1511 // OBSOLETE if (module_num)
1512 // OBSOLETE prim_record_minimal_symbol ("<end_of_program>",
1513 // OBSOLETE BLOCK_END (block), mst_text, objfile);
1514 // OBSOLETE /* One more faked symbol to make sure nothing can ever run off the
1515 // OBSOLETE * end of the symbol table. This one represents the end of the
1516 // OBSOLETE * text space. It used to be (CORE_ADDR) -1 (effectively the highest
1517 // OBSOLETE * int possible), but some parts of gdb treated it as a signed
1518 // OBSOLETE * number and failed comparisons. We could equally use 7fffffff,
1519 // OBSOLETE * but no functions are ever mapped to an address higher than
1520 // OBSOLETE * 40000000
1522 // OBSOLETE prim_record_minimal_symbol ("<end_of_text>",
1523 // OBSOLETE (CORE_ADDR) 0x40000000,
1524 // OBSOLETE mst_text, objfile);
1525 // OBSOLETE while (struct_list)
1527 // OBSOLETE element = struct_list;
1528 // OBSOLETE struct_list = element->next;
1529 // OBSOLETE xfree (element);
1534 // OBSOLETE /* Support for line number handling */
1535 // OBSOLETE static char *linetab = NULL;
1536 // OBSOLETE static long linetab_offset;
1537 // OBSOLETE static unsigned long linetab_size;
1539 // OBSOLETE /* Read in all the line numbers for fast lookups later. Leave them in
1540 // OBSOLETE external (unswapped) format in memory; we'll swap them as we enter
1541 // OBSOLETE them into GDB's data structures. */
1542 // OBSOLETE static int
1543 // OBSOLETE init_one_section (int chan, dst_sec *secinfo)
1545 // OBSOLETE if (secinfo->size == 0
1546 // OBSOLETE || lseek (chan, secinfo->position, 0) == -1
1547 // OBSOLETE || (secinfo->buffer = xmalloc (secinfo->size)) == NULL
1548 // OBSOLETE || myread (chan, secinfo->buffer, secinfo->size) == -1)
1549 // OBSOLETE return 0;
1551 // OBSOLETE return 1;
1554 // OBSOLETE static int
1555 // OBSOLETE init_dst_sections (int chan)
1558 // OBSOLETE if (!init_one_section (chan, &blocks_info) ||
1559 // OBSOLETE !init_one_section (chan, &lines_info) ||
1560 // OBSOLETE !init_one_section (chan, &symbols_info))
1561 // OBSOLETE return -1;
1563 // OBSOLETE return 0;
1566 // OBSOLETE /* Fake up support for relocating symbol addresses. FIXME. */
1568 // OBSOLETE struct section_offsets dst_symfile_faker =
1572 // OBSOLETE dst_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
1574 // OBSOLETE objfile->num_sections = 1;
1575 // OBSOLETE objfile->section_offsets = &dst_symfile_faker;
1578 // OBSOLETE /* Register our ability to parse symbols for DST BFD files */
1580 // OBSOLETE static struct sym_fns dst_sym_fns =
1582 // OBSOLETE /* FIXME: Can this be integrated with coffread.c? If not, should it be
1583 // OBSOLETE a separate flavour like ecoff? */
1584 // OBSOLETE (enum bfd_flavour) -2,
1586 // OBSOLETE dst_new_init, /* sym_new_init: init anything gbl to entire symtab */
1587 // OBSOLETE dst_symfile_init, /* sym_init: read initial info, setup for sym_read() */
1588 // OBSOLETE dst_symfile_read, /* sym_read: read a symbol file into symtab */
1589 // OBSOLETE dst_symfile_finish, /* sym_finish: finished with file, cleanup */
1590 // OBSOLETE dst_symfile_offsets, /* sym_offsets: xlate external to internal form */
1591 // OBSOLETE NULL /* next: pointer to next struct sym_fns */
1595 // OBSOLETE _initialize_dstread (void)
1597 // OBSOLETE add_symtab_fns (&dst_sym_fns);
This page took 0.060668 seconds and 4 git commands to generate.