#include "bfd.h"
-#include "coff/ecoff.h" /* COFF-like aspects of ecoff files */
+#include "coff/ecoff.h" /* COFF-like aspects of ecoff files. */
#include "libaout.h" /* Private BFD a.out information. */
#include "aout/aout64.h"
-#include "aout/stab_gnu.h" /* STABS information */
+#include "aout/stab_gnu.h" /* STABS information. */
#include "expression.h"
extern void _initialize_mdebugread (void);
-/* Provide a way to test if we have both ECOFF and ELF symbol tables.
+/* Provide a way to test if we have both ECOFF and ELF symbol tables.
We use this define in order to know whether we should override a
symbol's ECOFF section with its ELF section. This is necessary in
case the symbol's ELF section could not be represented in ECOFF. */
#define SC_IS_SBSS(sc) ((sc) == scSBss)
#define SC_IS_UNDEF(sc) ((sc) == scUndefined || (sc) == scSUndefined)
\f
-/* Various complaints about symbol reading that don't abort the process */
+/* Various complaints about symbol reading that don't abort the process. */
static void
index_complaint (const char *arg1)
{
complaint (&symfile_complaints, _("unexpected type code for %s"), arg1);
}
-/* Macros and extra defs */
+/* Macros and extra defs. */
-/* Puns: hard to find whether -g was used and how */
+/* Puns: hard to find whether -g was used and how. */
#define MIN_GLEVEL GLEVEL_0
#define compare_glevel(a,b) \
(((a) == GLEVEL_3) ? ((b) < GLEVEL_3) : \
((b) == GLEVEL_3) ? -1 : (int)((b) - (a)))
\f
-/* Things that really are local to this module */
+/* Things that really are local to this module. */
-/* Remember what we deduced to be the source language of this psymtab. */
+/* Remember what we deduced to be the source language of this psymtab. */
static enum language psymtab_language = language_unknown;
static struct ecoff_debug_info *debug_info;
-/* Pointer to current file decriptor record, and its index */
+/* Pointer to current file decriptor record, and its index. */
static FDR *cur_fdr;
static int cur_fd;
-/* Index of current symbol */
+/* Index of current symbol. */
static int cur_sdx;
/* Note how much "debuggable" this image is. We would like
- to see at least one FDR with full symbols */
+ to see at least one FDR with full symbols. */
static int max_gdbinfo;
static int max_glevel;
-/* When examining .o files, report on undefined symbols */
+/* When examining .o files, report on undefined symbols. */
static int n_undef_symbols, n_undef_labels, n_undef_vars, n_undef_procs;
static int found_ecoff_debugging_info;
-/* Forward declarations */
+/* Forward declarations. */
static int upgrade_type (int, struct type **, int, union aux_ext *,
int, char *);
/* Exported procedure: Builds a symtab from the PST partial one.
Restores the environment in effect when PST was created, delegates
most of the work to an ancillary procedure, and sorts
- and reorders the symtab list at the end */
+ and reorders the symtab list at the end. */
static void
mdebug_psymtab_to_symtab (struct partial_symtab *pst)
psymtab_to_symtab_1 (pst, pst->filename);
/* Match with global symbols. This only needs to be done once,
- after all of the symtabs and dependencies have been read in. */
+ after all of the symtabs and dependencies have been read in. */
scan_file_globals (pst->objfile);
if (info_verbose)
printf_filtered (_("done.\n"));
}
\f
-/* File-level interface functions */
+/* File-level interface functions. */
-/* Find a file descriptor given its index RF relative to a file CF */
+/* Find a file descriptor given its index RF relative to a file CF. */
static FDR *
get_rfd (int cf, int rf)
fdrs = debug_info->fdr;
f = fdrs + cf;
- /* Object files do not have the RFD table, all refs are absolute */
+ /* Object files do not have the RFD table, all refs are absolute. */
if (f->rfdBase == 0)
return fdrs + rf;
(*debug_swap->swap_rfd_in) (cur_bfd,
return fdrs + rfd;
}
-/* Return a safer print NAME for a file descriptor */
+/* Return a safer print NAME for a file descriptor. */
static char *
fdr_name (FDR *f)
\f
/* Local utilities */
-/* Map of FDR indexes to partial symtabs */
+/* Map of FDR indexes to partial symtabs. */
struct pst_map
{
/* Utility stack, used to nest procedures and blocks properly.
It is a doubly linked list, to avoid too many alloc/free.
Since we might need it quite a few times it is NOT deallocated
- after use. */
+ after use. */
static struct parse_stack
{
struct parse_stack *next, *prev;
- struct symtab *cur_st; /* Current symtab. */
- struct block *cur_block; /* Block in it. */
+ struct symtab *cur_st; /* Current symtab. */
+ struct block *cur_block; /* Block in it. */
/* What are we parsing. stFile, or stBlock are for files and
blocks. stProc or stStaticProc means we have seen the start of a
int blocktype;
- struct type *cur_type; /* Type we parse fields for. */
- int cur_field; /* Field number in cur_type. */
- CORE_ADDR procadr; /* Start addres of this procedure */
- int numargs; /* Its argument count */
+ struct type *cur_type; /* Type we parse fields for. */
+ int cur_field; /* Field number in cur_type. */
+ CORE_ADDR procadr; /* Start addres of this procedure. */
+ int numargs; /* Its argument count. */
}
*top_stack; /* Top stack ptr */
-/* Enter a new lexical context */
+/* Enter a new lexical context. */
static void
push_parse_stack (void)
{
struct parse_stack *new;
- /* Reuse frames if possible */
+ /* Reuse frames if possible. */
if (top_stack && top_stack->prev)
new = top_stack->prev;
else
new = (struct parse_stack *) xzalloc (sizeof (struct parse_stack));
- /* Initialize new frame with previous content */
+ /* Initialize new frame with previous content. */
if (top_stack)
{
struct parse_stack *prev = new->prev;
top_stack = new;
}
-/* Exit a lexical context */
+/* Exit a lexical context. */
static void
pop_parse_stack (void)
/* Cross-references might be to things we haven't looked at
yet, e.g. type references. To avoid too many type
duplications we keep a quick fixup table, an array
- of lists of references indexed by file descriptor */
+ of lists of references indexed by file descriptor. */
struct mdebug_pending
{
static struct mdebug_pending **pending_list;
-/* Check whether we already saw symbol SH in file FH */
+/* Check whether we already saw symbol SH in file FH. */
static struct mdebug_pending *
is_pending_symbol (FDR *fh, char *sh)
int f_idx = fh - debug_info->fdr;
struct mdebug_pending *p;
- /* Linear search is ok, list is typically no more than 10 deep */
+ /* Linear search is ok, list is typically no more than 10 deep. */
for (p = pending_list[f_idx]; p; p = p->next)
if (p->s == sh)
break;
return p;
}
-/* Add a new symbol SH of type T */
+/* Add a new symbol SH of type T. */
static void
add_pending (FDR *fh, char *sh, struct type *t)
int f_idx = fh - debug_info->fdr;
struct mdebug_pending *p = is_pending_symbol (fh, sh);
- /* Make sure we do not make duplicates */
+ /* Make sure we do not make duplicates. */
if (!p)
{
p = ((struct mdebug_pending *)
}
\f
-/* Parsing Routines proper. */
+/* Parsing Routines proper. */
-/* Parse a single symbol. Mostly just make up a GDB symbol for it.
+/* Parse a single symbol. Mostly just make up a GDB symbol for it.
For blocks, procedures and types we open a new lexical context.
This is basically just a big switch on the symbol's type. Argument
AX is the base pointer of aux symbols for this file (fh->iauxBase).
case stNil:
break;
- case stGlobal: /* external symbol, goes into global block */
+ case stGlobal: /* External symbol, goes into global block. */
class = LOC_STATIC;
b = BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack->cur_st),
GLOBAL_BLOCK);
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
goto data;
- case stStatic: /* static data, goes into current block. */
+ case stStatic: /* Static data, goes into current block. */
class = LOC_STATIC;
b = top_stack->cur_block;
s = new_symbol (name);
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
goto data;
- case stLocal: /* local variable, goes into current block */
+ case stLocal: /* Local variable, goes into current block. */
b = top_stack->cur_block;
s = new_symbol (name);
SYMBOL_VALUE (s) = svalue;
else
class = LOC_LOCAL;
- data: /* Common code for symbols describing data */
+ data: /* Common code for symbols describing data. */
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_CLASS (s) = class;
add_symbol (s, top_stack->cur_st, b);
SYMBOL_TYPE (s) = objfile_type (objfile)->nodebug_data_symbol;
else
SYMBOL_TYPE (s) = parse_type (cur_fd, ax, sh->index, 0, bigend, name);
- /* Value of a data symbol is its memory address */
+ /* Value of a data symbol is its memory address. */
break;
- case stParam: /* arg to procedure, goes into current block */
+ case stParam: /* Arg to procedure, goes into current
+ block. */
max_gdbinfo++;
found_ecoff_debugging_info = 1;
top_stack->numargs++;
/* Special GNU C++ name. */
if (is_cplus_marker (name[0]) && name[1] == 't' && name[2] == 0)
- name = "this"; /* FIXME, not alloc'd in obstack */
+ name = "this"; /* FIXME, not alloc'd in obstack. */
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
- case stLabel: /* label, goes into current block */
+ case stLabel: /* label, goes into current block. */
s = new_symbol (name);
- SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* so that it can be used */
- SYMBOL_CLASS (s) = LOC_LABEL; /* but not misused */
+ SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* So that it can be used */
+ SYMBOL_CLASS (s) = LOC_LABEL; /* but not misused. */
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
break;
- case stProc: /* Procedure, usually goes into global block */
- case stStaticProc: /* Static procedure, goes into current block */
+ case stProc: /* Procedure, usually goes into global block. */
+ case stStaticProc: /* Static procedure, goes into current block. */
/* For stProc symbol records, we need to check the storage class
as well, as only (stProc, scText) entries represent "real"
procedures - See the Compaq document titled "Object File /
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_CLASS (s) = LOC_BLOCK;
- /* Type of the return value */
+ /* Type of the return value. */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
t = objfile_type (objfile)->builtin_int;
else
printf("howdy\n")" would fail with the error message
"program has no memory available". To avoid this, we
patch up the type and make it void*
- instead. (davidm@azstarnet.com)
- */
+ instead. (davidm@azstarnet.com). */
t = make_pointer_type (t, NULL);
}
}
}
add_symbol (s, top_stack->cur_st, b);
- /* Make a type for the procedure itself */
+ /* Make a type for the procedure itself. */
SYMBOL_TYPE (s) = lookup_function_type (t);
/* All functions in C++ have prototypes. For C we don't have enough
if (SYMBOL_LANGUAGE (s) == language_cplus)
TYPE_PROTOTYPED (SYMBOL_TYPE (s)) = 1;
- /* Create and enter a new lexical context */
+ /* Create and enter a new lexical context. */
b = new_block (FUNCTION_BLOCK);
SYMBOL_BLOCK_VALUE (s) = b;
BLOCK_FUNCTION (b) = s;
BLOCK_SUPERBLOCK (b) = top_stack->cur_block;
add_block (b, top_stack->cur_st);
- /* Not if we only have partial info */
+ /* Not if we only have partial info. */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
break;
long max_value;
struct field *f;
- case stStruct: /* Start a block defining a struct type */
+ case stStruct: /* Start a block defining a struct type. */
type_code = TYPE_CODE_STRUCT;
goto structured_common;
- case stUnion: /* Start a block defining a union type */
+ case stUnion: /* Start a block defining a union type. */
type_code = TYPE_CODE_UNION;
goto structured_common;
- case stEnum: /* Start a block defining an enum type */
+ case stEnum: /* Start a block defining an enum type. */
type_code = TYPE_CODE_ENUM;
goto structured_common;
- case stBlock: /* Either a lexical block, or some type */
+ case stBlock: /* Either a lexical block, or some type. */
if (sh->sc != scInfo && !SC_IS_COMMON (sh->sc))
goto case_stBlock_code; /* Lexical block */
push_parse_stack ();
top_stack->blocktype = stBlock;
- /* First count the number of fields and the highest value. */
+ /* First count the number of fields and the highest value. */
nfields = 0;
max_value = 0;
for (ext_tsym = ext_sh + external_sym_size;
{
case stEnd:
/* C++ encodes class types as structures where there the
- methods are encoded as stProc. The scope of stProc
+ methods are encoded as stProc. The scope of stProc
symbols also ends with stEnd, thus creating a risk of
taking the wrong stEnd symbol record as the end of
the current struct, which would cause GDB to undercount
/* mips cc puts out a typedef for struct x if it is not yet
defined when it encounters
struct y { struct x *xp; };
- Just ignore it. */
+ Just ignore it. */
break;
case stIndirect:
/* Irix5 cc puts out a stIndirect for struct x if it is not
yet defined when it encounters
struct y { struct x *xp; };
- Just ignore it. */
+ Just ignore it. */
break;
default:
differently from struct/union fields, and that is harder to
patch up, but luckily we shouldn't need to. (If there are
any enumeration members, we can tell for sure it's an enum
- here.) */
+ here.) */
if (type_code == TYPE_CODE_UNDEF)
{
{
int unsigned_enum = 1;
- /* This is a non-empty enum. */
+ /* This is a non-empty enum. */
/* DEC c89 has the number of enumerators in the sh.value field,
not the type length, so we have to compensate for that
unsigned_enum = 0;
add_symbol (enum_sym, top_stack->cur_st, top_stack->cur_block);
- /* Skip the stMembers that we've handled. */
+ /* Skip the stMembers that we've handled. */
count++;
f++;
}
if (unsigned_enum)
TYPE_UNSIGNED (t) = 1;
}
- /* make this the current type */
+ /* Make this the current type. */
top_stack->cur_type = t;
top_stack->cur_field = 0;
case_stBlock_code:
found_ecoff_debugging_info = 1;
- /* beginnning of (code) block. Value of symbol
- is the displacement from procedure start */
+ /* Beginnning of (code) block. Value of symbol
+ is the displacement from procedure start. */
push_parse_stack ();
/* Do not start a new block if this is the outermost block of a
BLOCK_END (top_stack->cur_block) += sh->value; /* size */
- /* Make up special symbol to contain procedure specific info */
+ /* Make up special symbol to contain procedure specific info. */
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
SYMBOL_CLASS (s) = LOC_CONST;
if (TYPE_NFIELDS (ftype) <= 0)
{
/* No parameter type information is recorded with the function's
- type. Set that from the type of the parameter symbols. */
+ type. Set that from the type of the parameter symbols. */
int nparams = top_stack->numargs;
int iparams;
struct symbol *sym;
}
else if (sh->sc == scText && top_stack->blocktype == stBlock)
{
- /* End of (code) block. The value of the symbol is the
+ /* End of (code) block. The value of the symbol is the
displacement from the procedure`s start address of the
- end of this block. */
+ end of this block. */
BLOCK_END (top_stack->cur_block) = sh->value + top_stack->procadr;
}
else if (sh->sc == scText && top_stack->blocktype == stNil)
complaint (&symfile_complaints,
_("stEnd with storage class %d not handled"), sh->sc);
- pop_parse_stack (); /* restore previous lexical context */
+ pop_parse_stack (); /* Restore previous lexical context. */
break;
case stMember: /* member of struct or union */
else
t = pend->t;
- /* mips cc puts out a typedef with the name of the struct for forward
- declarations. These should not go into the symbol table and
+ /* Mips cc puts out a typedef with the name of the struct for forward
+ declarations. These should not go into the symbol table and
TYPE_NAME should not be set for them.
They can't be distinguished from an intentional typedef to
the same name however:
}
/* Parse the type information provided in the raw AX entries for
- the symbol SH. Return the bitfield size in BS, in case.
+ the symbol SH. Return the bitfield size in BS, in case.
We must byte-swap the AX entries before we use them; BIGEND says whether
they are big-endian or little-endian (from fh->fBigendian). */
struct type *tp = 0;
enum type_code type_code = TYPE_CODE_UNDEF;
- /* Handle undefined types, they have indexNil. */
+ /* Handle undefined types, they have indexNil. */
if (aux_index == indexNil)
return basic_type (btInt, current_objfile);
tp = basic_type (t->bt, current_objfile);
if (tp == NULL)
{
- /* Cannot use builtin types -- build our own */
+ /* Cannot use builtin types -- build our own. */
switch (t->bt)
{
case btStruct:
type_code = TYPE_CODE_SET;
break;
case btIndirect:
- /* alpha cc -migrate uses this for typedefs. The true type will
+ /* alpha cc -migrate uses this for typedefs. The true type will
be obtained by crossreferencing below. */
type_code = TYPE_CODE_ERROR;
break;
case btTypedef:
- /* alpha cc uses this for typedefs. The true type will be
+ /* alpha cc uses this for typedefs. The true type will be
obtained by crossreferencing below. */
type_code = TYPE_CODE_ERROR;
break;
}
}
- /* Move on to next aux */
+ /* Move on to next aux. */
ax++;
if (t->fBitfield)
/* All these types really point to some (common) MIPS type
definition, and only the type-qualifiers fully identify
- them. We'll make the same effort at sharing. */
+ them. We'll make the same effort at sharing. */
if (t->bt == btStruct ||
t->bt == btUnion ||
t->bt == btEnum ||
else
{
/* Usually, TYPE_CODE(tp) is already type_code. The main
- exception is if we guessed wrong re struct/union/enum. */
+ exception is if we guessed wrong re struct/union/enum. */
if (TYPE_CODE (tp) != type_code)
{
bad_tag_guess_complaint (sym_name);
}
}
- /* Deal with range types */
+ /* Deal with range types. */
if (t->bt == btRange)
{
TYPE_NFIELDS (tp) = 0;
ax++;
}
- /* Parse all the type qualifiers now. If there are more
- than 6 the game will continue in the next aux */
+ /* Parse all the type qualifiers now. If there are more
+ than 6 the game will continue in the next aux. */
while (1)
{
}
/* Make up a complex type from a basic one. Type is passed by
- reference in TPP and side-effected as necessary. The type
+ reference in TPP and side-effected as necessary. The type
qualifier TQ says how to handle the aux symbols at AX for
the symbol SX we are currently analyzing. BIGEND says whether
aux symbols are big-endian or little-endian.
- Returns the number of aux symbols we parsed. */
+ Returns the number of aux symbols we parsed. */
static int
upgrade_type (int fd, struct type **tpp, int tq, union aux_ext *ax, int bigend,
int off;
struct type *t;
- /* Used in array processing */
+ /* Used in array processing. */
int rf, id;
FDR *fh;
struct type *range;
case tqArray:
off = 0;
- /* Determine and record the domain type (type of index) */
+ /* Determine and record the domain type (type of index). */
(*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, &rndx);
id = rndx.index;
rf = rndx.rfd;
struct block *b;
char *sh_name;
- /* Simple rule to find files linked "-x" */
+ /* Simple rule to find files linked "-x". */
if (cur_fdr->rss == -1)
{
if (pr->isym == -1)
{
- /* Static procedure at address pr->adr. Sigh. */
+ /* Static procedure at address pr->adr. Sigh. */
/* FIXME-32x64. assuming pr->adr fits in long. */
complaint (&symfile_complaints,
_("can't handle PDR for static proc at 0x%lx"),
s = new_symbol (sh_name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
SYMBOL_CLASS (s) = LOC_BLOCK;
- /* Donno its type, hope int is ok */
+ /* Donno its type, hope int is ok. */
SYMBOL_TYPE (s)
= lookup_function_type (objfile_type (pst->objfile)->builtin_int);
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
- /* Wont have symbols for this one */
+ /* Won't have symbols for this one. */
b = new_block (2);
SYMBOL_BLOCK_VALUE (s) = b;
BLOCK_FUNCTION (b) = s;
SYMBOL_TYPE (s) = objfile_type (pst->objfile)->nodebug_text_symbol;
}
-/* Parse the external symbol ES. Just call parse_symbol() after
+/* Parse the external symbol ES. Just call parse_symbol() after
making sure we know where the aux are for it.
BIGEND says whether aux entries are big-endian or little-endian.
- This routine clobbers top_stack->cur_block and ->cur_st. */
+ This routine clobbers top_stack->cur_block and ->cur_st. */
static void parse_external (EXTR *, int, struct section_offsets *,
struct objfile *);
break;
}
n_undef_symbols++;
- /* FIXME: Turn this into a complaint? */
+ /* FIXME: Turn this into a complaint? */
if (info_verbose)
printf_filtered (_("Warning: %s `%s' is undefined (in %s)\n"),
what, debug_info->ssext + es->asym.iss,
GDB's linetable LT. MIPS' encoding requires a little bit
of magic to get things out. Note also that MIPS' line
numbers can go back and forth, apparently we can live
- with that and do not need to reorder our linetables */
+ with that and do not need to reorder our linetables. */
static void parse_lines (FDR *, PDR *, struct linetable *, int,
struct partial_symtab *, CORE_ADDR);
if (fh->cbLine == 0)
return;
- /* Scan by procedure descriptors */
+ /* Scan by procedure descriptors. */
k = 0;
for (j = 0; j < fh->cpd; j++, pr++)
{
CORE_ADDR adr;
unsigned char *halt;
- /* No code for this one */
+ /* No code for this one. */
if (pr->iline == ilineNil ||
pr->lnLow == -1 || pr->lnHigh == -1)
continue;
}
lineno += delta; /* first delta is 0 */
- /* Complain if the line table overflows. Could happen
+ /* Complain if the line table overflows. Could happen
with corrupt binaries. */
if (lt->nitems >= maxlines)
{
int textlow_not_set = 1;
int past_first_source_file = 0;
- /* List of current psymtab's include files */
+ /* List of current psymtab's include files. */
char **psymtab_include_list;
int includes_allocated;
int includes_used;
EXTR *extern_tab;
struct pst_map *fdr_to_pst;
- /* Index within current psymtab dependency list */
+ /* Index within current psymtab dependency list. */
struct partial_symtab **dependency_list;
int dependencies_used, dependencies_allocated;
struct cleanup *old_chain;
* Only parse the Local and External symbols, and the Relative FDR.
* Fixup enough of the loader symtab to be able to use it.
* Allocate space only for the file's portions we need to
- * look at. (XXX)
+ * look at. (XXX)
*/
max_gdbinfo = 0;
/* Allocate the map FDR -> PST.
Minor hack: -O3 images might claim some global data belongs
- to FDR -1. We`ll go along with that */
+ to FDR -1. We`ll go along with that. */
fdr_to_pst = (struct pst_map *)
xzalloc ((hdr->ifdMax + 1) * sizeof *fdr_to_pst);
old_chain = make_cleanup (xfree, fdr_to_pst);
for (; ext_out < ext_out_end; ext_out += external_ext_size, ext_in++)
(*swap_ext_in) (cur_bfd, ext_out, ext_in);
- /* Pass 1 over external syms: Presize and partition the list */
+ /* Pass 1 over external syms: Presize and partition the list. */
ext_in = ext_block;
ext_in_end = ext_in + hdr->iextMax;
for (; ext_in < ext_in_end; ext_in++)
fdr_to_pst[ext_in->ifd].n_globals++;
}
- /* Pass 1.5 over files: partition out global symbol space */
+ /* Pass 1.5 over files: partition out global symbol space. */
s_idx = 0;
for (f_idx = -1; f_idx < hdr->ifdMax; f_idx++)
{
Since absolute sections don't get relocated, we
end up calculating an address different from that of
the symbol's minimal symbol (created earlier from the
- Elf symtab).
+ Elf symtab).
To fix this, either :
1) don't create the duplicate symbol
I've implemented #1 here...
Skip the creation of the minimal symbols based on the ECOFF
- symbol table. */
+ symbol table. */
- /* Pass 2 over external syms: fill in external symbols */
+ /* Pass 2 over external syms: fill in external symbols. */
ext_in = ext_block;
ext_in_end = ext_in + hdr->iextMax;
for (; ext_in < ext_in_end; ext_in++)
continue;
- /* Pass 3 over files, over local syms: fill in static symbols */
+ /* Pass 3 over files, over local syms: fill in static symbols. */
name = debug_info->ssext + ext_in->asym.iss;
- /* Process ECOFF Symbol Types and Storage Classes */
+ /* Process ECOFF Symbol Types and Storage Classes. */
switch (ext_in->asym.st)
{
case stProc:
/* Label */
/* On certain platforms, some extra label symbols can be
- generated by the linker. One possible usage for this kind
+ generated by the linker. One possible usage for this kind
of symbols is to represent the address of the begining of a
- given section. For instance, on Tru64 5.1, the address of
+ given section. For instance, on Tru64 5.1, the address of
the _ftext label is the start address of the .text section.
The storage class of these symbols is usually directly
- related to the section to which the symbol refers. For
+ related to the section to which the symbol refers. For
instance, on Tru64 5.1, the storage class for the _fdata
label is scData, refering to the .data section.
It is actually possible that the section associated to the
- storage class of the label does not exist. On True64 5.1
+ storage class of the label does not exist. On True64 5.1
for instance, the libm.so shared library does not contain
any .data section, although it contains a _fpdata label
- which storage class is scData... Since these symbols are
+ which storage class is scData... Since these symbols are
usually useless for the debugger user anyway, we just
- discard these symbols.
- */
+ discard these symbols. */
if (SC_IS_TEXT (ext_in->asym.sc))
{
case stLocal:
case stNil:
/* The alpha has the section start addresses in stLocal symbols
- whose name starts with a `.'. Skip those but complain for all
+ whose name starts with a `.'. Skip those but complain for all
other stLocal symbols.
Irix6 puts the section start addresses in stNil symbols, skip
- those too. */
+ those too. */
if (name[0] == '.')
continue;
/* Fall through. */
objfile);
}
- /* Pass 3 over files, over local syms: fill in static symbols */
+ /* Pass 3 over files, over local syms: fill in static symbols. */
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
{
struct partial_symtab *save_pst;
DEBUG_INFO (pst) = debug_info;
PENDING_LIST (pst) = pending_list;
- /* The way to turn this into a symtab is to call... */
+ /* The way to turn this into a symtab is to call... */
pst->read_symtab = mdebug_psymtab_to_symtab;
/* Set up language for the pst.
a header file, which is not what we want.
But the FDRs for the header files are after the FDR for the source
file, so we can assign the language of the source file to the
- following header files. Then we save the language in the private
+ following header files. Then we save the language in the private
pst data so that we can reuse it when building symtabs. */
prev_language = psymtab_language;
current object file uses encapsulated stabs instead of mips
ecoff for local symbols. (It is the second symbol because
the first symbol is the stFile used to signal the start of a
- file). */
+ file). */
processing_gcc_compilation = 0;
if (fh->csym >= 2)
{
default:
/* FIXME! Shouldn't this use cases for bss,
- then have the default be abs? */
+ then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
sh.value += ANOFFSET (objfile->section_offsets,
SECT_OFF_BSS (objfile));
}
continue;
}
- /* Handle stabs continuation */
+ /* Handle stabs continuation. */
{
char *stabstring = debug_info->ss + fh->issBase + sh.iss;
int len = strlen (stabstring);
char *stabstring2;
int len2;
- /* Ignore continuation char from 1st string */
+ /* Ignore continuation char from 1st string. */
len--;
- /* Read next stabstring */
+ /* Read next stabstring. */
cur_sdx++;
(*swap_sym_in) (cur_bfd,
(((char *) debug_info->external_sym)
stabstring2 = debug_info->ss + fh->issBase + sh2.iss;
len2 = strlen (stabstring2);
- /* Concatinate stabstring2 with stabstring1 */
+ /* Concatinate stabstring2 with stabstring1. */
if (stabstring
&& stabstring != debug_info->ss + fh->issBase + sh.iss)
stabstring = xrealloc (stabstring, len + len2 + 1);
case N_BSS:
case N_BSS | N_EXT:
case N_NBBSS | N_EXT:
- case N_SETV | N_EXT: /* FIXME, is this in BSS? */
+ case N_SETV | N_EXT: /* FIXME, is this in BSS? */
sh.value += ANOFFSET (objfile->section_offsets,
SECT_OFF_BSS (objfile));
goto record_it;
record_it:
continue;
- /* Standard, local, non-debugger, symbols */
+ /* Standard, local, non-debugger, symbols. */
case N_NBTEXT:
goto record_it;
case N_UNDF | N_EXT:
- continue; /* Just undefined, not COMMON */
+ continue; /* Just undefined, not COMMON. */
case N_UNDF:
continue;
case N_NBBSS:
continue;
- /* Keep going . . . */
+ /* Keep going . . . */
/*
* Special symbol types for GNU
prev_textlow_not_set = textlow_not_set;
/* A zero value is probably an indication for the
- SunPRO 3.0 compiler. end_psymtab explicitly tests
+ SunPRO 3.0 compiler. end_psymtab explicitly tests
for zero, so don't relocate it. */
if (sh.value == 0
past_first_source_file = 1;
if (prev_so_symnum != symnum - 1)
- { /* Here if prev stab wasn't N_SO */
+ { /* Here if prev stab wasn't N_SO. */
first_so_symnum = symnum;
if (pst)
prev_so_symnum = symnum;
- /* End the current partial symtab and start a new one */
+ /* End the current partial symtab and start a
+ new one. */
/* SET_NAMESTRING ();*/
namestring = stabstring;
/* Null name means end of .o file. Don't start a new
- one. */
+ one. */
if (*namestring == '\000')
continue;
initial N_SOs. The first one is a directory name;
the second the file name. If pst exists, is
empty, and has a filename ending in '/', we assume
- the previous N_SO was a directory name. */
+ the previous N_SO was a directory name. */
p = strrchr (namestring, '/');
if (p && *(p + 1) == '\000')
continue; /* Simply ignore directory
- name SOs */
+ name SOs. */
/* Some other compilers (C++ ones in particular) emit
useless SOs for non-existant .c files. We ignore
{
enum language tmp_language;
- /* Mark down an include file in the current psymtab */
+ /* Mark down an include file in the current psymtab. */
- /* SET_NAMESTRING ();*/
+ /* SET_NAMESTRING (); */
namestring = stabstring;
tmp_language
/* In C++, one may expect the same filename to come
round many times, when code is coming alternately
from the main file and from inline functions in
- other files. So I check to see if this is a file
+ other files. So I check to see if this is a file
we've seen before -- either the main source file,
or a previously included file.
}
continue;
}
- case N_LSYM: /* Typedef or automatic variable. */
+ case N_LSYM: /* Typedef or automatic variable. */
case N_STSYM: /* Data seg var -- static */
case N_LCSYM: /* BSS " */
case N_ROSYM: /* Read-only data seg var -- static. */
case N_PC: /* I may or may not need this; I
suspect not. */
case N_M2C: /* I suspect that I can ignore this
- here. */
- case N_SCOPE: /* Same. */
+ here. */
+ case N_SCOPE: /* Same. */
- /* SET_NAMESTRING ();*/
+ /* SET_NAMESTRING (); */
namestring = stabstring;
p = (char *) strchr (namestring, ':');
if (!p)
- continue; /* Not a debugging symbol. */
+ continue; /* Not a debugging symbol. */
case 'G':
sh.value += ANOFFSET (objfile->section_offsets,
SECT_OFF_DATA (objfile));
- /* The addresses in these entries are reported to be
- wrong. See the code that reads 'G's for symtabs. */
+ /* The addresses in these entries are reported
+ to be wrong. See the code that reads 'G's
+ for symtabs. */
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_STATIC,
&objfile->global_psymbols,
goto check_enum;
case 't':
if (p != namestring) /* a name is there, not
- just :T... */
+ just :T... */
{
add_psymbol_to_list (namestring, p - namestring, 1,
VAR_DOMAIN, LOC_TYPEDEF,
/* If this is an enumerated type, we need to add
all the enum constants to the partial symbol
table. This does not cover enums without names,
- e.g. "enum {a, b} c;" in C, but fortunately
+ e.g. "enum {a, b} c;" in C, but fortunately
those are rare. There is no way for GDB to find
those from the enum type without spending too
much time on it. Thus to solve this problem,
element. Hopefully, I can
ignore this. */
case N_ENTRY: /* Alternate entry point; can
- ignore. */
+ ignore. */
case N_MAIN: /* Can definitely ignore this. */
- case N_CATCH: /* These are GNU C++ extensions */
- case N_EHDECL: /* that can safely be ignored here. */
+ case N_CATCH: /* These are GNU C++ extensions. */
+ case N_EHDECL: /* that can safely be ignored here. */
case N_LENG:
case N_BCOMM:
case N_ECOMM:
case N_ALIAS: /* SunPro F77: alias name, ignore
for now. */
- case N_OBJ: /* useless types from Solaris */
+ case N_OBJ: /* Useless types from Solaris. */
case N_OPT:
/* These symbols aren't interesting; don't worry about
- them */
+ them. */
continue;
probably some new type we don't know about yet. */
complaint (&symfile_complaints,
_("unknown symbol type %s"),
- hex_string (type_code)); /*CUR_SYMBOL_TYPE*/
+ hex_string (type_code)); /* CUR_SYMBOL_TYPE */
continue;
}
if (stabstring
|| (sh.index == indexNil
&& (sh.st != stStatic || sh.sc == scAbs)))
{
- /* FIXME, premature? */
+ /* FIXME, premature? */
cur_sdx++;
continue;
}
/* Should not happen, but does when cross-compiling
with the MIPS compiler. FIXME -- pull later. */
index_complaint (name);
- new_sdx = cur_sdx + 1; /* Don't skip at all */
+ new_sdx = cur_sdx + 1; /* Don't skip at all. */
}
else
new_sdx = AUX_GET_ISYM (fh->fBigendian,
complaint (&symfile_complaints,
_("bad proc end in aux found from symbol %s"),
name);
- new_sdx = cur_sdx + 1; /* Don't skip backward */
+ new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
/* For stProc symbol records, we need to check the
goto skip;
/* Usually there is a local and a global stProc symbol
- for a function. This means that the function name
+ for a function. This means that the function name
has already been entered into the mimimal symbol table
while processing the global symbols in pass 2 above.
One notable exception is the PROGRAM name from
break;
case stIndirect: /* Irix5 forward declaration */
- /* Skip forward declarations from Irix5 cc */
+ /* Skip forward declarations from Irix5 cc. */
goto skip;
case stTypedef: /* Typedef */
case stEnum:
case stBlock: /* { }, str, un, enum */
/* Do not create a partial symbol for cc unnamed aggregates
- and gcc empty aggregates. */
+ and gcc empty aggregates. */
if ((sh.sc == scInfo
|| SC_IS_COMMON (sh.sc))
&& sh.iss != 0
}
handle_psymbol_enumerators (objfile, fh, sh.st, sh.value);
- /* Skip over the block */
+ /* Skip over the block. */
new_sdx = sh.index;
if (new_sdx <= cur_sdx)
{
- /* This happens with the Ultrix kernel. */
+ /* This happens with the Ultrix kernel. */
complaint (&symfile_complaints,
_("bad aux index at block symbol %s"), name);
- new_sdx = cur_sdx + 1; /* Don't skip backward */
+ new_sdx = cur_sdx + 1; /* Don't skip backward. */
}
cur_sdx = new_sdx;
continue;
case stLocal: /* Local variables */
/* Normally these are skipped because we skip over
all blocks we see. However, these can occur
- as visible symbols in a .h file that contains code. */
+ as visible symbols in a .h file that contains code. */
goto skip;
default:
cur_sdx++;
continue;
}
- /* Use this gdb symbol */
+ /* Use this gdb symbol. */
add_psymbol_to_list (name, strlen (name), 1,
VAR_DOMAIN, class,
&objfile->static_psymbols,
0, sh.value, psymtab_language, objfile);
skip:
- cur_sdx++; /* Go to next file symbol */
+ cur_sdx++; /* Go to next file symbol. */
}
- /* Now do enter the external symbols. */
+ /* Now do enter the external symbols. */
ext_ptr = &extern_tab[fdr_to_pst[f_idx].globals_offset];
cur_sdx = fdr_to_pst[f_idx].n_globals;
PST_PRIVATE (save_pst)->extern_count = cur_sdx;
}
}
- /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
+ /* Link pst to FDR. end_psymtab returns NULL if the psymtab was
empty and put on the free list. */
fdr_to_pst[f_idx].pst = end_psymtab (save_pst,
psymtab_include_list, includes_used,
}
}
- /* Now scan the FDRs for dependencies */
+ /* Now scan the FDRs for dependencies. */
for (f_idx = 0; f_idx < hdr->ifdMax; f_idx++)
{
fh = f_idx + debug_info->fdr;
if (pst == (struct partial_symtab *) NULL)
continue;
- /* This should catch stabs-in-ecoff. */
+ /* This should catch stabs-in-ecoff. */
if (fh->crfd <= 1)
continue;
}
}
-/* Get the next symbol. OBJFILE is unused. */
+/* Get the next symbol. OBJFILE is unused. */
static char *
mdebug_next_symbol_text (struct objfile *objfile)
wrap_here (""); /* Flush output */
gdb_flush (gdb_stdout);
}
- /* We only pass the filename for debug purposes */
+ /* We only pass the filename for debug purposes. */
psymtab_to_symtab_1 (pst->dependencies[i],
pst->dependencies[i]->filename);
}
&& pst->textlow == 0 && pst->texthigh == 0)
return;
- /* Now read the symbols for this symtab */
+ /* Now read the symbols for this symtab. */
cur_bfd = CUR_BFD (pst);
debug_swap = DEBUG_SWAP (pst);
: debug_info->fdr + cur_fd);
cur_fdr = fh;
- /* See comment in parse_partial_symbols about the @stabs sentinel. */
+ /* See comment in parse_partial_symbols about the @stabs sentinel. */
processing_gcc_compilation = 0;
if (fh != (FDR *) NULL && fh->csym >= 2)
{
/* This symbol table contains stabs-in-ecoff entries. */
- /* Parse local symbols first */
+ /* Parse local symbols first. */
- if (fh->csym <= 2) /* FIXME, this blows psymtab->symtab ptr */
+ if (fh->csym <= 2) /* FIXME, this blows psymtab->symtab ptr. */
{
current_objfile = NULL;
return;
it here instead of in process_one_symbol, so we
can keep a handle to its symtab. The symtab
would otherwise be ended twice, once in
- process_one_symbol, and once after this loop. */
+ process_one_symbol, and once after this loop. */
if (type_code == N_SO
&& last_source_file
&& previous_stab_code != (unsigned char) N_SO
if (type_code == N_FUN)
{
/* Make up special symbol to contain
- procedure specific info */
+ procedure specific info. */
struct mdebug_extra_func_info *e =
((struct mdebug_extra_func_info *)
obstack_alloc (¤t_objfile->objfile_obstack,
}
else
{
- /* Handle encoded stab line number. */
+ /* Handle encoded stab line number. */
valu += ANOFFSET (pst->section_offsets,
SECT_OFF_TEXT (pst->objfile));
record_line (current_subfile, sh.index,
}
else if (sh.st == stProc || sh.st == stStaticProc
|| sh.st == stStatic || sh.st == stEnd)
- /* These are generated by gcc-2.x, do not complain */
+ /* These are generated by gcc-2.x, do not complain. */
;
else
complaint (&symfile_complaints,
lines = LINETABLE (st);
- /* Get a new lexical context */
+ /* Get a new lexical context. */
push_parse_stack ();
top_stack->cur_st = st;
char *sym_ptr;
char *sym_end;
- /* Parse local symbols first */
+ /* Parse local symbols first. */
sym_ptr = ((char *) debug_info->external_sym
+ fh->isymBase * external_sym_size);
sym_end = sym_ptr + fh->csym * external_sym_size;
LINETABLE (st) = lines;
/* .. and our share of externals.
- XXX use the global list to speed up things here. how?
- FIXME, Maybe quit once we have found the right number of ext's? */
+ XXX use the global list to speed up things here. How?
+ FIXME, Maybe quit once we have found the right number of ext's? */
top_stack->cur_st = st;
top_stack->cur_block
= BLOCKVECTOR_BLOCK (BLOCKVECTOR (top_stack->cur_st),
current_objfile = NULL;
}
\f
-/* Ancillary parsing procedures. */
+/* Ancillary parsing procedures. */
/* Return 1 if the symbol pointed to by SH has a cross reference
to an opaque aggregate type, else 0. */
/* Lookup the type at relative index RN. Return it in TPP
if found and in any event come up with its name PNAME.
BIGEND says whether aux symbols are big-endian or not (from fh->fBigendian).
- Return value says how many aux symbols we ate. */
+ Return value says how many aux symbols we ate. */
static int
cross_ref (int fd, union aux_ext *ax, struct type **tpp,
enum type_code type_code,
- /* Use to alloc new type if none is found. */
+ /* Use to alloc new type if none is found. */
char **pname, int bigend, char *sym_name)
{
RNDXR rn[1];
(*debug_swap->swap_rndx_in) (bigend, &ax->a_rndx, rn);
- /* Escape index means 'the next one' */
+ /* Escape index means 'the next one'. */
if (rn->rfd == 0xfff)
{
result++;
}
/* mips cc uses an escaped rn->index of 0 for struct return types
- of procedures that were compiled without -g. These will always remain
+ of procedures that were compiled without -g. These will always remain
undefined. */
if (rn->rfd == 0xfff && rn->index == 0)
{
two cases:
a) forward declarations of structs/unions/enums which are not
defined in this compilation unit.
- For these the type will be void. This is a bad design decision
+ For these the type will be void. This is a bad design decision
as cross referencing across compilation units is impossible
due to the missing name.
b) forward declarations of structs/unions/enums/typedefs which
are defined later in this file or in another file in the same
- compilation unit. Irix5 cc uses a stIndirect symbol for this.
+ compilation unit. Irix5 cc uses a stIndirect symbol for this.
Simply cross reference those again to get the true type.
The forward references are not entered in the pending list and
in the symbol table. */
break;
case btTypedef:
- /* Follow a forward typedef. This might recursively
+ /* Follow a forward typedef. This might recursively
call cross_ref till we get a non typedef'ed type.
FIXME: This is not correct behaviour, but gdb currently
- cannot handle typedefs without type copying. Type
+ cannot handle typedefs without type copying. Type
copying is impossible as we might have mutual forward
references between two files and the copied type would not
get filled in when we later parse its definition. */
}
else if (sh.st == stTypedef)
{
- /* Parse the type for a normal typedef. This might recursively call
+ /* Parse the type for a normal typedef. This might recursively call
cross_ref till we get a non typedef'ed type.
FIXME: This is not correct behaviour, but gdb currently
- cannot handle typedefs without type copying. But type copying is
+ cannot handle typedefs without type copying. But type copying is
impossible as we might have mutual forward references between
two files and the copied type would not get filled in when
we later parse its definition. */
add_pending (fh, esh, *tpp);
}
- /* We used one auxent normally, two if we got a "next one" rf. */
+ /* We used one auxent normally, two if we got a "next one" rf. */
return result;
}
/* Quick&dirty lookup procedure, to avoid the MI ones that require
- keeping the symtab sorted */
+ keeping the symtab sorted. */
static struct symbol *
mylookup_symbol (char *name, struct block *block,
dict_add_symbol (BLOCK_DICT (b), s);
}
-/* Add a new block B to a symtab S */
+/* Add a new block B to a symtab S. */
static void
add_block (struct block *b, struct symtab *s)
a prologue than mips_skip_prologue).
But due to the compressed line table format there are line number entries
for the same line which are needed to bridge the gap to the next
- line number entry. These entries have a bogus address info with them
+ line number entry. These entries have a bogus address info with them
and we are unable to tell them from intended duplicate line number
entries.
This is another reason why -ggdb debugging format is preferable. */
add_line (struct linetable *lt, int lineno, CORE_ADDR adr, int last)
{
/* DEC c89 sometimes produces zero linenos which confuse gdb.
- Change them to something sensible. */
+ Change them to something sensible. */
if (lineno == 0)
lineno = 1;
if (last == 0)
- last = -2; /* make sure we record first line */
+ last = -2; /* Make sure we record first line. */
- if (last == lineno) /* skip continuation lines */
+ if (last == lineno) /* Skip continuation lines. */
return lineno;
lt->item[lt->nitems].line = lineno;
return lineno;
}
\f
-/* Sorting and reordering procedures */
+/* Sorting and reordering procedures. */
-/* Blocks with a smaller low bound should come first */
+/* Blocks with a smaller low bound should come first. */
static int
compare_blocks (const void *arg1, const void *arg2)
/* Sort the blocks of a symtab S.
Reorder the blocks in the blockvector by code-address,
- as required by some MI search routines */
+ as required by some MI search routines. */
static void
sort_blocks (struct symtab *s)
}
\f
-/* Constructor/restructor/destructor procedures */
+/* Constructor/restructor/destructor procedures. */
/* Allocate a new symtab for NAME. Needs an estimate of how many
- linenumbers MAXLINES we'll put in it */
+ linenumbers MAXLINES we'll put in it. */
static struct symtab *
new_symtab (const char *name, int maxlines, struct objfile *objfile)
LINETABLE (s) = new_linetable (maxlines);
- /* All symtabs must have at least two blocks */
+ /* All symtabs must have at least two blocks. */
BLOCKVECTOR (s) = new_bvect (2);
BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK)
= new_block (NON_FUNCTION_BLOCK);
return (s);
}
-/* Allocate a new partial_symtab NAME */
+/* Allocate a new partial_symtab NAME. */
static struct partial_symtab *
new_psymtab (char *name, struct objfile *objfile)
psymtab = allocate_psymtab (name, objfile);
psymtab->section_offsets = objfile->section_offsets;
- /* Keep a backpointer to the file's symbols */
+ /* Keep a backpointer to the file's symbols. */
psymtab->read_symtab_private = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct symloc));
DEBUG_INFO (psymtab) = debug_info;
PENDING_LIST (psymtab) = pending_list;
- /* The way to turn this into a symtab is to call... */
+ /* The way to turn this into a symtab is to call... */
psymtab->read_symtab = mdebug_psymtab_to_symtab;
return (psymtab);
}
return l;
}
-/* Oops, too big. Shrink it. This was important with the 2.4 linetables,
+/* Oops, too big. Shrink it. This was important with the 2.4 linetables,
I am not so sure about the 3.4 ones.
Since the struct linetable already includes one item, we subtract one when
* sizeof (lt->item))));
}
-/* Allocate and zero a new blockvector of NBLOCKS blocks. */
+/* Allocate and zero a new blockvector of NBLOCKS blocks. */
static struct blockvector *
new_bvect (int nblocks)
return retval;
}
-/* Create a new symbol with printname NAME */
+/* Create a new symbol with printname NAME. */
static struct symbol *
new_symbol (char *name)
return s;
}
-/* Create a new type with printname NAME */
+/* Create a new type with printname NAME. */
static struct type *
new_type (char *name)