buildsym API cleanup
gdb/ChangeLog: * buildsym.c (buildsym_objfile): New static global. (buildsym_comp_dir): New static global. (finish_block_internal): Delete arg objfile. All callers updated. (finish_block): Delete arg objfile. All callers updated. (start_subfile): Delete arg dirname. All callers updated. (patch_subfile_names): Update buildsym_comp_dir. (get_macro_table): Delete arg objfile. All callers updated. (start_symtab): New arg objfile. All callers updated. Rename arg dirname to comp_dir. (reset_symtab_globals): Initialize buildsym_objfile, buildsym_comp_dir. (end_symtab_get_static_block): Delete arg objfile. All callers updated. (end_symtab_without_blockvector): Ditto. (end_symtab_with_blockvector): Ditto. (end_symtab_from_static_block): Ditto. (end_symtab): Ditto. (end_expandable_symtab): Ditto. (augment_type_symtab): Ditto. * coffread.c (coff_start_symtab): New arg objfile. All callers updated.
This commit is contained in:
parent
0593bd3ace
commit
4d663531f2
@ -1,3 +1,26 @@
|
||||
2014-11-18 Doug Evans <xdje42@gmail.com>
|
||||
|
||||
* buildsym.c (buildsym_objfile): New static global.
|
||||
(buildsym_comp_dir): New static global.
|
||||
(finish_block_internal): Delete arg objfile. All callers updated.
|
||||
(finish_block): Delete arg objfile. All callers updated.
|
||||
(start_subfile): Delete arg dirname. All callers updated.
|
||||
(patch_subfile_names): Update buildsym_comp_dir.
|
||||
(get_macro_table): Delete arg objfile. All callers updated.
|
||||
(start_symtab): New arg objfile. All callers updated.
|
||||
Rename arg dirname to comp_dir.
|
||||
(reset_symtab_globals): Initialize buildsym_objfile, buildsym_comp_dir.
|
||||
(end_symtab_get_static_block): Delete arg objfile. All callers
|
||||
updated.
|
||||
(end_symtab_without_blockvector): Ditto.
|
||||
(end_symtab_with_blockvector): Ditto.
|
||||
(end_symtab_from_static_block): Ditto.
|
||||
(end_symtab): Ditto.
|
||||
(end_expandable_symtab): Ditto.
|
||||
(augment_type_symtab): Ditto.
|
||||
* coffread.c (coff_start_symtab): New arg objfile. All callers
|
||||
updated.
|
||||
|
||||
2014-11-18 Doug Evans <xdje42@gmail.com>
|
||||
|
||||
* symtab.h (SYMTAB_LINETABLE): Renamed from LINETABLE. All uses
|
||||
|
@ -52,6 +52,14 @@
|
||||
|
||||
#include "stabsread.h"
|
||||
|
||||
/* The objfile we are currently reading debug info from. */
|
||||
|
||||
static struct objfile *buildsym_objfile;
|
||||
|
||||
/* The compilation directory. */
|
||||
|
||||
static char *buildsym_comp_dir;
|
||||
|
||||
/* List of subfiles. */
|
||||
|
||||
static struct subfile *subfiles;
|
||||
@ -254,9 +262,9 @@ static struct block *
|
||||
finish_block_internal (struct symbol *symbol, struct pending **listhead,
|
||||
struct pending_block *old_blocks,
|
||||
CORE_ADDR start, CORE_ADDR end,
|
||||
struct objfile *objfile,
|
||||
int is_global, int expandable)
|
||||
{
|
||||
struct objfile *objfile = buildsym_objfile;
|
||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||
struct pending *next, *next1;
|
||||
struct block *block;
|
||||
@ -434,11 +442,10 @@ finish_block_internal (struct symbol *symbol, struct pending **listhead,
|
||||
struct block *
|
||||
finish_block (struct symbol *symbol, struct pending **listhead,
|
||||
struct pending_block *old_blocks,
|
||||
CORE_ADDR start, CORE_ADDR end,
|
||||
struct objfile *objfile)
|
||||
CORE_ADDR start, CORE_ADDR end)
|
||||
{
|
||||
return finish_block_internal (symbol, listhead, old_blocks,
|
||||
start, end, objfile, 0, 0);
|
||||
start, end, 0, 0);
|
||||
}
|
||||
|
||||
/* Record BLOCK on the list of all blocks in the file. Put it after
|
||||
@ -571,12 +578,10 @@ make_blockvector (struct objfile *objfile)
|
||||
|
||||
/* Start recording information about source code that came from an
|
||||
included (or otherwise merged-in) source file with a different
|
||||
name. NAME is the name of the file (cannot be NULL), DIRNAME is
|
||||
the directory in which the file was compiled (or NULL if not
|
||||
known). */
|
||||
name. NAME is the name of the file (cannot be NULL). */
|
||||
|
||||
void
|
||||
start_subfile (const char *name, const char *dirname)
|
||||
start_subfile (const char *name)
|
||||
{
|
||||
struct subfile *subfile;
|
||||
|
||||
@ -620,7 +625,8 @@ start_subfile (const char *name, const char *dirname)
|
||||
|
||||
/* Save its name and compilation directory name. */
|
||||
subfile->name = xstrdup (name);
|
||||
subfile->dirname = (dirname == NULL) ? NULL : xstrdup (dirname);
|
||||
subfile->dirname
|
||||
= (buildsym_comp_dir == NULL) ? NULL : xstrdup (buildsym_comp_dir);
|
||||
|
||||
/* Initialize line-number recording for this subfile. */
|
||||
subfile->line_vector = NULL;
|
||||
@ -714,6 +720,11 @@ patch_subfile_names (struct subfile *subfile, char *name)
|
||||
if (subfile != NULL && subfile->dirname == NULL && subfile->name != NULL
|
||||
&& IS_DIR_SEPARATOR (subfile->name[strlen (subfile->name) - 1]))
|
||||
{
|
||||
/* With correct debug info, buildsym_comp_dir should be NULL since
|
||||
subfile->dirname is NULL. However, don't assume this. */
|
||||
xfree (buildsym_comp_dir);
|
||||
buildsym_comp_dir = xstrdup (subfile->name);
|
||||
|
||||
subfile->dirname = subfile->name;
|
||||
subfile->name = xstrdup (name);
|
||||
set_last_source_file (name);
|
||||
@ -861,11 +872,15 @@ compare_line_numbers (const void *ln1p, const void *ln2p)
|
||||
}
|
||||
|
||||
/* Return the macro table.
|
||||
Initialize it if this is the first use. */
|
||||
Initialize it if this is the first use.
|
||||
It is only valid to call this between calls to start_symtab and the
|
||||
end_symtab* functions. */
|
||||
|
||||
struct macro_table *
|
||||
get_macro_table (struct objfile *objfile, const char *comp_dir)
|
||||
get_macro_table (const char *comp_dir)
|
||||
{
|
||||
struct objfile *objfile = buildsym_objfile;
|
||||
|
||||
if (! pending_macros)
|
||||
pending_macros = new_macro_table (&objfile->per_bfd->storage_obstack,
|
||||
objfile->per_bfd->macro_cache,
|
||||
@ -873,21 +888,24 @@ get_macro_table (struct objfile *objfile, const char *comp_dir)
|
||||
return pending_macros;
|
||||
}
|
||||
|
||||
/* Start a new symtab for a new source file. Called, for example,
|
||||
/* Start a new symtab for a new source file in OBJFILE. Called, for example,
|
||||
when a stabs symbol of type N_SO is seen, or when a DWARF
|
||||
TAG_compile_unit DIE is seen. It indicates the start of data for
|
||||
one original source file.
|
||||
|
||||
NAME is the name of the file (cannot be NULL). DIRNAME is the directory in
|
||||
NAME is the name of the file (cannot be NULL). COMP_DIR is the directory in
|
||||
which the file was compiled (or NULL if not known). START_ADDR is the
|
||||
lowest address of objects in the file (or 0 if not known). */
|
||||
|
||||
void
|
||||
start_symtab (const char *name, const char *dirname, CORE_ADDR start_addr)
|
||||
start_symtab (struct objfile *objfile, const char *name, const char *comp_dir,
|
||||
CORE_ADDR start_addr)
|
||||
{
|
||||
buildsym_objfile = objfile;
|
||||
buildsym_comp_dir = comp_dir != NULL ? xstrdup (comp_dir) : NULL;
|
||||
restart_symtab (start_addr);
|
||||
set_last_source_file (name);
|
||||
start_subfile (name, dirname);
|
||||
start_subfile (name);
|
||||
/* Save this so that we don't have to go looking for it at the end
|
||||
of the subfiles list. */
|
||||
main_subfile = current_subfile;
|
||||
@ -1014,6 +1032,9 @@ block_compar (const void *ap, const void *bp)
|
||||
static void
|
||||
reset_symtab_globals (void)
|
||||
{
|
||||
buildsym_objfile = NULL;
|
||||
xfree (buildsym_comp_dir);
|
||||
buildsym_comp_dir = NULL;
|
||||
set_last_source_file (NULL);
|
||||
free_subfiles_list ();
|
||||
pending_macros = NULL;
|
||||
@ -1039,9 +1060,10 @@ reset_symtab_globals (void)
|
||||
not contain any symbols. */
|
||||
|
||||
struct block *
|
||||
end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile,
|
||||
int expandable, int required)
|
||||
end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
|
||||
{
|
||||
struct objfile *objfile = buildsym_objfile;
|
||||
|
||||
/* Finish the lexical context of the last function in the file; pop
|
||||
the context stack. */
|
||||
|
||||
@ -1051,7 +1073,7 @@ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile,
|
||||
|
||||
/* Make a block for the local symbols within. */
|
||||
finish_block (cstk->name, &local_symbols, cstk->old_blocks,
|
||||
cstk->start_addr, end_addr, objfile);
|
||||
cstk->start_addr, end_addr);
|
||||
|
||||
if (context_stack_depth > 0)
|
||||
{
|
||||
@ -1122,7 +1144,7 @@ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile,
|
||||
{
|
||||
/* Define the STATIC_BLOCK. */
|
||||
return finish_block_internal (NULL, &file_symbols, NULL,
|
||||
last_source_start_addr, end_addr, objfile,
|
||||
last_source_start_addr, end_addr,
|
||||
0, expandable);
|
||||
}
|
||||
}
|
||||
@ -1133,8 +1155,9 @@ end_symtab_get_static_block (CORE_ADDR end_addr, struct objfile *objfile,
|
||||
any memory we allocated while reading debug info. */
|
||||
|
||||
static void
|
||||
end_symtab_without_blockvector (struct objfile *objfile)
|
||||
end_symtab_without_blockvector (void)
|
||||
{
|
||||
struct objfile *objfile = buildsym_objfile;
|
||||
struct subfile *subfile;
|
||||
|
||||
/* Since we are ignoring these subfiles, we also need
|
||||
@ -1172,9 +1195,9 @@ end_symtab_without_blockvector (struct objfile *objfile)
|
||||
|
||||
static struct symtab *
|
||||
end_symtab_with_blockvector (struct block *static_block,
|
||||
struct objfile *objfile, int section,
|
||||
int expandable)
|
||||
int section, int expandable)
|
||||
{
|
||||
struct objfile *objfile = buildsym_objfile;
|
||||
struct symtab *symtab;
|
||||
struct blockvector *blockvector;
|
||||
struct subfile *subfile;
|
||||
@ -1187,7 +1210,7 @@ end_symtab_with_blockvector (struct block *static_block,
|
||||
|
||||
/* Create the GLOBAL_BLOCK and build the blockvector. */
|
||||
finish_block_internal (NULL, &global_symbols, NULL,
|
||||
last_source_start_addr, end_addr, objfile,
|
||||
last_source_start_addr, end_addr,
|
||||
1, expandable);
|
||||
blockvector = make_blockvector (objfile);
|
||||
|
||||
@ -1324,21 +1347,17 @@ end_symtab_with_blockvector (struct block *static_block,
|
||||
|
||||
struct symtab *
|
||||
end_symtab_from_static_block (struct block *static_block,
|
||||
struct objfile *objfile, int section,
|
||||
int expandable)
|
||||
int section, int expandable)
|
||||
{
|
||||
struct symtab *s;
|
||||
|
||||
if (static_block == NULL)
|
||||
{
|
||||
end_symtab_without_blockvector (objfile);
|
||||
end_symtab_without_blockvector ();
|
||||
s = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
s = end_symtab_with_blockvector (static_block, objfile, section,
|
||||
expandable);
|
||||
}
|
||||
s = end_symtab_with_blockvector (static_block, section, expandable);
|
||||
|
||||
reset_symtab_globals ();
|
||||
|
||||
@ -1367,24 +1386,23 @@ end_symtab_from_static_block (struct block *static_block,
|
||||
yourself. */
|
||||
|
||||
struct symtab *
|
||||
end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
|
||||
end_symtab (CORE_ADDR end_addr, int section)
|
||||
{
|
||||
struct block *static_block;
|
||||
|
||||
static_block = end_symtab_get_static_block (end_addr, objfile, 0, 0);
|
||||
return end_symtab_from_static_block (static_block, objfile, section, 0);
|
||||
static_block = end_symtab_get_static_block (end_addr, 0, 0);
|
||||
return end_symtab_from_static_block (static_block, section, 0);
|
||||
}
|
||||
|
||||
/* Same as end_symtab except create a symtab that can be later added to. */
|
||||
|
||||
struct symtab *
|
||||
end_expandable_symtab (CORE_ADDR end_addr, struct objfile *objfile,
|
||||
int section)
|
||||
end_expandable_symtab (CORE_ADDR end_addr, int section)
|
||||
{
|
||||
struct block *static_block;
|
||||
|
||||
static_block = end_symtab_get_static_block (end_addr, objfile, 1, 0);
|
||||
return end_symtab_from_static_block (static_block, objfile, section, 1);
|
||||
static_block = end_symtab_get_static_block (end_addr, 1, 0);
|
||||
return end_symtab_from_static_block (static_block, section, 1);
|
||||
}
|
||||
|
||||
/* Subroutine of augment_type_symtab to simplify it.
|
||||
@ -1411,7 +1429,7 @@ set_missing_symtab (struct pending *pending_list, struct symtab *symtab)
|
||||
This is the case for DWARF4 Type Units. */
|
||||
|
||||
void
|
||||
augment_type_symtab (struct objfile *objfile, struct symtab *primary_symtab)
|
||||
augment_type_symtab (struct symtab *primary_symtab)
|
||||
{
|
||||
const struct blockvector *blockvector = primary_symtab->blockvector;
|
||||
|
||||
|
@ -192,15 +192,14 @@ extern struct symbol *find_symbol_in_list (struct pending *list,
|
||||
extern struct block *finish_block (struct symbol *symbol,
|
||||
struct pending **listhead,
|
||||
struct pending_block *old_blocks,
|
||||
CORE_ADDR start, CORE_ADDR end,
|
||||
struct objfile *objfile);
|
||||
CORE_ADDR start, CORE_ADDR end);
|
||||
|
||||
extern void record_block_range (struct block *,
|
||||
CORE_ADDR start, CORE_ADDR end_inclusive);
|
||||
|
||||
extern void really_free_pendings (void *dummy);
|
||||
|
||||
extern void start_subfile (const char *name, const char *dirname);
|
||||
extern void start_subfile (const char *name);
|
||||
|
||||
extern void patch_subfile_names (struct subfile *subfile, char *name);
|
||||
|
||||
@ -209,24 +208,19 @@ extern void push_subfile (void);
|
||||
extern char *pop_subfile (void);
|
||||
|
||||
extern struct block *end_symtab_get_static_block (CORE_ADDR end_addr,
|
||||
struct objfile *objfile,
|
||||
int expandable,
|
||||
int required);
|
||||
|
||||
extern struct symtab *end_symtab_from_static_block (struct block *static_block,
|
||||
struct objfile *objfile,
|
||||
int section,
|
||||
int expandable);
|
||||
|
||||
extern struct symtab *end_symtab (CORE_ADDR end_addr,
|
||||
struct objfile *objfile, int section);
|
||||
extern struct symtab *end_symtab (CORE_ADDR end_addr, int section);
|
||||
|
||||
extern struct symtab *end_expandable_symtab (CORE_ADDR end_addr,
|
||||
struct objfile *objfile,
|
||||
int section);
|
||||
|
||||
extern void augment_type_symtab (struct objfile *objfile,
|
||||
struct symtab *primary_symtab);
|
||||
extern void augment_type_symtab (struct symtab *primary_symtab);
|
||||
|
||||
/* Defined in stabsread.c. */
|
||||
|
||||
@ -242,7 +236,8 @@ extern struct context_stack *pop_context (void);
|
||||
|
||||
extern record_line_ftype record_line;
|
||||
|
||||
extern void start_symtab (const char *name, const char *dirname,
|
||||
extern void start_symtab (struct objfile *objfile,
|
||||
const char *name, const char *dirname,
|
||||
CORE_ADDR start_addr);
|
||||
|
||||
extern void restart_symtab (CORE_ADDR start_addr);
|
||||
@ -277,8 +272,7 @@ extern const char *get_last_source_file (void);
|
||||
|
||||
/* Return the macro table. */
|
||||
|
||||
extern struct macro_table *get_macro_table (struct objfile *objfile,
|
||||
const char *comp_dir);
|
||||
extern struct macro_table *get_macro_table (const char *comp_dir);
|
||||
|
||||
#undef EXTERN
|
||||
|
||||
|
@ -382,9 +382,9 @@ coff_alloc_type (int index)
|
||||
it indicates the start of data for one original source file. */
|
||||
|
||||
static void
|
||||
coff_start_symtab (const char *name)
|
||||
coff_start_symtab (struct objfile *objfile, const char *name)
|
||||
{
|
||||
start_symtab (
|
||||
start_symtab (objfile,
|
||||
/* We fill in the filename later. start_symtab puts this pointer
|
||||
into last_source_file and we put it in subfiles->name, which
|
||||
end_symtab frees; that's why it must be malloc'd. */
|
||||
@ -421,8 +421,7 @@ coff_end_symtab (struct objfile *objfile)
|
||||
{
|
||||
last_source_start_addr = current_source_start_addr;
|
||||
|
||||
end_symtab (current_source_end_addr, objfile,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
end_symtab (current_source_end_addr, SECT_OFF_TEXT (objfile));
|
||||
|
||||
/* Reinitialize for beginning of new file. */
|
||||
set_last_source_file (NULL);
|
||||
@ -832,7 +831,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|
||||
xmalloc (type_vector_length * sizeof (struct type *));
|
||||
memset (type_vector, 0, type_vector_length * sizeof (struct type *));
|
||||
|
||||
coff_start_symtab ("");
|
||||
coff_start_symtab (objfile, "");
|
||||
|
||||
symnum = 0;
|
||||
while (symnum < nsyms)
|
||||
@ -846,7 +845,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|
||||
if (get_last_source_file ())
|
||||
coff_end_symtab (objfile);
|
||||
|
||||
coff_start_symtab ("_globals_");
|
||||
coff_start_symtab (objfile, "_globals_");
|
||||
/* coff_start_symtab will set the language of this symtab to
|
||||
language_unknown, since such a ``file name'' is not
|
||||
recognized. Override that with the minimal language to
|
||||
@ -910,7 +909,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|
||||
if (get_last_source_file ())
|
||||
{
|
||||
coff_end_symtab (objfile);
|
||||
coff_start_symtab (filestring);
|
||||
coff_start_symtab (objfile, filestring);
|
||||
}
|
||||
in_source_file = 1;
|
||||
break;
|
||||
@ -1136,9 +1135,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|
||||
fcn_cs_saved.c_value
|
||||
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
||||
+ ANOFFSET (objfile->section_offsets,
|
||||
SECT_OFF_TEXT (objfile)),
|
||||
objfile
|
||||
);
|
||||
SECT_OFF_TEXT (objfile)));
|
||||
within_function = 0;
|
||||
}
|
||||
break;
|
||||
@ -1178,7 +1175,7 @@ coff_symtab_read (long symtab_offset, unsigned int nsyms,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
/* Make a block for the local symbols within. */
|
||||
finish_block (0, &local_symbols, new->old_blocks,
|
||||
new->start_addr, tmpaddr, objfile);
|
||||
new->start_addr, tmpaddr);
|
||||
}
|
||||
/* Now pop locals of block just finished. */
|
||||
local_symbols = new->locals;
|
||||
|
@ -2644,7 +2644,7 @@ read_ofile_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
if (last_source_start_addr > text_offset)
|
||||
last_source_start_addr = text_offset;
|
||||
|
||||
pst->symtab = end_symtab (text_offset + text_size, objfile,
|
||||
pst->symtab = end_symtab (text_offset + text_size,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
|
||||
end_stabs ();
|
||||
@ -2783,8 +2783,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
|
||||
|
||||
/* Make a block for the local symbols within. */
|
||||
block = finish_block (new->name, &local_symbols, new->old_blocks,
|
||||
new->start_addr, new->start_addr + valu,
|
||||
objfile);
|
||||
new->start_addr, new->start_addr + valu);
|
||||
|
||||
/* For C++, set the block's scope. */
|
||||
if (SYMBOL_LANGUAGE (new->name) == language_cplus)
|
||||
@ -2885,7 +2884,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
|
||||
}
|
||||
/* Make a block for the local symbols within. */
|
||||
finish_block (0, &local_symbols, new->old_blocks,
|
||||
new->start_addr, valu, objfile);
|
||||
new->start_addr, valu);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2926,7 +2925,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
|
||||
patch_subfile_names (current_subfile, name);
|
||||
break; /* Ignore repeated SOs. */
|
||||
}
|
||||
end_symtab (valu, objfile, SECT_OFF_TEXT (objfile));
|
||||
end_symtab (valu, SECT_OFF_TEXT (objfile));
|
||||
end_stabs ();
|
||||
}
|
||||
|
||||
@ -2939,7 +2938,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
|
||||
function_start_offset = 0;
|
||||
|
||||
start_stabs ();
|
||||
start_symtab (name, NULL, valu);
|
||||
start_symtab (objfile, name, NULL, valu);
|
||||
record_debugformat ("stabs");
|
||||
break;
|
||||
|
||||
@ -2949,17 +2948,17 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
|
||||
in the compilation of the main source file (whose name was
|
||||
given in the N_SO symbol). Relocate for dynamic loading. */
|
||||
valu += ANOFFSET (section_offsets, SECT_OFF_TEXT (objfile));
|
||||
start_subfile (name, current_subfile->dirname);
|
||||
start_subfile (name);
|
||||
break;
|
||||
|
||||
case N_BINCL:
|
||||
push_subfile ();
|
||||
add_new_header_file (name, valu);
|
||||
start_subfile (name, current_subfile->dirname);
|
||||
start_subfile (name);
|
||||
break;
|
||||
|
||||
case N_EINCL:
|
||||
start_subfile (pop_subfile (), current_subfile->dirname);
|
||||
start_subfile (pop_subfile ());
|
||||
break;
|
||||
|
||||
case N_EXCL:
|
||||
@ -3188,7 +3187,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, char *name,
|
||||
/* Make a block for the local symbols within. */
|
||||
block = finish_block (new->name, &local_symbols,
|
||||
new->old_blocks, new->start_addr,
|
||||
valu, objfile);
|
||||
valu);
|
||||
|
||||
/* For C++, set the block's scope. */
|
||||
if (SYMBOL_LANGUAGE (new->name) == language_cplus)
|
||||
|
@ -1514,7 +1514,7 @@ static void dwarf_decode_lines (struct line_header *, const char *,
|
||||
struct dwarf2_cu *, struct partial_symtab *,
|
||||
CORE_ADDR);
|
||||
|
||||
static void dwarf2_start_subfile (const char *, const char *, const char *);
|
||||
static void dwarf2_start_subfile (const char *, const char *);
|
||||
|
||||
static void dwarf2_start_symtab (struct dwarf2_cu *,
|
||||
const char *, const char *, CORE_ADDR);
|
||||
@ -7960,7 +7960,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
|
||||
get_scope_pc_bounds (cu->dies, &lowpc, &highpc, cu);
|
||||
|
||||
static_block
|
||||
= end_symtab_get_static_block (highpc + baseaddr, objfile, 0, 1);
|
||||
= end_symtab_get_static_block (highpc + baseaddr, 0, 1);
|
||||
|
||||
/* If the comp unit has DW_AT_ranges, it may have discontiguous ranges.
|
||||
Also, DW_AT_ranges may record ranges not belonging to any child DIEs
|
||||
@ -7969,7 +7969,7 @@ process_full_comp_unit (struct dwarf2_per_cu_data *per_cu,
|
||||
this comp unit. */
|
||||
dwarf2_record_block_ranges (cu->dies, static_block, baseaddr, cu);
|
||||
|
||||
symtab = end_symtab_from_static_block (static_block, objfile,
|
||||
symtab = end_symtab_from_static_block (static_block,
|
||||
SECT_OFF_TEXT (objfile), 0);
|
||||
|
||||
if (symtab != NULL)
|
||||
@ -8062,7 +8062,7 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
|
||||
this TU's symbols to the existing symtab. */
|
||||
if (sig_type->type_unit_group->primary_symtab == NULL)
|
||||
{
|
||||
symtab = end_expandable_symtab (0, objfile, SECT_OFF_TEXT (objfile));
|
||||
symtab = end_expandable_symtab (0, SECT_OFF_TEXT (objfile));
|
||||
sig_type->type_unit_group->primary_symtab = symtab;
|
||||
|
||||
if (symtab != NULL)
|
||||
@ -8077,8 +8077,7 @@ process_full_type_unit (struct dwarf2_per_cu_data *per_cu,
|
||||
}
|
||||
else
|
||||
{
|
||||
augment_type_symtab (objfile,
|
||||
sig_type->type_unit_group->primary_symtab);
|
||||
augment_type_symtab (sig_type->type_unit_group->primary_symtab);
|
||||
symtab = sig_type->type_unit_group->primary_symtab;
|
||||
}
|
||||
|
||||
@ -9157,7 +9156,7 @@ setup_type_unit_groups (struct die_info *die, struct dwarf2_cu *cu)
|
||||
|
||||
if (fe->dir_index)
|
||||
dir = lh->include_dirs[fe->dir_index - 1];
|
||||
dwarf2_start_subfile (fe->name, dir, NULL);
|
||||
dwarf2_start_subfile (fe->name, dir);
|
||||
|
||||
/* Note: We don't have to watch for the main subfile here, type units
|
||||
don't have DW_AT_name. */
|
||||
@ -11263,7 +11262,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
new = pop_context ();
|
||||
/* Make a block for the local symbols within. */
|
||||
block = finish_block (new->name, &local_symbols, new->old_blocks,
|
||||
lowpc, highpc, objfile);
|
||||
lowpc, highpc);
|
||||
|
||||
/* For C++, set the block's scope. */
|
||||
if ((cu->language == language_cplus || cu->language == language_fortran)
|
||||
@ -11343,7 +11342,7 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
|
||||
{
|
||||
struct block *block
|
||||
= finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
|
||||
highpc, objfile);
|
||||
highpc);
|
||||
|
||||
/* Note that recording ranges after traversing children, as we
|
||||
do here, means that recording a parent's ranges entails
|
||||
@ -17309,7 +17308,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
|
||||
if (fe->dir_index)
|
||||
dir = lh->include_dirs[fe->dir_index - 1];
|
||||
|
||||
dwarf2_start_subfile (fe->name, dir, comp_dir);
|
||||
dwarf2_start_subfile (fe->name, dir);
|
||||
}
|
||||
|
||||
/* Decode the table. */
|
||||
@ -17527,7 +17526,7 @@ dwarf_decode_lines_1 (struct line_header *lh, const char *comp_dir,
|
||||
{
|
||||
last_subfile = current_subfile;
|
||||
line_has_non_zero_discriminator = discriminator != 0;
|
||||
dwarf2_start_subfile (fe->name, dir, comp_dir);
|
||||
dwarf2_start_subfile (fe->name, dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -17654,7 +17653,7 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
|
||||
fe = &lh->file_names[i];
|
||||
if (fe->dir_index)
|
||||
dir = lh->include_dirs[fe->dir_index - 1];
|
||||
dwarf2_start_subfile (fe->name, dir, comp_dir);
|
||||
dwarf2_start_subfile (fe->name, dir);
|
||||
|
||||
/* Skip the main file; we don't need it, and it must be
|
||||
allocated last, so that it will show up before the
|
||||
@ -17672,8 +17671,7 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
|
||||
|
||||
/* Start a subfile for DWARF. FILENAME is the name of the file and
|
||||
DIRNAME the name of the source directory which contains FILENAME
|
||||
or NULL if not known. COMP_DIR is the compilation directory for the
|
||||
linetable's compilation unit or NULL if not known.
|
||||
or NULL if not known.
|
||||
This routine tries to keep line numbers from identical absolute and
|
||||
relative file names in a common subfile.
|
||||
|
||||
@ -17682,7 +17680,7 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
|
||||
of /srcdir/list0.c yields the following debugging information for list0.c:
|
||||
|
||||
DW_AT_name: /srcdir/list0.c
|
||||
DW_AT_comp_dir: /compdir
|
||||
DW_AT_comp_dir: /compdir
|
||||
files.files[0].name: list0.h
|
||||
files.files[0].dir: /srcdir
|
||||
files.files[1].name: list0.c
|
||||
@ -17695,15 +17693,11 @@ dwarf_decode_lines (struct line_header *lh, const char *comp_dir,
|
||||
subfile's name. */
|
||||
|
||||
static void
|
||||
dwarf2_start_subfile (const char *filename, const char *dirname,
|
||||
const char *comp_dir)
|
||||
dwarf2_start_subfile (const char *filename, const char *dirname)
|
||||
{
|
||||
char *copy = NULL;
|
||||
|
||||
/* While reading the DIEs, we call start_symtab(DW_AT_name, DW_AT_comp_dir).
|
||||
`start_symtab' will always pass the contents of DW_AT_comp_dir as
|
||||
second argument to start_subfile. To be consistent, we do the
|
||||
same here. In order not to lose the line information directory,
|
||||
/* In order not to lose the line information directory,
|
||||
we concatenate it to the filename when it makes sense.
|
||||
Note that the Dwarf3 standard says (speaking of filenames in line
|
||||
information): ``The directory index is ignored for file names
|
||||
@ -17716,7 +17710,7 @@ dwarf2_start_subfile (const char *filename, const char *dirname,
|
||||
filename = copy;
|
||||
}
|
||||
|
||||
start_subfile (filename, comp_dir);
|
||||
start_subfile (filename);
|
||||
|
||||
if (copy != NULL)
|
||||
xfree (copy);
|
||||
@ -17729,7 +17723,7 @@ static void
|
||||
dwarf2_start_symtab (struct dwarf2_cu *cu,
|
||||
const char *name, const char *comp_dir, CORE_ADDR low_pc)
|
||||
{
|
||||
start_symtab (name, comp_dir, low_pc);
|
||||
start_symtab (dwarf2_per_objfile->objfile, name, comp_dir, low_pc);
|
||||
record_debugformat ("DWARF 2");
|
||||
record_producer (cu->producer);
|
||||
|
||||
@ -20372,7 +20366,7 @@ static struct macro_source_file *
|
||||
macro_start_file (int file, int line,
|
||||
struct macro_source_file *current_file,
|
||||
const char *comp_dir,
|
||||
struct line_header *lh, struct objfile *objfile)
|
||||
struct line_header *lh)
|
||||
{
|
||||
/* File name relative to the compilation directory of this source file. */
|
||||
char *file_name = file_file_name (file, lh);
|
||||
@ -20381,7 +20375,7 @@ macro_start_file (int file, int line,
|
||||
{
|
||||
/* Note: We don't create a macro table for this compilation unit
|
||||
at all until we actually get a filename. */
|
||||
struct macro_table *macro_table = get_macro_table (objfile, comp_dir);
|
||||
struct macro_table *macro_table = get_macro_table (comp_dir);
|
||||
|
||||
/* If we have no current file, then this must be the start_file
|
||||
directive for the compilation unit's main source file. */
|
||||
@ -20763,9 +20757,9 @@ dwarf_decode_macro_bytes (bfd *abfd,
|
||||
struct dwarf2_section_info *section,
|
||||
int section_is_gnu, int section_is_dwz,
|
||||
unsigned int offset_size,
|
||||
struct objfile *objfile,
|
||||
htab_t include_hash)
|
||||
{
|
||||
struct objfile *objfile = dwarf2_per_objfile->objfile;
|
||||
enum dwarf_macro_record_type macinfo_type;
|
||||
int at_commandline;
|
||||
const gdb_byte *opcode_definitions[256];
|
||||
@ -20906,9 +20900,8 @@ dwarf_decode_macro_bytes (bfd *abfd,
|
||||
at_commandline = 0;
|
||||
}
|
||||
else
|
||||
current_file = macro_start_file (file, line,
|
||||
current_file, comp_dir,
|
||||
lh, objfile);
|
||||
current_file = macro_start_file (file, line, current_file,
|
||||
comp_dir, lh);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -20968,8 +20961,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
|
||||
{
|
||||
struct dwz_file *dwz = dwarf2_get_dwz_file ();
|
||||
|
||||
dwarf2_read_section (dwarf2_per_objfile->objfile,
|
||||
&dwz->macro);
|
||||
dwarf2_read_section (objfile, &dwz->macro);
|
||||
|
||||
include_section = &dwz->macro;
|
||||
include_bfd = get_section_bfd_owner (include_section);
|
||||
@ -20996,7 +20988,7 @@ dwarf_decode_macro_bytes (bfd *abfd,
|
||||
include_mac_end, current_file,
|
||||
lh, comp_dir,
|
||||
section, section_is_gnu, is_dwz,
|
||||
offset_size, objfile, include_hash);
|
||||
offset_size, include_hash);
|
||||
|
||||
htab_remove_elt (include_hash, (void *) new_mac_ptr);
|
||||
}
|
||||
@ -21152,7 +21144,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
|
||||
mac_ptr += bytes_read;
|
||||
|
||||
current_file = macro_start_file (file, line, current_file,
|
||||
comp_dir, lh, objfile);
|
||||
comp_dir, lh);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -21218,8 +21210,7 @@ dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
|
||||
*slot = (void *) mac_ptr;
|
||||
dwarf_decode_macro_bytes (abfd, mac_ptr, mac_end,
|
||||
current_file, lh, comp_dir, section,
|
||||
section_is_gnu, 0,
|
||||
offset_size, objfile, include_hash);
|
||||
section_is_gnu, 0, offset_size, include_hash);
|
||||
do_cleanups (cleanup);
|
||||
}
|
||||
|
||||
|
@ -4051,8 +4051,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
|
||||
valu += ANOFFSET (pst->section_offsets,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
previous_stab_code = N_SO;
|
||||
st = end_symtab (valu, objfile,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
st = end_symtab (valu, SECT_OFF_TEXT (objfile));
|
||||
end_stabs ();
|
||||
last_symtab_ended = 1;
|
||||
}
|
||||
@ -4116,8 +4115,7 @@ psymtab_to_symtab_1 (struct objfile *objfile,
|
||||
|
||||
if (! last_symtab_ended)
|
||||
{
|
||||
st = end_symtab (pst->texthigh, objfile,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
st = end_symtab (pst->texthigh, SECT_OFF_TEXT (objfile));
|
||||
end_stabs ();
|
||||
}
|
||||
|
||||
|
@ -769,7 +769,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
fool it. */
|
||||
|
||||
#if 0
|
||||
start_subfile (inclTable[ii].name, (char *) 0);
|
||||
start_subfile (inclTable[ii].name);
|
||||
#else
|
||||
{
|
||||
/* Pick a fake name that will produce the same results as this
|
||||
@ -779,7 +779,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
|
||||
if (fakename == NULL)
|
||||
fakename = " ?";
|
||||
start_subfile (fakename, (char *) 0);
|
||||
start_subfile (fakename);
|
||||
xfree (current_subfile->name);
|
||||
}
|
||||
current_subfile->name = xstrdup (inclTable[ii].name);
|
||||
@ -801,7 +801,7 @@ process_linenos (CORE_ADDR start, CORE_ADDR end)
|
||||
|
||||
current_subfile->line_vector_length =
|
||||
current_subfile->line_vector->nitems;
|
||||
start_subfile (pop_subfile (), (char *) 0);
|
||||
start_subfile (pop_subfile ());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1050,7 +1050,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
last_csect_name = 0;
|
||||
|
||||
start_stabs ();
|
||||
start_symtab (filestring, (char *) NULL, file_start_addr);
|
||||
start_symtab (objfile, filestring, (char *) NULL, file_start_addr);
|
||||
record_debugformat (debugfmt);
|
||||
symnum = ((struct symloc *) pst->read_symtab_private)->first_symnum;
|
||||
max_symnum =
|
||||
@ -1136,13 +1136,13 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
{
|
||||
if (get_last_source_file ())
|
||||
{
|
||||
pst->symtab = end_symtab (cur_src_end_addr, objfile,
|
||||
pst->symtab = end_symtab (cur_src_end_addr,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
end_stabs ();
|
||||
}
|
||||
|
||||
start_stabs ();
|
||||
start_symtab ("_globals_", (char *) NULL, (CORE_ADDR) 0);
|
||||
start_symtab (objfile, "_globals_", (char *) NULL, (CORE_ADDR) 0);
|
||||
record_debugformat (debugfmt);
|
||||
cur_src_end_addr = first_object_file_end;
|
||||
/* Done with all files, everything from here on is globals. */
|
||||
@ -1194,13 +1194,14 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
{
|
||||
complete_symtab (filestring, file_start_addr);
|
||||
cur_src_end_addr = file_end_addr;
|
||||
end_symtab (file_end_addr, objfile,
|
||||
end_symtab (file_end_addr,
|
||||
SECT_OFF_TEXT (objfile));
|
||||
end_stabs ();
|
||||
start_stabs ();
|
||||
/* Give all csects for this source file the same
|
||||
name. */
|
||||
start_symtab (filestring, NULL, (CORE_ADDR) 0);
|
||||
start_symtab (objfile, filestring, NULL,
|
||||
(CORE_ADDR) 0);
|
||||
record_debugformat (debugfmt);
|
||||
}
|
||||
|
||||
@ -1316,7 +1317,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
|
||||
complete_symtab (filestring, file_start_addr);
|
||||
cur_src_end_addr = file_end_addr;
|
||||
end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
|
||||
end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
|
||||
end_stabs ();
|
||||
|
||||
/* XCOFF, according to the AIX 3.2 documentation, puts the
|
||||
@ -1335,7 +1336,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
filestring = cs->c_name;
|
||||
|
||||
start_stabs ();
|
||||
start_symtab (filestring, (char *) NULL, (CORE_ADDR) 0);
|
||||
start_symtab (objfile, filestring, (char *) NULL, (CORE_ADDR) 0);
|
||||
record_debugformat (debugfmt);
|
||||
last_csect_name = 0;
|
||||
|
||||
@ -1398,8 +1399,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
(fcn_cs_saved.c_value
|
||||
+ fcn_aux_saved.x_sym.x_misc.x_fsize
|
||||
+ ANOFFSET (objfile->section_offsets,
|
||||
SECT_OFF_TEXT (objfile))),
|
||||
objfile);
|
||||
SECT_OFF_TEXT (objfile))));
|
||||
within_function = 0;
|
||||
}
|
||||
break;
|
||||
@ -1490,8 +1490,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
new->start_addr,
|
||||
(cs->c_value
|
||||
+ ANOFFSET (objfile->section_offsets,
|
||||
SECT_OFF_TEXT (objfile))),
|
||||
objfile);
|
||||
SECT_OFF_TEXT (objfile))));
|
||||
}
|
||||
local_symbols = new->locals;
|
||||
}
|
||||
@ -1509,7 +1508,7 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
|
||||
|
||||
complete_symtab (filestring, file_start_addr);
|
||||
cur_src_end_addr = file_end_addr;
|
||||
s = end_symtab (file_end_addr, objfile, SECT_OFF_TEXT (objfile));
|
||||
s = end_symtab (file_end_addr, SECT_OFF_TEXT (objfile));
|
||||
/* When reading symbols for the last C_FILE of the objfile, try
|
||||
to make sure that we set pst->symtab to the symtab for the
|
||||
file, not to the _globals_ symtab. I'm not sure whether this
|
||||
|
Loading…
x
Reference in New Issue
Block a user