OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.3/] [gdb/] [dstread.c] - Blame information for rev 1767

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1181 sfurman
// 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.
5
// OBSOLETE 
6
// OBSOLETE    This file is part of GDB.
7
// OBSOLETE 
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.
12
// OBSOLETE 
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.
17
// OBSOLETE 
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.  */
22
// OBSOLETE 
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"
32
// OBSOLETE 
33
// OBSOLETE #include "gdb_string.h"
34
// OBSOLETE 
35
// OBSOLETE #include "dst.h"
36
// OBSOLETE 
37
// OBSOLETE CORE_ADDR cur_src_start_addr, cur_src_end_addr;
38
// OBSOLETE dst_sec blocks_info, lines_info, symbols_info;
39
// OBSOLETE 
40
// OBSOLETE /* Vector of line number information.  */
41
// OBSOLETE 
42
// OBSOLETE static struct linetable *line_vector;
43
// OBSOLETE 
44
// OBSOLETE /* Index of next entry to go in line_vector_index.  */
45
// OBSOLETE 
46
// OBSOLETE static int line_vector_index;
47
// OBSOLETE 
48
// OBSOLETE /* Last line number recorded in the line vector.  */
49
// OBSOLETE 
50
// OBSOLETE static int prev_line_number;
51
// OBSOLETE 
52
// OBSOLETE /* Number of elements allocated for line_vector currently.  */
53
// OBSOLETE 
54
// OBSOLETE static int line_vector_length;
55
// OBSOLETE 
56
// OBSOLETE static int init_dst_sections (int);
57
// OBSOLETE 
58
// OBSOLETE static void read_dst_symtab (struct objfile *);
59
// OBSOLETE 
60
// OBSOLETE static void find_dst_sections (bfd *, sec_ptr, PTR);
61
// OBSOLETE 
62
// OBSOLETE static void dst_symfile_init (struct objfile *);
63
// OBSOLETE 
64
// OBSOLETE static void dst_new_init (struct objfile *);
65
// OBSOLETE 
66
// OBSOLETE static void dst_symfile_read (struct objfile *, int);
67
// OBSOLETE 
68
// OBSOLETE static void dst_symfile_finish (struct objfile *);
69
// OBSOLETE 
70
// OBSOLETE static void dst_end_symtab (struct objfile *);
71
// OBSOLETE 
72
// OBSOLETE static void complete_symtab (char *, CORE_ADDR, unsigned int);
73
// OBSOLETE 
74
// OBSOLETE static void dst_start_symtab (void);
75
// OBSOLETE 
76
// OBSOLETE static void dst_record_line (int, CORE_ADDR);
77
// OBSOLETE 
78
// OBSOLETE /* Manage the vector of line numbers.  */
79
// OBSOLETE /* FIXME: Use record_line instead.  */
80
// OBSOLETE 
81
// OBSOLETE static void
82
// OBSOLETE dst_record_line (int line, CORE_ADDR pc)
83
// OBSOLETE {
84
// OBSOLETE   struct linetable_entry *e;
85
// OBSOLETE   /* Make sure line vector is big enough.  */
86
// OBSOLETE 
87
// OBSOLETE   if (line_vector_index + 2 >= line_vector_length)
88
// OBSOLETE     {
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)));
94
// OBSOLETE     }
95
// OBSOLETE 
96
// OBSOLETE   e = line_vector->item + line_vector_index++;
97
// OBSOLETE   e->line = line;
98
// OBSOLETE   e->pc = pc;
99
// OBSOLETE }
100
// OBSOLETE 
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.  */
104
// OBSOLETE 
105
// OBSOLETE static void
106
// OBSOLETE dst_start_symtab (void)
107
// OBSOLETE {
108
// OBSOLETE   /* Initialize the source file line number information for this file.  */
109
// OBSOLETE 
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));
118
// OBSOLETE }
119
// OBSOLETE 
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.  */
124
// OBSOLETE 
125
// OBSOLETE static void
126
// OBSOLETE complete_symtab (char *name, CORE_ADDR start_addr, unsigned int size)
127
// OBSOLETE {
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;
131
// OBSOLETE 
132
// OBSOLETE   if (current_objfile->ei.entry_point >= cur_src_start_addr &&
133
// OBSOLETE       current_objfile->ei.entry_point < cur_src_end_addr)
134
// OBSOLETE     {
135
// OBSOLETE       current_objfile->ei.entry_file_lowpc = cur_src_start_addr;
136
// OBSOLETE       current_objfile->ei.entry_file_highpc = cur_src_end_addr;
137
// OBSOLETE     }
138
// OBSOLETE }
139
// OBSOLETE 
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.  */
145
// OBSOLETE 
146
// OBSOLETE static void
147
// OBSOLETE dst_end_symtab (struct objfile *objfile)
148
// OBSOLETE {
149
// OBSOLETE   register struct symtab *symtab;
150
// OBSOLETE   register struct blockvector *blockvector;
151
// OBSOLETE   register struct linetable *lv;
152
// OBSOLETE 
153
// OBSOLETE   /* Create the blockvector that points to all the file's blocks.  */
154
// OBSOLETE 
155
// OBSOLETE   blockvector = make_blockvector (objfile);
156
// OBSOLETE 
157
// OBSOLETE   /* Now create the symtab object for this source file.  */
158
// OBSOLETE   symtab = allocate_symtab (last_source_file, objfile);
159
// OBSOLETE 
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)));
173
// OBSOLETE 
174
// OBSOLETE   free_named_symtabs (symtab->filename);
175
// OBSOLETE 
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;
180
// OBSOLETE }
181
// OBSOLETE 
182
// OBSOLETE /* dst_symfile_init ()
183
// OBSOLETE    is the dst-specific initialization routine for reading symbols.
184
// OBSOLETE 
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.
188
// OBSOLETE 
189
// OBSOLETE    The ultimate result is a new symtab (or, FIXME, eventually a psymtab).  */
190
// OBSOLETE 
191
// OBSOLETE static void
192
// OBSOLETE dst_symfile_init (struct objfile *objfile)
193
// OBSOLETE {
194
// OBSOLETE   asection *section;
195
// OBSOLETE   bfd *abfd = objfile->obfd;
196
// OBSOLETE 
197
// OBSOLETE   init_entry_point_info (objfile);
198
// OBSOLETE 
199
// OBSOLETE }
200
// OBSOLETE 
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.  */
204
// OBSOLETE 
205
// OBSOLETE /* ARGSUSED */
206
// OBSOLETE static void
207
// OBSOLETE find_dst_sections (bfd *abfd, sec_ptr asect, PTR vpinfo)
208
// OBSOLETE {
209
// OBSOLETE   int size, count;
210
// OBSOLETE   long base;
211
// OBSOLETE   file_ptr offset, maxoff;
212
// OBSOLETE   dst_sec *section;
213
// OBSOLETE 
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 */
219
// OBSOLETE 
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)
228
// OBSOLETE     return;
229
// OBSOLETE   section->size = size;
230
// OBSOLETE   section->position = offset;
231
// OBSOLETE   section->base = base;
232
// OBSOLETE }
233
// OBSOLETE 
234
// OBSOLETE 
235
// OBSOLETE /* The BFD for this file -- only good while we're actively reading
236
// OBSOLETE    symbols into a psymtab or a symtab.  */
237
// OBSOLETE 
238
// OBSOLETE static bfd *symfile_bfd;
239
// OBSOLETE 
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!  */
243
// OBSOLETE 
244
// OBSOLETE /* ARGSUSED */
245
// OBSOLETE static void
246
// OBSOLETE dst_symfile_read (struct objfile *objfile, int mainline)
247
// OBSOLETE {
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;
255
// OBSOLETE 
256
// OBSOLETE   symfile_bfd = abfd;               /* Kludge for swap routines */
257
// OBSOLETE 
258
// OBSOLETE /* WARNING WILL ROBINSON!  ACCESSING BFD-PRIVATE DATA HERE!  FIXME!  */
259
// OBSOLETE   desc = fileno ((FILE *) (abfd->iostream));        /* File descriptor */
260
// OBSOLETE 
261
// OBSOLETE   /* Read the line number table, all at once.  */
262
// OBSOLETE   bfd_map_over_sections (abfd, find_dst_sections, (PTR) NULL);
263
// OBSOLETE 
264
// OBSOLETE   val = init_dst_sections (desc);
265
// OBSOLETE   if (val < 0)
266
// OBSOLETE     error ("\"%s\": error reading debugging symbol tables\n", name);
267
// OBSOLETE 
268
// OBSOLETE   init_minimal_symbol_collection ();
269
// OBSOLETE   make_cleanup_discard_minimal_symbols ();
270
// OBSOLETE 
271
// OBSOLETE   /* Now that the executable file is positioned at symbol table,
272
// OBSOLETE      process it and define symbols accordingly.  */
273
// OBSOLETE 
274
// OBSOLETE   read_dst_symtab (objfile);
275
// OBSOLETE 
276
// OBSOLETE   /* Sort symbols alphabetically within each block.  */
277
// OBSOLETE 
278
// OBSOLETE   {
279
// OBSOLETE     struct symtab *s;
280
// OBSOLETE     for (s = objfile->symtabs; s != NULL; s = s->next)
281
// OBSOLETE       {
282
// OBSOLETE     sort_symtab_syms (s);
283
// OBSOLETE       }
284
// OBSOLETE   }
285
// OBSOLETE 
286
// OBSOLETE   /* Install any minimal symbols that have been collected as the current
287
// OBSOLETE      minimal symbols for this objfile. */
288
// OBSOLETE 
289
// OBSOLETE   install_minimal_symbols (objfile);
290
// OBSOLETE }
291
// OBSOLETE 
292
// OBSOLETE static void
293
// OBSOLETE dst_new_init (struct objfile *ignore)
294
// OBSOLETE {
295
// OBSOLETE   /* Nothin' to do */
296
// OBSOLETE }
297
// OBSOLETE 
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. */
302
// OBSOLETE 
303
// OBSOLETE static void
304
// OBSOLETE dst_symfile_finish (struct objfile *objfile)
305
// OBSOLETE {
306
// OBSOLETE   /* Nothing to do */
307
// OBSOLETE }
308
// OBSOLETE 
309
// OBSOLETE 
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.
312
// OBSOLETE  *
313
// OBSOLETE  * Note that ordinary pc deltas are multiplied by two. Apparently
314
// OBSOLETE  * this is what was really intended.
315
// OBSOLETE  */
316
// OBSOLETE static int
317
// OBSOLETE get_dst_line (signed char **buffer, long *pc)
318
// OBSOLETE {
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;
325
// OBSOLETE 
326
// OBSOLETE   if (*pc != -1)
327
// OBSOLETE     {
328
// OBSOLETE       last_pc = *pc;
329
// OBSOLETE       *pc = -1;
330
// OBSOLETE     }
331
// OBSOLETE   entry = (dst_ln_entry_ptr_t) * buffer;
332
// OBSOLETE 
333
// OBSOLETE   while (dst_ln_ln_delta (*entry) == dst_ln_escape_flag)
334
// OBSOLETE     {
335
// OBSOLETE       switch (entry->esc.esc_code)
336
// OBSOLETE     {
337
// OBSOLETE     case dst_ln_pad:
338
// OBSOLETE       size = 1;             /* pad byte */
339
// OBSOLETE       break;
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;
346
// OBSOLETE       break;
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;
353
// OBSOLETE       break;
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);
360
// OBSOLETE       break;
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);
367
// OBSOLETE       break;
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];
372
// OBSOLETE       break;
373
// OBSOLETE     case dst_ln_ln_off_1:
374
// OBSOLETE       /* statement escape, stmt # = 1 (2nd stmt on line) */
375
// OBSOLETE       size = 1;
376
// OBSOLETE       break;
377
// OBSOLETE     case dst_ln_ln_off:
378
// OBSOLETE       /* statement escape, stmt # = next byte */
379
// OBSOLETE       size = 2;
380
// OBSOLETE       break;
381
// OBSOLETE     case dst_ln_entry:
382
// OBSOLETE       /* entry escape, next byte is entry number */
383
// OBSOLETE       size = 2;
384
// OBSOLETE       break;
385
// OBSOLETE     case dst_ln_exit:
386
// OBSOLETE       /* exit escape */
387
// OBSOLETE       size = 1;
388
// OBSOLETE       break;
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.
395
// OBSOLETE        */
396
// OBSOLETE       break;
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;
401
// OBSOLETE       break;
402
// OBSOLETE     case dst_ln_nxt_byte:
403
// OBSOLETE       /* This shouldn't happen. If it does, we're SOL */
404
// OBSOLETE       return 0;
405
// OBSOLETE       break;
406
// OBSOLETE     case dst_ln_end:
407
// OBSOLETE       /* end escape, final entry follows */
408
// OBSOLETE       return 0;
409
// OBSOLETE     }
410
// OBSOLETE       *buffer += (size < 0) ? -size : size;
411
// OBSOLETE       entry = (dst_ln_entry_ptr_t) * buffer;
412
// OBSOLETE     }
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;
418
// OBSOLETE }
419
// OBSOLETE 
420
// OBSOLETE static void
421
// OBSOLETE enter_all_lines (char *buffer, long address)
422
// OBSOLETE {
423
// OBSOLETE   if (buffer)
424
// OBSOLETE     while (get_dst_line (&buffer, &address));
425
// OBSOLETE }
426
// OBSOLETE 
427
// OBSOLETE static int
428
// OBSOLETE get_dst_entry (char *buffer, dst_rec_ptr_t *ret_entry)
429
// OBSOLETE {
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;
435
// OBSOLETE 
436
// OBSOLETE   entry = (dst_rec_ptr_t) buffer;
437
// OBSOLETE   switch (entry->rec_type)
438
// OBSOLETE     {
439
// OBSOLETE     case dst_typ_pad:
440
// OBSOLETE       size = 0;
441
// OBSOLETE       break;
442
// OBSOLETE     case dst_typ_comp_unit:
443
// OBSOLETE       size = sizeof (DST_comp_unit (entry));
444
// OBSOLETE       break;
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);
449
// OBSOLETE       break;
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);
454
// OBSOLETE       break;
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);
459
// OBSOLETE       break;
460
// OBSOLETE     case dst_typ_5:
461
// OBSOLETE       size = -1;
462
// OBSOLETE       break;
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));
470
// OBSOLETE       break;
471
// OBSOLETE     case dst_typ_pointer:
472
// OBSOLETE       size = sizeof (DST_pointer (entry));
473
// OBSOLETE       break;
474
// OBSOLETE     case dst_typ_array:
475
// OBSOLETE       size = sizeof (DST_array (entry));
476
// OBSOLETE       break;
477
// OBSOLETE     case dst_typ_subrange:
478
// OBSOLETE       size = sizeof (DST_subrange (entry));
479
// OBSOLETE       break;
480
// OBSOLETE     case dst_typ_set:
481
// OBSOLETE       size = sizeof (DST_set (entry));
482
// OBSOLETE       break;
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);
487
// OBSOLETE       break;
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);
492
// OBSOLETE       break;
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);
497
// OBSOLETE       break;
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);
502
// OBSOLETE       break;
503
// OBSOLETE     case dst_typ_file:
504
// OBSOLETE       size = sizeof (DST_file (entry));
505
// OBSOLETE       break;
506
// OBSOLETE     case dst_typ_offset:
507
// OBSOLETE       size = sizeof (DST_offset (entry));
508
// OBSOLETE       break;
509
// OBSOLETE     case dst_typ_alias:
510
// OBSOLETE       size = sizeof (DST_alias (entry));
511
// OBSOLETE       break;
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);
516
// OBSOLETE       break;
517
// OBSOLETE     case dst_typ_21:
518
// OBSOLETE       size = -1;
519
// OBSOLETE       break;
520
// OBSOLETE     case dst_typ_old_label:
521
// OBSOLETE       size = sizeof (DST_old_label (entry));
522
// OBSOLETE       break;
523
// OBSOLETE     case dst_typ_scope:
524
// OBSOLETE       size = sizeof (DST_scope (entry));
525
// OBSOLETE       break;
526
// OBSOLETE     case dst_typ_end_scope:
527
// OBSOLETE       size = 0;
528
// OBSOLETE       break;
529
// OBSOLETE     case dst_typ_25:
530
// OBSOLETE     case dst_typ_26:
531
// OBSOLETE       size = -1;
532
// OBSOLETE       break;
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;
538
// OBSOLETE       break;
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);
542
// OBSOLETE       break;
543
// OBSOLETE     case dst_typ_aux_size:
544
// OBSOLETE       size = sizeof (DST_aux_size (entry));
545
// OBSOLETE       break;
546
// OBSOLETE     case dst_typ_aux_align:
547
// OBSOLETE       size = sizeof (DST_aux_align (entry));
548
// OBSOLETE       break;
549
// OBSOLETE     case dst_typ_aux_field_size:
550
// OBSOLETE       size = sizeof (DST_aux_field_size (entry));
551
// OBSOLETE       break;
552
// OBSOLETE     case dst_typ_aux_field_off:
553
// OBSOLETE       size = sizeof (DST_aux_field_off (entry));
554
// OBSOLETE       break;
555
// OBSOLETE     case dst_typ_aux_field_align:
556
// OBSOLETE       size = sizeof (DST_aux_field_align (entry));
557
// OBSOLETE       break;
558
// OBSOLETE     case dst_typ_aux_qual:
559
// OBSOLETE       size = sizeof (DST_aux_qual (entry));
560
// OBSOLETE       break;
561
// OBSOLETE     case dst_typ_aux_var_bound:
562
// OBSOLETE       size = sizeof (DST_aux_var_bound (entry));
563
// OBSOLETE       break;
564
// OBSOLETE     case dst_typ_extension:
565
// OBSOLETE       size = DST_extension (entry).rec_size;
566
// OBSOLETE       break;
567
// OBSOLETE     case dst_typ_string:
568
// OBSOLETE       size = sizeof (DST_string (entry));
569
// OBSOLETE       break;
570
// OBSOLETE     case dst_typ_old_entry:
571
// OBSOLETE       size = 48;            /* Obsolete entry type */
572
// OBSOLETE       break;
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);
577
// OBSOLETE       break;
578
// OBSOLETE     case dst_typ_reference:
579
// OBSOLETE       size = sizeof (DST_reference (entry));
580
// OBSOLETE       break;
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);
588
// OBSOLETE       break;
589
// OBSOLETE     case dst_typ_aux_type_deriv:
590
// OBSOLETE       size = sizeof (DST_aux_type_deriv (entry));
591
// OBSOLETE       break;
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);
596
// OBSOLETE       break;
597
// OBSOLETE     case dst_typ_variable:
598
// OBSOLETE       size = sizeof (DST_variable (entry));
599
// OBSOLETE       break;
600
// OBSOLETE     case dst_typ_label:
601
// OBSOLETE       size = sizeof (DST_label (entry));
602
// OBSOLETE       break;
603
// OBSOLETE     case dst_typ_entry:
604
// OBSOLETE       size = sizeof (DST_entry (entry));
605
// OBSOLETE       break;
606
// OBSOLETE     case dst_typ_aux_lifetime:
607
// OBSOLETE       size = sizeof (DST_aux_lifetime (entry));
608
// OBSOLETE       break;
609
// OBSOLETE     case dst_typ_aux_ptr_base:
610
// OBSOLETE       size = sizeof (DST_aux_ptr_base (entry));
611
// OBSOLETE       break;
612
// OBSOLETE     case dst_typ_aux_src_range:
613
// OBSOLETE       size = sizeof (DST_aux_src_range (entry));
614
// OBSOLETE       break;
615
// OBSOLETE     case dst_typ_aux_reg_val:
616
// OBSOLETE       size = sizeof (DST_aux_reg_val (entry));
617
// OBSOLETE       break;
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);
622
// OBSOLETE       break;
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);
627
// OBSOLETE       break;
628
// OBSOLETE     default:
629
// OBSOLETE       size = -1;
630
// OBSOLETE       break;
631
// OBSOLETE     }
632
// OBSOLETE   if (size == -1)
633
// OBSOLETE     {
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;
639
// OBSOLETE     }
640
// OBSOLETE   else
641
// OBSOLETE     last_type = entry->rec_type;
642
// OBSOLETE   if (size & 1)                     /* Align on a word boundary */
643
// OBSOLETE     size++;
644
// OBSOLETE   size += 2;
645
// OBSOLETE   *ret_entry = entry;
646
// OBSOLETE   return size;
647
// OBSOLETE }
648
// OBSOLETE 
649
// OBSOLETE static int
650
// OBSOLETE next_dst_entry (char **buffer, dst_rec_ptr_t *entry, dst_sec *table)
651
// OBSOLETE {
652
// OBSOLETE   if (*buffer - table->buffer >= table->size)
653
// OBSOLETE     {
654
// OBSOLETE       *entry = NULL;
655
// OBSOLETE       return 0;
656
// OBSOLETE     }
657
// OBSOLETE   *buffer += get_dst_entry (*buffer, entry);
658
// OBSOLETE   return 1;
659
// OBSOLETE }
660
// OBSOLETE 
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))
664
// OBSOLETE 
665
// OBSOLETE static dst_rec_ptr_t section_table = NULL;
666
// OBSOLETE 
667
// OBSOLETE char *
668
// OBSOLETE get_sec_ref (dst_sect_ref_t *ref)
669
// OBSOLETE {
670
// OBSOLETE   dst_sec *section = NULL;
671
// OBSOLETE   long offset;
672
// OBSOLETE 
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);
689
// OBSOLETE }
690
// OBSOLETE 
691
// OBSOLETE CORE_ADDR
692
// OBSOLETE dst_get_addr (int section, long offset)
693
// OBSOLETE {
694
// OBSOLETE   if (!section_table || !section)
695
// OBSOLETE     return 0;
696
// OBSOLETE   return DST_section_tab (section_table).section_base[section - 1] + offset;
697
// OBSOLETE }
698
// OBSOLETE 
699
// OBSOLETE CORE_ADDR
700
// OBSOLETE dst_sym_addr (dst_sect_ref_t *ref)
701
// OBSOLETE {
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;
706
// OBSOLETE }
707
// OBSOLETE 
708
// OBSOLETE static struct symbol *
709
// OBSOLETE create_new_symbol (struct objfile *objfile, char *name)
710
// OBSOLETE {
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;
718
// OBSOLETE 
719
// OBSOLETE   SYMBOL_CLASS (sym) = LOC_BLOCK;
720
// OBSOLETE   return sym;
721
// OBSOLETE };
722
// OBSOLETE 
723
// OBSOLETE static struct type *decode_dst_type (struct objfile *, dst_rec_ptr_t);
724
// OBSOLETE 
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)
728
// OBSOLETE {
729
// OBSOLETE   struct type *type;
730
// OBSOLETE   dst_rec_ptr_t entry;
731
// OBSOLETE   if (type_desc->std_type.user_defined_type)
732
// OBSOLETE     {
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);
736
// OBSOLETE     }
737
// OBSOLETE   else
738
// OBSOLETE     {
739
// OBSOLETE       switch (type_desc->std_type.dtc)
740
// OBSOLETE     {
741
// OBSOLETE     case dst_int8_type:
742
// OBSOLETE       type = builtin_type_signed_char;
743
// OBSOLETE       break;
744
// OBSOLETE     case dst_int16_type:
745
// OBSOLETE       type = builtin_type_short;
746
// OBSOLETE       break;
747
// OBSOLETE     case dst_int32_type:
748
// OBSOLETE       type = builtin_type_long;
749
// OBSOLETE       break;
750
// OBSOLETE     case dst_uint8_type:
751
// OBSOLETE       type = builtin_type_unsigned_char;
752
// OBSOLETE       break;
753
// OBSOLETE     case dst_uint16_type:
754
// OBSOLETE       type = builtin_type_unsigned_short;
755
// OBSOLETE       break;
756
// OBSOLETE     case dst_uint32_type:
757
// OBSOLETE       type = builtin_type_unsigned_long;
758
// OBSOLETE       break;
759
// OBSOLETE     case dst_real32_type:
760
// OBSOLETE       type = builtin_type_float;
761
// OBSOLETE       break;
762
// OBSOLETE     case dst_real64_type:
763
// OBSOLETE       type = builtin_type_double;
764
// OBSOLETE       break;
765
// OBSOLETE     case dst_complex_type:
766
// OBSOLETE       type = builtin_type_complex;
767
// OBSOLETE       break;
768
// OBSOLETE     case dst_dcomplex_type:
769
// OBSOLETE       type = builtin_type_double_complex;
770
// OBSOLETE       break;
771
// OBSOLETE     case dst_bool8_type:
772
// OBSOLETE       type = builtin_type_char;
773
// OBSOLETE       break;
774
// OBSOLETE     case dst_bool16_type:
775
// OBSOLETE       type = builtin_type_short;
776
// OBSOLETE       break;
777
// OBSOLETE     case dst_bool32_type:
778
// OBSOLETE       type = builtin_type_long;
779
// OBSOLETE       break;
780
// OBSOLETE     case dst_char_type:
781
// OBSOLETE       type = builtin_type_char;
782
// OBSOLETE       break;
783
// OBSOLETE       /* The next few are more complex. I will take care
784
// OBSOLETE        * of them properly at a later point.
785
// OBSOLETE        */
786
// OBSOLETE     case dst_string_type:
787
// OBSOLETE       type = builtin_type_void;
788
// OBSOLETE       break;
789
// OBSOLETE     case dst_ptr_type:
790
// OBSOLETE       type = builtin_type_void;
791
// OBSOLETE       break;
792
// OBSOLETE     case dst_set_type:
793
// OBSOLETE       type = builtin_type_void;
794
// OBSOLETE       break;
795
// OBSOLETE     case dst_proc_type:
796
// OBSOLETE       type = builtin_type_void;
797
// OBSOLETE       break;
798
// OBSOLETE     case dst_func_type:
799
// OBSOLETE       type = builtin_type_void;
800
// OBSOLETE       break;
801
// OBSOLETE       /* Back tto some ordinary ones */
802
// OBSOLETE     case dst_void_type:
803
// OBSOLETE       type = builtin_type_void;
804
// OBSOLETE       break;
805
// OBSOLETE     case dst_uchar_type:
806
// OBSOLETE       type = builtin_type_unsigned_char;
807
// OBSOLETE       break;
808
// OBSOLETE     default:
809
// OBSOLETE       type = builtin_type_void;
810
// OBSOLETE       break;
811
// OBSOLETE     }
812
// OBSOLETE     }
813
// OBSOLETE   return type;
814
// OBSOLETE }
815
// OBSOLETE 
816
// OBSOLETE struct structure_list
817
// OBSOLETE {
818
// OBSOLETE   struct structure_list *next;
819
// OBSOLETE   struct type *type;
820
// OBSOLETE };
821
// OBSOLETE 
822
// OBSOLETE static struct structure_list *struct_list = NULL;
823
// OBSOLETE 
824
// OBSOLETE static struct type *
825
// OBSOLETE find_dst_structure (char *name)
826
// OBSOLETE {
827
// OBSOLETE   struct structure_list *element;
828
// OBSOLETE 
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;
833
// OBSOLETE }
834
// OBSOLETE 
835
// OBSOLETE 
836
// OBSOLETE static struct type *
837
// OBSOLETE decode_dst_structure (struct objfile *objfile, dst_rec_ptr_t entry, int code,
838
// OBSOLETE                   int version)
839
// OBSOLETE {
840
// OBSOLETE   struct type *type, *child_type;
841
// OBSOLETE   char *struct_name;
842
// OBSOLETE   char *name, *field_name;
843
// OBSOLETE   int i;
844
// OBSOLETE   int fieldoffset, fieldsize;
845
// OBSOLETE   dst_type_t type_desc;
846
// OBSOLETE   struct structure_list *element;
847
// OBSOLETE 
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)
853
// OBSOLETE     {
854
// OBSOLETE       xfree (name);
855
// OBSOLETE       return type;
856
// OBSOLETE     }
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++)
875
// OBSOLETE     {
876
// OBSOLETE       switch (version)
877
// OBSOLETE     {
878
// OBSOLETE     case 2:
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;
885
// OBSOLETE       break;
886
// OBSOLETE     case 1:
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)
891
// OBSOLETE         {
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;
896
// OBSOLETE           break;
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;
904
// OBSOLETE           break;
905
// OBSOLETE         case dst_field_loc:
906
// OBSOLETE           fieldoffset += fieldsize;
907
// OBSOLETE           fieldsize = -1;
908
// OBSOLETE           break;
909
// OBSOLETE         }
910
// OBSOLETE       break;
911
// OBSOLETE     case 0:
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;
918
// OBSOLETE       else
919
// OBSOLETE         fieldsize = DST_record (entry).size;
920
// OBSOLETE       fieldsize -= fieldoffset;
921
// OBSOLETE       fieldoffset *= 8;
922
// OBSOLETE       fieldsize *= 8;
923
// OBSOLETE     }
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,
929
// OBSOLETE                                                  entry);
930
// OBSOLETE       if (fieldsize == -1)
931
// OBSOLETE     fieldsize = TYPE_LENGTH (TYPE_FIELDS (type)[i].type) *
932
// OBSOLETE       8;
933
// OBSOLETE       TYPE_FIELDS (type)[i].bitsize = fieldsize;
934
// OBSOLETE       TYPE_FIELDS (type)[i].bitpos = fieldoffset;
935
// OBSOLETE     }
936
// OBSOLETE   return type;
937
// OBSOLETE }
938
// OBSOLETE 
939
// OBSOLETE static struct type *
940
// OBSOLETE decode_dst_type (struct objfile *objfile, dst_rec_ptr_t entry)
941
// OBSOLETE {
942
// OBSOLETE   struct type *child_type, *type, *range_type, *index_type;
943
// OBSOLETE 
944
// OBSOLETE   switch (entry->rec_type)
945
// OBSOLETE     {
946
// OBSOLETE     case dst_typ_var:
947
// OBSOLETE       return decode_type_desc (objfile,
948
// OBSOLETE                            &DST_var (entry).type_desc,
949
// OBSOLETE                            entry);
950
// OBSOLETE       break;
951
// OBSOLETE     case dst_typ_variable:
952
// OBSOLETE       return decode_type_desc (objfile,
953
// OBSOLETE                            &DST_variable (entry).type_desc,
954
// OBSOLETE                            entry);
955
// OBSOLETE       break;
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,
972
// OBSOLETE                                                entry),
973
// OBSOLETE                              NULL);
974
// OBSOLETE     case dst_typ_array:
975
// OBSOLETE       child_type = decode_type_desc (objfile,
976
// OBSOLETE                                  &DST_pointer (entry).type_desc,
977
// OBSOLETE                                  entry);
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,
988
// OBSOLETE                            entry);
989
// OBSOLETE     default:
990
// OBSOLETE       return builtin_type_int;
991
// OBSOLETE     }
992
// OBSOLETE }
993
// OBSOLETE 
994
// OBSOLETE struct symbol_list
995
// OBSOLETE {
996
// OBSOLETE   struct symbol_list *next;
997
// OBSOLETE   struct symbol *symbol;
998
// OBSOLETE };
999
// OBSOLETE 
1000
// OBSOLETE static struct symbol_list *dst_global_symbols = NULL;
1001
// OBSOLETE static int total_globals = 0;
1002
// OBSOLETE 
1003
// OBSOLETE static void
1004
// OBSOLETE decode_dst_locstring (char *locstr, struct symbol *sym)
1005
// OBSOLETE {
1006
// OBSOLETE   dst_loc_entry_t *entry, *next_entry;
1007
// OBSOLETE   CORE_ADDR temp;
1008
// OBSOLETE   int count = 0;
1009
// OBSOLETE 
1010
// OBSOLETE   while (1)
1011
// OBSOLETE     {
1012
// OBSOLETE       if (count++ == 100)
1013
// OBSOLETE     {
1014
// OBSOLETE       fprintf_unfiltered (gdb_stderr, "Error reading locstring\n");
1015
// OBSOLETE       break;
1016
// OBSOLETE     }
1017
// OBSOLETE       entry = (dst_loc_entry_t *) locstr;
1018
// OBSOLETE       next_entry = (dst_loc_entry_t *) (locstr + 1);
1019
// OBSOLETE       switch (entry->header.code)
1020
// OBSOLETE     {
1021
// OBSOLETE     case dst_lsc_end:       /* End of string */
1022
// OBSOLETE       return;
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)
1026
// OBSOLETE         {
1027
// OBSOLETE           SYMBOL_CLASS (sym) = LOC_REGISTER;
1028
// OBSOLETE           SYMBOL_VALUE (sym) = entry->header.arg + 8;
1029
// OBSOLETE         }
1030
// OBSOLETE       /* We predict indirects */
1031
// OBSOLETE       locstr++;
1032
// OBSOLETE       break;
1033
// OBSOLETE     case dst_lsc_dreg:
1034
// OBSOLETE       SYMBOL_CLASS (sym) = LOC_REGISTER;
1035
// OBSOLETE       SYMBOL_VALUE (sym) = entry->header.arg;
1036
// OBSOLETE       locstr++;
1037
// OBSOLETE       break;
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++;
1041
// OBSOLETE       break;
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;
1045
// OBSOLETE       break;
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)
1051
// OBSOLETE         {
1052
// OBSOLETE           temp <<= 8;
1053
// OBSOLETE           locstr++;
1054
// OBSOLETE         }
1055
// OBSOLETE       switch (entry->header.code)
1056
// OBSOLETE         {
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;
1061
// OBSOLETE           break;
1062
// OBSOLETE         case dst_lsc_sub:
1063
// OBSOLETE           SYMBOL_VALUE (sym) -= temp;
1064
// OBSOLETE           break;
1065
// OBSOLETE         }
1066
// OBSOLETE       break;
1067
// OBSOLETE     case dst_lsc_add_byte:
1068
// OBSOLETE     case dst_lsc_sub_byte:
1069
// OBSOLETE       switch (entry->header.arg & 0x03)
1070
// OBSOLETE         {
1071
// OBSOLETE         case 1:
1072
// OBSOLETE           temp = (unsigned char) locstr[1];
1073
// OBSOLETE           locstr += 2;
1074
// OBSOLETE           break;
1075
// OBSOLETE         case 2:
1076
// OBSOLETE           temp = *(unsigned short *) (locstr + 1);
1077
// OBSOLETE           locstr += 3;
1078
// OBSOLETE           break;
1079
// OBSOLETE         case 3:
1080
// OBSOLETE           temp = *(unsigned long *) (locstr + 1);
1081
// OBSOLETE           locstr += 5;
1082
// OBSOLETE           break;
1083
// OBSOLETE         }
1084
// OBSOLETE       if (*locstr == dst_multiply_256)
1085
// OBSOLETE         {
1086
// OBSOLETE           temp <<= 8;
1087
// OBSOLETE           locstr++;
1088
// OBSOLETE         }
1089
// OBSOLETE       switch (entry->header.code)
1090
// OBSOLETE         {
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;
1095
// OBSOLETE           break;
1096
// OBSOLETE         case dst_lsc_sub_byte:
1097
// OBSOLETE           SYMBOL_VALUE (sym) -= temp;
1098
// OBSOLETE           break;
1099
// OBSOLETE         }
1100
// OBSOLETE       break;
1101
// OBSOLETE     case dst_lsc_sbreg:     /* Stack base register (frame pointer). Arg==0 */
1102
// OBSOLETE       if (next_entry->header.code != dst_lsc_indirect)
1103
// OBSOLETE         {
1104
// OBSOLETE           SYMBOL_VALUE (sym) = 0;
1105
// OBSOLETE           SYMBOL_CLASS (sym) = LOC_STATIC;
1106
// OBSOLETE           return;
1107
// OBSOLETE         }
1108
// OBSOLETE       SYMBOL_VALUE (sym) = 0;
1109
// OBSOLETE       SYMBOL_CLASS (sym) = LOC_LOCAL;
1110
// OBSOLETE       locstr++;
1111
// OBSOLETE       break;
1112
// OBSOLETE     default:
1113
// OBSOLETE       SYMBOL_VALUE (sym) = 0;
1114
// OBSOLETE       SYMBOL_CLASS (sym) = LOC_STATIC;
1115
// OBSOLETE       return;
1116
// OBSOLETE     }
1117
// OBSOLETE     }
1118
// OBSOLETE }
1119
// OBSOLETE 
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)
1123
// OBSOLETE {
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;
1136
// OBSOLETE 
1137
// OBSOLETE   if (!entry)
1138
// OBSOLETE     {
1139
// OBSOLETE       *nsyms_ret = 0;
1140
// OBSOLETE       return NULL;
1141
// OBSOLETE     }
1142
// OBSOLETE   location = (char *) entry;
1143
// OBSOLETE   while (NEXT_SYM (&location, &entry) &&
1144
// OBSOLETE      entry->rec_type != dst_typ_end_scope)
1145
// OBSOLETE     {
1146
// OBSOLETE       if (entry->rec_type == dst_typ_var)
1147
// OBSOLETE     {
1148
// OBSOLETE       if (DST_var (entry).short_locs)
1149
// OBSOLETE         {
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;
1153
// OBSOLETE         }
1154
// OBSOLETE       else
1155
// OBSOLETE         {
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;
1159
// OBSOLETE         }
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;
1166
// OBSOLETE     }
1167
// OBSOLETE       else if (entry->rec_type == dst_typ_variable)
1168
// OBSOLETE     {
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;
1174
// OBSOLETE     }
1175
// OBSOLETE       else
1176
// OBSOLETE     {
1177
// OBSOLETE       continue;
1178
// OBSOLETE     }
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);
1183
// OBSOLETE 
1184
// OBSOLETE       if ((attr & (1 << dst_var_attr_global)) ||
1185
// OBSOLETE       (attr & (1 << dst_var_attr_static)))
1186
// OBSOLETE     SYMBOL_CLASS (sym) = LOC_STATIC;
1187
// OBSOLETE       else
1188
// OBSOLETE     SYMBOL_CLASS (sym) = LOC_LOCAL;
1189
// OBSOLETE       SYMBOL_LINE (sym) = line;
1190
// OBSOLETE       SYMBOL_TYPE (sym) = decode_type_desc (objfile, &symtype,
1191
// OBSOLETE                                         entry);
1192
// OBSOLETE       SYMBOL_VALUE (sym) = 0;
1193
// OBSOLETE       switch (entry->rec_type)
1194
// OBSOLETE     {
1195
// OBSOLETE     case dst_typ_var:
1196
// OBSOLETE       switch (loc_type)
1197
// OBSOLETE         {
1198
// OBSOLETE         case dst_var_loc_abs:
1199
// OBSOLETE           SYMBOL_VALUE_ADDRESS (sym) = loc_value;
1200
// OBSOLETE           break;
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);
1206
// OBSOLETE           break;
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.
1211
// OBSOLETE            */
1212
// OBSOLETE           if (loc_index)
1213
// OBSOLETE             {
1214
// OBSOLETE               sym->aux_value.basereg = loc_index;
1215
// OBSOLETE             }
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;
1220
// OBSOLETE           break;
1221
// OBSOLETE         case dst_var_loc_reg:
1222
// OBSOLETE           SYMBOL_VALUE (sym) = loc_index;
1223
// OBSOLETE           SYMBOL_CLASS (sym) = LOC_REGISTER;
1224
// OBSOLETE           break;
1225
// OBSOLETE         }
1226
// OBSOLETE       break;
1227
// OBSOLETE     case dst_typ_variable:
1228
// OBSOLETE       /* External variable..... don't try to interpret
1229
// OBSOLETE        * its nonexistant locstring.
1230
// OBSOLETE        */
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),
1235
// OBSOLETE                             sym);
1236
// OBSOLETE     }
1237
// OBSOLETE       element = (struct symbol_list *)
1238
// OBSOLETE     xmalloc (sizeof (struct symbol_list));
1239
// OBSOLETE 
1240
// OBSOLETE       if (attr & (1 << dst_var_attr_global))
1241
// OBSOLETE     {
1242
// OBSOLETE       element->next = dst_global_symbols;
1243
// OBSOLETE       dst_global_symbols = element;
1244
// OBSOLETE       total_globals++;
1245
// OBSOLETE     }
1246
// OBSOLETE       else
1247
// OBSOLETE     {
1248
// OBSOLETE       element->next = list;
1249
// OBSOLETE       list = element;
1250
// OBSOLETE       nsyms++;
1251
// OBSOLETE     }
1252
// OBSOLETE       element->symbol = sym;
1253
// OBSOLETE     }
1254
// OBSOLETE   *nsyms_ret = nsyms;
1255
// OBSOLETE   return list;
1256
// OBSOLETE }
1257
// OBSOLETE 
1258
// OBSOLETE 
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)
1262
// OBSOLETE {
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;
1268
// OBSOLETE 
1269
// OBSOLETE   type = builtin_type_int;
1270
// OBSOLETE   sym = create_new_symbol (objfile, name);
1271
// OBSOLETE   SYMBOL_CLASS (sym) = LOC_BLOCK;
1272
// OBSOLETE 
1273
// OBSOLETE   if (entry)
1274
// OBSOLETE     {
1275
// OBSOLETE       location = (char *) entry;
1276
// OBSOLETE       do
1277
// OBSOLETE     {
1278
// OBSOLETE       NEXT_SYM (&location, &sym_entry);
1279
// OBSOLETE     }
1280
// OBSOLETE       while (sym_entry && sym_entry->rec_type != dst_typ_signature);
1281
// OBSOLETE 
1282
// OBSOLETE       if (sym_entry)
1283
// OBSOLETE     {
1284
// OBSOLETE       SYMBOL_LINE (sym) =
1285
// OBSOLETE         DST_signature (sym_entry).src_loc.line_number;
1286
// OBSOLETE       if (DST_signature (sym_entry).result)
1287
// OBSOLETE         {
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);
1292
// OBSOLETE         }
1293
// OBSOLETE     }
1294
// OBSOLETE     }
1295
// OBSOLETE 
1296
// OBSOLETE   if (!type->function_type)
1297
// OBSOLETE     {
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;
1302
// OBSOLETE     }
1303
// OBSOLETE   SYMBOL_TYPE (sym) = type->function_type;
1304
// OBSOLETE 
1305
// OBSOLETE   /* Now add ourselves to the global symbols list */
1306
// OBSOLETE   element = (struct symbol_list *)
1307
// OBSOLETE     xmalloc (sizeof (struct symbol_list));
1308
// OBSOLETE 
1309
// OBSOLETE   element->next = dst_global_symbols;
1310
// OBSOLETE   dst_global_symbols = element;
1311
// OBSOLETE   total_globals++;
1312
// OBSOLETE   element->symbol = sym;
1313
// OBSOLETE 
1314
// OBSOLETE   return sym;
1315
// OBSOLETE }
1316
// OBSOLETE 
1317
// OBSOLETE static struct block *
1318
// OBSOLETE process_dst_block (struct objfile *objfile, dst_rec_ptr_t entry)
1319
// OBSOLETE {
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;
1332
// OBSOLETE 
1333
// OBSOLETE   if (DST_block (entry).noffset)
1334
// OBSOLETE     name = DST_OFFSET (entry, DST_block (entry).noffset);
1335
// OBSOLETE   else
1336
// OBSOLETE     name = NULL;
1337
// OBSOLETE   if (DST_block (entry).n_of_code_ranges)
1338
// OBSOLETE     {
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;
1342
// OBSOLETE     }
1343
// OBSOLETE   else
1344
// OBSOLETE     {
1345
// OBSOLETE       address = -1;
1346
// OBSOLETE       size = 0;
1347
// OBSOLETE     }
1348
// OBSOLETE   symbol_entry = (dst_rec_ptr_t) get_sec_ref (&DST_block (entry).symbols_start);
1349
// OBSOLETE   switch (DST_block (entry).block_type)
1350
// OBSOLETE     {
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?
1355
// OBSOLETE        */
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,
1364
// OBSOLETE                                     name,
1365
// OBSOLETE                                     address);
1366
// OBSOLETE       enter_all_lines (get_sec_ref (&DST_block (entry).code_ranges[0].lines_start), address);
1367
// OBSOLETE       break;
1368
// OBSOLETE     case dst_block_block_data:
1369
// OBSOLETE       break;
1370
// OBSOLETE 
1371
// OBSOLETE     default:
1372
// OBSOLETE       /* GDB has to call it something, and the module name
1373
// OBSOLETE        * won't cut it
1374
// OBSOLETE        */
1375
// OBSOLETE       sprintf (fake_name, "block_%08lx", fake_seq++);
1376
// OBSOLETE       function = process_dst_function (
1377
// OBSOLETE                                     objfile, NULL, fake_name, address);
1378
// OBSOLETE       break;
1379
// OBSOLETE     }
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 *));
1386
// OBSOLETE 
1387
// OBSOLETE   symnum = 0;
1388
// OBSOLETE   while (symlist)
1389
// OBSOLETE     {
1390
// OBSOLETE       nextsym = symlist->next;
1391
// OBSOLETE 
1392
// OBSOLETE       block->sym[symnum] = symlist->symbol;
1393
// OBSOLETE 
1394
// OBSOLETE       xfree (symlist);
1395
// OBSOLETE       symlist = nextsym;
1396
// OBSOLETE       symnum++;
1397
// OBSOLETE     }
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)
1404
// OBSOLETE     {
1405
// OBSOLETE       SYMBOL_BLOCK_VALUE (function) = block;
1406
// OBSOLETE       BLOCK_FUNCTION (block) = function;
1407
// OBSOLETE     }
1408
// OBSOLETE   else
1409
// OBSOLETE     BLOCK_FUNCTION (block) = 0;
1410
// OBSOLETE 
1411
// OBSOLETE   if (DST_block (entry).child_block_off)
1412
// OBSOLETE     {
1413
// OBSOLETE       child_entry = (dst_rec_ptr_t) DST_OFFSET (entry,
1414
// OBSOLETE                                      DST_block (entry).child_block_off);
1415
// OBSOLETE       while (child_entry)
1416
// OBSOLETE     {
1417
// OBSOLETE       child_block = process_dst_block (objfile, child_entry);
1418
// OBSOLETE       if (child_block)
1419
// OBSOLETE         {
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;
1431
// OBSOLETE         }
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);
1436
// OBSOLETE       else
1437
// OBSOLETE         child_entry = NULL;
1438
// OBSOLETE     }
1439
// OBSOLETE     }
1440
// OBSOLETE   record_pending_block (objfile, block, NULL);
1441
// OBSOLETE   return block;
1442
// OBSOLETE }
1443
// OBSOLETE 
1444
// OBSOLETE 
1445
// OBSOLETE static void
1446
// OBSOLETE read_dst_symtab (struct objfile *objfile)
1447
// OBSOLETE {
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;
1456
// OBSOLETE 
1457
// OBSOLETE   current_objfile = objfile;
1458
// OBSOLETE   buffer = blocks_info.buffer;
1459
// OBSOLETE   while (NEXT_BLK (&buffer, &entry))
1460
// OBSOLETE     {
1461
// OBSOLETE       if (entry->rec_type == dst_typ_comp_unit)
1462
// OBSOLETE     {
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 ();
1475
// OBSOLETE 
1476
// OBSOLETE       block = process_dst_block (objfile, root_block);
1477
// OBSOLETE 
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++)
1486
// OBSOLETE         {
1487
// OBSOLETE           nextsym = dst_global_symbols->next;
1488
// OBSOLETE 
1489
// OBSOLETE           global_block->sym[symnum] =
1490
// OBSOLETE             dst_global_symbols->symbol;
1491
// OBSOLETE 
1492
// OBSOLETE           xfree (dst_global_symbols);
1493
// OBSOLETE           dst_global_symbols = nextsym;
1494
// OBSOLETE         }
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);
1503
// OBSOLETE 
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);
1509
// OBSOLETE     }
1510
// OBSOLETE     }
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
1521
// OBSOLETE    */
1522
// OBSOLETE   prim_record_minimal_symbol ("<end_of_text>",
1523
// OBSOLETE                           (CORE_ADDR) 0x40000000,
1524
// OBSOLETE                           mst_text, objfile);
1525
// OBSOLETE   while (struct_list)
1526
// OBSOLETE     {
1527
// OBSOLETE       element = struct_list;
1528
// OBSOLETE       struct_list = element->next;
1529
// OBSOLETE       xfree (element);
1530
// OBSOLETE     }
1531
// OBSOLETE }
1532
// OBSOLETE 
1533
// OBSOLETE 
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;
1538
// OBSOLETE 
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)
1544
// OBSOLETE {
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;
1550
// OBSOLETE   else
1551
// OBSOLETE     return 1;
1552
// OBSOLETE }
1553
// OBSOLETE 
1554
// OBSOLETE static int
1555
// OBSOLETE init_dst_sections (int chan)
1556
// OBSOLETE {
1557
// OBSOLETE 
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;
1562
// OBSOLETE   else
1563
// OBSOLETE     return 0;
1564
// OBSOLETE }
1565
// OBSOLETE 
1566
// OBSOLETE /* Fake up support for relocating symbol addresses.  FIXME.  */
1567
// OBSOLETE 
1568
// OBSOLETE struct section_offsets dst_symfile_faker =
1569
// OBSOLETE {0};
1570
// OBSOLETE 
1571
// OBSOLETE void
1572
// OBSOLETE dst_symfile_offsets (struct objfile *objfile, struct section_addr_info *addrs)
1573
// OBSOLETE {
1574
// OBSOLETE   objfile->num_sections = 1;
1575
// OBSOLETE   objfile->section_offsets = &dst_symfile_faker;
1576
// OBSOLETE }
1577
// OBSOLETE 
1578
// OBSOLETE /* Register our ability to parse symbols for DST BFD files */
1579
// OBSOLETE 
1580
// OBSOLETE static struct sym_fns dst_sym_fns =
1581
// OBSOLETE {
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,
1585
// OBSOLETE 
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 */
1592
// OBSOLETE };
1593
// OBSOLETE 
1594
// OBSOLETE void
1595
// OBSOLETE _initialize_dstread (void)
1596
// OBSOLETE {
1597
// OBSOLETE   add_symtab_fns (&dst_sym_fns);
1598
// OBSOLETE }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.