Fix PR gdb/778
[deliverable/binutils-gdb.git] / gdb / os9kread.c
CommitLineData
a99a9e1b
AC
1// OBSOLETE /* Read os9/os9k symbol tables and convert to internal format, for GDB.
2// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
3// OBSOLETE 1996, 1997, 1998, 1999, 2000, 2001
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 /* This module provides three functions: os9k_symfile_init,
24// OBSOLETE which initializes to read a symbol file; os9k_new_init, which
25// OBSOLETE discards existing cached information when all symbols are being
26// OBSOLETE discarded; and os9k_symfile_read, which reads a symbol table
27// OBSOLETE from a file.
28// OBSOLETE
29// OBSOLETE os9k_symfile_read only does the minimum work necessary for letting the
30// OBSOLETE user "name" things symbolically; it does not read the entire symtab.
31// OBSOLETE Instead, it reads the external and static symbols and puts them in partial
32// OBSOLETE symbol tables. When more extensive information is requested of a
33// OBSOLETE file, the corresponding partial symbol table is mutated into a full
34// OBSOLETE fledged symbol table by going back and reading the symbols
35// OBSOLETE for real. os9k_psymtab_to_symtab() is the function that does this */
36// OBSOLETE
37// OBSOLETE #include "defs.h"
38// OBSOLETE #include "gdb_string.h"
39// OBSOLETE #include "gdb_assert.h"
40// OBSOLETE #include <stdio.h>
41// OBSOLETE
42// OBSOLETE #if defined(USG) || defined(__CYGNUSCLIB__)
43// OBSOLETE #include <sys/types.h>
44// OBSOLETE #include <fcntl.h>
45// OBSOLETE #endif
46// OBSOLETE
47// OBSOLETE #include "obstack.h"
48// OBSOLETE #include "gdb_stat.h"
49// OBSOLETE #include "symtab.h"
50// OBSOLETE #include "breakpoint.h"
51// OBSOLETE #include "command.h"
52// OBSOLETE #include "target.h"
53// OBSOLETE #include "gdbcore.h" /* for bfd stuff */
54// OBSOLETE #include "libaout.h" /* FIXME Secret internal BFD stuff for a.out */
55// OBSOLETE #include "symfile.h"
56// OBSOLETE #include "objfiles.h"
57// OBSOLETE #include "buildsym.h"
58// OBSOLETE #include "gdb-stabs.h"
59// OBSOLETE #include "demangle.h"
60// OBSOLETE #include "language.h" /* Needed inside partial-stab.h */
61// OBSOLETE #include "complaints.h"
62// OBSOLETE #include "os9k.h"
63// OBSOLETE #include "stabsread.h"
64// OBSOLETE
65// OBSOLETE extern void _initialize_os9kread (void);
66// OBSOLETE
67// OBSOLETE /* Each partial symbol table entry contains a pointer to private data for the
68// OBSOLETE read_symtab() function to use when expanding a partial symbol table entry
69// OBSOLETE to a full symbol table entry.
70// OBSOLETE
71// OBSOLETE For dbxread this structure contains the offset within the file symbol table
72// OBSOLETE of first local symbol for this file, and count of the section
73// OBSOLETE of the symbol table devoted to this file's symbols (actually, the section
74// OBSOLETE bracketed may contain more than just this file's symbols). It also contains
75// OBSOLETE further information needed to locate the symbols if they are in an ELF file.
76// OBSOLETE
77// OBSOLETE If ldsymcnt is 0, the only reason for this thing's existence is the
78// OBSOLETE dependency list. Nothing else will happen when it is read in. */
79// OBSOLETE
80// OBSOLETE #define LDSYMOFF(p) (((struct symloc *)((p)->read_symtab_private))->ldsymoff)
81// OBSOLETE #define LDSYMCNT(p) (((struct symloc *)((p)->read_symtab_private))->ldsymnum)
82// OBSOLETE
83// OBSOLETE struct symloc
84// OBSOLETE {
85// OBSOLETE int ldsymoff;
86// OBSOLETE int ldsymnum;
87// OBSOLETE };
88// OBSOLETE
89// OBSOLETE /* Remember what we deduced to be the source language of this psymtab. */
90// OBSOLETE static enum language psymtab_language = language_unknown;
91// OBSOLETE
92// OBSOLETE /* keep partial symbol table file nested depth */
93// OBSOLETE static int psymfile_depth = 0;
94// OBSOLETE
95// OBSOLETE /* keep symbol table file nested depth */
96// OBSOLETE static int symfile_depth = 0;
97// OBSOLETE
98// OBSOLETE extern int previous_stab_code;
99// OBSOLETE
100// OBSOLETE /* Name of last function encountered. Used in Solaris to approximate
101// OBSOLETE object file boundaries. */
102// OBSOLETE static char *last_function_name;
103// OBSOLETE
104// OBSOLETE /* Complaints about the symbols we have encountered. */
105// OBSOLETE extern struct complaint lbrac_complaint;
106// OBSOLETE
107// OBSOLETE extern struct complaint unknown_symtype_complaint;
108// OBSOLETE
109// OBSOLETE extern struct complaint unknown_symchar_complaint;
110// OBSOLETE
111// OBSOLETE extern struct complaint lbrac_rbrac_complaint;
112// OBSOLETE
113// OBSOLETE extern struct complaint repeated_header_complaint;
114// OBSOLETE
115// OBSOLETE extern struct complaint repeated_header_name_complaint;
116// OBSOLETE
117// OBSOLETE #if 0
118// OBSOLETE static struct complaint lbrac_unmatched_complaint =
119// OBSOLETE {"unmatched Increment Block Entry before symtab pos %d", 0, 0};
120// OBSOLETE
121// OBSOLETE static struct complaint lbrac_mismatch_complaint =
122// OBSOLETE {"IBE/IDE symbol mismatch at symtab pos %d", 0, 0};
123// OBSOLETE #endif
124// OBSOLETE \f
125// OBSOLETE /* Local function prototypes */
126// OBSOLETE
127// OBSOLETE static void read_minimal_symbols (struct objfile *);
128// OBSOLETE
129// OBSOLETE static void os9k_read_ofile_symtab (struct partial_symtab *);
130// OBSOLETE
131// OBSOLETE static void os9k_psymtab_to_symtab (struct partial_symtab *);
132// OBSOLETE
133// OBSOLETE static void os9k_psymtab_to_symtab_1 (struct partial_symtab *);
134// OBSOLETE
135// OBSOLETE static void read_os9k_psymtab (struct objfile *, CORE_ADDR, int);
136// OBSOLETE
137// OBSOLETE static int fill_sym (FILE *, bfd *);
138// OBSOLETE
139// OBSOLETE static void os9k_symfile_init (struct objfile *);
140// OBSOLETE
141// OBSOLETE static void os9k_new_init (struct objfile *);
142// OBSOLETE
143// OBSOLETE static void os9k_symfile_read (struct objfile *, int);
144// OBSOLETE
145// OBSOLETE static void os9k_symfile_finish (struct objfile *);
146// OBSOLETE
147// OBSOLETE static void os9k_process_one_symbol (int, int, CORE_ADDR, char *,
148// OBSOLETE struct section_offsets *,
149// OBSOLETE struct objfile *);
150// OBSOLETE
151// OBSOLETE static struct partial_symtab *os9k_start_psymtab (struct objfile *, char *,
152// OBSOLETE CORE_ADDR, int, int,
153// OBSOLETE struct partial_symbol **,
154// OBSOLETE struct partial_symbol **);
155// OBSOLETE
156// OBSOLETE static struct partial_symtab *os9k_end_psymtab (struct partial_symtab *,
157// OBSOLETE char **, int, int, CORE_ADDR,
158// OBSOLETE struct partial_symtab **,
159// OBSOLETE int);
160// OBSOLETE
161// OBSOLETE static void record_minimal_symbol (char *, CORE_ADDR, int, struct objfile *);
162// OBSOLETE \f
163// OBSOLETE #define HANDLE_RBRAC(val) \
164// OBSOLETE if ((val) > pst->texthigh) pst->texthigh = (val);
165// OBSOLETE
166// OBSOLETE #define SWAP_STBHDR(hdrp, abfd) \
167// OBSOLETE { \
168// OBSOLETE (hdrp)->fmtno = bfd_get_16(abfd, (unsigned char *)&(hdrp)->fmtno); \
169// OBSOLETE (hdrp)->crc = bfd_get_32(abfd, (unsigned char *)&(hdrp)->crc); \
170// OBSOLETE (hdrp)->offset = bfd_get_32(abfd, (unsigned char *)&(hdrp)->offset); \
171// OBSOLETE (hdrp)->nsym = bfd_get_32(abfd, (unsigned char *)&(hdrp)->nsym); \
172// OBSOLETE }
173// OBSOLETE #define SWAP_STBSYM(symp, abfd) \
174// OBSOLETE { \
175// OBSOLETE (symp)->value = bfd_get_32(abfd, (unsigned char *)&(symp)->value); \
176// OBSOLETE (symp)->type = bfd_get_16(abfd, (unsigned char *)&(symp)->type); \
177// OBSOLETE (symp)->stroff = bfd_get_32(abfd, (unsigned char *)&(symp)->stroff); \
178// OBSOLETE }
179// OBSOLETE #define N_DATA 0
180// OBSOLETE #define N_BSS 1
181// OBSOLETE #define N_RDATA 2
182// OBSOLETE #define N_IDATA 3
183// OBSOLETE #define N_TEXT 4
184// OBSOLETE #define N_ABS 6
185// OBSOLETE
186// OBSOLETE static void
187// OBSOLETE record_minimal_symbol (char *name, CORE_ADDR address, int type,
188// OBSOLETE struct objfile *objfile)
189// OBSOLETE {
190// OBSOLETE enum minimal_symbol_type ms_type;
191// OBSOLETE
192// OBSOLETE switch (type)
193// OBSOLETE {
194// OBSOLETE case N_TEXT:
195// OBSOLETE ms_type = mst_text;
196// OBSOLETE address += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
197// OBSOLETE break;
198// OBSOLETE case N_DATA:
199// OBSOLETE ms_type = mst_data;
200// OBSOLETE break;
201// OBSOLETE case N_BSS:
202// OBSOLETE ms_type = mst_bss;
203// OBSOLETE break;
204// OBSOLETE case N_RDATA:
205// OBSOLETE ms_type = mst_bss;
206// OBSOLETE break;
207// OBSOLETE case N_IDATA:
208// OBSOLETE ms_type = mst_data;
209// OBSOLETE break;
210// OBSOLETE case N_ABS:
211// OBSOLETE ms_type = mst_abs;
212// OBSOLETE break;
213// OBSOLETE default:
214// OBSOLETE ms_type = mst_unknown;
215// OBSOLETE break;
216// OBSOLETE }
217// OBSOLETE
218// OBSOLETE prim_record_minimal_symbol (name, address, ms_type, objfile);
219// OBSOLETE }
220// OBSOLETE
221// OBSOLETE /* read and process .stb file and store in minimal symbol table */
222// OBSOLETE typedef char mhhdr[80];
223// OBSOLETE struct stbhdr
224// OBSOLETE {
225// OBSOLETE mhhdr comhdr;
226// OBSOLETE char *name;
227// OBSOLETE short fmtno;
228// OBSOLETE int crc;
229// OBSOLETE int offset;
230// OBSOLETE int nsym;
231// OBSOLETE char *pad;
232// OBSOLETE };
233// OBSOLETE struct stbsymbol
234// OBSOLETE {
235// OBSOLETE int value;
236// OBSOLETE short type;
237// OBSOLETE int stroff;
238// OBSOLETE };
239// OBSOLETE #define STBSYMSIZE 10
240// OBSOLETE
241// OBSOLETE static void
242// OBSOLETE read_minimal_symbols (struct objfile *objfile)
243// OBSOLETE {
244// OBSOLETE FILE *fp;
245// OBSOLETE bfd *abfd;
246// OBSOLETE struct stbhdr hdr;
247// OBSOLETE struct stbsymbol sym;
248// OBSOLETE int ch, i, j, off;
249// OBSOLETE char buf[64], buf1[128];
250// OBSOLETE
251// OBSOLETE fp = objfile->auxf1;
252// OBSOLETE if (fp == NULL)
253// OBSOLETE return;
254// OBSOLETE abfd = objfile->obfd;
255// OBSOLETE fread (&hdr.comhdr[0], sizeof (mhhdr), 1, fp);
256// OBSOLETE i = 0;
257// OBSOLETE ch = getc (fp);
258// OBSOLETE while (ch != -1)
259// OBSOLETE {
260// OBSOLETE buf[i] = (char) ch;
261// OBSOLETE i++;
262// OBSOLETE if (ch == 0)
263// OBSOLETE break;
264// OBSOLETE ch = getc (fp);
265// OBSOLETE };
266// OBSOLETE if (i % 2)
267// OBSOLETE ch = getc (fp);
268// OBSOLETE hdr.name = &buf[0];
269// OBSOLETE
270// OBSOLETE fread (&hdr.fmtno, sizeof (hdr.fmtno), 1, fp);
271// OBSOLETE fread (&hdr.crc, sizeof (hdr.crc), 1, fp);
272// OBSOLETE fread (&hdr.offset, sizeof (hdr.offset), 1, fp);
273// OBSOLETE fread (&hdr.nsym, sizeof (hdr.nsym), 1, fp);
274// OBSOLETE SWAP_STBHDR (&hdr, abfd);
275// OBSOLETE
276// OBSOLETE /* read symbols */
277// OBSOLETE init_minimal_symbol_collection ();
278// OBSOLETE off = hdr.offset;
279// OBSOLETE for (i = hdr.nsym; i > 0; i--)
280// OBSOLETE {
281// OBSOLETE fseek (fp, (long) off, 0);
282// OBSOLETE fread (&sym.value, sizeof (sym.value), 1, fp);
283// OBSOLETE fread (&sym.type, sizeof (sym.type), 1, fp);
284// OBSOLETE fread (&sym.stroff, sizeof (sym.stroff), 1, fp);
285// OBSOLETE SWAP_STBSYM (&sym, abfd);
286// OBSOLETE fseek (fp, (long) sym.stroff, 0);
287// OBSOLETE j = 0;
288// OBSOLETE ch = getc (fp);
289// OBSOLETE while (ch != -1)
290// OBSOLETE {
291// OBSOLETE buf1[j] = (char) ch;
292// OBSOLETE j++;
293// OBSOLETE if (ch == 0)
294// OBSOLETE break;
295// OBSOLETE ch = getc (fp);
296// OBSOLETE };
297// OBSOLETE record_minimal_symbol (buf1, sym.value, sym.type & 7, objfile);
298// OBSOLETE off += STBSYMSIZE;
299// OBSOLETE };
300// OBSOLETE install_minimal_symbols (objfile);
301// OBSOLETE return;
302// OBSOLETE }
303// OBSOLETE \f
304// OBSOLETE /* Scan and build partial symbols for a symbol file.
305// OBSOLETE We have been initialized by a call to os9k_symfile_init, which
306// OBSOLETE put all the relevant info into a "struct os9k_symfile_info",
307// OBSOLETE hung off the objfile structure.
308// OBSOLETE
309// OBSOLETE MAINLINE is true if we are reading the main symbol
310// OBSOLETE table (as opposed to a shared lib or dynamically loaded file). */
311// OBSOLETE
312// OBSOLETE static void
313// OBSOLETE os9k_symfile_read (struct objfile *objfile, int mainline)
314// OBSOLETE {
315// OBSOLETE bfd *sym_bfd;
316// OBSOLETE struct cleanup *back_to;
317// OBSOLETE
318// OBSOLETE sym_bfd = objfile->obfd;
319// OBSOLETE /* If we are reinitializing, or if we have never loaded syms yet, init */
320// OBSOLETE if (mainline
321// OBSOLETE || (objfile->global_psymbols.size == 0
322// OBSOLETE && objfile->static_psymbols.size == 0))
323// OBSOLETE init_psymbol_list (objfile, DBX_SYMCOUNT (objfile));
324// OBSOLETE
325// OBSOLETE free_pending_blocks ();
326// OBSOLETE back_to = make_cleanup (really_free_pendings, 0);
327// OBSOLETE
328// OBSOLETE make_cleanup_discard_minimal_symbols ();
329// OBSOLETE read_minimal_symbols (objfile);
330// OBSOLETE
331// OBSOLETE /* Now that the symbol table data of the executable file are all in core,
332// OBSOLETE process them and define symbols accordingly. */
333// OBSOLETE read_os9k_psymtab (objfile,
334// OBSOLETE DBX_TEXT_ADDR (objfile),
335// OBSOLETE DBX_TEXT_SIZE (objfile));
336// OBSOLETE
337// OBSOLETE do_cleanups (back_to);
338// OBSOLETE }
339// OBSOLETE
340// OBSOLETE /* Initialize anything that needs initializing when a completely new
341// OBSOLETE symbol file is specified (not just adding some symbols from another
342// OBSOLETE file, e.g. a shared library). */
343// OBSOLETE
344// OBSOLETE static void
345// OBSOLETE os9k_new_init (struct objfile *ignore)
346// OBSOLETE {
347// OBSOLETE stabsread_new_init ();
348// OBSOLETE buildsym_new_init ();
349// OBSOLETE psymfile_depth = 0;
350// OBSOLETE /*
351// OBSOLETE init_header_files ();
352// OBSOLETE */
353// OBSOLETE }
354// OBSOLETE
355// OBSOLETE /* os9k_symfile_init ()
356// OBSOLETE It is passed a struct objfile which contains, among other things,
357// OBSOLETE the BFD for the file whose symbols are being read, and a slot for a pointer
358// OBSOLETE to "private data" which we fill with goodies.
359// OBSOLETE
360// OBSOLETE Since BFD doesn't know how to read debug symbols in a format-independent
361// OBSOLETE way (and may never do so...), we have to do it ourselves. We will never
362// OBSOLETE be called unless this is an a.out (or very similar) file.
363// OBSOLETE FIXME, there should be a cleaner peephole into the BFD environment here. */
364// OBSOLETE
365// OBSOLETE static void
366// OBSOLETE os9k_symfile_init (struct objfile *objfile)
367// OBSOLETE {
368// OBSOLETE bfd *sym_bfd = objfile->obfd;
369// OBSOLETE char *name = bfd_get_filename (sym_bfd);
370// OBSOLETE char dbgname[512], stbname[512];
371// OBSOLETE FILE *symfile = 0;
372// OBSOLETE FILE *minfile = 0;
373// OBSOLETE asection *text_sect;
374// OBSOLETE
375// OBSOLETE strcpy (dbgname, name);
376// OBSOLETE strcat (dbgname, ".dbg");
377// OBSOLETE strcpy (stbname, name);
378// OBSOLETE strcat (stbname, ".stb");
379// OBSOLETE
380// OBSOLETE if ((symfile = fopen (dbgname, "r")) == NULL)
381// OBSOLETE {
382// OBSOLETE warning ("Symbol file %s not found", dbgname);
383// OBSOLETE }
384// OBSOLETE objfile->auxf2 = symfile;
385// OBSOLETE
386// OBSOLETE if ((minfile = fopen (stbname, "r")) == NULL)
387// OBSOLETE {
388// OBSOLETE warning ("Symbol file %s not found", stbname);
389// OBSOLETE }
390// OBSOLETE objfile->auxf1 = minfile;
391// OBSOLETE
392// OBSOLETE /* Allocate struct to keep track of the symfile */
393// OBSOLETE objfile->sym_stab_info = (struct dbx_symfile_info *)
394// OBSOLETE xmmalloc (objfile->md, sizeof (struct dbx_symfile_info));
395// OBSOLETE DBX_SYMFILE_INFO (objfile)->stab_section_info = NULL;
396// OBSOLETE
397// OBSOLETE text_sect = bfd_get_section_by_name (sym_bfd, ".text");
398// OBSOLETE if (!text_sect)
399// OBSOLETE error ("Can't find .text section in file");
400// OBSOLETE DBX_TEXT_ADDR (objfile) = bfd_section_vma (sym_bfd, text_sect);
401// OBSOLETE DBX_TEXT_SIZE (objfile) = bfd_section_size (sym_bfd, text_sect);
402// OBSOLETE
403// OBSOLETE DBX_SYMBOL_SIZE (objfile) = 0; /* variable size symbol */
404// OBSOLETE DBX_SYMCOUNT (objfile) = 0; /* used to be bfd_get_symcount(sym_bfd) */
405// OBSOLETE DBX_SYMTAB_OFFSET (objfile) = 0; /* used to be SYMBOL_TABLE_OFFSET */
406// OBSOLETE }
407// OBSOLETE
408// OBSOLETE /* Perform any local cleanups required when we are done with a particular
409// OBSOLETE objfile. I.E, we are in the process of discarding all symbol information
410// OBSOLETE for an objfile, freeing up all memory held for it, and unlinking the
411// OBSOLETE objfile struct from the global list of known objfiles. */
412// OBSOLETE
413// OBSOLETE static void
414// OBSOLETE os9k_symfile_finish (struct objfile *objfile)
415// OBSOLETE {
416// OBSOLETE if (objfile->sym_stab_info != NULL)
417// OBSOLETE {
418// OBSOLETE xmfree (objfile->md, objfile->sym_stab_info);
419// OBSOLETE }
420// OBSOLETE /*
421// OBSOLETE free_header_files ();
422// OBSOLETE */
423// OBSOLETE }
424// OBSOLETE \f
425// OBSOLETE
426// OBSOLETE struct st_dbghdr
427// OBSOLETE {
428// OBSOLETE int sync;
429// OBSOLETE short rev;
430// OBSOLETE int crc;
431// OBSOLETE short os;
432// OBSOLETE short cpu;
433// OBSOLETE };
434// OBSOLETE #define SYNC (int)0xefbefeca
435// OBSOLETE
436// OBSOLETE #define SWAP_DBGHDR(hdrp, abfd) \
437// OBSOLETE { \
438// OBSOLETE (hdrp)->sync = bfd_get_32(abfd, (unsigned char *)&(hdrp)->sync); \
439// OBSOLETE (hdrp)->rev = bfd_get_16(abfd, (unsigned char *)&(hdrp)->rev); \
440// OBSOLETE (hdrp)->crc = bfd_get_32(abfd, (unsigned char *)&(hdrp)->crc); \
441// OBSOLETE (hdrp)->os = bfd_get_16(abfd, (unsigned char *)&(hdrp)->os); \
442// OBSOLETE (hdrp)->cpu = bfd_get_16(abfd, (unsigned char *)&(hdrp)->cpu); \
443// OBSOLETE }
444// OBSOLETE
445// OBSOLETE #define N_SYM_CMPLR 0
446// OBSOLETE #define N_SYM_SLINE 1
447// OBSOLETE #define N_SYM_SYM 2
448// OBSOLETE #define N_SYM_LBRAC 3
449// OBSOLETE #define N_SYM_RBRAC 4
450// OBSOLETE #define N_SYM_SE 5
451// OBSOLETE
452// OBSOLETE struct internal_symstruct
453// OBSOLETE {
454// OBSOLETE short n_type;
455// OBSOLETE short n_desc;
456// OBSOLETE long n_value;
457// OBSOLETE char *n_strx;
458// OBSOLETE };
459// OBSOLETE static struct internal_symstruct symbol;
460// OBSOLETE static struct internal_symstruct *symbuf = &symbol;
461// OBSOLETE static char strbuf[4096];
462// OBSOLETE static struct st_dbghdr dbghdr;
463// OBSOLETE static short cmplrid;
464// OBSOLETE
465// OBSOLETE #define VER_PRE_ULTRAC ((short)4)
466// OBSOLETE #define VER_ULTRAC ((short)5)
467// OBSOLETE
468// OBSOLETE static int
469// OBSOLETE fill_sym (FILE *dbg_file, bfd *abfd)
470// OBSOLETE {
471// OBSOLETE short si, nmask;
472// OBSOLETE long li;
473// OBSOLETE int ii;
474// OBSOLETE char *p;
475// OBSOLETE
476// OBSOLETE int nbytes = fread (&si, sizeof (si), 1, dbg_file);
477// OBSOLETE if (nbytes == 0)
478// OBSOLETE return 0;
479// OBSOLETE if (nbytes < 0)
480// OBSOLETE perror_with_name ("reading .dbg file.");
481// OBSOLETE symbuf->n_desc = 0;
482// OBSOLETE symbuf->n_value = 0;
483// OBSOLETE symbuf->n_strx = NULL;
484// OBSOLETE symbuf->n_type = bfd_get_16 (abfd, (unsigned char *) &si);
485// OBSOLETE symbuf->n_type = 0xf & symbuf->n_type;
486// OBSOLETE switch (symbuf->n_type)
487// OBSOLETE {
488// OBSOLETE case N_SYM_CMPLR:
489// OBSOLETE fread (&si, sizeof (si), 1, dbg_file);
490// OBSOLETE symbuf->n_desc = bfd_get_16 (abfd, (unsigned char *) &si);
491// OBSOLETE cmplrid = symbuf->n_desc & 0xff;
492// OBSOLETE break;
493// OBSOLETE case N_SYM_SLINE:
494// OBSOLETE fread (&li, sizeof (li), 1, dbg_file);
495// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li);
496// OBSOLETE fread (&li, sizeof (li), 1, dbg_file);
497// OBSOLETE li = bfd_get_32 (abfd, (unsigned char *) &li);
498// OBSOLETE symbuf->n_strx = (char *) (li >> 12);
499// OBSOLETE symbuf->n_desc = li & 0xfff;
500// OBSOLETE break;
501// OBSOLETE case N_SYM_SYM:
502// OBSOLETE fread (&li, sizeof (li), 1, dbg_file);
503// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li);
504// OBSOLETE si = 0;
505// OBSOLETE do
506// OBSOLETE {
507// OBSOLETE ii = getc (dbg_file);
508// OBSOLETE strbuf[si++] = (char) ii;
509// OBSOLETE }
510// OBSOLETE while (ii != 0 || si % 2 != 0);
511// OBSOLETE symbuf->n_strx = strbuf;
512// OBSOLETE p = (char *) strchr (strbuf, ':');
513// OBSOLETE if (!p)
514// OBSOLETE break;
515// OBSOLETE if ((p[1] == 'F' || p[1] == 'f') && cmplrid == VER_PRE_ULTRAC)
516// OBSOLETE {
517// OBSOLETE fread (&si, sizeof (si), 1, dbg_file);
518// OBSOLETE nmask = bfd_get_16 (abfd, (unsigned char *) &si);
519// OBSOLETE for (ii = 0; ii < nmask; ii++)
520// OBSOLETE fread (&si, sizeof (si), 1, dbg_file);
521// OBSOLETE }
522// OBSOLETE break;
523// OBSOLETE case N_SYM_LBRAC:
524// OBSOLETE fread (&li, sizeof (li), 1, dbg_file);
525// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li);
526// OBSOLETE break;
527// OBSOLETE case N_SYM_RBRAC:
528// OBSOLETE fread (&li, sizeof (li), 1, dbg_file);
529// OBSOLETE symbuf->n_value = bfd_get_32 (abfd, (unsigned char *) &li);
530// OBSOLETE break;
531// OBSOLETE case N_SYM_SE:
532// OBSOLETE break;
533// OBSOLETE }
534// OBSOLETE return 1;
535// OBSOLETE }
536// OBSOLETE \f
537// OBSOLETE /* Given pointers to an a.out symbol table in core containing dbx
538// OBSOLETE style data, setup partial_symtab's describing each source file for
539// OBSOLETE which debugging information is available.
540// OBSOLETE SYMFILE_NAME is the name of the file we are reading from. */
541// OBSOLETE
542// OBSOLETE static void
543// OBSOLETE read_os9k_psymtab (struct objfile *objfile, CORE_ADDR text_addr, int text_size)
544// OBSOLETE {
545// OBSOLETE register struct internal_symstruct *bufp = 0; /* =0 avoids gcc -Wall glitch */
546// OBSOLETE register char *namestring;
547// OBSOLETE int past_first_source_file = 0;
548// OBSOLETE CORE_ADDR last_o_file_start = 0;
549// OBSOLETE #if 0
550// OBSOLETE struct cleanup *back_to;
551// OBSOLETE #endif
552// OBSOLETE bfd *abfd;
553// OBSOLETE FILE *fp;
554// OBSOLETE
555// OBSOLETE /* End of the text segment of the executable file. */
556// OBSOLETE static CORE_ADDR end_of_text_addr;
557// OBSOLETE
558// OBSOLETE /* Current partial symtab */
559// OBSOLETE static struct partial_symtab *pst = 0;
560// OBSOLETE
561// OBSOLETE /* List of current psymtab's include files */
562// OBSOLETE char **psymtab_include_list;
563// OBSOLETE int includes_allocated;
564// OBSOLETE int includes_used;
565// OBSOLETE
566// OBSOLETE /* Index within current psymtab dependency list */
567// OBSOLETE struct partial_symtab **dependency_list;
568// OBSOLETE int dependencies_used, dependencies_allocated;
569// OBSOLETE
570// OBSOLETE includes_allocated = 30;
571// OBSOLETE includes_used = 0;
572// OBSOLETE psymtab_include_list = (char **) alloca (includes_allocated *
573// OBSOLETE sizeof (char *));
574// OBSOLETE
575// OBSOLETE dependencies_allocated = 30;
576// OBSOLETE dependencies_used = 0;
577// OBSOLETE dependency_list =
578// OBSOLETE (struct partial_symtab **) alloca (dependencies_allocated *
579// OBSOLETE sizeof (struct partial_symtab *));
580// OBSOLETE
581// OBSOLETE last_source_file = NULL;
582// OBSOLETE
583// OBSOLETE #ifdef END_OF_TEXT_DEFAULT
584// OBSOLETE end_of_text_addr = END_OF_TEXT_DEFAULT;
585// OBSOLETE #else
586// OBSOLETE end_of_text_addr = text_addr + ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile))
587// OBSOLETE + text_size; /* Relocate */
588// OBSOLETE #endif
589// OBSOLETE
590// OBSOLETE abfd = objfile->obfd;
591// OBSOLETE fp = objfile->auxf2;
592// OBSOLETE if (!fp)
593// OBSOLETE return;
594// OBSOLETE
595// OBSOLETE fread (&dbghdr.sync, sizeof (dbghdr.sync), 1, fp);
596// OBSOLETE fread (&dbghdr.rev, sizeof (dbghdr.rev), 1, fp);
597// OBSOLETE fread (&dbghdr.crc, sizeof (dbghdr.crc), 1, fp);
598// OBSOLETE fread (&dbghdr.os, sizeof (dbghdr.os), 1, fp);
599// OBSOLETE fread (&dbghdr.cpu, sizeof (dbghdr.cpu), 1, fp);
600// OBSOLETE SWAP_DBGHDR (&dbghdr, abfd);
601// OBSOLETE
602// OBSOLETE symnum = 0;
603// OBSOLETE while (1)
604// OBSOLETE {
605// OBSOLETE int ret;
606// OBSOLETE long cursymoffset;
607// OBSOLETE
608// OBSOLETE /* Get the symbol for this run and pull out some info */
609// OBSOLETE QUIT; /* allow this to be interruptable */
610// OBSOLETE cursymoffset = ftell (objfile->auxf2);
611// OBSOLETE ret = fill_sym (objfile->auxf2, abfd);
612// OBSOLETE if (ret <= 0)
613// OBSOLETE break;
614// OBSOLETE else
615// OBSOLETE symnum++;
616// OBSOLETE bufp = symbuf;
617// OBSOLETE
618// OBSOLETE /* Special case to speed up readin. */
619// OBSOLETE if (bufp->n_type == (short) N_SYM_SLINE)
620// OBSOLETE continue;
621// OBSOLETE
622// OBSOLETE #define CUR_SYMBOL_VALUE bufp->n_value
623// OBSOLETE /* partial-stab.h */
624// OBSOLETE
625// OBSOLETE switch (bufp->n_type)
626// OBSOLETE {
627// OBSOLETE char *p;
628// OBSOLETE
629// OBSOLETE case N_SYM_CMPLR:
630// OBSOLETE continue;
631// OBSOLETE
632// OBSOLETE case N_SYM_SE:
633// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
634// OBSOLETE if (psymfile_depth == 1 && pst)
635// OBSOLETE {
636// OBSOLETE os9k_end_psymtab (pst, psymtab_include_list, includes_used,
637// OBSOLETE symnum, CUR_SYMBOL_VALUE,
638// OBSOLETE dependency_list, dependencies_used);
639// OBSOLETE pst = (struct partial_symtab *) 0;
640// OBSOLETE includes_used = 0;
641// OBSOLETE dependencies_used = 0;
642// OBSOLETE }
643// OBSOLETE psymfile_depth--;
644// OBSOLETE continue;
645// OBSOLETE
646// OBSOLETE case N_SYM_SYM: /* Typedef or automatic variable. */
647// OBSOLETE namestring = bufp->n_strx;
648// OBSOLETE p = (char *) strchr (namestring, ':');
649// OBSOLETE if (!p)
650// OBSOLETE continue; /* Not a debugging symbol. */
651// OBSOLETE
652// OBSOLETE /* Main processing section for debugging symbols which
653// OBSOLETE the initial read through the symbol tables needs to worry
654// OBSOLETE about. If we reach this point, the symbol which we are
655// OBSOLETE considering is definitely one we are interested in.
656// OBSOLETE p must also contain the (valid) index into the namestring
657// OBSOLETE which indicates the debugging type symbol. */
658// OBSOLETE
659// OBSOLETE switch (p[1])
660// OBSOLETE {
661// OBSOLETE case 'S':
662// OBSOLETE {
663// OBSOLETE unsigned long valu;
664// OBSOLETE enum language tmp_language;
665// OBSOLETE char *str, *p;
666// OBSOLETE int n;
667// OBSOLETE
668// OBSOLETE valu = CUR_SYMBOL_VALUE;
669// OBSOLETE if (valu)
670// OBSOLETE valu += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
671// OBSOLETE past_first_source_file = 1;
672// OBSOLETE
673// OBSOLETE p = strchr (namestring, ':');
674// OBSOLETE if (p)
675// OBSOLETE n = p - namestring;
676// OBSOLETE else
677// OBSOLETE n = strlen (namestring);
678// OBSOLETE str = alloca (n + 1);
679// OBSOLETE strncpy (str, namestring, n);
680// OBSOLETE str[n] = '\0';
681// OBSOLETE
682// OBSOLETE if (psymfile_depth == 0)
683// OBSOLETE {
684// OBSOLETE if (!pst)
685// OBSOLETE pst = os9k_start_psymtab (objfile,
686// OBSOLETE str, valu,
687// OBSOLETE cursymoffset,
688// OBSOLETE symnum - 1,
689// OBSOLETE objfile->global_psymbols.next,
690// OBSOLETE objfile->static_psymbols.next);
691// OBSOLETE }
692// OBSOLETE else
693// OBSOLETE { /* this is a include file */
694// OBSOLETE tmp_language = deduce_language_from_filename (str);
695// OBSOLETE if (tmp_language != language_unknown
696// OBSOLETE && (tmp_language != language_c
697// OBSOLETE || psymtab_language != language_cplus))
698// OBSOLETE psymtab_language = tmp_language;
699// OBSOLETE
700// OBSOLETE /*
701// OBSOLETE if (pst && STREQ (str, pst->filename))
702// OBSOLETE continue;
703// OBSOLETE {
704// OBSOLETE register int i;
705// OBSOLETE for (i = 0; i < includes_used; i++)
706// OBSOLETE if (STREQ (str, psymtab_include_list[i]))
707// OBSOLETE {
708// OBSOLETE i = -1;
709// OBSOLETE break;
710// OBSOLETE }
711// OBSOLETE if (i == -1)
712// OBSOLETE continue;
713// OBSOLETE }
714// OBSOLETE */
715// OBSOLETE
716// OBSOLETE psymtab_include_list[includes_used++] = str;
717// OBSOLETE if (includes_used >= includes_allocated)
718// OBSOLETE {
719// OBSOLETE char **orig = psymtab_include_list;
720// OBSOLETE
721// OBSOLETE psymtab_include_list = (char **)
722// OBSOLETE alloca ((includes_allocated *= 2) * sizeof (char *));
723// OBSOLETE memcpy ((PTR) psymtab_include_list, (PTR) orig,
724// OBSOLETE includes_used * sizeof (char *));
725// OBSOLETE }
726// OBSOLETE
727// OBSOLETE }
728// OBSOLETE psymfile_depth++;
729// OBSOLETE continue;
730// OBSOLETE }
731// OBSOLETE
732// OBSOLETE case 'v':
733// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
734// OBSOLETE VAR_NAMESPACE, LOC_STATIC,
735// OBSOLETE &objfile->static_psymbols,
736// OBSOLETE 0, CUR_SYMBOL_VALUE,
737// OBSOLETE psymtab_language, objfile);
738// OBSOLETE continue;
739// OBSOLETE case 'V':
740// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
741// OBSOLETE VAR_NAMESPACE, LOC_STATIC,
742// OBSOLETE &objfile->global_psymbols,
743// OBSOLETE 0, CUR_SYMBOL_VALUE,
744// OBSOLETE psymtab_language, objfile);
745// OBSOLETE continue;
746// OBSOLETE
747// OBSOLETE case 'T':
748// OBSOLETE if (p != namestring) /* a name is there, not just :T... */
749// OBSOLETE {
750// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
751// OBSOLETE STRUCT_NAMESPACE, LOC_TYPEDEF,
752// OBSOLETE &objfile->static_psymbols,
753// OBSOLETE CUR_SYMBOL_VALUE, 0,
754// OBSOLETE psymtab_language, objfile);
755// OBSOLETE if (p[2] == 't')
756// OBSOLETE {
757// OBSOLETE /* Also a typedef with the same name. */
758// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
759// OBSOLETE VAR_NAMESPACE, LOC_TYPEDEF,
760// OBSOLETE &objfile->static_psymbols,
761// OBSOLETE CUR_SYMBOL_VALUE, 0, psymtab_language,
762// OBSOLETE objfile);
763// OBSOLETE p += 1;
764// OBSOLETE }
765// OBSOLETE /* The semantics of C++ state that "struct foo { ... }"
766// OBSOLETE also defines a typedef for "foo". Unfortuantely, cfront
767// OBSOLETE never makes the typedef when translating from C++ to C.
768// OBSOLETE We make the typedef here so that "ptype foo" works as
769// OBSOLETE expected for cfront translated code. */
770// OBSOLETE else if (psymtab_language == language_cplus)
771// OBSOLETE {
772// OBSOLETE /* Also a typedef with the same name. */
773// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
774// OBSOLETE VAR_NAMESPACE, LOC_TYPEDEF,
775// OBSOLETE &objfile->static_psymbols,
776// OBSOLETE CUR_SYMBOL_VALUE, 0, psymtab_language,
777// OBSOLETE objfile);
778// OBSOLETE }
779// OBSOLETE }
780// OBSOLETE goto check_enum;
781// OBSOLETE case 't':
782// OBSOLETE if (p != namestring) /* a name is there, not just :T... */
783// OBSOLETE {
784// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
785// OBSOLETE VAR_NAMESPACE, LOC_TYPEDEF,
786// OBSOLETE &objfile->static_psymbols,
787// OBSOLETE CUR_SYMBOL_VALUE, 0,
788// OBSOLETE psymtab_language, objfile);
789// OBSOLETE }
790// OBSOLETE check_enum:
791// OBSOLETE /* If this is an enumerated type, we need to
792// OBSOLETE add all the enum constants to the partial symbol
793// OBSOLETE table. This does not cover enums without names, e.g.
794// OBSOLETE "enum {a, b} c;" in C, but fortunately those are
795// OBSOLETE rare. There is no way for GDB to find those from the
796// OBSOLETE enum type without spending too much time on it. Thus
797// OBSOLETE to solve this problem, the compiler needs to put out the
798// OBSOLETE enum in a nameless type. GCC2 does this. */
799// OBSOLETE
800// OBSOLETE /* We are looking for something of the form
801// OBSOLETE <name> ":" ("t" | "T") [<number> "="] "e" <size>
802// OBSOLETE {<constant> ":" <value> ","} ";". */
803// OBSOLETE
804// OBSOLETE /* Skip over the colon and the 't' or 'T'. */
805// OBSOLETE p += 2;
806// OBSOLETE /* This type may be given a number. Also, numbers can come
807// OBSOLETE in pairs like (0,26). Skip over it. */
808// OBSOLETE while ((*p >= '0' && *p <= '9')
809// OBSOLETE || *p == '(' || *p == ',' || *p == ')'
810// OBSOLETE || *p == '=')
811// OBSOLETE p++;
812// OBSOLETE
813// OBSOLETE if (*p++ == 'e')
814// OBSOLETE {
815// OBSOLETE /* We have found an enumerated type. skip size */
816// OBSOLETE while (*p >= '0' && *p <= '9')
817// OBSOLETE p++;
818// OBSOLETE /* According to comments in read_enum_type
819// OBSOLETE a comma could end it instead of a semicolon.
820// OBSOLETE I don't know where that happens.
821// OBSOLETE Accept either. */
822// OBSOLETE while (*p && *p != ';' && *p != ',')
823// OBSOLETE {
824// OBSOLETE char *q;
825// OBSOLETE
826// OBSOLETE /* Check for and handle cretinous dbx symbol name
827// OBSOLETE continuation!
828// OBSOLETE if (*p == '\\')
829// OBSOLETE p = next_symbol_text (objfile);
830// OBSOLETE */
831// OBSOLETE
832// OBSOLETE /* Point to the character after the name
833// OBSOLETE of the enum constant. */
834// OBSOLETE for (q = p; *q && *q != ':'; q++)
835// OBSOLETE ;
836// OBSOLETE /* Note that the value doesn't matter for
837// OBSOLETE enum constants in psymtabs, just in symtabs. */
838// OBSOLETE add_psymbol_to_list (p, q - p,
839// OBSOLETE VAR_NAMESPACE, LOC_CONST,
840// OBSOLETE &objfile->static_psymbols, 0,
841// OBSOLETE 0, psymtab_language, objfile);
842// OBSOLETE /* Point past the name. */
843// OBSOLETE p = q;
844// OBSOLETE /* Skip over the value. */
845// OBSOLETE while (*p && *p != ',')
846// OBSOLETE p++;
847// OBSOLETE /* Advance past the comma. */
848// OBSOLETE if (*p)
849// OBSOLETE p++;
850// OBSOLETE }
851// OBSOLETE }
852// OBSOLETE continue;
853// OBSOLETE case 'c':
854// OBSOLETE /* Constant, e.g. from "const" in Pascal. */
855// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
856// OBSOLETE VAR_NAMESPACE, LOC_CONST,
857// OBSOLETE &objfile->static_psymbols, CUR_SYMBOL_VALUE,
858// OBSOLETE 0, psymtab_language, objfile);
859// OBSOLETE continue;
860// OBSOLETE
861// OBSOLETE case 'f':
862// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
863// OBSOLETE if (pst && pst->textlow == 0)
864// OBSOLETE pst->textlow = CUR_SYMBOL_VALUE;
865// OBSOLETE
866// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
867// OBSOLETE VAR_NAMESPACE, LOC_BLOCK,
868// OBSOLETE &objfile->static_psymbols, CUR_SYMBOL_VALUE,
869// OBSOLETE 0, psymtab_language, objfile);
870// OBSOLETE continue;
871// OBSOLETE
872// OBSOLETE case 'F':
873// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
874// OBSOLETE if (pst && pst->textlow == 0)
875// OBSOLETE pst->textlow = CUR_SYMBOL_VALUE;
876// OBSOLETE
877// OBSOLETE add_psymbol_to_list (namestring, p - namestring,
878// OBSOLETE VAR_NAMESPACE, LOC_BLOCK,
879// OBSOLETE &objfile->global_psymbols, CUR_SYMBOL_VALUE,
880// OBSOLETE 0, psymtab_language, objfile);
881// OBSOLETE continue;
882// OBSOLETE
883// OBSOLETE case 'p':
884// OBSOLETE case 'l':
885// OBSOLETE case 's':
886// OBSOLETE continue;
887// OBSOLETE
888// OBSOLETE case ':':
889// OBSOLETE /* It is a C++ nested symbol. We don't need to record it
890// OBSOLETE (I don't think); if we try to look up foo::bar::baz,
891// OBSOLETE then symbols for the symtab containing foo should get
892// OBSOLETE read in, I think. */
893// OBSOLETE /* Someone says sun cc puts out symbols like
894// OBSOLETE /foo/baz/maclib::/usr/local/bin/maclib,
895// OBSOLETE which would get here with a symbol type of ':'. */
896// OBSOLETE continue;
897// OBSOLETE
898// OBSOLETE default:
899// OBSOLETE /* Unexpected symbol descriptor. The second and subsequent stabs
900// OBSOLETE of a continued stab can show up here. The question is
901// OBSOLETE whether they ever can mimic a normal stab--it would be
902// OBSOLETE nice if not, since we certainly don't want to spend the
903// OBSOLETE time searching to the end of every string looking for
904// OBSOLETE a backslash. */
905// OBSOLETE
906// OBSOLETE complain (&unknown_symchar_complaint, p[1]);
907// OBSOLETE continue;
908// OBSOLETE }
909// OBSOLETE
910// OBSOLETE case N_SYM_RBRAC:
911// OBSOLETE CUR_SYMBOL_VALUE += ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
912// OBSOLETE #ifdef HANDLE_RBRAC
913// OBSOLETE HANDLE_RBRAC (CUR_SYMBOL_VALUE);
914// OBSOLETE continue;
915// OBSOLETE #endif
916// OBSOLETE case N_SYM_LBRAC:
917// OBSOLETE continue;
918// OBSOLETE
919// OBSOLETE default:
920// OBSOLETE /* If we haven't found it yet, ignore it. It's probably some
921// OBSOLETE new type we don't know about yet. */
922// OBSOLETE complain (&unknown_symtype_complaint,
923// OBSOLETE local_hex_string ((unsigned long) bufp->n_type));
924// OBSOLETE continue;
925// OBSOLETE }
926// OBSOLETE }
927// OBSOLETE
928// OBSOLETE DBX_SYMCOUNT (objfile) = symnum;
929// OBSOLETE
930// OBSOLETE /* If there's stuff to be cleaned up, clean it up. */
931// OBSOLETE if (DBX_SYMCOUNT (objfile) > 0
932// OBSOLETE /*FIXME, does this have a bug at start address 0? */
933// OBSOLETE && last_o_file_start
934// OBSOLETE && objfile->ei.entry_point < bufp->n_value
935// OBSOLETE && objfile->ei.entry_point >= last_o_file_start)
936// OBSOLETE {
937// OBSOLETE objfile->ei.entry_file_lowpc = last_o_file_start;
938// OBSOLETE objfile->ei.entry_file_highpc = bufp->n_value;
939// OBSOLETE }
940// OBSOLETE
941// OBSOLETE if (pst)
942// OBSOLETE {
943// OBSOLETE os9k_end_psymtab (pst, psymtab_include_list, includes_used,
944// OBSOLETE symnum, end_of_text_addr,
945// OBSOLETE dependency_list, dependencies_used);
946// OBSOLETE }
947// OBSOLETE /*
948// OBSOLETE do_cleanups (back_to);
949// OBSOLETE */
950// OBSOLETE }
951// OBSOLETE
952// OBSOLETE /* Allocate and partially fill a partial symtab. It will be
953// OBSOLETE completely filled at the end of the symbol list.
954// OBSOLETE
955// OBSOLETE SYMFILE_NAME is the name of the symbol-file we are reading from, and ADDR
956// OBSOLETE is the address relative to which its symbols are (incremental) or 0
957// OBSOLETE (normal). */
958// OBSOLETE
959// OBSOLETE
960// OBSOLETE static struct partial_symtab *
961// OBSOLETE os9k_start_psymtab (struct objfile *objfile, char *filename, CORE_ADDR textlow,
962// OBSOLETE int ldsymoff, int ldsymcnt,
963// OBSOLETE struct partial_symbol **global_syms,
964// OBSOLETE struct partial_symbol **static_syms)
965// OBSOLETE {
966// OBSOLETE struct partial_symtab *result =
967// OBSOLETE start_psymtab_common (objfile, objfile->section_offsets,
968// OBSOLETE filename, textlow, global_syms, static_syms);
969// OBSOLETE
970// OBSOLETE result->read_symtab_private = (char *)
971// OBSOLETE obstack_alloc (&objfile->psymbol_obstack, sizeof (struct symloc));
972// OBSOLETE
973// OBSOLETE LDSYMOFF (result) = ldsymoff;
974// OBSOLETE LDSYMCNT (result) = ldsymcnt;
975// OBSOLETE result->read_symtab = os9k_psymtab_to_symtab;
976// OBSOLETE
977// OBSOLETE /* Deduce the source language from the filename for this psymtab. */
978// OBSOLETE psymtab_language = deduce_language_from_filename (filename);
979// OBSOLETE return result;
980// OBSOLETE }
981// OBSOLETE
982// OBSOLETE /* Close off the current usage of PST.
983// OBSOLETE Returns PST or NULL if the partial symtab was empty and thrown away.
984// OBSOLETE FIXME: List variables and peculiarities of same. */
985// OBSOLETE
986// OBSOLETE static struct partial_symtab *
987// OBSOLETE os9k_end_psymtab (struct partial_symtab *pst, char **include_list,
988// OBSOLETE int num_includes, int capping_symbol_cnt,
989// OBSOLETE CORE_ADDR capping_text,
990// OBSOLETE struct partial_symtab **dependency_list,
991// OBSOLETE int number_dependencies)
992// OBSOLETE {
993// OBSOLETE int i;
994// OBSOLETE struct partial_symtab *p1;
995// OBSOLETE struct objfile *objfile = pst->objfile;
996// OBSOLETE
997// OBSOLETE if (capping_symbol_cnt != -1)
998// OBSOLETE LDSYMCNT (pst) = capping_symbol_cnt - LDSYMCNT (pst);
999// OBSOLETE
1000// OBSOLETE /* Under Solaris, the N_SO symbols always have a value of 0,
1001// OBSOLETE instead of the usual address of the .o file. Therefore,
1002// OBSOLETE we have to do some tricks to fill in texthigh and textlow.
1003// OBSOLETE The first trick is in partial-stab.h: if we see a static
1004// OBSOLETE or global function, and the textlow for the current pst
1005// OBSOLETE is still 0, then we use that function's address for
1006// OBSOLETE the textlow of the pst.
1007// OBSOLETE
1008// OBSOLETE Now, to fill in texthigh, we remember the last function seen
1009// OBSOLETE in the .o file (also in partial-stab.h). Also, there's a hack in
1010// OBSOLETE bfd/elf.c and gdb/elfread.c to pass the ELF st_size field
1011// OBSOLETE to here via the misc_info field. Therefore, we can fill in
1012// OBSOLETE a reliable texthigh by taking the address plus size of the
1013// OBSOLETE last function in the file.
1014// OBSOLETE
1015// OBSOLETE Unfortunately, that does not cover the case where the last function
1016// OBSOLETE in the file is static. See the paragraph below for more comments
1017// OBSOLETE on this situation.
1018// OBSOLETE
1019// OBSOLETE Finally, if we have a valid textlow for the current file, we run
1020// OBSOLETE down the partial_symtab_list filling in previous texthighs that
1021// OBSOLETE are still unknown. */
1022// OBSOLETE
1023// OBSOLETE if (pst->texthigh == 0 && last_function_name)
1024// OBSOLETE {
1025// OBSOLETE char *p;
1026// OBSOLETE int n;
1027// OBSOLETE struct minimal_symbol *minsym;
1028// OBSOLETE
1029// OBSOLETE p = strchr (last_function_name, ':');
1030// OBSOLETE if (p == NULL)
1031// OBSOLETE p = last_function_name;
1032// OBSOLETE n = p - last_function_name;
1033// OBSOLETE p = alloca (n + 1);
1034// OBSOLETE strncpy (p, last_function_name, n);
1035// OBSOLETE p[n] = 0;
1036// OBSOLETE
1037// OBSOLETE minsym = lookup_minimal_symbol (p, NULL, objfile);
1038// OBSOLETE
1039// OBSOLETE if (minsym)
1040// OBSOLETE {
1041// OBSOLETE pst->texthigh = SYMBOL_VALUE_ADDRESS (minsym) + (long) MSYMBOL_INFO (minsym);
1042// OBSOLETE }
1043// OBSOLETE else
1044// OBSOLETE {
1045// OBSOLETE /* This file ends with a static function, and it's
1046// OBSOLETE difficult to imagine how hard it would be to track down
1047// OBSOLETE the elf symbol. Luckily, most of the time no one will notice,
1048// OBSOLETE since the next file will likely be compiled with -g, so
1049// OBSOLETE the code below will copy the first fuction's start address
1050// OBSOLETE back to our texthigh variable. (Also, if this file is the
1051// OBSOLETE last one in a dynamically linked program, texthigh already
1052// OBSOLETE has the right value.) If the next file isn't compiled
1053// OBSOLETE with -g, then the last function in this file winds up owning
1054// OBSOLETE all of the text space up to the next -g file, or the end (minus
1055// OBSOLETE shared libraries). This only matters for single stepping,
1056// OBSOLETE and even then it will still work, except that it will single
1057// OBSOLETE step through all of the covered functions, instead of setting
1058// OBSOLETE breakpoints around them as it usualy does. This makes it
1059// OBSOLETE pretty slow, but at least it doesn't fail.
1060// OBSOLETE
1061// OBSOLETE We can fix this with a fairly big change to bfd, but we need
1062// OBSOLETE to coordinate better with Cygnus if we want to do that. FIXME. */
1063// OBSOLETE }
1064// OBSOLETE last_function_name = NULL;
1065// OBSOLETE }
1066// OBSOLETE
1067// OBSOLETE /* this test will be true if the last .o file is only data */
1068// OBSOLETE if (pst->textlow == 0)
1069// OBSOLETE pst->textlow = pst->texthigh;
1070// OBSOLETE
1071// OBSOLETE /* If we know our own starting text address, then walk through all other
1072// OBSOLETE psymtabs for this objfile, and if any didn't know their ending text
1073// OBSOLETE address, set it to our starting address. Take care to not set our
1074// OBSOLETE own ending address to our starting address, nor to set addresses on
1075// OBSOLETE `dependency' files that have both textlow and texthigh zero. */
1076// OBSOLETE if (pst->textlow)
1077// OBSOLETE {
1078// OBSOLETE ALL_OBJFILE_PSYMTABS (objfile, p1)
1079// OBSOLETE {
1080// OBSOLETE if (p1->texthigh == 0 && p1->textlow != 0 && p1 != pst)
1081// OBSOLETE {
1082// OBSOLETE p1->texthigh = pst->textlow;
1083// OBSOLETE /* if this file has only data, then make textlow match texthigh */
1084// OBSOLETE if (p1->textlow == 0)
1085// OBSOLETE p1->textlow = p1->texthigh;
1086// OBSOLETE }
1087// OBSOLETE }
1088// OBSOLETE }
1089// OBSOLETE
1090// OBSOLETE /* End of kludge for patching Solaris textlow and texthigh. */
1091// OBSOLETE
1092// OBSOLETE pst->n_global_syms =
1093// OBSOLETE objfile->global_psymbols.next - (objfile->global_psymbols.list + pst->globals_offset);
1094// OBSOLETE pst->n_static_syms =
1095// OBSOLETE objfile->static_psymbols.next - (objfile->static_psymbols.list + pst->statics_offset);
1096// OBSOLETE
1097// OBSOLETE pst->number_of_dependencies = number_dependencies;
1098// OBSOLETE if (number_dependencies)
1099// OBSOLETE {
1100// OBSOLETE pst->dependencies = (struct partial_symtab **)
1101// OBSOLETE obstack_alloc (&objfile->psymbol_obstack,
1102// OBSOLETE number_dependencies * sizeof (struct partial_symtab *));
1103// OBSOLETE memcpy (pst->dependencies, dependency_list,
1104// OBSOLETE number_dependencies * sizeof (struct partial_symtab *));
1105// OBSOLETE }
1106// OBSOLETE else
1107// OBSOLETE pst->dependencies = 0;
1108// OBSOLETE
1109// OBSOLETE for (i = 0; i < num_includes; i++)
1110// OBSOLETE {
1111// OBSOLETE struct partial_symtab *subpst =
1112// OBSOLETE allocate_psymtab (include_list[i], objfile);
1113// OBSOLETE
1114// OBSOLETE subpst->section_offsets = pst->section_offsets;
1115// OBSOLETE subpst->read_symtab_private =
1116// OBSOLETE (char *) obstack_alloc (&objfile->psymbol_obstack,
1117// OBSOLETE sizeof (struct symloc));
1118// OBSOLETE LDSYMOFF (subpst) =
1119// OBSOLETE LDSYMCNT (subpst) =
1120// OBSOLETE subpst->textlow =
1121// OBSOLETE subpst->texthigh = 0;
1122// OBSOLETE
1123// OBSOLETE /* We could save slight bits of space by only making one of these,
1124// OBSOLETE shared by the entire set of include files. FIXME-someday. */
1125// OBSOLETE subpst->dependencies = (struct partial_symtab **)
1126// OBSOLETE obstack_alloc (&objfile->psymbol_obstack,
1127// OBSOLETE sizeof (struct partial_symtab *));
1128// OBSOLETE subpst->dependencies[0] = pst;
1129// OBSOLETE subpst->number_of_dependencies = 1;
1130// OBSOLETE
1131// OBSOLETE subpst->globals_offset =
1132// OBSOLETE subpst->n_global_syms =
1133// OBSOLETE subpst->statics_offset =
1134// OBSOLETE subpst->n_static_syms = 0;
1135// OBSOLETE
1136// OBSOLETE subpst->readin = 0;
1137// OBSOLETE subpst->symtab = 0;
1138// OBSOLETE subpst->read_symtab = pst->read_symtab;
1139// OBSOLETE }
1140// OBSOLETE
1141// OBSOLETE sort_pst_symbols (pst);
1142// OBSOLETE
1143// OBSOLETE /* If there is already a psymtab or symtab for a file of this name,
1144// OBSOLETE remove it.
1145// OBSOLETE (If there is a symtab, more drastic things also happen.)
1146// OBSOLETE This happens in VxWorks. */
1147// OBSOLETE free_named_symtabs (pst->filename);
1148// OBSOLETE
1149// OBSOLETE if (num_includes == 0
1150// OBSOLETE && number_dependencies == 0
1151// OBSOLETE && pst->n_global_syms == 0
1152// OBSOLETE && pst->n_static_syms == 0)
1153// OBSOLETE {
1154// OBSOLETE /* Throw away this psymtab, it's empty. We can't deallocate it, since
1155// OBSOLETE it is on the obstack, but we can forget to chain it on the list. */
1156// OBSOLETE /* Indicate that psymtab was thrown away. */
1157// OBSOLETE
1158// OBSOLETE discard_psymtab (pst);
1159// OBSOLETE
1160// OBSOLETE pst = (struct partial_symtab *) NULL;
1161// OBSOLETE }
1162// OBSOLETE return pst;
1163// OBSOLETE }
1164// OBSOLETE \f
1165// OBSOLETE static void
1166// OBSOLETE os9k_psymtab_to_symtab_1 (struct partial_symtab *pst)
1167// OBSOLETE {
1168// OBSOLETE struct cleanup *old_chain;
1169// OBSOLETE int i;
1170// OBSOLETE
1171// OBSOLETE if (!pst)
1172// OBSOLETE return;
1173// OBSOLETE
1174// OBSOLETE if (pst->readin)
1175// OBSOLETE {
1176// OBSOLETE fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
1177// OBSOLETE pst->filename);
1178// OBSOLETE return;
1179// OBSOLETE }
1180// OBSOLETE
1181// OBSOLETE /* Read in all partial symtabs on which this one is dependent */
1182// OBSOLETE for (i = 0; i < pst->number_of_dependencies; i++)
1183// OBSOLETE if (!pst->dependencies[i]->readin)
1184// OBSOLETE {
1185// OBSOLETE /* Inform about additional files that need to be read in. */
1186// OBSOLETE if (info_verbose)
1187// OBSOLETE {
1188// OBSOLETE fputs_filtered (" ", gdb_stdout);
1189// OBSOLETE wrap_here ("");
1190// OBSOLETE fputs_filtered ("and ", gdb_stdout);
1191// OBSOLETE wrap_here ("");
1192// OBSOLETE printf_filtered ("%s...", pst->dependencies[i]->filename);
1193// OBSOLETE wrap_here (""); /* Flush output */
1194// OBSOLETE gdb_flush (gdb_stdout);
1195// OBSOLETE }
1196// OBSOLETE os9k_psymtab_to_symtab_1 (pst->dependencies[i]);
1197// OBSOLETE }
1198// OBSOLETE
1199// OBSOLETE if (LDSYMCNT (pst)) /* Otherwise it's a dummy */
1200// OBSOLETE {
1201// OBSOLETE /* Init stuff necessary for reading in symbols */
1202// OBSOLETE stabsread_init ();
1203// OBSOLETE buildsym_init ();
1204// OBSOLETE old_chain = make_cleanup (really_free_pendings, 0);
1205// OBSOLETE
1206// OBSOLETE /* Read in this file's symbols */
1207// OBSOLETE os9k_read_ofile_symtab (pst);
1208// OBSOLETE sort_symtab_syms (pst->symtab);
1209// OBSOLETE do_cleanups (old_chain);
1210// OBSOLETE }
1211// OBSOLETE
1212// OBSOLETE pst->readin = 1;
1213// OBSOLETE }
1214// OBSOLETE
1215// OBSOLETE /* Read in all of the symbols for a given psymtab for real.
1216// OBSOLETE Be verbose about it if the user wants that. */
1217// OBSOLETE
1218// OBSOLETE static void
1219// OBSOLETE os9k_psymtab_to_symtab (struct partial_symtab *pst)
1220// OBSOLETE {
1221// OBSOLETE bfd *sym_bfd;
1222// OBSOLETE
1223// OBSOLETE if (!pst)
1224// OBSOLETE return;
1225// OBSOLETE
1226// OBSOLETE if (pst->readin)
1227// OBSOLETE {
1228// OBSOLETE fprintf_unfiltered (gdb_stderr, "Psymtab for %s already read in. Shouldn't happen.\n",
1229// OBSOLETE pst->filename);
1230// OBSOLETE return;
1231// OBSOLETE }
1232// OBSOLETE
1233// OBSOLETE if (LDSYMCNT (pst) || pst->number_of_dependencies)
1234// OBSOLETE {
1235// OBSOLETE /* Print the message now, before reading the string table,
1236// OBSOLETE to avoid disconcerting pauses. */
1237// OBSOLETE if (info_verbose)
1238// OBSOLETE {
1239// OBSOLETE printf_filtered ("Reading in symbols for %s...", pst->filename);
1240// OBSOLETE gdb_flush (gdb_stdout);
1241// OBSOLETE }
1242// OBSOLETE
1243// OBSOLETE sym_bfd = pst->objfile->obfd;
1244// OBSOLETE os9k_psymtab_to_symtab_1 (pst);
1245// OBSOLETE
1246// OBSOLETE /* Match with global symbols. This only needs to be done once,
1247// OBSOLETE after all of the symtabs and dependencies have been read in. */
1248// OBSOLETE scan_file_globals (pst->objfile);
1249// OBSOLETE
1250// OBSOLETE /* Finish up the debug error message. */
1251// OBSOLETE if (info_verbose)
1252// OBSOLETE printf_filtered ("done.\n");
1253// OBSOLETE }
1254// OBSOLETE }
1255// OBSOLETE
1256// OBSOLETE /* Read in a defined section of a specific object file's symbols. */
1257// OBSOLETE static void
1258// OBSOLETE os9k_read_ofile_symtab (struct partial_symtab *pst)
1259// OBSOLETE {
1260// OBSOLETE register struct internal_symstruct *bufp;
1261// OBSOLETE unsigned char type;
1262// OBSOLETE unsigned max_symnum;
1263// OBSOLETE register bfd *abfd;
1264// OBSOLETE struct objfile *objfile;
1265// OBSOLETE int sym_offset; /* Offset to start of symbols to read */
1266// OBSOLETE CORE_ADDR text_offset; /* Start of text segment for symbols */
1267// OBSOLETE int text_size; /* Size of text segment for symbols */
1268// OBSOLETE FILE *dbg_file;
1269// OBSOLETE
1270// OBSOLETE objfile = pst->objfile;
1271// OBSOLETE sym_offset = LDSYMOFF (pst);
1272// OBSOLETE max_symnum = LDSYMCNT (pst);
1273// OBSOLETE text_offset = pst->textlow;
1274// OBSOLETE text_size = pst->texthigh - pst->textlow;
1275// OBSOLETE
1276// OBSOLETE current_objfile = objfile;
1277// OBSOLETE subfile_stack = NULL;
1278// OBSOLETE last_source_file = NULL;
1279// OBSOLETE
1280// OBSOLETE abfd = objfile->obfd;
1281// OBSOLETE dbg_file = objfile->auxf2;
1282// OBSOLETE
1283// OBSOLETE #if 0
1284// OBSOLETE /* It is necessary to actually read one symbol *before* the start
1285// OBSOLETE of this symtab's symbols, because the GCC_COMPILED_FLAG_SYMBOL
1286// OBSOLETE occurs before the N_SO symbol.
1287// OBSOLETE Detecting this in read_dbx_symtab
1288// OBSOLETE would slow down initial readin, so we look for it here instead. */
1289// OBSOLETE if (!processing_acc_compilation && sym_offset >= (int) symbol_size)
1290// OBSOLETE {
1291// OBSOLETE fseek (objefile->auxf2, sym_offset, SEEK_CUR);
1292// OBSOLETE fill_sym (objfile->auxf2, abfd);
1293// OBSOLETE bufp = symbuf;
1294// OBSOLETE
1295// OBSOLETE processing_gcc_compilation = 0;
1296// OBSOLETE if (bufp->n_type == N_TEXT)
1297// OBSOLETE {
1298// OBSOLETE if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
1299// OBSOLETE processing_gcc_compilation = 1;
1300// OBSOLETE else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
1301// OBSOLETE processing_gcc_compilation = 2;
1302// OBSOLETE }
1303// OBSOLETE
1304// OBSOLETE /* Try to select a C++ demangling based on the compilation unit
1305// OBSOLETE producer. */
1306// OBSOLETE
1307// OBSOLETE if (processing_gcc_compilation)
1308// OBSOLETE {
1309// OBSOLETE if (AUTO_DEMANGLING)
1310// OBSOLETE {
1311// OBSOLETE set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
1312// OBSOLETE }
1313// OBSOLETE }
1314// OBSOLETE }
1315// OBSOLETE else
1316// OBSOLETE {
1317// OBSOLETE /* The N_SO starting this symtab is the first symbol, so we
1318// OBSOLETE better not check the symbol before it. I'm not this can
1319// OBSOLETE happen, but it doesn't hurt to check for it. */
1320// OBSOLETE bfd_seek (symfile_bfd, sym_offset, SEEK_CUR);
1321// OBSOLETE processing_gcc_compilation = 0;
1322// OBSOLETE }
1323// OBSOLETE #endif /* 0 */
1324// OBSOLETE
1325// OBSOLETE fseek (dbg_file, (long) sym_offset, 0);
1326// OBSOLETE /*
1327// OBSOLETE if (bufp->n_type != (unsigned char)N_SYM_SYM)
1328// OBSOLETE error("First symbol in segment of executable not a source symbol");
1329// OBSOLETE */
1330// OBSOLETE
1331// OBSOLETE for (symnum = 0; symnum < max_symnum; symnum++)
1332// OBSOLETE {
1333// OBSOLETE QUIT; /* Allow this to be interruptable */
1334// OBSOLETE fill_sym (dbg_file, abfd);
1335// OBSOLETE bufp = symbuf;
1336// OBSOLETE type = bufp->n_type;
1337// OBSOLETE
1338// OBSOLETE os9k_process_one_symbol ((int) type, (int) bufp->n_desc,
1339// OBSOLETE (CORE_ADDR) bufp->n_value, bufp->n_strx, pst->section_offsets, objfile);
1340// OBSOLETE
1341// OBSOLETE /* We skip checking for a new .o or -l file; that should never
1342// OBSOLETE happen in this routine. */
1343// OBSOLETE #if 0
1344// OBSOLETE else
1345// OBSOLETE if (type == N_TEXT)
1346// OBSOLETE {
1347// OBSOLETE /* I don't think this code will ever be executed, because
1348// OBSOLETE the GCC_COMPILED_FLAG_SYMBOL usually is right before
1349// OBSOLETE the N_SO symbol which starts this source file.
1350// OBSOLETE However, there is no reason not to accept
1351// OBSOLETE the GCC_COMPILED_FLAG_SYMBOL anywhere. */
1352// OBSOLETE
1353// OBSOLETE if (STREQ (namestring, GCC_COMPILED_FLAG_SYMBOL))
1354// OBSOLETE processing_gcc_compilation = 1;
1355// OBSOLETE else if (STREQ (namestring, GCC2_COMPILED_FLAG_SYMBOL))
1356// OBSOLETE processing_gcc_compilation = 2;
1357// OBSOLETE
1358// OBSOLETE if (AUTO_DEMANGLING)
1359// OBSOLETE {
1360// OBSOLETE set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
1361// OBSOLETE }
1362// OBSOLETE }
1363// OBSOLETE else if (type & N_EXT || type == (unsigned char) N_TEXT
1364// OBSOLETE || type == (unsigned char) N_NBTEXT
1365// OBSOLETE )
1366// OBSOLETE {
1367// OBSOLETE /* Global symbol: see if we came across a dbx defintion for
1368// OBSOLETE a corresponding symbol. If so, store the value. Remove
1369// OBSOLETE syms from the chain when their values are stored, but
1370// OBSOLETE search the whole chain, as there may be several syms from
1371// OBSOLETE different files with the same name. */
1372// OBSOLETE /* This is probably not true. Since the files will be read
1373// OBSOLETE in one at a time, each reference to a global symbol will
1374// OBSOLETE be satisfied in each file as it appears. So we skip this
1375// OBSOLETE section. */
1376// OBSOLETE ;
1377// OBSOLETE }
1378// OBSOLETE #endif /* 0 */
1379// OBSOLETE }
1380// OBSOLETE
1381// OBSOLETE current_objfile = NULL;
1382// OBSOLETE
1383// OBSOLETE /* In a Solaris elf file, this variable, which comes from the
1384// OBSOLETE value of the N_SO symbol, will still be 0. Luckily, text_offset,
1385// OBSOLETE which comes from pst->textlow is correct. */
1386// OBSOLETE if (last_source_start_addr == 0)
1387// OBSOLETE last_source_start_addr = text_offset;
1388// OBSOLETE pst->symtab = end_symtab (text_offset + text_size, objfile, SECT_OFF_TEXT (objfile));
1389// OBSOLETE end_stabs ();
1390// OBSOLETE }
1391// OBSOLETE \f
1392// OBSOLETE
1393// OBSOLETE /* This handles a single symbol from the symbol-file, building symbols
1394// OBSOLETE into a GDB symtab. It takes these arguments and an implicit argument.
1395// OBSOLETE
1396// OBSOLETE TYPE is the type field of the ".stab" symbol entry.
1397// OBSOLETE DESC is the desc field of the ".stab" entry.
1398// OBSOLETE VALU is the value field of the ".stab" entry.
1399// OBSOLETE NAME is the symbol name, in our address space.
1400// OBSOLETE SECTION_OFFSETS is a set of amounts by which the sections of this object
1401// OBSOLETE file were relocated when it was loaded into memory.
1402// OBSOLETE All symbols that refer
1403// OBSOLETE to memory locations need to be offset by these amounts.
1404// OBSOLETE OBJFILE is the object file from which we are reading symbols.
1405// OBSOLETE It is used in end_symtab. */
1406// OBSOLETE
1407// OBSOLETE static void
1408// OBSOLETE os9k_process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
1409// OBSOLETE struct section_offsets *section_offsets,
1410// OBSOLETE struct objfile *objfile)
1411// OBSOLETE {
1412// OBSOLETE register struct context_stack *new;
1413// OBSOLETE /* The stab type used for the definition of the last function.
1414// OBSOLETE N_STSYM or N_GSYM for SunOS4 acc; N_FUN for other compilers. */
1415// OBSOLETE static int function_stab_type = 0;
1416// OBSOLETE
1417// OBSOLETE #if 0
1418// OBSOLETE /* Something is wrong if we see real data before
1419// OBSOLETE seeing a source file name. */
1420// OBSOLETE if (last_source_file == NULL && type != (unsigned char) N_SO)
1421// OBSOLETE {
1422// OBSOLETE /* Ignore any symbols which appear before an N_SO symbol.
1423// OBSOLETE Currently no one puts symbols there, but we should deal
1424// OBSOLETE gracefully with the case. A complain()t might be in order,
1425// OBSOLETE but this should not be an error (). */
1426// OBSOLETE return;
1427// OBSOLETE }
1428// OBSOLETE #endif /* 0 */
1429// OBSOLETE
1430// OBSOLETE switch (type)
1431// OBSOLETE {
1432// OBSOLETE case N_SYM_LBRAC:
1433// OBSOLETE /* On most machines, the block addresses are relative to the
1434// OBSOLETE N_SO, the linker did not relocate them (sigh). */
1435// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
1436// OBSOLETE new = push_context (desc, valu);
1437// OBSOLETE break;
1438// OBSOLETE
1439// OBSOLETE case N_SYM_RBRAC:
1440// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
1441// OBSOLETE new = pop_context ();
1442// OBSOLETE
1443// OBSOLETE #if !defined (OS9K_VARIABLES_INSIDE_BLOCK)
1444// OBSOLETE #define OS9K_VARIABLES_INSIDE_BLOCK(desc, gcc_p) 1
1445// OBSOLETE #endif
1446// OBSOLETE
1447// OBSOLETE if (!OS9K_VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
1448// OBSOLETE local_symbols = new->locals;
1449// OBSOLETE
1450// OBSOLETE if (context_stack_depth > 1)
1451// OBSOLETE {
1452// OBSOLETE /* This is not the outermost LBRAC...RBRAC pair in the function,
1453// OBSOLETE its local symbols preceded it, and are the ones just recovered
1454// OBSOLETE from the context stack. Define the block for them (but don't
1455// OBSOLETE bother if the block contains no symbols. Should we complain
1456// OBSOLETE on blocks without symbols? I can't think of any useful purpose
1457// OBSOLETE for them). */
1458// OBSOLETE if (local_symbols != NULL)
1459// OBSOLETE {
1460// OBSOLETE /* Muzzle a compiler bug that makes end < start. (which
1461// OBSOLETE compilers? Is this ever harmful?). */
1462// OBSOLETE if (new->start_addr > valu)
1463// OBSOLETE {
1464// OBSOLETE complain (&lbrac_rbrac_complaint);
1465// OBSOLETE new->start_addr = valu;
1466// OBSOLETE }
1467// OBSOLETE /* Make a block for the local symbols within. */
1468// OBSOLETE finish_block (0, &local_symbols, new->old_blocks,
1469// OBSOLETE new->start_addr, valu, objfile);
1470// OBSOLETE }
1471// OBSOLETE }
1472// OBSOLETE else
1473// OBSOLETE {
1474// OBSOLETE if (context_stack_depth == 0)
1475// OBSOLETE {
1476// OBSOLETE within_function = 0;
1477// OBSOLETE /* Make a block for the local symbols within. */
1478// OBSOLETE finish_block (new->name, &local_symbols, new->old_blocks,
1479// OBSOLETE new->start_addr, valu, objfile);
1480// OBSOLETE }
1481// OBSOLETE else
1482// OBSOLETE {
1483// OBSOLETE /* attach local_symbols to the end of new->locals */
1484// OBSOLETE if (!new->locals)
1485// OBSOLETE new->locals = local_symbols;
1486// OBSOLETE else
1487// OBSOLETE {
1488// OBSOLETE struct pending *p;
1489// OBSOLETE
1490// OBSOLETE p = new->locals;
1491// OBSOLETE while (p->next)
1492// OBSOLETE p = p->next;
1493// OBSOLETE p->next = local_symbols;
1494// OBSOLETE }
1495// OBSOLETE }
1496// OBSOLETE }
1497// OBSOLETE
1498// OBSOLETE if (OS9K_VARIABLES_INSIDE_BLOCK (desc, processing_gcc_compilation))
1499// OBSOLETE /* Now pop locals of block just finished. */
1500// OBSOLETE local_symbols = new->locals;
1501// OBSOLETE break;
1502// OBSOLETE
1503// OBSOLETE
1504// OBSOLETE case N_SYM_SLINE:
1505// OBSOLETE /* This type of "symbol" really just records
1506// OBSOLETE one line-number -- core-address correspondence.
1507// OBSOLETE Enter it in the line list for this symbol table. */
1508// OBSOLETE /* Relocate for dynamic loading and for ELF acc fn-relative syms. */
1509// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
1510// OBSOLETE /* FIXME: loses if sizeof (char *) > sizeof (int) */
1511// OBSOLETE gdb_assert (sizeof (name) <= sizeof (int));
1512// OBSOLETE record_line (current_subfile, (int) name, valu);
1513// OBSOLETE break;
1514// OBSOLETE
1515// OBSOLETE /* The following symbol types need to have the appropriate offset added
1516// OBSOLETE to their value; then we process symbol definitions in the name. */
1517// OBSOLETE case N_SYM_SYM:
1518// OBSOLETE
1519// OBSOLETE if (name)
1520// OBSOLETE {
1521// OBSOLETE char deftype;
1522// OBSOLETE char *dirn, *n;
1523// OBSOLETE char *p = strchr (name, ':');
1524// OBSOLETE if (p == NULL)
1525// OBSOLETE deftype = '\0';
1526// OBSOLETE else
1527// OBSOLETE deftype = p[1];
1528// OBSOLETE
1529// OBSOLETE
1530// OBSOLETE switch (deftype)
1531// OBSOLETE {
1532// OBSOLETE case 'S':
1533// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
1534// OBSOLETE n = strrchr (name, '/');
1535// OBSOLETE if (n != NULL)
1536// OBSOLETE {
1537// OBSOLETE *n = '\0';
1538// OBSOLETE n++;
1539// OBSOLETE dirn = name;
1540// OBSOLETE }
1541// OBSOLETE else
1542// OBSOLETE {
1543// OBSOLETE n = name;
1544// OBSOLETE dirn = NULL;
1545// OBSOLETE }
1546// OBSOLETE *p = '\0';
1547// OBSOLETE if (symfile_depth++ == 0)
1548// OBSOLETE {
1549// OBSOLETE if (last_source_file)
1550// OBSOLETE {
1551// OBSOLETE end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
1552// OBSOLETE end_stabs ();
1553// OBSOLETE }
1554// OBSOLETE start_stabs ();
1555// OBSOLETE os9k_stabs = 1;
1556// OBSOLETE start_symtab (n, dirn, valu);
1557// OBSOLETE record_debugformat ("OS9");
1558// OBSOLETE }
1559// OBSOLETE else
1560// OBSOLETE {
1561// OBSOLETE push_subfile ();
1562// OBSOLETE start_subfile (n, dirn != NULL ? dirn : current_subfile->dirname);
1563// OBSOLETE }
1564// OBSOLETE break;
1565// OBSOLETE
1566// OBSOLETE case 'f':
1567// OBSOLETE case 'F':
1568// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
1569// OBSOLETE function_stab_type = type;
1570// OBSOLETE
1571// OBSOLETE within_function = 1;
1572// OBSOLETE new = push_context (0, valu);
1573// OBSOLETE new->name = define_symbol (valu, name, desc, type, objfile);
1574// OBSOLETE break;
1575// OBSOLETE
1576// OBSOLETE case 'V':
1577// OBSOLETE case 'v':
1578// OBSOLETE valu += ANOFFSET (section_offsets, SECT_OFF_DATA (objfile));
1579// OBSOLETE define_symbol (valu, name, desc, type, objfile);
1580// OBSOLETE break;
1581// OBSOLETE
1582// OBSOLETE default:
1583// OBSOLETE define_symbol (valu, name, desc, type, objfile);
1584// OBSOLETE break;
1585// OBSOLETE }
1586// OBSOLETE }
1587// OBSOLETE break;
1588// OBSOLETE
1589// OBSOLETE case N_SYM_SE:
1590// OBSOLETE if (--symfile_depth != 0)
1591// OBSOLETE start_subfile (pop_subfile (), current_subfile->dirname);
1592// OBSOLETE break;
1593// OBSOLETE
1594// OBSOLETE default:
1595// OBSOLETE complain (&unknown_symtype_complaint,
1596// OBSOLETE local_hex_string ((unsigned long) type));
1597// OBSOLETE /* FALLTHROUGH */
1598// OBSOLETE break;
1599// OBSOLETE
1600// OBSOLETE case N_SYM_CMPLR:
1601// OBSOLETE break;
1602// OBSOLETE }
1603// OBSOLETE previous_stab_code = type;
1604// OBSOLETE }
1605// OBSOLETE
1606// OBSOLETE static struct sym_fns os9k_sym_fns =
1607// OBSOLETE {
1608// OBSOLETE bfd_target_os9k_flavour,
1609// OBSOLETE os9k_new_init, /* sym_new_init: init anything gbl to entire symtab */
1610// OBSOLETE os9k_symfile_init, /* sym_init: read initial info, setup for sym_read() */
1611// OBSOLETE os9k_symfile_read, /* sym_read: read a symbol file into symtab */
1612// OBSOLETE os9k_symfile_finish, /* sym_finish: finished with file, cleanup */
1613// OBSOLETE default_symfile_offsets, /* sym_offsets: parse user's offsets to internal form */
1614// OBSOLETE NULL /* next: pointer to next struct sym_fns */
1615// OBSOLETE };
1616// OBSOLETE
1617// OBSOLETE void
1618// OBSOLETE _initialize_os9kread (void)
1619// OBSOLETE {
1620// OBSOLETE add_symtab_fns (&os9k_sym_fns);
1621// OBSOLETE }
This page took 0.13306 seconds and 4 git commands to generate.