/* Read a symbol table in ECOFF format (Third-Eye).
- Copyright (C) 1986-2013 Free Software Foundation, Inc.
+ Copyright (C) 1986-2014 Free Software Foundation, Inc.
Original version contributed by Alessandro Forin (af@cs.cmu.edu) at
CMU. Major work by Per Bothner, John Gilmore and Ian Lance Taylor
#include "complaints.h"
#include "demangle.h"
#include "gdb-demangle.h"
-#include "gdb_assert.h"
#include "block.h"
#include "dictionary.h"
#include "mdebugread.h"
#include <sys/stat.h>
-#include <string.h>
#include "psympriv.h"
#include "source.h"
static struct type *parse_type (int, union aux_ext *, unsigned int, int *,
int, char *);
-static struct symbol *mylookup_symbol (char *, struct block *, domain_enum,
- enum address_class);
+static struct symbol *mylookup_symbol (char *, const struct block *,
+ domain_enum, enum address_class);
static void sort_blocks (struct symtab *);
b = top_stack->cur_block;
if (sh->st == stProc)
{
- struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
+ const struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
/* The next test should normally be true, but provides a
hook for nested functions (which we don't want to make
top_stack->blocktype == stStaticProc))
{
/* Finished with procedure */
- struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
+ const struct blockvector *bv = BLOCKVECTOR (top_stack->cur_st);
struct mdebug_extra_func_info *e;
struct block *b = top_stack->cur_block;
struct type *ftype = top_stack->cur_type;
ax++;
rf = AUX_GET_WIDTH (bigend, ax); /* bit size of array element */
- range = create_range_type ((struct type *) NULL, indx,
- lower, upper);
+ range = create_static_range_type ((struct type *) NULL, indx,
+ lower, upper);
t = create_array_type ((struct type *) NULL, *tpp, range);
to look for the function which contains the MDEBUG_EFI_SYMBOL_NAME symbol
in question, or NULL to use top_stack->cur_block. */
-static void parse_procedure (PDR *, struct symtab *, struct partial_symtab *);
-
static void
parse_procedure (PDR *pr, struct symtab *search_symtab,
struct partial_symtab *pst)
{
struct symbol *s, *i;
- struct block *b;
+ const struct block *b;
char *sh_name;
/* Simple rule to find files linked "-x". */
{
case stProc:
/* Beginnning of Procedure */
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
break;
case stStaticProc:
/* Load time only static procs */
ms_type = mst_file_text;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
break;
case stGlobal:
/* External symbol */
else if (SC_IS_DATA (ext_in->asym.sc))
{
ms_type = mst_data;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
ms_type = mst_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
}
else if (SC_IS_SBSS (ext_in->asym.sc))
{
ms_type = mst_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- get_section_index (objfile, ".sbss"));
}
else
ms_type = mst_abs;
continue;
ms_type = mst_file_text;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
}
else if (SC_IS_DATA (ext_in->asym.sc))
{
continue;
ms_type = mst_file_data;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
}
else if (SC_IS_BSS (ext_in->asym.sc))
{
continue;
ms_type = mst_file_bss;
- svalue += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
}
else if (SC_IS_SBSS (ext_in->asym.sc))
{
continue;
ms_type = mst_file_bss;
- svalue += ANOFFSET (objfile->section_offsets, sbss_sect_index);
}
else
ms_type = mst_abs;
CORE_ADDR procaddr;
long isym;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_TEXT (objfile));
if (sh.st == stStaticProc)
{
namestring = debug_info->ss + fh->issBase + sh.iss;
mst_file_text, sh.sc,
objfile);
}
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
procaddr = sh.value;
isym = AUX_GET_ISYM (fh->fBigendian,
case scPData:
case scXData:
namestring = debug_info->ss + fh->issBase + sh.iss;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_DATA (objfile));
record_minimal_symbol (namestring, sh.value,
mst_file_data, sh.sc,
objfile);
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_DATA (objfile));
break;
default:
/* FIXME! Shouldn't this use cases for bss,
then have the default be abs? */
namestring = debug_info->ss + fh->issBase + sh.iss;
- sh.value += ANOFFSET (objfile->section_offsets,
- SECT_OFF_BSS (objfile));
record_minimal_symbol (namestring, sh.value,
mst_file_bss, sh.sc,
objfile);
+ sh.value += ANOFFSET (objfile->section_offsets,
+ SECT_OFF_BSS (objfile));
break;
}
}
{
char *name;
enum address_class class;
+ CORE_ADDR minsym_value;
(*swap_sym_in) (cur_bfd,
((char *) debug_info->external_sym
name = debug_info->ss + fh->issBase + sh.iss;
+ minsym_value = sh.value;
+
switch (sh.sc)
{
case scText:
int new_sdx;
case stStaticProc:
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_text,
SECT_OFF_TEXT (objfile),
objfile);
case stStatic: /* Variable */
if (SC_IS_DATA (sh.sc))
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_data,
SECT_OFF_DATA (objfile),
objfile);
else
- prim_record_minimal_symbol_and_info (name, sh.value,
+ prim_record_minimal_symbol_and_info (name, minsym_value,
mst_file_bss,
SECT_OFF_BSS (objfile),
objfile);
psymtab_language = st->language;
- lines = LINETABLE (st);
+ lines = SYMTAB_LINETABLE (st);
/* Get a new lexical context. */
size = lines->nitems;
if (size > 1)
--size;
- LINETABLE (st) = obstack_copy (&mdebugread_objfile->objfile_obstack,
- lines,
- (sizeof (struct linetable)
- + size * sizeof (lines->item)));
+ SYMTAB_LINETABLE (st)
+ = obstack_copy (&mdebugread_objfile->objfile_obstack,
+ lines,
+ (sizeof (struct linetable)
+ + size * sizeof (lines->item)));
xfree (lines);
/* .. and our share of externals.
keeping the symtab sorted. */
static struct symbol *
-mylookup_symbol (char *name, struct block *block,
+mylookup_symbol (char *name, const struct block *block,
domain_enum domain, enum address_class class)
{
struct block_iterator iter;
static void
add_block (struct block *b, struct symtab *s)
{
- struct blockvector *bv = BLOCKVECTOR (s);
+ /* Cast away "const", but that's ok because we're building the
+ symtab and blockvector here. */
+ struct blockvector *bv = (struct blockvector *) BLOCKVECTOR (s);
bv = (struct blockvector *) xrealloc ((void *) bv,
(sizeof (struct blockvector)
static void
sort_blocks (struct symtab *s)
{
- struct blockvector *bv = BLOCKVECTOR (s);
+ /* We have to cast away const here, but this is ok because we're
+ constructing the blockvector in this code. */
+ struct blockvector *bv = (struct blockvector *) BLOCKVECTOR (s);
if (BLOCKVECTOR_NBLOCKS (bv) <= FIRST_LOCAL_BLOCK)
{
new_symtab (const char *name, int maxlines, struct objfile *objfile)
{
struct symtab *s = allocate_symtab (name, objfile);
+ struct blockvector *bv;
- LINETABLE (s) = new_linetable (maxlines);
+ SYMTAB_LINETABLE (s) = new_linetable (maxlines);
/* All symtabs must have at least two blocks. */
- BLOCKVECTOR (s) = new_bvect (2);
- BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK)
- = new_block (NON_FUNCTION_BLOCK);
- BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)
- = new_block (NON_FUNCTION_BLOCK);
- BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), STATIC_BLOCK)) =
- BLOCKVECTOR_BLOCK (BLOCKVECTOR (s), GLOBAL_BLOCK);
+ bv = new_bvect (2);
+ BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK) = new_block (NON_FUNCTION_BLOCK);
+ BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK) = new_block (NON_FUNCTION_BLOCK);
+ BLOCK_SUPERBLOCK (BLOCKVECTOR_BLOCK (bv, STATIC_BLOCK)) =
+ BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK);
+ BLOCKVECTOR (s) = bv;
s->debugformat = "ECOFF";
return (s);