1 /* Read AIXcoff symbol tables and convert to internal format, for GDB.
2 Copyright (C) 1986-1991 Free Software Foundation, Inc.
3 Derived from coffread.c, dbxread.c, and a lot of hacking.
4 Contributed by IBM Corporation.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
26 /* Native only: Need struct tbtable in <sys/debug.h>. */
28 /* AIX COFF names have a preceeding dot `.' */
29 #define NAMES_HAVE_DOT 1
31 #include <sys/types.h>
36 #include <sys/param.h>
41 /*#include <linenum.h>*/
42 #include <sys/debug.h>
49 #include "coff/internal.h" /* FIXME, internal data from BFD */
50 #include "libcoff.h" /* FIXME, internal data from BFD */
51 #include "coff/rs6000.h" /* FIXME, raw file-format guts of xcoff */
53 /* Simplified internal version of coff symbol table information */
57 int c_symnum
; /* symbol number of this entry */
58 int c_nsyms
; /* 0 if syment only, 1 if syment + auxent */
65 /* The COFF line table, in raw form. */
66 static char *linetab
= NULL
; /* Its actual contents */
67 static long linetab_offset
; /* Its offset in the file */
68 static unsigned long linetab_size
; /* Its size */
70 /* last function's saved coff symbol `cs' */
72 static struct coff_symbol fcn_cs_saved
;
74 static bfd
*symfile_bfd
;
76 /* Core address of start and end of text of current source file.
77 This is calculated from the first function seen after a C_FILE
81 static CORE_ADDR cur_src_end_addr
;
83 /* Core address of the end of the first object file. */
85 static CORE_ADDR first_object_file_end
;
87 /* pointer to the string table */
90 /* length of the string table */
91 static int strtbl_len
;
93 /* pointer to debug section */
94 static char *debugsec
;
96 /* pointer to the a.out symbol table */
99 /* initial symbol-table-debug-string vector length */
101 #define INITIAL_STABVECTOR_LENGTH 40
103 struct pending_stabs
*global_stabs
;
106 /* Nonzero if within a function (so symbols should be local,
107 if nothing says specifically). */
111 /* Local variables that hold the shift and mask values for the
112 COFF file that we are currently reading. These come back to us
113 from BFD, and are referenced by their macro names, as well as
114 internally to the BTYPE, ISPTR, ISFCN, ISARY, ISTAG, and DECREF
115 macros from ../internalcoff.h . */
117 static unsigned local_n_btshft
;
118 static unsigned local_n_tmask
;
121 #define N_BTSHFT local_n_btshft
123 #define N_TMASK local_n_tmask
125 /* Local variables that hold the sizes in the file of various COFF structures.
126 (We only need to know this to read them from the file -- BFD will then
127 translate the data in them, into `internal_xxx' structs in the right
128 byte order, alignment, etc.) */
130 static unsigned local_symesz
;
133 /* coff_symfile_init()
134 is the coff-specific initialization routine for reading symbols.
135 It is passed a struct sym_fns which contains, among other things,
136 the BFD for the file whose symbols are being read, and a slot for
137 a pointer to "private data" which we fill with cookies and other
138 treats for coff_symfile_read().
140 We will only be called if this is a COFF or COFF-like file.
141 BFD handles figuring out the format of the file, and code in symtab.c
142 uses BFD's determination to vector to us.
144 The ultimate result is a new symtab (or, FIXME, eventually a psymtab). */
146 struct coff_symfile_info
{
147 file_ptr min_lineno_offset
; /* Where in file lowest line#s are */
148 file_ptr max_lineno_offset
; /* 1+last byte of line#s in file */
153 enter_line_range
PARAMS ((struct subfile
*, unsigned, unsigned,
154 CORE_ADDR
, CORE_ADDR
, unsigned *));
157 free_debugsection
PARAMS ((void));
160 init_debugsection
PARAMS ((bfd
*));
163 init_stringtab
PARAMS ((bfd
*, long, struct objfile
*));
166 aixcoff_symfile_init
PARAMS ((struct objfile
*));
169 aixcoff_new_init
PARAMS ((struct objfile
*));
172 aixcoff_symfile_read
PARAMS ((struct sym_fns
*, CORE_ADDR
, int));
175 aixcoff_symfile_finish
PARAMS ((struct objfile
*));
178 init_lineno
PARAMS ((bfd
*, long, int));
181 find_linenos
PARAMS ((bfd
*, sec_ptr
, PTR
));
184 read_symbol_lineno
PARAMS ((char *, int));
187 read_symbol_nvalue
PARAMS ((char *, int));
189 static struct symbol
*
190 process_xcoff_symbol
PARAMS ((struct coff_symbol
*, struct objfile
*));
193 read_xcoff_symtab
PARAMS ((struct objfile
*, int));
196 add_stab_to_list
PARAMS ((char *, struct pending_stabs
**));
199 sort_syms
PARAMS ((void));
202 compare_symbols
PARAMS ((const void *, const void *));
204 /* Call sort_syms to sort alphabetically
205 the symbols of each block of each symtab. */
208 compare_symbols (s1p
, s2p
)
212 /* Names that are less should come first. */
213 register struct symbol
**s1
= (struct symbol
**) s1p
;
214 register struct symbol
**s2
= (struct symbol
**) s2p
;
215 register int namediff
= strcmp (SYMBOL_NAME (*s1
), SYMBOL_NAME (*s2
));
219 /* For symbols of the same name, registers should come first. */
220 return ((SYMBOL_CLASS (*s2
) == LOC_REGISTER
)
221 - (SYMBOL_CLASS (*s1
) == LOC_REGISTER
));
225 /* Sort a vector of symbols by their value. */
230 register struct symtab
*s
;
231 register struct objfile
*objfile
;
233 register struct blockvector
*bv
;
234 register struct block
*b
;
236 for (objfile
= object_files
; objfile
!= NULL
; objfile
= objfile
-> next
)
238 for (s
= objfile
-> symtabs
; s
!= NULL
; s
= s
-> next
)
240 bv
= BLOCKVECTOR (s
);
241 nbl
= BLOCKVECTOR_NBLOCKS (bv
);
242 for (i
= 0; i
< nbl
; i
++)
244 b
= BLOCKVECTOR_BLOCK (bv
, i
);
245 if (BLOCK_SHOULD_SORT (b
))
247 qsort (&BLOCK_SYM (b
, 0), BLOCK_NSYMS (b
),
248 sizeof (struct symbol
*), compare_symbols
);
256 /* add a given stab string into given stab vector. */
259 add_stab_to_list (stabname
, stabvector
)
261 struct pending_stabs
**stabvector
;
263 if ( *stabvector
== NULL
) {
264 *stabvector
= (struct pending_stabs
*)
265 xmalloc (sizeof (struct pending_stabs
) +
266 INITIAL_STABVECTOR_LENGTH
* sizeof (char*));
267 (*stabvector
)->count
= 0;
268 (*stabvector
)->length
= INITIAL_STABVECTOR_LENGTH
;
270 else if ((*stabvector
)->count
>= (*stabvector
)->length
) {
271 (*stabvector
)->length
+= INITIAL_STABVECTOR_LENGTH
;
272 *stabvector
= (struct pending_stabs
*)
273 xrealloc ((char *) *stabvector
, sizeof (struct pending_stabs
) +
274 (*stabvector
)->length
* sizeof (char*));
276 (*stabvector
)->stab
[(*stabvector
)->count
++] = stabname
;
281 /* for all the stabs in a given stab vector, build appropriate types
282 and fix their symbols in given symbol vector. */
285 patch_block_stabs (symbols
, stabs
)
286 struct pending
*symbols
;
287 struct pending_stabs
*stabs
;
294 /* for all the stab entries, find their corresponding symbols and
295 patch their types! */
297 for (ii
=0; ii
< stabs
->count
; ++ii
) {
298 char *name
= stabs
->stab
[ii
];
299 char *pp
= (char*) index (name
, ':');
300 struct symbol
*sym
= find_symbol_in_list (symbols
, name
, pp
-name
);
303 /* printf ("ERROR! stab symbol not found!\n"); /* FIXME */
304 /* The above is a false alarm. There are cases the we can have
305 a stab, without its symbol. xlc generates this for the extern
306 definitions in inner blocks. */
311 if (*(pp
-1) == 'F' || *(pp
-1) == 'f')
312 SYMBOL_TYPE (sym
) = lookup_function_type (read_type (&pp
));
314 SYMBOL_TYPE (sym
) = read_type (&pp
, objfile
);
321 /* compare line table entry addresses. */
324 compare_lte (lte1
, lte2
)
325 struct linetable_entry
*lte1
, *lte2
;
327 return lte1
->pc
- lte2
->pc
;
330 /* Give a line table with function entries are marked, arrange its functions
331 in assending order and strip off function entry markers and return it in
332 a newly created table. If the old one is good enough, return the old one. */
334 static struct linetable
*
335 arrange_linetable (oldLineTb
)
336 struct linetable
*oldLineTb
; /* old linetable */
339 newline
, /* new line count */
340 function_count
; /* # of functions */
342 struct linetable_entry
*fentry
; /* function entry vector */
343 int fentry_size
; /* # of function entries */
344 struct linetable
*newLineTb
; /* new line table */
346 #define NUM_OF_FUNCTIONS 20
348 fentry_size
= NUM_OF_FUNCTIONS
;
349 fentry
= (struct linetable_entry
*)
350 malloc (fentry_size
* sizeof (struct linetable_entry
));
352 for (function_count
=0, ii
=0; ii
<oldLineTb
->nitems
; ++ii
) {
354 if (oldLineTb
->item
[ii
].line
== 0) { /* function entry found. */
356 if (function_count
>= fentry_size
) { /* make sure you have room. */
358 fentry
= (struct linetable_entry
*)
359 realloc (fentry
, fentry_size
* sizeof (struct linetable_entry
));
361 fentry
[function_count
].line
= ii
;
362 fentry
[function_count
].pc
= oldLineTb
->item
[ii
].pc
;
367 if (function_count
== 0) {
371 else if (function_count
> 1)
372 qsort (fentry
, function_count
, sizeof(struct linetable_entry
), compare_lte
);
374 /* allocate a new line table. */
375 newLineTb
= (struct linetable
*) malloc (sizeof (struct linetable
) +
376 (oldLineTb
->nitems
- function_count
) * sizeof (struct linetable_entry
));
378 /* if line table does not start with a function beginning, copy up until
382 if (oldLineTb
->item
[0].line
!= 0)
384 newline
< oldLineTb
->nitems
&& oldLineTb
->item
[newline
].line
; ++newline
)
385 newLineTb
->item
[newline
] = oldLineTb
->item
[newline
];
387 /* Now copy function lines one by one. */
389 for (ii
=0; ii
< function_count
; ++ii
) {
390 for (jj
= fentry
[ii
].line
+ 1;
391 jj
< oldLineTb
->nitems
&& oldLineTb
->item
[jj
].line
!= 0;
393 newLineTb
->item
[newline
] = oldLineTb
->item
[jj
];
396 newLineTb
->nitems
= oldLineTb
->nitems
- function_count
;
402 /* We try to detect the beginning of a compilation unit. That info will
403 be used as an entry in line number recording routines (enter_line_range) */
405 static unsigned first_fun_line_offset
;
406 static unsigned first_fun_bf
;
408 #define mark_first_line(OFFSET, SYMNUM) \
409 if (!first_fun_line_offset) { \
410 first_fun_line_offset = OFFSET; \
411 first_fun_bf = SYMNUM; \
415 /* include file support: C_BINCL/C_EINCL pairs will be kept in the
416 following `IncludeChain'. At the end of each symtab (end_symtab),
417 we will determine if we should create additional symtab's to
418 represent if (the include files. */
421 typedef struct _inclTable
{
422 char *name
; /* include filename */
423 int begin
, end
; /* offsets to the line table */
424 struct subfile
*subfile
;
425 unsigned funStartLine
; /* start line # of its function */
428 #define INITIAL_INCLUDE_TABLE_LENGTH 20
429 static InclTable
*inclTable
; /* global include table */
430 static int inclIndx
; /* last entry to table */
431 static int inclLength
; /* table length */
432 static int inclDepth
; /* nested include depth */
436 record_include_begin (cs
)
437 struct coff_symbol
*cs
;
439 /* In aixcoff, we assume include files cannot be nested (not in .c files
440 of course, but in corresponding .s files.) */
443 fatal ("aix internal: pending include file exists.");
447 /* allocate an include file, or make room for the new entry */
448 if (inclLength
== 0) {
449 inclTable
= (InclTable
*)
450 xmalloc (sizeof (InclTable
) * INITIAL_INCLUDE_TABLE_LENGTH
);
451 bzero (inclTable
, sizeof (InclTable
) * INITIAL_INCLUDE_TABLE_LENGTH
);
452 inclLength
= INITIAL_INCLUDE_TABLE_LENGTH
;
455 else if (inclIndx
>= inclLength
) {
456 inclLength
+= INITIAL_INCLUDE_TABLE_LENGTH
;
457 inclTable
= (InclTable
*)
458 xrealloc (inclTable
, sizeof (InclTable
) * inclLength
);
459 bzero (inclTable
+inclLength
-INITIAL_INCLUDE_TABLE_LENGTH
,
460 sizeof (InclTable
)*INITIAL_INCLUDE_TABLE_LENGTH
);
463 inclTable
[inclIndx
].name
= cs
->c_name
;
464 inclTable
[inclIndx
].begin
= cs
->c_value
;
469 record_include_end (cs
)
470 struct coff_symbol
*cs
;
475 fatal ("aix internal: Mismatch C_BINCL/C_EINCL pair found.");
477 pTbl
= &inclTable
[inclIndx
];
478 pTbl
->end
= cs
->c_value
;
489 if (inclTable
&& inclLength
)
490 for (ii
=0; ii
< inclIndx
; ++ii
)
491 printf ("name: %s, begin: 0x%x, end: 0x%x\n",
492 inclTable
[ii
].name
, inclTable
[ii
].begin
, inclTable
[ii
].end
);
496 /* given the start and end addresses of a compilation unit (or a csect, at times)
497 process its lines and create appropriate line vectors. */
500 process_linenos (start
, end
)
501 CORE_ADDR start
, end
;
506 struct subfile main_subfile
; /* subfile structure for the main
509 /* in the main source file, any time we see a function entry, we reset
510 this variable to function's absolute starting line number. All the
511 following line numbers in the function are relative to this, and
512 we record absolute line numbers in record_line(). */
514 int main_source_baseline
= 0;
520 if (!(offset
= first_fun_line_offset
))
521 goto return_after_cleanup
;
523 bzero (&main_subfile
, sizeof (main_subfile
));
524 first_fun_line_offset
= 0;
527 enter_line_range (&main_subfile
, offset
, 0, start
, end
,
528 &main_source_baseline
);
530 /* else, there was source with line numbers in include files */
533 main_source_baseline
= 0;
534 for (ii
=0; ii
< inclIndx
; ++ii
) {
536 struct subfile
*tmpSubfile
;
538 /* if there is main file source before include file, enter it. */
539 if (offset
< inclTable
[ii
].begin
) {
541 (&main_subfile
, offset
, inclTable
[ii
].begin
- LINESZ
, start
, 0,
542 &main_source_baseline
);
545 /* Have a new subfile for the include file */
547 tmpSubfile
= inclTable
[ii
].subfile
= (struct subfile
*)
548 xmalloc (sizeof (struct subfile
));
550 bzero (tmpSubfile
, sizeof (struct subfile
));
551 firstLine
= &(inclTable
[ii
].funStartLine
);
553 /* enter include file's lines now. */
554 enter_line_range (tmpSubfile
, inclTable
[ii
].begin
,
555 inclTable
[ii
].end
, start
, 0, firstLine
);
557 offset
= inclTable
[ii
].end
+ LINESZ
;
560 /* all the include files' line have been processed at this point. Now,
561 enter remaining lines of the main file, if any left. */
562 if (offset
< (linetab_offset
+ linetab_size
+ 1 - LINESZ
)) {
563 enter_line_range (&main_subfile
, offset
, 0, start
, end
,
564 &main_source_baseline
);
568 /* Process main file's line numbers. */
569 if (main_subfile
.line_vector
) {
570 struct linetable
*lineTb
, *lv
;
572 lv
= main_subfile
.line_vector
;
574 /* Line numbers are not necessarily ordered. xlc compilation will
575 put static function to the end. */
577 lineTb
= arrange_linetable (lv
);
579 current_subfile
->line_vector
= (struct linetable
*)
580 xrealloc (lv
, (sizeof (struct linetable
)
581 + lv
->nitems
* sizeof (struct linetable_entry
)));
586 current_subfile
->line_vector
= lineTb
;
589 current_subfile
->line_vector_length
=
590 current_subfile
->line_vector
->nitems
;
593 /* Now, process included files' line numbers. */
595 for (ii
=0; ii
< inclIndx
; ++ii
) {
597 if ( (inclTable
[ii
].subfile
)->line_vector
) { /* Useless if!!! FIXMEmgo */
598 struct linetable
*lineTb
, *lv
;
600 lv
= (inclTable
[ii
].subfile
)->line_vector
;
602 /* Line numbers are not necessarily ordered. xlc compilation will
603 put static function to the end. */
605 lineTb
= arrange_linetable (lv
);
609 /* For the same include file, we might want to have more than one subfile.
610 This happens if we have something like:
618 while foo.h including code in it. (stupid but possible)
619 Since start_subfile() looks at the name and uses an existing one if finds,
620 we need to provide a fake name and fool it. */
622 /* start_subfile (inclTable[ii].name, (char*)0); */
623 start_subfile (" ?", (char*)0);
624 current_subfile
->name
=
625 obsavestring (inclTable
[ii
].name
, strlen (inclTable
[ii
].name
),
626 ¤t_objfile
->symbol_obstack
);
629 current_subfile
->line_vector
= (struct linetable
*)
630 xrealloc (lv
, (sizeof (struct linetable
)
631 + lv
->nitems
* sizeof (struct linetable_entry
)));
636 current_subfile
->line_vector
= lineTb
;
639 current_subfile
->line_vector_length
=
640 current_subfile
->line_vector
->nitems
;
641 start_subfile (pop_subfile (), (char*)0);
646 /* I am not sure this logic is correct. There might be no lines in the
647 main file, whereas there are some in included ones. FIXMEibm */
648 current_subfile
->line_vector
= NULL
;
650 return_after_cleanup
:
652 /* We don't want to keep alloc/free'ing the global include file table. */
655 /* start with a fresh subfile structure for the next file. */
656 bzero (&main_subfile
, sizeof (struct subfile
));
660 aix_process_linenos ()
662 /* process line numbers and enter them into line vector */
663 process_linenos (last_source_start_addr
, cur_src_end_addr
);
667 /* Enter a given range of lines into the line vector.
668 can be called in the following two ways:
669 enter_line_range (subfile, beginoffset, endoffset, startaddr, 0, firstLine) or
670 enter_line_range (subfile, beginoffset, 0, startaddr, endaddr, firstLine) */
673 enter_line_range (subfile
, beginoffset
, endoffset
, startaddr
, endaddr
, firstLine
)
674 struct subfile
*subfile
;
675 unsigned beginoffset
, endoffset
; /* offsets to line table */
676 CORE_ADDR startaddr
, endaddr
;
682 /* Do Byte swapping, if needed. FIXME! */
683 #define P_LINENO(PP) (*(unsigned short*)((struct external_lineno*)(PP))->l_lnno)
684 #define P_LINEADDR(PP) (*(long*)((struct external_lineno*)(PP))->l_addr.l_paddr)
685 #define P_LINESYM(PP) (*(long*)((struct external_lineno*)(PP))->l_addr.l_symndx)
687 pp
= &linetab
[beginoffset
- linetab_offset
];
688 limit
= endoffset
? &linetab
[endoffset
- linetab_offset
]
689 : &linetab
[linetab_size
-1];
691 while (pp
<= limit
) {
693 /* find the address this line represents */
694 addr
= P_LINENO(pp
) ?
695 P_LINEADDR(pp
) : read_symbol_nvalue (symtbl
, P_LINESYM(pp
));
697 if (addr
< startaddr
|| (endaddr
&& addr
> endaddr
))
700 if (P_LINENO(pp
) == 0) {
701 *firstLine
= read_symbol_lineno (symtbl
, P_LINESYM(pp
));
702 record_line (subfile
, 0, addr
);
706 record_line (subfile
, *firstLine
+ P_LINENO(pp
), addr
);
713 int fsize
; /* file size */
714 int fixedparms
; /* number of fixed parms */
715 int floatparms
; /* number of float parms */
716 unsigned int parminfo
; /* parameter info.
717 See /usr/include/sys/debug.h
718 tbtable_ext.parminfo */
719 int framesize
; /* function frame size */
723 /* Given a function symbol, return its traceback information. */
726 retrieve_tracebackinfo (abfd
, textsec
, cs
)
729 struct coff_symbol
*cs
;
731 #define TBTABLE_BUFSIZ 2000
732 #define MIN_TBTABSIZ 50 /* minimum buffer size to hold a
735 static TracebackInfo tbInfo
;
738 static char buffer
[TBTABLE_BUFSIZ
];
741 int bytesread
=0; /* total # of bytes read so far */
742 int bufferbytes
; /* number of bytes in the buffer */
744 int functionstart
= cs
->c_value
- textsec
->vma
;
746 bzero (&tbInfo
, sizeof (tbInfo
));
748 /* keep reading blocks of data from the text section, until finding a zero
749 word and a traceback table. */
751 while (bfd_get_section_contents (abfd
, textsec
, buffer
,
752 (file_ptr
)(functionstart
+ bytesread
),
754 (TBTABLE_BUFSIZ
< (textsec
->_raw_size
- functionstart
- bytesread
)) ?
755 TBTABLE_BUFSIZ
: (textsec
->_raw_size
- functionstart
- bytesread
))))
757 bytesread
+= bufferbytes
;
758 pinsn
= (int*) buffer
;
760 /* if this is the first time we filled the buffer, retrieve function
763 if (bytesread
== bufferbytes
) {
765 /* skip over unrelated instructions */
767 if (*pinsn
== 0x7c0802a6) /* mflr r0 */
769 if ((*pinsn
& 0xfc00003e) == 0x7c000026) /* mfcr Rx */
771 if ((*pinsn
& 0xfc000000) == 0x48000000) /* bl foo, save fprs */
773 if ((*pinsn
& 0xfc1f0000) == 0xbc010000) /* stm Rx, NUM(r1) */
777 int tmp
= (*pinsn
>> 16) & 0xffff;
779 if (tmp
== 0x9421) { /* stu r1, NUM(r1) */
780 tbInfo
.framesize
= 0x10000 - (*pinsn
& 0xffff);
783 else if ((*pinsn
== 0x93e1fffc) || /* st r31,-4(r1) */
784 (tmp
== 0x9001)) /* st r0, NUM(r1) */
786 /* else, could not find a frame size. */
790 } while (++pinsn
&& *pinsn
);
792 if (!tbInfo
.framesize
)
796 /* look for a zero word. */
798 while (*pinsn
&& (pinsn
< (int*)(buffer
+ bufferbytes
- sizeof(int))))
801 if (pinsn
>= (int*)(buffer
+ bufferbytes
))
806 /* function size is the amount of bytes we have skipped so far. */
807 tbInfo
.fsize
= bytesread
- (buffer
+ bufferbytes
- (char*)pinsn
);
811 /* if we don't have the whole traceback table in the buffer, re-read
814 if ((char*)pinsn
> (buffer
+ bufferbytes
- MIN_TBTABSIZ
)) {
816 /* In case if we are *very* close to the end of the text section
817 and cannot read properly from that point on, abort by returning
819 Handle this case more graciously -- FIXME */
821 if (!bfd_get_section_contents (
822 abfd
, textsec
, buffer
,
823 (file_ptr
)(functionstart
+
824 bytesread
- (buffer
+ bufferbytes
- (char*)pinsn
)),MIN_TBTABSIZ
))
825 { printf ("Abnormal return!..\n"); return NULL
; }
827 ptb
= (struct tbtable
*)buffer
;
830 ptb
= (struct tbtable
*)pinsn
;
832 tbInfo
.fixedparms
= ptb
->tb
.fixedparms
;
833 tbInfo
.floatparms
= ptb
->tb
.floatparms
;
834 tbInfo
.parminfo
= ptb
->tb_ext
.parminfo
;
842 /* Given a function symbol, return a pointer to its traceback table. */
845 retrieve_traceback (abfd
, textsec
, cs
, size
)
848 struct coff_symbol
*cs
;
849 int *size
; /* return function size */
851 #define TBTABLE_BUFSIZ 2000
852 #define MIN_TBTABSIZ 50 /* minimum buffer size to hold a
855 static char buffer
[TBTABLE_BUFSIZ
];
858 int bytesread
=0; /* total # of bytes read so far */
859 int bufferbytes
; /* number of bytes in the buffer */
861 int functionstart
= cs
->c_value
- textsec
->filepos
+ textsec
->vma
;
864 /* keep reading blocks of data from the text section, until finding a zero
865 word and a traceback table. */
867 while (bfd_get_section_contents (abfd
, textsec
, buffer
,
868 (file_ptr
)(functionstart
+ bytesread
),
870 (TBTABLE_BUFSIZ
< (textsec
->size
- functionstart
- bytesread
)) ?
871 TBTABLE_BUFSIZ
: (textsec
->size
- functionstart
- bytesread
))))
873 bytesread
+= bufferbytes
;
874 pinsn
= (int*) buffer
;
876 /* look for a zero word. */
878 while (*pinsn
&& (pinsn
< (int*)(buffer
+ bufferbytes
- sizeof(int))))
881 if (pinsn
>= (int*)(buffer
+ bufferbytes
))
886 /* function size is the amount of bytes we have skipped so far. */
887 *size
= bytesread
- (buffer
+ bufferbytes
- pinsn
);
891 /* if we don't have the whole traceback table in the buffer, re-read
894 if ((char*)pinsn
> (buffer
+ bufferbytes
- MIN_TBTABSIZ
)) {
896 /* In case if we are *very* close to the end of the text section
897 and cannot read properly from that point on, abort for now.
898 Handle this case more graciously -- FIXME */
900 if (!bfd_get_section_contents (
901 abfd
, textsec
, buffer
,
902 (file_ptr
)(functionstart
+
903 bytesread
- (buffer
+ bufferbytes
- pinsn
)),MIN_TBTABSIZ
))
904 /* abort (); */ { printf ("abort!!!\n"); return NULL
; }
906 return (struct tbtable
*)buffer
;
909 return (struct tbtable
*)pinsn
;
919 /* Save the vital information for use when closing off the current file.
920 NAME is the file name the symbols came from, START_ADDR is the first
921 text address for the file, and SIZE is the number of bytes of text. */
923 #define complete_symtab(name, start_addr) { \
924 last_source_file = savestring (name, strlen (name)); \
925 last_source_start_addr = start_addr; \
929 /* Refill the symbol table input buffer
930 and set the variables that control fetching entries from it.
931 Reports an error if no data available.
932 This function can read past the end of the symbol table
933 (into the string table) but this does no harm. */
935 /* Reading symbol table has to be fast! Keep the followings as macros, rather
938 #define RECORD_MINIMAL_SYMBOL(NAME, ADDR, TYPE, ALLOCED) \
942 namestr = (NAME) + 1; \
944 namestr = obstack_copy0 (&objfile->symbol_obstack, (NAME) + 1, strlen ((NAME)+1)); \
947 prim_record_minimal_symbol (namestr, (ADDR), (TYPE)); \
948 misc_func_recorded = 1; \
952 /* A parameter template, used by ADD_PARM_TO_PENDING. */
954 static struct symbol parmsym
= { /* default parameter symbol */
956 VAR_NAMESPACE
, /* namespace */
963 /* Add a parameter to a given pending symbol list. */
965 #define ADD_PARM_TO_PENDING(PARM, VALUE, PTYPE, PENDING_SYMBOLS) \
967 PARM = (struct symbol *) \
968 obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); \
970 SYMBOL_TYPE (PARM) = PTYPE; \
971 SYMBOL_VALUE (PARM) = VALUE; \
972 add_symbol_to_list (PARM, &PENDING_SYMBOLS); \
976 /* aixcoff has static blocks marked in `.bs', `.es' pairs. They cannot be
977 nested. At any given time, a symbol can only be in one static block.
978 This is the base address of current static block, zero if non exists. */
980 static int static_block_base
= 0;
982 /* true if space for symbol name has been allocated. */
984 static int symname_alloced
= 0;
986 /* read the whole symbol table of a given bfd. */
989 read_xcoff_symtab (objfile
, nsyms
)
990 struct objfile
*objfile
; /* Object file we're reading from */
991 int nsyms
; /* # of symbols */
993 bfd
*abfd
= objfile
->obfd
;
994 char *raw_symbol
; /* Pointer into raw seething symbol table */
995 char *raw_auxptr
; /* Pointer to first raw aux entry for sym */
996 sec_ptr textsec
; /* Pointer to text section */
997 TracebackInfo
*ptb
; /* Pointer to traceback table */
999 struct internal_syment symbol
[1];
1000 union internal_auxent main_aux
[1];
1001 struct coff_symbol cs
[1];
1002 CORE_ADDR file_start_addr
= 0;
1003 CORE_ADDR file_end_addr
= 0;
1005 int next_file_symnum
= -1;
1006 int just_started
= 1;
1011 long fcn_line_offset
;
1014 /* fcn_cs_saved is global because process_xcoff_symbol needs it. */
1015 union internal_auxent fcn_aux_saved
;
1016 struct type
*fcn_type_saved
= NULL
;
1017 struct context_stack
*new;
1019 char *filestring
= " _start_ "; /* Name of the current file. */
1021 char *last_csect_name
; /* last seen csect's name and value */
1022 CORE_ADDR last_csect_val
;
1023 int misc_func_recorded
; /* true if any misc. function */
1025 current_objfile
= objfile
;
1027 /* Get the appropriate COFF "constants" related to the file we're handling. */
1028 N_TMASK
= coff_data (abfd
)->local_n_tmask
;
1029 N_BTSHFT
= coff_data (abfd
)->local_n_btshft
;
1030 local_symesz
= coff_data (abfd
)->local_symesz
;
1032 last_source_file
= 0;
1033 last_csect_name
= 0;
1035 misc_func_recorded
= 0;
1037 start_symtab (filestring
, (char *)NULL
, file_start_addr
);
1039 first_object_file_end
= 0;
1041 /* Allocate space for the entire symbol table at once, and read it
1042 all in. The bfd is already positioned at the beginning of
1043 the symbol table. */
1045 size
= coff_data (abfd
)->local_symesz
* nsyms
;
1046 symtbl
= xmalloc (size
);
1048 val
= bfd_read (symtbl
, size
, 1, abfd
);
1050 perror_with_name ("reading symbol table");
1052 raw_symbol
= symtbl
;
1054 textsec
= bfd_get_section_by_name (abfd
, ".text");
1056 printf ("Unable to locate text section!\n");
1059 while (symnum
< nsyms
) {
1061 QUIT
; /* make this command interruptable. */
1063 /* READ_ONE_SYMBOL (symbol, cs, symname_alloced); */
1064 /* read one symbol into `cs' structure. After processing the whole symbol
1065 table, only string table will be kept in memory, symbol table and debug
1066 section of aixcoff will be freed. Thus we can mark symbols with names
1067 in string table as `alloced'. */
1071 /* Swap and align the symbol into a reasonable C structure. */
1072 bfd_coff_swap_sym_in (abfd
, raw_symbol
, symbol
);
1074 cs
->c_symnum
= symnum
;
1075 cs
->c_nsyms
= symbol
->n_numaux
;
1076 if (symbol
->n_zeroes
) {
1077 symname_alloced
= 0;
1078 /* We must use the original, unswapped, name here so the name field
1079 pointed to by cs->c_name will persist throughout xcoffread. If
1080 we use the new field, it gets overwritten for each symbol. */
1081 cs
->c_name
= ((struct external_syment
*)raw_symbol
)->e
.e_name
;
1082 } else if (symbol
->n_sclass
& 0x80) {
1083 cs
->c_name
= debugsec
+ symbol
->n_offset
;
1084 symname_alloced
= 0;
1085 } else { /* in string table */
1086 cs
->c_name
= strtbl
+ (int)symbol
->n_offset
;
1087 symname_alloced
= 1;
1089 cs
->c_value
= symbol
->n_value
;
1090 cs
->c_sclass
= symbol
->n_sclass
& 0xff;
1091 cs
->c_secnum
= symbol
->n_scnum
;
1092 cs
->c_type
= (unsigned)symbol
->n_type
;
1094 raw_symbol
+= coff_data (abfd
)->local_symesz
;
1097 raw_auxptr
= raw_symbol
; /* Save addr of first aux entry */
1099 /* Skip all the auxents associated with this symbol. */
1100 for (ii
= symbol
->n_numaux
; ii
; --ii
) {
1101 raw_symbol
+= coff_data (abfd
)->local_auxesz
;
1106 /* if symbol name starts with ".$" or "$", ignore it. */
1107 if (cs
->c_name
[0] == '$' || (cs
->c_name
[1] == '$' && cs
->c_name
[0] == '.'))
1110 if (cs
->c_symnum
== next_file_symnum
&& cs
->c_sclass
!= C_FILE
) {
1111 if (last_source_file
)
1112 end_symtab (cur_src_end_addr
, 1, 0, objfile
);
1114 start_symtab ("_globals_", (char *)NULL
, (CORE_ADDR
)0);
1115 cur_src_end_addr
= first_object_file_end
;
1116 /* done with all files, everything from here on is globals */
1119 /* if explicitly specified as a function, treat is as one. */
1120 if (ISFCN(cs
->c_type
) && cs
->c_sclass
!= C_TPDEF
) {
1121 bfd_coff_swap_aux_in (abfd
, raw_auxptr
, cs
->c_type
, cs
->c_sclass
,
1123 goto function_entry_point
;
1126 if ((cs
->c_sclass
== C_EXT
|| cs
->c_sclass
== C_HIDEXT
) && cs
->c_nsyms
== 1)
1128 /* dealing with a symbol with a csect entry. */
1130 # define CSECT(PP) ((PP)->x_csect)
1131 # define CSECT_LEN(PP) (CSECT(PP).x_scnlen)
1132 # define CSECT_ALIGN(PP) (SMTYP_ALIGN(CSECT(PP).x_smtyp))
1133 # define CSECT_SMTYP(PP) (SMTYP_SMTYP(CSECT(PP).x_smtyp))
1134 # define CSECT_SCLAS(PP) (CSECT(PP).x_smclas)
1136 /* Convert the auxent to something we can access. */
1137 bfd_coff_swap_aux_in (abfd
, raw_auxptr
, cs
->c_type
, cs
->c_sclass
,
1140 switch (CSECT_SMTYP (main_aux
)) {
1143 continue; /* ignore all external references. */
1145 case XTY_SD
: /* a section description. */
1147 switch (CSECT_SCLAS (main_aux
)) {
1149 case XMC_PR
: /* a `.text' csect. */
1152 /* A program csect is seen.
1154 We have to allocate one symbol table for each program csect. Normally
1155 gdb prefers one symtab for each compilation unit (CU). In case of AIX, one
1156 CU might include more than one prog csect, and they don't have to be
1157 adjacent in terms of the space they occupy in memory. Thus, one single
1158 CU might get fragmented in the memory and gdb's file start and end address
1159 approach does not work! */
1161 if (last_csect_name
) {
1163 /* if no misc. function recorded in the last seen csect, enter
1164 it as a function. This will take care of functions like
1165 strcmp() compiled by xlc. */
1167 if (!misc_func_recorded
) {
1169 RECORD_MINIMAL_SYMBOL (last_csect_name
, last_csect_val
,
1174 complete_symtab (filestring
, file_start_addr
);
1175 cur_src_end_addr
= file_end_addr
;
1176 end_symtab (file_end_addr
, 1, 0, objfile
);
1177 start_symtab ((char *)NULL
, (char *)NULL
, (CORE_ADDR
)0);
1180 /* If this is the very first csect seen, basically `__start'. */
1182 first_object_file_end
= cs
->c_value
+ CSECT_LEN (main_aux
);
1186 file_start_addr
= cs
->c_value
;
1187 file_end_addr
= cs
->c_value
+ CSECT_LEN (main_aux
);
1189 if (cs
->c_name
&& cs
->c_name
[0] == '.') {
1190 last_csect_name
= cs
->c_name
;
1191 last_csect_val
= cs
->c_value
;
1194 misc_func_recorded
= 0;
1200 /* If the section is not a data description, ignore it. Note that
1201 uninitialized data will show up as XTY_CM/XMC_RW pair. */
1204 #ifdef XCOFF_ADD_TOC_TO_LOADINFO
1205 XCOFF_ADD_TOC_TO_LOADINFO (cs
->c_value
);
1207 /* fall down to default case. */
1209 case XMC_TC
: /* ignore toc entries */
1210 default : /* any other XMC_XXX */
1214 break; /* switch CSECT_SCLAS() */
1218 /* a function entry point. */
1219 if (CSECT_SCLAS (main_aux
) == XMC_PR
) {
1221 function_entry_point
:
1222 RECORD_MINIMAL_SYMBOL (cs
->c_name
, cs
->c_value
, mst_text
,
1225 fcn_line_offset
= main_aux
->x_sym
.x_fcnary
.x_fcn
.x_lnnoptr
;
1226 fcn_start_addr
= cs
->c_value
;
1228 /* save the function header info, which will be used
1229 when `.bf' is seen. */
1231 fcn_aux_saved
= *main_aux
;
1236 /* If function has two auxent, then debugging information is
1237 already available for it. Process traceback table for
1238 functions with only one auxent. */
1240 if (cs
->c_nsyms
== 1)
1241 ptb
= retrieve_tracebackinfo (abfd
, textsec
, cs
);
1243 else if (cs
->c_nsyms
!= 2)
1246 /* If there is traceback info, create and add parameters for it. */
1248 if (ptb
&& (ptb
->fixedparms
|| ptb
->floatparms
)) {
1250 int parmcnt
= ptb
->fixedparms
+ ptb
->floatparms
;
1251 char *parmcode
= (char*) &ptb
->parminfo
;
1252 int parmvalue
= ptb
->framesize
+ 0x18; /* sizeof(LINK AREA) == 0x18 */
1253 unsigned int ii
, mask
;
1255 for (ii
=0, mask
= 0x80000000; ii
<parmcnt
; ++ii
) {
1256 struct symbol
*parm
;
1258 if (ptb
->parminfo
& mask
) { /* float or double */
1260 if (ptb
->parminfo
& mask
) { /* double parm */
1262 (parm
, parmvalue
, builtin_type_double
, local_symbols
);
1263 parmvalue
+= sizeof (double);
1265 else { /* float parm */
1267 (parm
, parmvalue
, builtin_type_float
, local_symbols
);
1268 parmvalue
+= sizeof (float);
1271 else { /* fixed parm, use (int*) for hex rep. */
1272 ADD_PARM_TO_PENDING (parm
, parmvalue
,
1273 lookup_pointer_type (builtin_type_int
),
1275 parmvalue
+= sizeof (int);
1280 /* Fake this as a function. Needed in process_xcoff_symbol() */
1283 finish_block(process_xcoff_symbol (cs
, objfile
), &local_symbols
,
1284 pending_blocks
, cs
->c_value
,
1285 cs
->c_value
+ ptb
->fsize
, objfile
);
1289 /* shared library function trampoline code entry point. */
1290 else if (CSECT_SCLAS (main_aux
) == XMC_GL
) {
1292 /* record trampoline code entries as mst_unknown symbol. When we
1293 lookup mst symbols, we will choose mst_text over mst_unknown. */
1295 RECORD_MINIMAL_SYMBOL (cs
->c_name
, cs
->c_value
, mst_unknown
,
1301 default : /* all other XTY_XXXs */
1303 } /* switch CSECT_SMTYP() */ }
1305 switch (cs
->c_sclass
) {
1309 /* see if the last csect needs to be recorded. */
1311 if (last_csect_name
&& !misc_func_recorded
) {
1313 /* if no misc. function recorded in the last seen csect, enter
1314 it as a function. This will take care of functions like
1315 strcmp() compiled by xlc. */
1318 RECORD_MINIMAL_SYMBOL (last_csect_name
, last_csect_val
,
1322 /* c_value field contains symnum of next .file entry in table
1323 or symnum of first global after last .file. */
1325 next_file_symnum
= cs
->c_value
;
1327 /* complete symbol table for last object file containing
1328 debugging information. */
1330 /* Whether or not there was a csect in the previous file, we have
1331 to call `end_symtab' and `start_symtab' to reset type_vector,
1332 line_vector, etc. structures. */
1334 complete_symtab (filestring
, file_start_addr
);
1335 cur_src_end_addr
= file_end_addr
;
1336 end_symtab (file_end_addr
, 1, 0, objfile
);
1337 start_symtab (cs
->c_name
, (char *)NULL
, (CORE_ADDR
)0);
1338 last_csect_name
= 0;
1340 /* reset file start and end addresses. A compilation unit with no text
1341 (only data) should have zero file boundaries. */
1342 file_start_addr
= file_end_addr
= 0;
1344 filestring
= cs
->c_name
;
1350 /* For a function stab, just save its type in `fcn_type_saved', and leave
1351 it for the `.bf' processing. */
1353 char *pp
= (char*) index (cs
->c_name
, ':');
1355 if (!pp
|| ( *(pp
+1) != 'F' && *(pp
+1) != 'f'))
1356 fatal ("Unrecognized stab");
1360 fatal ("Unprocessed function type");
1362 fcn_type_saved
= lookup_function_type (read_type (&pp
, objfile
));
1368 if (strcmp (cs
->c_name
, ".bf") == 0) {
1370 bfd_coff_swap_aux_in (abfd
, raw_auxptr
, cs
->c_type
, cs
->c_sclass
,
1373 within_function
= 1;
1375 /* Linenos are now processed on a file-by-file, not fn-by-fn, basis.
1376 Metin did it, I'm not sure why. FIXME. -- gnu@cygnus.com */
1380 1) xlc (IBM's native c compiler) postpones static function code
1381 emission to the end of a compilation unit. This way it can
1382 determine if those functions (statics) are needed or not, and
1383 can do some garbage collection (I think). This makes line
1384 numbers and corresponding addresses unordered, and we end up
1385 with a line table like:
1402 and that breaks gdb's binary search on line numbers, if the
1403 above table is not sorted on line numbers. And that sort
1404 should be on function based, since gcc can emit line numbers
1407 10 0x100 - for the init/test part of a for stmt.
1410 10 0x400 - for the increment part of a for stmt.
1412 arrange_linenos() will do this sorting.
1415 2) aix symbol table might look like:
1417 c_file // beginning of a new file
1418 .bi // beginning of include file
1419 .ei // end of include file
1423 basically, .bi/.ei pairs do not necessarily encapsulate
1424 their scope. They need to be recorded, and processed later
1425 on when we come the end of the compilation unit.
1426 Include table (inclTable) and process_linenos() handle
1429 mark_first_line (fcn_line_offset
, cs
->c_symnum
);
1431 new = push_context (0, fcn_start_addr
);
1432 new->name
= process_xcoff_symbol (&fcn_cs_saved
, objfile
);
1434 /* Between a function symbol and `.bf', there always will be a function
1435 stab. We save function type when processing that stab. */
1437 if (fcn_type_saved
== NULL
) {
1438 printf ("Unknown function type: symbol 0x%x\n", cs
->c_symnum
);
1439 SYMBOL_TYPE (new->name
) = lookup_function_type (builtin_type_int
);
1442 SYMBOL_TYPE (new->name
) = fcn_type_saved
;
1443 fcn_type_saved
= NULL
;
1446 else if (strcmp (cs
->c_name
, ".ef") == 0) {
1448 bfd_coff_swap_aux_in (abfd
, raw_auxptr
, cs
->c_type
, cs
->c_sclass
,
1451 /* the value of .ef is the address of epilogue code;
1452 not useful for gdb */
1453 /* { main_aux.x_sym.x_misc.x_lnsz.x_lnno
1454 contains number of lines to '}' */
1456 fcn_last_line
= main_aux
->x_sym
.x_misc
.x_lnsz
.x_lnno
;
1457 new = pop_context ();
1458 if (context_stack_depth
!= 0)
1459 error ("invalid symbol data; .bf/.ef/.bb/.eb symbol mismatch, at symbol %d.",
1462 finish_block (new->name
, &local_symbols
, new->old_blocks
,
1464 fcn_cs_saved
.c_value
+
1465 fcn_aux_saved
.x_sym
.x_misc
.x_fsize
, objfile
);
1466 within_function
= 0;
1470 case C_BSTAT
: /* begin static block */
1471 static_block_base
= read_symbol_nvalue (symtbl
, cs
->c_value
);
1474 case C_ESTAT
: /* end of static block */
1475 static_block_base
= 0;
1478 case C_ARG
: /* These are not implemented. */
1484 printf ("ERROR: Unimplemented storage class: %d.\n", cs
->c_sclass
);
1487 case C_HIDEXT
: /* ignore these.. */
1492 case C_BINCL
: /* beginning of include file */
1494 /* In xlc output, C_BINCL/C_EINCL pair doesn't show up in sorted
1495 order. Thus, when wee see them, we might not know enough info
1496 to process them. Thus, we'll be saving them into a table
1497 (inclTable) and postpone their processing. */
1499 record_include_begin (cs
);
1502 case C_EINCL
: /* end of include file */
1503 /* see the comment after case C_BINCL. */
1504 record_include_end (cs
);
1508 if (strcmp (cs
->c_name
, ".bb") == 0) {
1510 new = push_context (depth
, cs
->c_value
);
1512 else if (strcmp (cs
->c_name
, ".eb") == 0) {
1513 new = pop_context ();
1514 if (depth
!= new->depth
)
1515 error ("Invalid symbol data: .bb/.eb symbol mismatch at symbol %d.",
1519 if (local_symbols
&& context_stack_depth
> 0) {
1520 /* Make a block for the local symbols within. */
1521 finish_block (new->name
, &local_symbols
, new->old_blocks
,
1522 new->start_addr
, cs
->c_value
, objfile
);
1524 local_symbols
= new->locals
;
1529 (void) process_xcoff_symbol (cs
, objfile
);
1535 if (last_source_file
)
1536 end_symtab (cur_src_end_addr
, 1, 0, objfile
);
1539 current_objfile
= NULL
;
1542 #define SYMBOL_DUP(SYMBOL1, SYMBOL2) \
1543 (SYMBOL2) = (struct symbol *) \
1544 obstack_alloc (&objfile->symbol_obstack, sizeof (struct symbol)); \
1545 *(SYMBOL2) = *(SYMBOL1);
1548 #define SYMNAME_ALLOC(NAME, ALLOCED) \
1549 (ALLOCED) ? (NAME) : obstack_copy0 (&objfile->symbol_obstack, (NAME), strlen (NAME));
1552 /* process one xcoff symbol. */
1554 static struct symbol
*
1555 process_xcoff_symbol (cs
, objfile
)
1556 register struct coff_symbol
*cs
;
1557 struct objfile
*objfile
;
1559 struct symbol onesymbol
;
1560 register struct symbol
*sym
= &onesymbol
;
1561 struct symbol
*sym2
= NULL
;
1563 char *name
, *pp
, *qq
;
1564 int struct_and_type_combined
;
1571 bzero (sym
, sizeof (struct symbol
));
1573 /* default assumptions */
1574 SYMBOL_VALUE (sym
) = cs
->c_value
;
1575 SYMBOL_NAMESPACE (sym
) = VAR_NAMESPACE
;
1577 if (ISFCN (cs
->c_type
)) {
1579 /* At this point, we don't know the type of the function and assume it
1580 is int. This will be patched with the type from its stab entry later
1581 on in patch_block_stabs () */
1583 SYMBOL_NAME (sym
) = SYMNAME_ALLOC (name
, symname_alloced
);
1584 SYMBOL_TYPE (sym
) = lookup_function_type (lookup_fundamental_type (objfile
, FT_INTEGER
));
1586 SYMBOL_CLASS (sym
) = LOC_BLOCK
;
1587 SYMBOL_DUP (sym
, sym2
);
1589 if (cs
->c_sclass
== C_EXT
)
1590 add_symbol_to_list (sym2
, &global_symbols
);
1591 else if (cs
->c_sclass
== C_HIDEXT
|| cs
->c_sclass
== C_STAT
)
1592 add_symbol_to_list (sym2
, &file_symbols
);
1597 /* in case we can't figure out the type, default is `int'. */
1598 SYMBOL_TYPE (sym
) = lookup_fundamental_type (objfile
, FT_INTEGER
);
1600 switch (cs
->c_sclass
)
1604 if (fcn_cs_saved
.c_sclass
== C_EXT
)
1605 add_stab_to_list (name
, &global_stabs
);
1607 add_stab_to_list (name
, &file_stabs
);
1611 case C_DECL
: /* a type decleration?? */
1612 qq
= (char*) strchr (name
, ':');
1613 if (!qq
) /* skip if there is no ':' */
1616 nameless
= (qq
== name
);
1618 struct_and_type_combined
= (qq
[1] == 'T' && qq
[2] == 't');
1619 pp
= qq
+ (struct_and_type_combined
? 3 : 2);
1622 /* To handle GNU C++ typename abbreviation, we need to be able to fill
1623 in a type's name as soon as space for that type is allocated. */
1625 if (struct_and_type_combined
&& name
!= qq
) {
1628 struct type
*tmp_type
;
1631 read_type_number (&tmp_pp
, typenums
);
1632 tmp_type
= dbx_alloc_type (typenums
, objfile
);
1634 if (tmp_type
&& !TYPE_NAME (tmp_type
) && !nameless
)
1635 TYPE_NAME (tmp_type
) = SYMBOL_NAME (sym
) =
1636 obsavestring (name
, qq
-name
,
1637 &objfile
->symbol_obstack
);
1639 ttype
= SYMBOL_TYPE (sym
) = read_type (&pp
, objfile
);
1641 /* read_type() will return null if type (or tag) definition was
1642 unnnecessarily duplicated. Also, if the symbol doesn't have a name,
1643 there is no need to keep it in symbol table. */
1644 /* The above argument no longer valid. read_type() never returns NULL. */
1649 /* if there is no name for this typedef, you don't have to keep its
1650 symbol, since nobody could ask for it. Otherwise, build a symbol
1651 and add it into symbol_list. */
1655 SYMBOL_NAMESPACE (sym
) = STRUCT_NAMESPACE
;
1656 else if (qq
[1] == 't')
1657 SYMBOL_NAMESPACE (sym
) = VAR_NAMESPACE
;
1659 printf ("ERROR: Unrecognized stab string.\n");
1663 SYMBOL_CLASS (sym
) = LOC_TYPEDEF
;
1664 if (!SYMBOL_NAME (sym
))
1665 SYMBOL_NAME (sym
) = obsavestring (name
, qq
-name
,
1666 &objfile
->symbol_obstack
);
1668 SYMBOL_DUP (sym
, sym2
);
1670 (sym2
, within_function
? &local_symbols
: &file_symbols
);
1672 /* For a combination of struct and type, add one more symbol
1675 if (struct_and_type_combined
) {
1676 SYMBOL_DUP (sym
, sym2
);
1677 SYMBOL_NAMESPACE (sym2
) = VAR_NAMESPACE
;
1679 (sym2
, within_function
? &local_symbols
: &file_symbols
);
1683 /* assign a name to the type node. */
1685 if (!nameless
&& (!TYPE_NAME (ttype
) || *(TYPE_NAME (ttype
)) == '\0')) {
1686 if (struct_and_type_combined
)
1687 TYPE_NAME (ttype
) = SYMBOL_NAME (sym
);
1689 /* else if (SYMBOL_NAMESPACE (sym) == STRUCT_NAMESPACE) */
1690 else if (qq
[1] == 'T') /* struct namespace */
1691 TYPE_NAME (ttype
) = concat (
1692 TYPE_CODE (ttype
) == TYPE_CODE_UNION
? "union " :
1693 TYPE_CODE (ttype
) == TYPE_CODE_STRUCT
? "struct " : "enum ",
1694 SYMBOL_NAME (sym
), NULL
);
1700 add_stab_to_list (name
, &global_stabs
);
1705 if (*name
== ':' || (pp
= (char *) strchr (name
, ':')) == NULL
)
1707 SYMBOL_NAME (sym
) = obsavestring (name
, pp
-name
, &objfile
-> symbol_obstack
);
1708 SYMBOL_CLASS (sym
) = (cs
->c_sclass
== C_PSYM
) ? LOC_ARG
: LOC_REGPARM
;
1710 SYMBOL_TYPE (sym
) = read_type (&pp
, objfile
);
1711 SYMBOL_DUP (sym
, sym2
);
1712 add_symbol_to_list (sym2
, &local_symbols
);
1716 if (*name
== ':' || (pp
= (char *) strchr (name
, ':')) == NULL
)
1718 SYMBOL_NAME (sym
) = obsavestring (name
, pp
-name
, &objfile
-> symbol_obstack
);
1719 SYMBOL_CLASS (sym
) = LOC_STATIC
;
1720 SYMBOL_VALUE (sym
) += static_block_base
;
1722 SYMBOL_TYPE (sym
) = read_type (&pp
, objfile
);
1723 SYMBOL_DUP (sym
, sym2
);
1725 (sym2
, within_function
? &local_symbols
: &file_symbols
);
1729 if (*name
== ':' || (pp
= (char *) strchr (name
, ':')) == NULL
)
1731 SYMBOL_NAME (sym
) = obsavestring (name
, pp
-name
, &objfile
-> symbol_obstack
);
1732 SYMBOL_CLASS (sym
) = LOC_LOCAL
;
1734 SYMBOL_TYPE (sym
) = read_type (&pp
, objfile
);
1735 SYMBOL_DUP (sym
, sym2
);
1736 add_symbol_to_list (sym2
, &local_symbols
);
1740 SYMBOL_CLASS (sym
) = LOC_LOCAL
;
1741 SYMBOL_NAME (sym
) = SYMNAME_ALLOC (name
, symname_alloced
);
1742 SYMBOL_DUP (sym
, sym2
);
1743 add_symbol_to_list (sym2
, &local_symbols
);
1747 SYMBOL_CLASS (sym
) = LOC_STATIC
;
1748 SYMBOL_NAME (sym
) = SYMNAME_ALLOC (name
, symname_alloced
);
1749 SYMBOL_DUP (sym
, sym2
);
1750 add_symbol_to_list (sym2
, &global_symbols
);
1754 SYMBOL_CLASS (sym
) = LOC_STATIC
;
1755 SYMBOL_NAME (sym
) = SYMNAME_ALLOC (name
, symname_alloced
);
1756 SYMBOL_DUP (sym
, sym2
);
1758 (sym2
, within_function
? &local_symbols
: &file_symbols
);
1762 printf ("ERROR! C_REG is not fully implemented!\n");
1763 SYMBOL_CLASS (sym
) = LOC_REGISTER
;
1764 SYMBOL_NAME (sym
) = SYMNAME_ALLOC (name
, symname_alloced
);
1765 SYMBOL_DUP (sym
, sym2
);
1766 add_symbol_to_list (sym2
, &local_symbols
);
1770 pp
= (char*) strchr (name
, ':');
1771 SYMBOL_CLASS (sym
) = LOC_REGISTER
;
1772 SYMBOL_VALUE (sym
) = STAB_REG_TO_REGNUM (cs
->c_value
);
1774 SYMBOL_NAME (sym
) = obsavestring (name
, pp
-name
, &objfile
-> symbol_obstack
);
1777 SYMBOL_TYPE (sym
) = read_type (&pp
, objfile
);
1780 /* else this is not a stab entry, suppose the type is either
1781 `int' or `float', depending on the register class. */
1783 SYMBOL_TYPE (sym
) = (SYMBOL_VALUE (sym
) < 32)
1784 ? lookup_fundamental_type (objfile
, FT_INTEGER
)
1785 : lookup_fundamental_type (objfile
, FT_FLOAT
);
1787 SYMBOL_DUP (sym
, sym2
);
1788 add_symbol_to_list (sym2
, &local_symbols
);
1792 printf ("ERROR: Unexpected storage class: %d.\n", cs
->c_sclass
);
1801 read_symbol_nvalue (symtable
, symno
)
1805 struct internal_syment symbol
[1];
1807 bfd_coff_swap_sym_in (symfile_bfd
, symtable
+ (symno
*local_symesz
), symbol
);
1808 return symbol
->n_value
;
1813 read_symbol_lineno (symtable
, symno
)
1817 struct internal_syment symbol
[1];
1818 union internal_auxent main_aux
[1];
1822 for (ii
= 0; ii
< 50; ii
++) {
1823 bfd_coff_swap_sym_in (symfile_bfd
,
1824 symtable
+ (symno
*local_symesz
), symbol
);
1825 if (symbol
->n_sclass
== C_FCN
&& 0 == strcmp (symbol
->n_name
, ".bf"))
1827 symno
+= symbol
->n_numaux
+1;
1830 printf ("GDB Error: `.bf' not found.\n");
1834 /* take aux entry and return its lineno */
1836 bfd_coff_swap_aux_in (symfile_bfd
, symtable
+(symno
*local_symesz
),
1837 symbol
->n_type
, symbol
->n_sclass
, main_aux
);
1839 return main_aux
->x_sym
.x_misc
.x_lnsz
.x_lnno
;
1842 /* Support for line number handling */
1844 /* This function is called for every section; it finds the outer limits
1845 * of the line table (minimum and maximum file offset) so that the
1846 * mainline code can read the whole thing for efficiency.
1849 find_linenos(abfd
, asect
, vpinfo
)
1854 struct coff_symfile_info
*info
;
1856 file_ptr offset
, maxoff
;
1858 count
= asect
->lineno_count
;
1860 if (strcmp (asect
->name
, ".text") || count
== 0)
1863 size
= count
* coff_data (symfile_bfd
)->local_linesz
;
1864 info
= (struct coff_symfile_info
*)vpinfo
;
1865 offset
= asect
->line_filepos
;
1866 maxoff
= offset
+ size
;
1868 if (offset
< info
->min_lineno_offset
|| info
->min_lineno_offset
== 0)
1869 info
->min_lineno_offset
= offset
;
1871 if (maxoff
> info
->max_lineno_offset
)
1872 info
->max_lineno_offset
= maxoff
;
1876 /* Read in all the line numbers for fast lookups later. Leave them in
1877 external (unswapped) format in memory; we'll swap them as we enter
1878 them into GDB's data structures. */
1881 init_lineno (abfd
, offset
, size
)
1888 if (bfd_seek(abfd
, offset
, 0) < 0)
1891 linetab
= (char *) xmalloc(size
);
1893 val
= bfd_read(linetab
, 1, size
, abfd
);
1897 linetab_offset
= offset
;
1898 linetab_size
= size
;
1899 make_cleanup (free
, linetab
); /* Be sure it gets de-allocated. */
1903 /* dbx allows the text of a symbol name to be continued into the
1904 next symbol name! When such a continuation is encountered
1905 (a \ at the end of the text of a name)
1906 call this function to get the continuation. */
1907 /* So far, I haven't seen this happenning xlc output. I doubt we'll need this
1910 #undef next_symbol_text
1911 #define next_symbol_text() \
1912 printf ("Gdb Error: symbol names on multiple lines not implemented.\n")
1915 /* xlc/dbx combination uses a set of builtin types, starting from -1. return
1916 the proper type node fora given builtin type #. */
1925 printf ("ERROR!, unknown built-in type!\n");
1929 read_type_number (pp
, typenums
);
1931 /* default types are defined in dbxstclass.h. */
1932 switch ( typenums
[1] ) {
1934 return lookup_fundamental_type (current_objfile
, FT_INTEGER
);
1936 return lookup_fundamental_type (current_objfile
, FT_CHAR
);
1938 return lookup_fundamental_type (current_objfile
, FT_SHORT
);
1940 return lookup_fundamental_type (current_objfile
, FT_LONG
);
1942 return lookup_fundamental_type (current_objfile
, FT_UNSIGNED_CHAR
);
1944 return lookup_fundamental_type (current_objfile
, FT_SIGNED_CHAR
);
1946 return lookup_fundamental_type (current_objfile
, FT_UNSIGNED_SHORT
);
1948 return lookup_fundamental_type (current_objfile
, FT_UNSIGNED_INTEGER
);
1950 return lookup_fundamental_type (current_objfile
, FT_UNSIGNED_INTEGER
);
1952 return lookup_fundamental_type (current_objfile
, FT_UNSIGNED_LONG
);
1954 return lookup_fundamental_type (current_objfile
, FT_VOID
);
1956 return lookup_fundamental_type (current_objfile
, FT_FLOAT
);
1958 return lookup_fundamental_type (current_objfile
, FT_DBL_PREC_FLOAT
);
1960 return lookup_fundamental_type (current_objfile
, FT_EXT_PREC_FLOAT
);
1962 /* requires a builtin `integer' */
1963 return lookup_fundamental_type (current_objfile
, FT_INTEGER
);
1965 return lookup_fundamental_type (current_objfile
, FT_BOOLEAN
);
1967 /* requires builtin `short real' */
1968 return lookup_fundamental_type (current_objfile
, FT_FLOAT
);
1970 /* requires builtin `real' */
1971 return lookup_fundamental_type (current_objfile
, FT_FLOAT
);
1973 printf ("ERROR! Unknown builtin type -%d\n", typenums
[1]);
1978 #if 0 /* Seems to be unused, don't bother converting from old misc function
1979 vector usage to new minimal symbol tables. FIXME: Delete this? */
1981 /* if we now nothing about a function but its address, make a function symbol
1982 out of it with the limited knowladge you have. This will be used when
1983 somebody refers to a function, which doesn't exist in the symbol table,
1984 but is in the minimal symbol table. */
1987 build_function_symbol (ind
, objfile
)
1989 struct objfile
*objfile
;
1991 struct symbol
*sym
=
1992 (struct symbol
*) obstack_alloc (&objfile
->symbol_obstack
, sizeof (struct symbol
));
1993 SYMBOL_NAME (sym
) = misc_function_vector
[ind
].name
;
1994 /* SYMBOL_VALUE (sym) = misc_function_vector[ind].address; */
1995 SYMBOL_NAMESPACE (sym
) = VAR_NAMESPACE
;
1996 SYMBOL_CLASS (sym
) = LOC_BLOCK
;
1997 SYMBOL_TYPE (sym
) = lookup_function_type (lookup_fundamental_type (current_objfile
, FT_INTEGER
));
1998 SYMBOL_BLOCK_VALUE (sym
) = (struct block
*)
1999 obstack_alloc (&objfile
->symbol_obstack
, sizeof (struct block
));
2000 BLOCK_START (SYMBOL_BLOCK_VALUE (sym
)) = misc_function_vector
[ind
].address
;
2007 aixcoff_new_init (objfile
)
2008 struct objfile
*objfile
;
2013 aixcoff_symfile_init (objfile
)
2014 struct objfile
*objfile
;
2016 bfd
*abfd
= objfile
->obfd
;
2018 /* Allocate struct to keep track of the symfile */
2019 objfile
-> sym_private
= xmmalloc (objfile
-> md
,
2020 sizeof (struct coff_symfile_info
));
2023 * Save startup file's range of PC addresses to help
2024 * blockframe.c decide where the bottom of the stack is.
2026 if (bfd_get_file_flags(abfd
) & EXEC_P
) {
2027 entry_point
= bfd_get_start_address(abfd
);
2030 /* set the startup file to be an empty range. */
2031 startup_file_start
= 0;
2032 startup_file_end
= 0;
2036 /* Perform any local cleanups required when we are done with a particular
2037 objfile. I.E, we are in the process of discarding all symbol information
2038 for an objfile, freeing up all memory held for it, and unlinking the
2039 objfile struct from the global list of known objfiles. */
2042 aixcoff_symfile_finish (objfile
)
2043 struct objfile
*objfile
;
2045 if (objfile
-> sym_private
!= NULL
)
2047 mfree (objfile
-> md
, objfile
-> sym_private
);
2050 /* Start with a fresh include table for the next objfile. */
2057 inclIndx
= inclLength
= inclDepth
= 0;
2062 init_stringtab(abfd
, offset
, objfile
)
2065 struct objfile
*objfile
;
2069 unsigned char lengthbuf
[4];
2071 if (bfd_seek(abfd
, offset
, 0) < 0)
2074 val
= bfd_read((char *)lengthbuf
, 1, sizeof lengthbuf
, abfd
);
2075 length
= bfd_h_get_32(abfd
, lengthbuf
);
2077 /* If no string table is needed, then the file may end immediately
2078 after the symbols. Just return with `strtbl' set to null. */
2080 if (val
!= sizeof length
|| length
< sizeof length
)
2083 /* Allocate string table from symbol_obstack. We will need this table
2084 as long as we have its symbol table around. */
2086 strtbl
= (char*) obstack_alloc (&objfile
->symbol_obstack
, length
);
2090 bcopy(&length
, strtbl
, sizeof length
);
2091 if (length
== sizeof length
)
2094 val
= bfd_read(strtbl
+ sizeof length
, 1, length
- sizeof length
, abfd
);
2096 if (val
!= length
- sizeof length
|| strtbl
[length
- 1] != '\0')
2103 init_debugsection(abfd
)
2106 register sec_ptr secp
;
2107 bfd_size_type length
;
2114 secp
= bfd_get_section_by_name(abfd
, ".debug");
2118 if (!(length
= bfd_section_size(abfd
, secp
)))
2121 debugsec
= (char *) xmalloc ((unsigned)length
);
2122 if (debugsec
== NULL
)
2125 if (!bfd_get_section_contents(abfd
, secp
, debugsec
, (file_ptr
) 0, length
)) {
2126 printf ("Can't read .debug section from symbol file\n");
2141 /* aixcoff version of symbol file read. */
2144 aixcoff_symfile_read (objfile
, addr
, mainline
)
2145 struct objfile
*objfile
;
2149 int num_symbols
; /* # of symbols */
2150 int symtab_offset
; /* symbol table and */
2151 int stringtab_offset
; /* string table file offsets */
2154 struct coff_symfile_info
*info
;
2157 info
= (struct coff_symfile_info
*) objfile
-> sym_private
;
2158 symfile_bfd
= abfd
= objfile
->obfd
;
2159 name
= objfile
->name
;
2161 num_symbols
= bfd_get_symcount (abfd
); /* # of symbols */
2162 symtab_offset
= obj_sym_filepos (abfd
); /* symbol table file offset */
2163 stringtab_offset
= symtab_offset
+
2164 num_symbols
* coff_data(abfd
)->local_symesz
;
2166 info
->min_lineno_offset
= 0;
2167 info
->max_lineno_offset
= 0;
2168 bfd_map_over_sections (abfd
, find_linenos
, info
);
2170 /* FIXME! This stuff should move into symfile_init */
2171 if (info
->min_lineno_offset
!= 0
2172 && info
->max_lineno_offset
> info
->min_lineno_offset
) {
2174 /* only read in the line # table if one exists */
2175 val
= init_lineno(abfd
, info
->min_lineno_offset
,
2176 info
->max_lineno_offset
- info
->min_lineno_offset
);
2179 error("\"%s\": error reading line numbers\n", name
);
2182 val
= init_stringtab(abfd
, stringtab_offset
, objfile
);
2184 error ("\"%s\": can't get string table", name
);
2187 if (init_debugsection(abfd
) < 0) {
2188 error ("Error reading .debug section of `%s'\n", name
);
2191 /* Position to read the symbol table. Do not read it all at once. */
2192 val
= bfd_seek(abfd
, (long)symtab_offset
, 0);
2194 perror_with_name(name
);
2196 if (bfd_tell(abfd
) != symtab_offset
)
2199 init_minimal_symbol_collection ();
2200 make_cleanup (discard_minimal_symbols
, 0);
2202 #ifdef XCOFF_INIT_LOADINFO
2204 XCOFF_INIT_LOADINFO ();
2207 /* Now that the executable file is positioned at symbol table,
2208 process it and define symbols accordingly. */
2210 read_xcoff_symtab(objfile
, num_symbols
);
2212 make_cleanup (free_debugsection
, 0);
2214 /* Sort symbols alphabetically within each block. */
2217 /* Install any minimal symbols that have been collected as the current
2218 minimal symbols for this objfile. */
2220 install_minimal_symbols (objfile
);
2222 /* Make a default for file to list. */
2223 select_source_symtab (0);
2226 /* Register our ability to parse symbols for aixcoff BFD files. */
2228 static struct sym_fns aixcoff_sym_fns
=
2230 "aixcoff-rs6000", /* sym_name: name or name prefix of BFD target type */
2231 15, /* sym_namelen: number of significant sym_name chars */
2232 aixcoff_new_init
, /* sym_new_init: init anything gbl to entire symtab */
2233 aixcoff_symfile_init
, /* sym_init: read initial info, setup for sym_read() */
2234 aixcoff_symfile_read
, /* sym_read: read a symbol file into symtab */
2235 aixcoff_symfile_finish
, /* sym_finish: finished with file, cleanup */
2236 NULL
/* next: pointer to next struct sym_fns */
2240 _initialize_xcoffread ()
2242 add_symtab_fns(&aixcoff_sym_fns
);
2246 /* In order to handle forward type references, we needed to have this old
2247 routine. Try printing the type of member `p' in the following structure
2248 in a dbx environment.
2256 /* Smash TYPE to be a type of pointers to TO_TYPE.
2257 If TO_TYPE is not permanent and has no pointer-type yet,
2258 record TYPE as its pointer-type. */
2261 smash_to_pointer_type (type
, to_type
)
2262 struct type
*type
, *to_type
;
2264 int type_permanent
= (TYPE_FLAGS (type
) & TYPE_FLAG_PERM
);
2266 bzero (type
, sizeof (struct type
));
2267 TYPE_TARGET_TYPE (type
) = to_type
;
2268 /* We assume the machine has only one representation for pointers! */
2269 TYPE_LENGTH (type
) = sizeof (char *);
2270 TYPE_CODE (type
) = TYPE_CODE_PTR
;
2272 /* ??? TYPE_TARGET_TYPE and TYPE_MAIN_VARIANT are the same. You can't do
2273 this. It will break the target type!!!
2274 TYPE_MAIN_VARIANT (type) = type;
2278 TYPE_FLAGS (type
) |= TYPE_FLAG_PERM
;
2280 if (TYPE_POINTER_TYPE (to_type
) == 0
2281 && (!(TYPE_FLAGS (to_type
) & TYPE_FLAG_PERM
)
2284 TYPE_POINTER_TYPE (to_type
) = type
;
2294 fatal ("internals eror: builtin_type called!");
2296 #endif /* IBM6000 */
2301 #if defined (DEBUG) && defined (IBM6000) /* Needs both defined */
2306 printf ("===STRING TABLE DUMP...\n\n");
2307 for ( ii
=0; ii
< strtbl_len
; ++ii
)
2308 printf ("%c", isprint (*(strtbl
+ii
)) ? *(strtbl
+ii
) : ' ');
2313 dump_linetable (ltb
)
2314 struct linetable
*ltb
;
2317 for (ii
=0; ii
< ltb
->nitems
; ++ii
)
2318 printf ("line: %d, addr: 0x%x\n", ltb
->item
[ii
].line
, ltb
->item
[ii
].pc
);
2325 printf ("0x%x: name: %s\n", typeP
, typeP
->name
? typeP
->name
: "(nil)");
2328 char *dump_namespace ();
2329 char *dump_addrclass ();
2335 printf (" sym: %s\t%s,\t%s\ttype: 0x%x, val: 0x%x end: 0x%x\n",
2336 pp
->name
, dump_namespace (pp
->namespace),
2337 dump_addrclass (pp
->class), pp
->type
,
2338 SYMBOL_CLASS(pp
) == LOC_BLOCK
? BLOCK_START(SYMBOL_BLOCK_VALUE(pp
))
2340 SYMBOL_CLASS(pp
) == LOC_BLOCK
? BLOCK_END(SYMBOL_BLOCK_VALUE(pp
)) : 0);
2348 static char *ns_name
[] = {
2349 "UNDEF_NS", "VAR_NS", "STRUCT_NS", "LABEL_NS"};
2352 case UNDEF_NAMESPACE
:
2354 case STRUCT_NAMESPACE
:
2355 case LABEL_NAMESPACE
:
2359 return "***ERROR***";
2365 int ac
; /* address class */
2367 static char *ac_name
[] = {
2394 case LOC_CONST_BYTES
:
2396 return ac_name
[ac
];
2398 return "***ERROR***";
2406 printf ("BLOCK..: start: 0x%x, end: 0x%x\n", pp
->startaddr
, pp
->endaddr
);
2407 for (ii
=0; ii
< pp
->nsyms
; ++ii
)
2408 dump_symbol (pp
->sym
[ii
]);
2412 dump_blockvector (pp
)
2413 struct blockvector
*pp
;
2416 for (ii
=0; ii
< pp
->nblocks
; ++ii
)
2417 dump_block (pp
->block
[ii
]);
2422 dump_last_symtab (pp
)
2425 for ( ; pp
; pp
= pp
->next
) {
2426 if ( pp
->next
== 0 ) {
2427 printf ("SYMTAB NAME: %s\n", pp
->filename
);
2428 dump_blockvector (pp
->blockvector
);
2437 for ( ; pp
; pp
= pp
->next
) {
2438 printf ("SYMTAB NAME: %s\n", pp
->filename
? pp
->filename
: "(nil)");
2439 /* if (pp->linetable)
2440 dump_linetable (pp->linetable); */
2441 dump_blockvector (pp
->blockvector
);
2446 dump_symtab_lines (pp
)
2449 for ( ; pp
; pp
= pp
->next
) {
2450 printf ("SYMTAB NAME: %s\n", pp
->filename
? pp
->filename
: "(nil)");
2452 dump_linetable (pp
->linetable
);
2453 /* dump_blockvector (pp->blockvector); */
2462 for (ii
=0; ii
< of
->minimal_symbol_count
; ++ii
)
2463 printf ("name: %s, addr: 0x%x, info: 0x%x\n",
2464 of
->msymbols
[ii
].name
,
2465 of
->msymbols
[ii
].address
,
2466 of
->msymbols
[ii
].info
);