/* When == 1, print basic high level tracing messages.
When > 1, be more verbose.
- This is in contrast to the low level DIE reading of dwarf2_die_debug. */
-static unsigned int dwarf2_read_debug = 0;
+ This is in contrast to the low level DIE reading of dwarf_die_debug. */
+static unsigned int dwarf_read_debug = 0;
/* When non-zero, dump DIEs after they are read in. */
-static unsigned int dwarf2_die_debug = 0;
+static unsigned int dwarf_die_debug = 0;
+
+/* When non-zero, dump line number entries as they are read in. */
+static unsigned int dwarf_line_debug = 0;
/* When non-zero, cross-check physname against demangler. */
static int check_physname = 0;
struct dwarf2_section_info *section;
/* Set to non-NULL iff this CU is currently loaded. When it gets freed out
- of the CU cache it gets reset to NULL again. */
+ of the CU cache it gets reset to NULL again. This is left as NULL for
+ dummy CUs (a CU header, but nothing else). */
struct dwarf2_cu *cu;
/* The corresponding objfile.
unsigned int dir_index;
unsigned int mod_time;
unsigned int length;
- int included_p; /* Non-zero if referenced by the Line Number Program. */
- struct symtab *symtab; /* The associated symbol table, if any. */
+ /* Non-zero if referenced by the Line Number Program. */
+ int included_p;
+ /* The associated symbol table, if any. */
+ struct symtab *symtab;
};
/* The line number information for a compilation unit (found in the
/* Flag set if the DIE has a byte_size attribute. */
unsigned int has_byte_size : 1;
+ /* Flag set if the DIE has a DW_AT_const_value attribute. */
+ unsigned int has_const_value : 1;
+
/* Flag set if any of the DIE's children are template arguments. */
unsigned int has_template_arguments : 1;
compilation units. Set this to zero to disable caching. Cache
sizes of up to at least twenty will improve startup time for
typical inter-CU-reference binaries, at an obvious memory cost. */
-static int dwarf2_max_cache_age = 5;
+static int dwarf_max_cache_age = 5;
static void
-show_dwarf2_max_cache_age (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_dwarf_max_cache_age (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("The upper bound on the age of cached "
- "dwarf2 compilation units is %s.\n"),
+ "DWARF compilation units is %s.\n"),
value);
}
\f
dwarf2_per_objfile->gdb_index.size = bfd_get_section_size (sectp);
}
- if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD)
+ if ((bfd_get_section_flags (abfd, sectp) & (SEC_LOAD | SEC_ALLOC))
&& bfd_section_vma (abfd, sectp) == 0)
dwarf2_per_objfile->has_section_at_zero = 1;
}
else
load_full_comp_unit (per_cu, language_minimal);
- gdb_assert (per_cu->cu != NULL);
+ if (per_cu->cu == NULL)
+ return; /* Dummy CU. */
dwarf2_find_base_address (per_cu->cu->dies, per_cu->cu);
}
that may badly handle TUs, load all the TUs in that DWO as well.
http://sourceware.org/bugzilla/show_bug.cgi?id=15021 */
if (!per_cu->is_debug_types
+ && per_cu->cu != NULL
&& per_cu->cu->dwo_unit != NULL
&& dwarf2_per_objfile->index_table != NULL
&& dwarf2_per_objfile->index_table->version <= 7
if (current_language->la_language == language_cplus
|| current_language->la_language == language_java
- || current_language->la_language == language_fortran)
+ || current_language->la_language == language_fortran
+ || current_language->la_language == language_d)
{
/* NAME is already canonical. Drop any qualifiers as .gdb_index does
not contain any. */
while ((per_cu = dw2_symtab_iter_next (&iter)) != NULL)
{
- struct symbol *sym = NULL;
+ struct symbol *sym, *with_opaque = NULL;
struct compunit_symtab *stab = dw2_instantiate_symtab (per_cu);
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (stab);
struct block *block = BLOCKVECTOR_BLOCK (bv, block_index);
+ sym = block_find_symbol (block, name, domain,
+ block_find_non_opaque_type_preferred,
+ &with_opaque);
+
/* Some caution must be observed with overloaded functions
and methods, since the index will not contain any overload
information (but NAME might contain it). */
- sym = block_lookup_symbol (block, name, domain);
- if (sym && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
- {
- if (!TYPE_IS_OPAQUE (SYMBOL_TYPE (sym)))
- return stab;
-
- stab_best = stab;
- }
+ if (sym != NULL
+ && strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
+ return stab;
+ if (with_opaque != NULL
+ && strcmp_iw (SYMBOL_SEARCH_NAME (with_opaque), name) == 0)
+ stab_best = stab;
/* Keep looking through other CUs. */
}
struct quick_file_names *file_data;
void **slot;
+ QUIT;
+
per_cu->v.quick->mark = 0;
/* We only need to look at symtabs not already expanded. */
offset_type *vec, vec_len, vec_idx;
int global_seen = 0;
+ QUIT;
+
if (index->symbol_table[idx] == 0 && index->symbol_table[idx + 1] == 0)
continue;
void
dwarf2_build_psymtabs (struct objfile *objfile)
{
- volatile struct gdb_exception except;
if (objfile->global_psymbols.size == 0 && objfile->static_psymbols.size == 0)
{
init_psymbol_list (objfile, 1024);
}
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
/* This isn't really ideal: all the data we allocate on the
objfile's obstack is still uselessly kept around. However,
dwarf2_build_psymtabs_hard (objfile);
discard_cleanups (cleanups);
}
- if (except.reason < 0)
- exception_print (gdb_stderr, except);
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_print (gdb_stderr, except);
+ }
+ END_CATCH
}
/* Return the total length of the CU described by HEADER. */
subpst->dirname = pst->dirname;
}
- subpst->section_offsets = pst->section_offsets;
subpst->textlow = 0;
subpst->texthigh = 0;
? &dwo_file->sections.abbrev
: &dwarf2_per_objfile->abbrev);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "Reading .debug_types%s for %s:\n",
dwo_file ? ".dwo" : "",
get_section_file_name (abbrev_section));
}
*slot = dwo_file ? (void *) dwo_tu : (void *) sig_type;
- if (dwarf2_read_debug > 1)
+ if (dwarf_read_debug > 1)
fprintf_unfiltered (gdb_stdlog, " offset 0x%x, signature %s\n",
offset.sect_off,
hex_string (signature));
comp_unit_die->attrs[i++] = *comp_dir;
comp_unit_die->num_attrs += num_extra_attrs;
- if (dwarf2_die_debug)
+ if (dwarf_die_debug)
{
fprintf_unfiltered (gdb_stdlog,
"Read die from %s@0x%x of %s:\n",
get_section_name (section),
(unsigned) (begin_info_ptr - section->buffer),
bfd_get_filename (abfd));
- dump_die (comp_unit_die, dwarf2_die_debug);
+ dump_die (comp_unit_die, dwarf_die_debug);
}
/* Save the comp_dir attribute. If there is no DWP file then we'll read
before we can reread the DWO file (this only applies to CUs, not TUs). */
int rereading_dwo_cu = 0;
- if (dwarf2_die_debug)
+ if (dwarf_die_debug)
fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset 0x%x\n",
this_cu->is_debug_types ? "type" : "comp",
this_cu->offset.sect_off);
struct die_info *comp_unit_die;
int has_children;
- if (dwarf2_die_debug)
+ if (dwarf_die_debug)
fprintf_unfiltered (gdb_stdlog, "Reading %s unit at offset 0x%x\n",
this_cu->is_debug_types ? "type" : "comp",
this_cu->offset.sect_off);
struct objfile *objfile = per_cu->objfile;
struct partial_symtab *pst;
- pst = start_psymtab_common (objfile, objfile->section_offsets,
- name, 0,
+ pst = start_psymtab_common (objfile, name, 0,
objfile->global_psymbols.next,
objfile->static_psymbols.next);
and build a psymtab for each of them. */
dwarf2_build_include_psymtabs (cu, comp_unit_die, pst);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
struct gdbarch *gdbarch = get_objfile_arch (objfile);
[IWBN if DWO skeletons had DW_AT_stmt_list]
call FUNC */
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "Building type unit groups ...\n");
/* Sort in a separate table to maintain the order of all_type_units
struct obstack temp_obstack;
int i;
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Building psymtabs of objfile %s ...\n",
objfile_name (objfile));
build_type_psymtab_dependencies, NULL);
}
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
print_tu_stats ();
set_partial_user (objfile);
do_cleanups (back_to);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "Done building psymtabs of %s\n",
objfile_name (objfile));
}
const gdb_byte *info_ptr;
bfd *abfd = get_section_bfd_owner (section);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "Reading %s for %s\n",
get_section_name (section),
get_section_file_name (section));
}
else
{
- /* Static Variable. Skip symbols without location descriptors. */
- if (pdi->d.locdesc == NULL)
+ int has_loc = pdi->d.locdesc != NULL;
+
+ /* Static Variable. Skip symbols whose value we cannot know (those
+ without location descriptors or constant values). */
+ if (!has_loc && !pdi->has_const_value)
{
xfree (built_actual_name);
return;
}
+
/* prim_record_minimal_symbol (actual_name, addr + baseaddr,
mst_file_data, objfile); */
add_psymbol_to_list (actual_name, strlen (actual_name),
built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
&objfile->static_psymbols,
- 0, addr + baseaddr,
+ 0,
+ has_loc ? addr + baseaddr : (CORE_ADDR) 0,
cu->language, objfile);
}
break;
{
struct dwarf2_queue_item *item, *next_item;
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog,
"Expanding one or more symtabs of objfile %s ...\n",
may load a new CU, adding it to the end of the queue. */
for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
{
- if (dwarf2_per_objfile->using_index
- ? !item->per_cu->v.quick->compunit_symtab
- : (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin))
+ if ((dwarf2_per_objfile->using_index
+ ? !item->per_cu->v.quick->compunit_symtab
+ : (item->per_cu->v.psymtab && !item->per_cu->v.psymtab->readin))
+ /* Skip dummy CUs. */
+ && item->per_cu->cu != NULL)
{
struct dwarf2_per_cu_data *per_cu = item->per_cu;
unsigned int debug_print_threshold;
debug_print_threshold = 1;
}
- if (dwarf2_read_debug >= debug_print_threshold)
+ if (dwarf_read_debug >= debug_print_threshold)
fprintf_unfiltered (gdb_stdlog, "Expanding symtab of %s\n", buf);
if (per_cu->is_debug_types)
else
process_full_comp_unit (per_cu, item->pretend_language);
- if (dwarf2_read_debug >= debug_print_threshold)
+ if (dwarf_read_debug >= debug_print_threshold)
fprintf_unfiltered (gdb_stdlog, "Done expanding %s\n", buf);
}
dwarf2_queue_tail = NULL;
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Done expanding symtabs of %s.\n",
objfile_name (dwarf2_per_objfile->objfile));
len = VEC_length (compunit_symtab_ptr, result_symtabs);
cust->includes
= obstack_alloc (&dwarf2_per_objfile->objfile->objfile_obstack,
- (len + 1) * sizeof (struct symtab *));
+ (len + 1) * sizeof (struct compunit_symtab *));
for (ix = 0;
VEC_iterate (compunit_symtab_ptr, result_symtabs, ix,
compunit_symtab_iter);
case DW_TAG_enumeration_type:
case DW_TAG_enumerator:
case DW_TAG_subprogram:
+ case DW_TAG_inlined_subroutine:
case DW_TAG_member:
case DW_TAG_imported_declaration:
return 1;
/* These are the only languages we know how to qualify names in. */
if (name != NULL
&& (cu->language == language_cplus || cu->language == language_java
- || cu->language == language_fortran))
+ || cu->language == language_fortran || cu->language == language_d))
{
if (die_needs_namespace (die, cu))
{
}
else if (strlen (imported_name_prefix) > 0)
canonical_name = obconcat (&objfile->objfile_obstack,
- imported_name_prefix, "::", imported_name,
- (char *) NULL);
+ imported_name_prefix,
+ (cu->language == language_d ? "." : "::"),
+ imported_name, (char *) NULL);
else
canonical_name = imported_name;
const char *dir = NULL;
struct file_entry *fe = &lh->file_names[i];
- if (fe->dir_index)
+ if (fe->dir_index && lh->include_dirs != NULL)
dir = lh->include_dirs[fe->dir_index - 1];
dwarf2_start_subfile (fe->name, dir);
dwo_unit->offset = offset;
dwo_unit->length = cu->per_cu->length;
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, " offset 0x%x, dwo_id %s\n",
offset.sect_off, hex_string (dwo_unit->signature));
}
not present, in which case section->asection will be NULL. */
abfd = get_section_bfd_owner (section);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Reading %s for %s:\n",
get_section_name (section),
gdb_assert (dwp_file->version == 1);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Reading %s %s/%s in DWP V1 file: %s\n",
kind,
/* Create one if necessary. */
if (*dwo_file_slot == NULL)
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Creating virtual DWO: %s\n",
virtual_dwo_name);
}
else
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Using existing virtual DWO: %s\n",
virtual_dwo_name);
gdb_assert (dwp_file->version == 2);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Reading %s %s/%s in DWP V2 file: %s\n",
kind,
/* Create one if necessary. */
if (*dwo_file_slot == NULL)
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Creating virtual DWO: %s\n",
virtual_dwo_name);
}
else
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "Using existing virtual DWO: %s\n",
virtual_dwo_name);
dbfd = open_dwo_file (dwo_name, comp_dir);
if (dbfd == NULL)
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "DWO file not found: %s\n", dwo_name);
return NULL;
}
discard_cleanups (cleanups);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "DWO file found: %s\n", dwo_name);
return dwo_file;
if (dbfd == NULL)
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
fprintf_unfiltered (gdb_stdlog, "DWP file not found: %s\n", dwp_name);
do_cleanups (cleanups);
return NULL;
dwp_file->loaded_cus = allocate_dwp_loaded_cutus_table (objfile);
dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table (objfile);
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "DWP file found: %s\n", dwp_file->name);
fprintf_unfiltered (gdb_stdlog,
if (dwo_cutu != NULL)
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog,
"Virtual DWO %s %s found: @%s\n",
if (dwo_cutu != NULL)
{
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "DWO %s %s(%s) found: @%s\n",
kind, dwo_name, hex_string (signature),
someone deleted the DWO/DWP file, or the search path isn't set up
correctly to find the file. */
- if (dwarf2_read_debug)
+ if (dwarf_read_debug)
{
fprintf_unfiltered (gdb_stdlog, "DWO %s %s(%s) not found\n",
kind, dwo_name, hex_string (signature));
cleanups = make_cleanup (xfree, offsets);
offsets_end = offsets;
- child_die = die->child;
- while (child_die && child_die->tag)
+ for (child_die = die->child;
+ child_die && child_die->tag;
+ child_die = sibling_die (child_die))
{
+ struct die_info *child_origin_die;
+ struct dwarf2_cu *child_origin_cu;
+
+ /* We are trying to process concrete instance entries:
+ DW_TAG_GNU_call_site DIEs indeed have a DW_AT_abstract_origin tag, but
+ it's not relevant to our analysis here. i.e. detecting DIEs that are
+ present in the abstract instance but not referenced in the concrete
+ one. */
+ if (child_die->tag == DW_TAG_GNU_call_site)
+ continue;
+
/* For each CHILD_DIE, find the corresponding child of
ORIGIN_DIE. If there is more than one layer of
DW_AT_abstract_origin, follow them all; there shouldn't be,
but GCC versions at least through 4.4 generate this (GCC PR
40573). */
- struct die_info *child_origin_die = child_die;
- struct dwarf2_cu *child_origin_cu = cu;
-
+ child_origin_die = child_die;
+ child_origin_cu = cu;
while (1)
{
attr = dwarf2_attr (child_origin_die, DW_AT_abstract_origin,
else
*offsets_end++ = child_origin_die->offset;
}
- child_die = sibling_die (child_die);
}
qsort (offsets, offsets_end - offsets, sizeof (*offsets),
unsigned_int_compar);
lowpc, highpc);
/* For C++, set the block's scope. */
- if ((cu->language == language_cplus || cu->language == language_fortran)
+ if ((cu->language == language_cplus
+ || cu->language == language_fortran
+ || cu->language == language_d)
&& cu->processing_has_namespace_info)
block_set_scope (block, determine_prefix (die, cu),
&objfile->objfile_obstack);
child_die = sibling_die (child_die);
}
}
+ inherit_abstract_dies (die, cu);
newobj = pop_context ();
if (local_symbols != NULL || using_directives != NULL)
cu->producer_is_gxx_lt_4_6 = major < 4 || (major == 4 && minor < 6);
cu->producer_is_gcc_lt_4_3 = major < 4 || (major == 4 && minor < 3);
}
- else if (strncmp (cu->producer, "Intel(R) C", strlen ("Intel(R) C")) == 0)
+ else if (startswith (cu->producer, "Intel(R) C"))
cu->producer_is_icc = 1;
else
{
dwarf2_complex_location_expr_complaint ();
if (!fnp->fcontext)
- fnp->fcontext = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0));
+ {
+ /* If there is no `this' field and no DW_AT_containing_type,
+ we cannot actually find a base class context for the
+ vtable! */
+ if (TYPE_NFIELDS (this_type) == 0
+ || !TYPE_FIELD_ARTIFICIAL (this_type, 0))
+ {
+ complaint (&symfile_complaints,
+ _("cannot determine context for virtual member "
+ "function \"%s\" (offset %d)"),
+ fieldname, die->offset.sect_off);
+ }
+ else
+ {
+ fnp->fcontext
+ = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (this_type, 0));
+ }
+ }
}
else if (attr_form_is_section_offset (attr))
{
/* Look for the C++ and Java forms of the vtable. */
if ((cu->language == language_java
- && strncmp (name, vtable, sizeof (vtable) - 1) == 0)
- || (strncmp (name, vptr, sizeof (vptr) - 1) == 0
+ && startswith (name, vtable))
+ || (startswith (name, vptr)
&& is_cplus_marker (name[sizeof (vptr) - 1])))
return 1;
if (name != NULL)
{
if (cu->language == language_cplus
- || cu->language == language_java)
+ || cu->language == language_java
+ || cu->language == language_d)
{
const char *full_name = dwarf2_full_name (name, die, cu);
}
}
else if (cu->producer
- && strncmp (cu->producer,
- "IBM(R) XL C/C++ Advanced Edition", 32) == 0)
+ && startswith (cu->producer, "IBM(R) XL C/C++ Advanced Edition"))
{
/* The IBM XLC compiler does not provide direct indication
of the containing type, but the vtable pointer is
type_flags |= TYPE_FLAG_UNSIGNED;
if (cu->language == language_fortran
&& name
- && strncmp (name, "character(", sizeof ("character(") - 1) == 0)
+ && startswith (name, "character("))
code = TYPE_CODE_CHAR;
break;
case DW_ATE_signed_char:
return 0;
baton = obstack_alloc (obstack, sizeof (*baton));
- baton->referenced_type = get_die_type (target_die->parent,
- target_cu);
+ baton->referenced_type = read_type_die (target_die->parent,
+ target_cu);
baton->offset_info.offset = offset;
baton->offset_info.type = die_type (target_die, target_cu);
prop->data.baton = baton;
struct die_info *die = read_die_and_siblings_1 (reader, info_ptr,
new_info_ptr, parent);
- if (dwarf2_die_debug)
+ if (dwarf_die_debug)
{
fprintf_unfiltered (gdb_stdlog,
"Read die from %s@0x%x of %s:\n",
get_section_name (reader->die_section),
(unsigned) (info_ptr - reader->die_section->buffer),
bfd_get_filename (reader->abfd));
- dump_die (die, dwarf2_die_debug);
+ dump_die (die, dwarf_die_debug);
}
return die;
result = read_full_die_1 (reader, diep, info_ptr, has_children, 0);
- if (dwarf2_die_debug)
+ if (dwarf_die_debug)
{
fprintf_unfiltered (gdb_stdlog,
"Read die from %s@0x%x of %s:\n",
get_section_name (reader->die_section),
(unsigned) (info_ptr - reader->die_section->buffer),
bfd_get_filename (reader->abfd));
- dump_die (*diep, dwarf2_die_debug);
+ dump_die (*diep, dwarf_die_debug);
}
return result;
case DW_AT_byte_size:
part_die->has_byte_size = 1;
break;
+ case DW_AT_const_value:
+ part_die->has_const_value = 1;
+ break;
case DW_AT_calling_convention:
/* DWARF doesn't provide a way to identify a program's source-level
entry point. DW_AT_calling_convention attributes are only meant
static void
add_include_dir (struct line_header *lh, const char *include_dir)
{
+ if (dwarf_line_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "Adding dir %u: %s\n",
+ lh->num_include_dirs + 1, include_dir);
+
/* Grow the array if necessary. */
if (lh->include_dirs_size == 0)
{
{
struct file_entry *fe;
+ if (dwarf_line_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "Adding file %u: %s\n",
+ lh->num_file_names + 1, name);
+
/* Grow the array if necessary. */
if (lh->file_names_size == 0)
{
fe->symtab = NULL;
}
-/* A convenience function to find the proper .debug_line section for a
- CU. */
+/* A convenience function to find the proper .debug_line section for a CU. */
static struct dwarf2_section_info *
get_debug_line_section (struct dwarf2_cu *cu)
char *copied_name = NULL;
int file_is_pst;
- if (fe.dir_index)
+ if (fe.dir_index && lh->include_dirs != NULL)
dir_name = lh->include_dirs[fe.dir_index - 1];
if (!IS_ABSOLUTE_PATH (include_name)
return include_name;
}
+/* State machine to track the state of the line number program. */
+
+typedef struct
+{
+ /* These are part of the standard DWARF line number state machine. */
+
+ unsigned char op_index;
+ unsigned int file;
+ unsigned int line;
+ CORE_ADDR address;
+ int is_stmt;
+ unsigned int discriminator;
+
+ /* Additional bits of state we need to track. */
+
+ /* The last file that we called dwarf2_start_subfile for.
+ This is only used for TLLs. */
+ unsigned int last_file;
+ /* The last file a line number was recorded for. */
+ struct subfile *last_subfile;
+
+ /* The function to call to record a line. */
+ record_line_ftype *record_line;
+
+ /* The last line number that was recorded, used to coalesce
+ consecutive entries for the same line. This can happen, for
+ example, when discriminators are present. PR 17276. */
+ unsigned int last_line;
+ int line_has_non_zero_discriminator;
+} lnp_state_machine;
+
+/* There's a lot of static state to pass to dwarf_record_line.
+ This keeps it all together. */
+
+typedef struct
+{
+ /* The gdbarch. */
+ struct gdbarch *gdbarch;
+
+ /* The line number header. */
+ struct line_header *line_header;
+
+ /* Non-zero if we're recording lines.
+ Otherwise we're building partial symtabs and are just interested in
+ finding include files mentioned by the line number program. */
+ int record_lines_p;
+} lnp_reader_state;
+
/* Ignore this record_line request. */
static void
in the line table of subfile SUBFILE. */
static void
-dwarf_record_line (struct gdbarch *gdbarch, struct subfile *subfile,
- unsigned int line, CORE_ADDR address,
- record_line_ftype p_record_line)
+dwarf_record_line_1 (struct gdbarch *gdbarch, struct subfile *subfile,
+ unsigned int line, CORE_ADDR address,
+ record_line_ftype p_record_line)
{
CORE_ADDR addr = gdbarch_addr_bits_remove (gdbarch, address);
+ if (dwarf_line_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "Recording line %u, file %s, address %s\n",
+ line, lbasename (subfile->name),
+ paddress (gdbarch, address));
+ }
+
(*p_record_line) (subfile, line, addr);
}
/* Subroutine of dwarf_decode_lines_1 to simplify it.
Mark the end of a set of line number records.
- The arguments are the same as for dwarf_record_line.
+ The arguments are the same as for dwarf_record_line_1.
If SUBFILE is NULL the request is ignored. */
static void
dwarf_finish_line (struct gdbarch *gdbarch, struct subfile *subfile,
CORE_ADDR address, record_line_ftype p_record_line)
{
- if (subfile != NULL)
- dwarf_record_line (gdbarch, subfile, 0, address, p_record_line);
+ if (subfile == NULL)
+ return;
+
+ if (dwarf_line_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "Finishing current line, file %s, address %s\n",
+ lbasename (subfile->name),
+ paddress (gdbarch, address));
+ }
+
+ dwarf_record_line_1 (gdbarch, subfile, 0, address, p_record_line);
+}
+
+/* Record the line in STATE.
+ END_SEQUENCE is non-zero if we're processing the end of a sequence. */
+
+static void
+dwarf_record_line (lnp_reader_state *reader, lnp_state_machine *state,
+ int end_sequence)
+{
+ const struct line_header *lh = reader->line_header;
+ unsigned int file, line, discriminator;
+ int is_stmt;
+
+ file = state->file;
+ line = state->line;
+ is_stmt = state->is_stmt;
+ discriminator = state->discriminator;
+
+ if (dwarf_line_debug)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "Processing actual line %u: file %u,"
+ " address %s, is_stmt %u, discrim %u\n",
+ line, file,
+ paddress (reader->gdbarch, state->address),
+ is_stmt, discriminator);
+ }
+
+ if (file == 0 || file - 1 >= lh->num_file_names)
+ dwarf2_debug_line_missing_file_complaint ();
+ /* For now we ignore lines not starting on an instruction boundary.
+ But not when processing end_sequence for compatibility with the
+ previous version of the code. */
+ else if (state->op_index == 0 || end_sequence)
+ {
+ lh->file_names[file - 1].included_p = 1;
+ if (reader->record_lines_p && is_stmt)
+ {
+ if (state->last_subfile != current_subfile || end_sequence)
+ {
+ dwarf_finish_line (reader->gdbarch, state->last_subfile,
+ state->address, state->record_line);
+ }
+
+ if (!end_sequence)
+ {
+ if (dwarf_record_line_p (line, state->last_line,
+ state->line_has_non_zero_discriminator,
+ state->last_subfile))
+ {
+ dwarf_record_line_1 (reader->gdbarch, current_subfile,
+ line, state->address,
+ state->record_line);
+ }
+ state->last_subfile = current_subfile;
+ state->last_line = line;
+ }
+ }
+ }
+}
+
+/* Initialize STATE for the start of a line number program. */
+
+static void
+init_lnp_state_machine (lnp_state_machine *state,
+ const lnp_reader_state *reader)
+{
+ memset (state, 0, sizeof (*state));
+
+ /* Just starting, there is no "last file". */
+ state->last_file = 0;
+ state->last_subfile = NULL;
+
+ state->record_line = record_line;
+
+ state->last_line = 0;
+ state->line_has_non_zero_discriminator = 0;
+
+ /* Initialize these according to the DWARF spec. */
+ state->op_index = 0;
+ state->file = 1;
+ state->line = 1;
+ /* Call `gdbarch_adjust_dwarf2_line' on the initial 0 address as if there
+ was a line entry for it so that the backend has a chance to adjust it
+ and also record it in case it needs it. This is currently used by MIPS
+ code, cf. `mips_adjust_dwarf2_line'. */
+ state->address = gdbarch_adjust_dwarf2_line (reader->gdbarch, 0, 0);
+ state->is_stmt = reader->line_header->default_is_stmt;
+ state->discriminator = 0;
+}
+
+/* Check address and if invalid nop-out the rest of the lines in this
+ sequence. */
+
+static void
+check_line_address (struct dwarf2_cu *cu, lnp_state_machine *state,
+ const gdb_byte *line_ptr,
+ CORE_ADDR lowpc, CORE_ADDR address)
+{
+ /* If address < lowpc then it's not a usable value, it's outside the
+ pc range of the CU. However, we restrict the test to only address
+ values of zero to preserve GDB's previous behaviour which is to
+ handle the specific case of a function being GC'd by the linker. */
+
+ if (address == 0 && address < lowpc)
+ {
+ /* This line table is for a function which has been
+ GCd by the linker. Ignore it. PR gdb/12528 */
+
+ struct objfile *objfile = cu->objfile;
+ long line_offset = line_ptr - get_debug_line_section (cu)->buffer;
+
+ complaint (&symfile_complaints,
+ _(".debug_line address at offset 0x%lx is 0 [in module %s]"),
+ line_offset, objfile_name (objfile));
+ state->record_line = noop_record_line;
+ /* Note: sm.record_line is left as noop_record_line
+ until we see DW_LNE_end_sequence. */
+ }
}
/* Subroutine of dwarf_decode_lines to simplify it.
- Process the line number information in LH. */
+ Process the line number information in LH.
+ If DECODE_FOR_PST_P is non-zero, all we do is process the line number
+ program in order to set included_p for every referenced header. */
static void
dwarf_decode_lines_1 (struct line_header *lh, struct dwarf2_cu *cu,
struct objfile *objfile = cu->objfile;
bfd *abfd = objfile->obfd;
struct gdbarch *gdbarch = get_objfile_arch (objfile);
- struct subfile *last_subfile = NULL;
- void (*p_record_line) (struct subfile *subfile, int line, CORE_ADDR pc)
- = record_line;
+ /* Non-zero if we're recording line info (as opposed to building partial
+ symtabs). */
+ int record_lines_p = !decode_for_pst_p;
+ /* A collection of things we need to pass to dwarf_record_line. */
+ lnp_reader_state reader_state;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
line_ptr = lh->statement_program_start;
line_end = lh->statement_program_end;
+ reader_state.gdbarch = gdbarch;
+ reader_state.line_header = lh;
+ reader_state.record_lines_p = record_lines_p;
+
/* Read the statement sequences until there's nothing left. */
while (line_ptr < line_end)
{
- /* State machine registers. Call `gdbarch_adjust_dwarf2_line'
- on the initial 0 address as if there was a line entry for it
- so that the backend has a chance to adjust it and also record
- it in case it needs it. This is currently used by MIPS code,
- cf. `mips_adjust_dwarf2_line'. */
- CORE_ADDR address = gdbarch_adjust_dwarf2_line (gdbarch, 0, 0);
- unsigned int file = 1;
- unsigned int line = 1;
- int is_stmt = lh->default_is_stmt;
+ /* The DWARF line number program state machine. */
+ lnp_state_machine state_machine;
int end_sequence = 0;
- unsigned char op_index = 0;
- unsigned int discriminator = 0;
- /* The last line number that was recorded, used to coalesce
- consecutive entries for the same line. This can happen, for
- example, when discriminators are present. PR 17276. */
- unsigned int last_line = 0;
- int line_has_non_zero_discriminator = 0;
-
- if (!decode_for_pst_p && lh->num_file_names >= file)
+
+ /* Reset the state machine at the start of each sequence. */
+ init_lnp_state_machine (&state_machine, &reader_state);
+
+ if (record_lines_p && lh->num_file_names >= state_machine.file)
{
/* Start a subfile for the current file of the state machine. */
/* lh->include_dirs and lh->file_names are 0-based, but the
directory and file name numbers in the statement program
are 1-based. */
- struct file_entry *fe = &lh->file_names[file - 1];
+ struct file_entry *fe = &lh->file_names[state_machine.file - 1];
const char *dir = NULL;
- if (fe->dir_index)
+ if (fe->dir_index && lh->include_dirs != NULL)
dir = lh->include_dirs[fe->dir_index - 1];
dwarf2_start_subfile (fe->name, dir);
}
/* Decode the table. */
- while (!end_sequence)
+ while (line_ptr < line_end && !end_sequence)
{
op_code = read_1_byte (abfd, line_ptr);
line_ptr += 1;
- if (line_ptr > line_end)
- {
- dwarf2_debug_line_missing_end_sequence_complaint ();
- break;
- }
if (op_code >= lh->opcode_base)
{
int line_delta;
adj_opcode = op_code - lh->opcode_base;
- addr_adj = (((op_index + (adj_opcode / lh->line_range))
+ addr_adj = (((state_machine.op_index
+ + (adj_opcode / lh->line_range))
/ lh->maximum_ops_per_instruction)
* lh->minimum_instruction_length);
- address += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
- op_index = ((op_index + (adj_opcode / lh->line_range))
- % lh->maximum_ops_per_instruction);
+ state_machine.address
+ += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
+ state_machine.op_index = ((state_machine.op_index
+ + (adj_opcode / lh->line_range))
+ % lh->maximum_ops_per_instruction);
line_delta = lh->line_base + (adj_opcode % lh->line_range);
- line += line_delta;
+ state_machine.line += line_delta;
if (line_delta != 0)
- line_has_non_zero_discriminator = discriminator != 0;
- if (lh->num_file_names < file || file == 0)
- dwarf2_debug_line_missing_file_complaint ();
- /* For now we ignore lines not starting on an
- instruction boundary. */
- else if (op_index == 0)
- {
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p && is_stmt)
- {
- if (last_subfile != current_subfile)
- {
- dwarf_finish_line (gdbarch, last_subfile,
- address, p_record_line);
- }
- if (dwarf_record_line_p (line, last_line,
- line_has_non_zero_discriminator,
- last_subfile))
- {
- dwarf_record_line (gdbarch, current_subfile,
- line, address, p_record_line);
- }
- last_subfile = current_subfile;
- last_line = line;
- }
- }
- discriminator = 0;
+ state_machine.line_has_non_zero_discriminator
+ = state_machine.discriminator != 0;
+
+ dwarf_record_line (&reader_state, &state_machine, 0);
+ state_machine.discriminator = 0;
}
else switch (op_code)
{
switch (extended_op)
{
case DW_LNE_end_sequence:
- p_record_line = record_line;
+ state_machine.record_line = record_line;
end_sequence = 1;
break;
case DW_LNE_set_address:
- address = read_address (abfd, line_ptr, cu, &bytes_read);
-
- /* If address < lowpc then it's not a usable value, it's
- outside the pc range of the CU. However, we restrict
- the test to only address values of zero to preserve
- GDB's previous behaviour which is to handle the specific
- case of a function being GC'd by the linker. */
- if (address == 0 && address < lowpc)
- {
- /* This line table is for a function which has been
- GCd by the linker. Ignore it. PR gdb/12528 */
-
- long line_offset
- = line_ptr - get_debug_line_section (cu)->buffer;
-
- complaint (&symfile_complaints,
- _(".debug_line address at offset 0x%lx is 0 "
- "[in module %s]"),
- line_offset, objfile_name (objfile));
- p_record_line = noop_record_line;
- /* Note: p_record_line is left as noop_record_line
- until we see DW_LNE_end_sequence. */
- }
+ {
+ CORE_ADDR address
+ = read_address (abfd, line_ptr, cu, &bytes_read);
- op_index = 0;
- line_ptr += bytes_read;
- address += baseaddr;
- address = gdbarch_adjust_dwarf2_line (gdbarch, address, 0);
+ line_ptr += bytes_read;
+ check_line_address (cu, &state_machine, line_ptr,
+ lowpc, address);
+ state_machine.op_index = 0;
+ address += baseaddr;
+ state_machine.address
+ = gdbarch_adjust_dwarf2_line (gdbarch, address, 0);
+ }
break;
case DW_LNE_define_file:
{
if there are consecutive entries for the same
(non-prologue) line we want to coalesce them.
PR 17276. */
- discriminator = read_unsigned_leb128 (abfd, line_ptr,
- &bytes_read);
- line_has_non_zero_discriminator |= discriminator != 0;
+ state_machine.discriminator
+ = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
+ state_machine.line_has_non_zero_discriminator
+ |= state_machine.discriminator != 0;
line_ptr += bytes_read;
break;
default:
}
break;
case DW_LNS_copy:
- if (lh->num_file_names < file || file == 0)
- dwarf2_debug_line_missing_file_complaint ();
- else
- {
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p && is_stmt)
- {
- if (last_subfile != current_subfile)
- {
- dwarf_finish_line (gdbarch, last_subfile,
- address, p_record_line);
- }
- if (dwarf_record_line_p (line, last_line,
- line_has_non_zero_discriminator,
- last_subfile))
- {
- dwarf_record_line (gdbarch, current_subfile,
- line, address, p_record_line);
- }
- last_subfile = current_subfile;
- last_line = line;
- }
- }
- discriminator = 0;
+ dwarf_record_line (&reader_state, &state_machine, 0);
+ state_machine.discriminator = 0;
break;
case DW_LNS_advance_pc:
{
= read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
CORE_ADDR addr_adj;
- addr_adj = (((op_index + adjust)
+ addr_adj = (((state_machine.op_index + adjust)
/ lh->maximum_ops_per_instruction)
* lh->minimum_instruction_length);
- address += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
- op_index = ((op_index + adjust)
- % lh->maximum_ops_per_instruction);
+ state_machine.address
+ += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
+ state_machine.op_index = ((state_machine.op_index + adjust)
+ % lh->maximum_ops_per_instruction);
line_ptr += bytes_read;
}
break;
int line_delta
= read_signed_leb128 (abfd, line_ptr, &bytes_read);
- line += line_delta;
+ state_machine.line += line_delta;
if (line_delta != 0)
- line_has_non_zero_discriminator = discriminator != 0;
+ state_machine.line_has_non_zero_discriminator
+ = state_machine.discriminator != 0;
line_ptr += bytes_read;
}
break;
case DW_LNS_set_file:
- {
- /* The arrays lh->include_dirs and lh->file_names are
- 0-based, but the directory and file name numbers in
- the statement program are 1-based. */
- struct file_entry *fe;
- const char *dir = NULL;
-
- file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
- line_ptr += bytes_read;
- if (lh->num_file_names < file || file == 0)
- dwarf2_debug_line_missing_file_complaint ();
- else
- {
- fe = &lh->file_names[file - 1];
- if (fe->dir_index)
- dir = lh->include_dirs[fe->dir_index - 1];
- if (!decode_for_pst_p)
- {
- last_subfile = current_subfile;
- line_has_non_zero_discriminator = discriminator != 0;
- dwarf2_start_subfile (fe->name, dir);
- }
- }
- }
+ {
+ /* The arrays lh->include_dirs and lh->file_names are
+ 0-based, but the directory and file name numbers in
+ the statement program are 1-based. */
+ struct file_entry *fe;
+ const char *dir = NULL;
+
+ state_machine.file = read_unsigned_leb128 (abfd, line_ptr,
+ &bytes_read);
+ line_ptr += bytes_read;
+ if (state_machine.file == 0
+ || state_machine.file - 1 >= lh->num_file_names)
+ dwarf2_debug_line_missing_file_complaint ();
+ else
+ {
+ fe = &lh->file_names[state_machine.file - 1];
+ if (fe->dir_index && lh->include_dirs != NULL)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ if (record_lines_p)
+ {
+ state_machine.last_subfile = current_subfile;
+ state_machine.line_has_non_zero_discriminator
+ = state_machine.discriminator != 0;
+ dwarf2_start_subfile (fe->name, dir);
+ }
+ }
+ }
break;
case DW_LNS_set_column:
(void) read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
break;
case DW_LNS_negate_stmt:
- is_stmt = (!is_stmt);
+ state_machine.is_stmt = (!state_machine.is_stmt);
break;
case DW_LNS_set_basic_block:
break;
CORE_ADDR adjust = (255 - lh->opcode_base) / lh->line_range;
CORE_ADDR addr_adj;
- addr_adj = (((op_index + adjust)
+ addr_adj = (((state_machine.op_index + adjust)
/ lh->maximum_ops_per_instruction)
* lh->minimum_instruction_length);
- address += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
- op_index = ((op_index + adjust)
- % lh->maximum_ops_per_instruction);
+ state_machine.address
+ += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
+ state_machine.op_index = ((state_machine.op_index + adjust)
+ % lh->maximum_ops_per_instruction);
}
break;
case DW_LNS_fixed_advance_pc:
CORE_ADDR addr_adj;
addr_adj = read_2_bytes (abfd, line_ptr);
- address += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
- op_index = 0;
+ state_machine.address
+ += gdbarch_adjust_dwarf2_line (gdbarch, addr_adj, 1);
+ state_machine.op_index = 0;
line_ptr += 2;
}
break;
}
}
}
- if (lh->num_file_names < file || file == 0)
- dwarf2_debug_line_missing_file_complaint ();
- else
- {
- lh->file_names[file - 1].included_p = 1;
- if (!decode_for_pst_p)
- {
- dwarf_finish_line (gdbarch, current_subfile, address,
- p_record_line);
- }
- }
+
+ if (!end_sequence)
+ dwarf2_debug_line_missing_end_sequence_complaint ();
+
+ /* We got a DW_LNE_end_sequence (or we ran off the end of the buffer,
+ in which case we still finish recording the last line). */
+ dwarf_record_line (&reader_state, &state_machine, 1);
}
}
struct file_entry *fe;
fe = &lh->file_names[i];
- if (fe->dir_index)
+ if (fe->dir_index && lh->include_dirs != NULL)
dir = lh->include_dirs[fe->dir_index - 1];
dwarf2_start_subfile (fe->name, dir);
if (cu->language == language_fortran && die->parent
&& die->parent->tag == DW_TAG_module
&& cu->producer
- && strncmp (cu->producer, "GNU Fortran ", 12) == 0)
+ && startswith (cu->producer, "GNU Fortran "))
SYMBOL_ACLASS_INDEX (sym) = LOC_UNRESOLVED;
/* A variable with DW_AT_external is never static,
class. */
if (cu->language == language_cplus
|| cu->language == language_java
- || cu->language == language_ada)
+ || cu->language == language_ada
+ || cu->language == language_d)
{
/* The symbol's name is already allocated along
with this objfile, so we don't need to
char *retval;
if (cu->language != language_cplus && cu->language != language_java
- && cu->language != language_fortran)
+ && cu->language != language_fortran && cu->language != language_d)
return "";
retval = anonymous_struct_prefix (die, cu);
sep = "";
else if (cu->language == language_java)
sep = ".";
+ else if (cu->language == language_d)
+ {
+ /* For D, the 'main' function could be defined in any module, but it
+ should never be prefixed. */
+ if (strcmp (suffix, "D main") == 0)
+ {
+ prefix = "";
+ sep = "";
+ }
+ else
+ sep = ".";
+ }
else if (cu->language == language_fortran && physname)
{
/* This is gfortran specific mangling. Normally DW_AT_linkage_name or
or simply "<anonymous struct>" or "<anonymous union>" in GCC 4.3
and GCC 4.4. We work around this problem by ignoring these. */
if (attr && DW_STRING (attr)
- && (strncmp (DW_STRING (attr), "._", 2) == 0
- || strncmp (DW_STRING (attr), "<anonymous", 10) == 0))
+ && (startswith (DW_STRING (attr), "._")
+ || startswith (DW_STRING (attr), "<anonymous")))
return NULL;
/* GCC might emit a nameless typedef that has a linkage name. See
if (per_cu->cu == NULL)
load_cu (per_cu);
cu = per_cu->cu;
+ if (cu == NULL)
+ {
+ /* We shouldn't get here for a dummy CU, but don't crash on the user.
+ Instead just throw an error, not much else we can do. */
+ error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"),
+ offset.sect_off, objfile_name (per_cu->objfile));
+ }
die = follow_die_offset (offset, per_cu->is_dwz, &cu);
if (!die)
if (per_cu->cu == NULL)
load_cu (per_cu);
cu = per_cu->cu;
+ if (cu == NULL)
+ {
+ /* We shouldn't get here for a dummy CU, but don't crash on the user.
+ Instead just throw an error, not much else we can do. */
+ error (_("Dwarf Error: Dummy CU at 0x%x referenced in module %s"),
+ offset.sect_off, objfile_name (per_cu->objfile));
+ }
die = follow_die_offset (offset, per_cu->is_dwz, &cu);
if (!die)
{
struct file_entry *fe = &lh->file_names[file - 1];
- if (IS_ABSOLUTE_PATH (fe->name) || fe->dir_index == 0)
+ if (IS_ABSOLUTE_PATH (fe->name) || fe->dir_index == 0
+ || lh->include_dirs == NULL)
return xstrdup (fe->name);
return concat (lh->include_dirs[fe->dir_index - 1], SLASH_STRING,
fe->name, NULL);
while (per_cu != NULL)
{
per_cu->cu->last_used ++;
- if (per_cu->cu->last_used <= dwarf2_max_cache_age)
+ if (per_cu->cu->last_used <= dwarf_max_cache_age)
dwarf2_mark (per_cu->cu);
per_cu = per_cu->cu->read_in_chain;
}
/* Read DW_AT_data_location and set in type. */
attr = dwarf2_attr (die, DW_AT_data_location, cu);
if (attr_to_dynamic_prop (attr, die, cu, &prop))
- {
- TYPE_DATA_LOCATION (type)
- = obstack_alloc (&objfile->objfile_obstack, sizeof (prop));
- *TYPE_DATA_LOCATION (type) = prop;
- }
+ add_dyn_prop (DYN_PROP_DATA_LOCATION, prop, type, objfile);
if (dwarf2_per_objfile->die_type_hash == NULL)
{
return part_die_lhs->offset.sect_off == part_die_rhs->offset.sect_off;
}
-static struct cmd_list_element *set_dwarf2_cmdlist;
-static struct cmd_list_element *show_dwarf2_cmdlist;
+static struct cmd_list_element *set_dwarf_cmdlist;
+static struct cmd_list_element *show_dwarf_cmdlist;
static void
-set_dwarf2_cmd (char *args, int from_tty)
+set_dwarf_cmd (char *args, int from_tty)
{
- help_list (set_dwarf2_cmdlist, "maintenance set dwarf2 ", all_commands,
+ help_list (set_dwarf_cmdlist, "maintenance set dwarf ", all_commands,
gdb_stdout);
}
static void
-show_dwarf2_cmd (char *args, int from_tty)
+show_dwarf_cmd (char *args, int from_tty)
{
- cmd_show_list (show_dwarf2_cmdlist, from_tty, "");
+ cmd_show_list (show_dwarf_cmdlist, from_tty, "");
}
/* Free data associated with OBJFILE, if necessary. */
dwarf2_per_objfile = objfile_data (objfile, dwarf2_objfile_data_key);
if (dwarf2_per_objfile)
{
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ERROR)
+ TRY
{
write_psymtabs_to_index (objfile, arg);
}
- if (except.reason < 0)
- exception_fprintf (gdb_stderr, except,
- _("Error while writing index for `%s': "),
- objfile_name (objfile));
+ CATCH (except, RETURN_MASK_ERROR)
+ {
+ exception_fprintf (gdb_stderr, except,
+ _("Error while writing index for `%s': "),
+ objfile_name (objfile));
+ }
+ END_CATCH
}
}
}
\f
-int dwarf2_always_disassemble;
+int dwarf_always_disassemble;
static void
-show_dwarf2_always_disassemble (struct ui_file *file, int from_tty,
- struct cmd_list_element *c, const char *value)
+show_dwarf_always_disassemble (struct ui_file *file, int from_tty,
+ struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("Whether to always disassemble "
dwarf2_objfile_data_key
= register_objfile_data_with_cleanup (NULL, dwarf2_per_objfile_free);
- add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd, _("\
-Set DWARF 2 specific variables.\n\
-Configure DWARF 2 variables such as the cache size"),
- &set_dwarf2_cmdlist, "maintenance set dwarf2 ",
+ add_prefix_cmd ("dwarf", class_maintenance, set_dwarf_cmd, _("\
+Set DWARF specific variables.\n\
+Configure DWARF variables such as the cache size"),
+ &set_dwarf_cmdlist, "maintenance set dwarf ",
0/*allow-unknown*/, &maintenance_set_cmdlist);
- add_prefix_cmd ("dwarf2", class_maintenance, show_dwarf2_cmd, _("\
-Show DWARF 2 specific variables\n\
-Show DWARF 2 variables such as the cache size"),
- &show_dwarf2_cmdlist, "maintenance show dwarf2 ",
+ add_prefix_cmd ("dwarf", class_maintenance, show_dwarf_cmd, _("\
+Show DWARF specific variables\n\
+Show DWARF variables such as the cache size"),
+ &show_dwarf_cmdlist, "maintenance show dwarf ",
0/*allow-unknown*/, &maintenance_show_cmdlist);
add_setshow_zinteger_cmd ("max-cache-age", class_obscure,
- &dwarf2_max_cache_age, _("\
-Set the upper bound on the age of cached dwarf2 compilation units."), _("\
-Show the upper bound on the age of cached dwarf2 compilation units."), _("\
+ &dwarf_max_cache_age, _("\
+Set the upper bound on the age of cached DWARF compilation units."), _("\
+Show the upper bound on the age of cached DWARF compilation units."), _("\
A higher limit means that cached compilation units will be stored\n\
in memory longer, and more total memory will be used. Zero disables\n\
caching, which can slow down startup."),
NULL,
- show_dwarf2_max_cache_age,
- &set_dwarf2_cmdlist,
- &show_dwarf2_cmdlist);
+ show_dwarf_max_cache_age,
+ &set_dwarf_cmdlist,
+ &show_dwarf_cmdlist);
add_setshow_boolean_cmd ("always-disassemble", class_obscure,
- &dwarf2_always_disassemble, _("\
+ &dwarf_always_disassemble, _("\
Set whether `info address' always disassembles DWARF expressions."), _("\
Show whether `info address' always disassembles DWARF expressions."), _("\
When enabled, DWARF expressions are always printed in an assembly-like\n\
syntax. When disabled, expressions will be printed in a more\n\
conversational style, when possible."),
NULL,
- show_dwarf2_always_disassemble,
- &set_dwarf2_cmdlist,
- &show_dwarf2_cmdlist);
-
- add_setshow_zuinteger_cmd ("dwarf2-read", no_class, &dwarf2_read_debug, _("\
-Set debugging of the dwarf2 reader."), _("\
-Show debugging of the dwarf2 reader."), _("\
-When enabled (non-zero), debugging messages are printed during dwarf2\n\
+ show_dwarf_always_disassemble,
+ &set_dwarf_cmdlist,
+ &show_dwarf_cmdlist);
+
+ add_setshow_zuinteger_cmd ("dwarf-read", no_class, &dwarf_read_debug, _("\
+Set debugging of the DWARF reader."), _("\
+Show debugging of the DWARF reader."), _("\
+When enabled (non-zero), debugging messages are printed during DWARF\n\
reading and symtab expansion. A value of 1 (one) provides basic\n\
information. A value greater than 1 provides more verbose information."),
NULL,
NULL,
&setdebuglist, &showdebuglist);
- add_setshow_zuinteger_cmd ("dwarf2-die", no_class, &dwarf2_die_debug, _("\
-Set debugging of the dwarf2 DIE reader."), _("\
-Show debugging of the dwarf2 DIE reader."), _("\
+ add_setshow_zuinteger_cmd ("dwarf-die", no_class, &dwarf_die_debug, _("\
+Set debugging of the DWARF DIE reader."), _("\
+Show debugging of the DWARF DIE reader."), _("\
When enabled (non-zero), DIEs are dumped after they are read in.\n\
The value is the maximum depth to print."),
NULL,
NULL,
&setdebuglist, &showdebuglist);
+ add_setshow_zuinteger_cmd ("dwarf-line", no_class, &dwarf_line_debug, _("\
+Set debugging of the dwarf line reader."), _("\
+Show debugging of the dwarf line reader."), _("\
+When enabled (non-zero), line number entries are dumped as they are read in.\n\
+A value of 1 (one) provides basic information.\n\
+A value greater than 1 provides more verbose information."),
+ NULL,
+ NULL,
+ &setdebuglist, &showdebuglist);
+
add_setshow_boolean_cmd ("check-physname", no_class, &check_physname, _("\
Set cross-checking of \"physname\" code against demangler."), _("\
Show cross-checking of \"physname\" code against demangler."), _("\