/* DWARF 2 debugging format support for GDB.
- Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004
+ Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+ 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
+ Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA. */
#include "defs.h"
#include "bfd.h"
unsigned int eh_frame_size;
/* Loaded data from the sections. */
- char *info_buffer;
- char *abbrev_buffer;
- char *line_buffer;
- char *str_buffer;
- char *macinfo_buffer;
- char *ranges_buffer;
- char *loc_buffer;
+ gdb_byte *info_buffer;
+ gdb_byte *abbrev_buffer;
+ gdb_byte *line_buffer;
+ gdb_byte *str_buffer;
+ gdb_byte *macinfo_buffer;
+ gdb_byte *ranges_buffer;
+ gdb_byte *loc_buffer;
/* A list of all the compilation units. This is used to locate
the target compilation unit of a particular reference. */
/* A chain of compilation units that are currently read in, so that
they can be freed later. */
struct dwarf2_per_cu_data *read_in_chain;
+
+ /* A flag indicating wether this objfile has a section loaded at a
+ VMA of 0. */
+ int has_section_at_zero;
};
static struct dwarf2_per_objfile *dwarf2_per_objfile;
/* Pointer to this compilation unit header in the .debug_info
section. */
- char *cu_head_ptr;
+ gdb_byte *cu_head_ptr;
/* Pointer to the first die of this compilation unit. This will be
the first byte following the compilation unit header. */
- char *first_die_ptr;
+ gdb_byte *first_die_ptr;
/* Pointer to the next compilation unit header in the program. */
struct comp_unit_head *next;
struct dwarf2_per_cu_data
{
- /* The start offset and length of this compilation unit. 2**31-1
+ /* The start offset and length of this compilation unit. 2**30-1
bytes should suffice to store the length of any compilation unit
- if it doesn't, GDB will fall over anyway. */
unsigned long offset;
- unsigned long length : 31;
+ unsigned long length : 30;
/* Flag indicating this compilation unit will be read in before
any of the current compilation units are processed. */
unsigned long queued : 1;
+ /* This flag will be set if we need to load absolutely all DIEs
+ for this compilation unit, instead of just the ones we think
+ are interesting. It gets set if we look for a DIE in the
+ hash table and don't find it. */
+ unsigned int load_all_dies : 1;
+
/* Set iff currently read in. */
struct dwarf2_cu *cu;
it. */
htab_t type_hash;
- /* The partial symbol table associated with this compilation unit. */
+ /* The partial symbol table associated with this compilation unit,
+ or NULL for partial units (which do not have an associated
+ symtab). */
struct partial_symtab *psymtab;
};
/* The start and end of the statement program following this
header. These point into dwarf2_per_objfile->line_buffer. */
- char *statement_program_start, *statement_program_end;
+ gdb_byte *statement_program_start, *statement_program_end;
};
/* When we construct a partial symbol table entry we only
/* Pointer into the info_buffer pointing at the target of
DW_AT_sibling, if any. */
- char *sibling;
+ gdb_byte *sibling;
/* If HAS_SPECIFICATION, the offset of the DIE referred to by
DW_AT_specification (or DW_AT_abstract_origin or
struct dwarf_block
{
unsigned int size;
- char *data;
+ gdb_byte *data;
};
#ifndef ATTR_ALLOC_CHUNK
/* A zeroed version of a partial die for initialization purposes. */
static struct partial_die_info zeroed_partial_die;
-/* FIXME: decode_locdesc sets these variables to describe the location
- to the caller. These ought to be a structure or something. If
- none of the flags are set, the object lives at the address returned
- by decode_locdesc. */
-
-static int isreg; /* Object lives in register.
- decode_locdesc's return value is
- the register number. */
-
/* FIXME: We might want to set this from BFD via bfd_arch_bits_per_byte,
but this would require a corresponding change in unpack_field_as_long
and friends. */
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 void
+show_dwarf2_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"),
+ value);
+}
+
/* Various complaints about symbol reading that don't abort the process */
static void add_partial_enumeration (struct partial_die_info *enum_pdi,
struct dwarf2_cu *cu);
-static char *locate_pdi_sibling (struct partial_die_info *orig_pdi,
- char *info_ptr,
- bfd *abfd,
- struct dwarf2_cu *cu);
+static gdb_byte *locate_pdi_sibling (struct partial_die_info *orig_pdi,
+ gdb_byte *info_ptr,
+ bfd *abfd,
+ struct dwarf2_cu *cu);
static void dwarf2_psymtab_to_symtab (struct partial_symtab *);
static void psymtab_to_symtab_1 (struct partial_symtab *);
-char *dwarf2_read_section (struct objfile *, asection *);
+gdb_byte *dwarf2_read_section (struct objfile *, asection *);
static void dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu);
static void dwarf2_free_abbrev_table (void *);
-static struct abbrev_info *peek_die_abbrev (char *, int *, struct dwarf2_cu *);
+static struct abbrev_info *peek_die_abbrev (gdb_byte *, unsigned int *,
+ struct dwarf2_cu *);
static struct abbrev_info *dwarf2_lookup_abbrev (unsigned int,
struct dwarf2_cu *);
-static struct partial_die_info *load_partial_dies (bfd *, char *, int,
+static struct partial_die_info *load_partial_dies (bfd *, gdb_byte *, int,
struct dwarf2_cu *);
-static char *read_partial_die (struct partial_die_info *,
- struct abbrev_info *abbrev, unsigned int,
- bfd *, char *, struct dwarf2_cu *);
+static gdb_byte *read_partial_die (struct partial_die_info *,
+ struct abbrev_info *abbrev, unsigned int,
+ bfd *, gdb_byte *, struct dwarf2_cu *);
static struct partial_die_info *find_partial_die (unsigned long,
struct dwarf2_cu *);
static void fixup_partial_die (struct partial_die_info *,
struct dwarf2_cu *);
-static char *read_full_die (struct die_info **, bfd *, char *,
- struct dwarf2_cu *, int *);
+static gdb_byte *read_full_die (struct die_info **, bfd *, gdb_byte *,
+ struct dwarf2_cu *, int *);
-static char *read_attribute (struct attribute *, struct attr_abbrev *,
- bfd *, char *, struct dwarf2_cu *);
+static gdb_byte *read_attribute (struct attribute *, struct attr_abbrev *,
+ bfd *, gdb_byte *, struct dwarf2_cu *);
-static char *read_attribute_value (struct attribute *, unsigned,
- bfd *, char *, struct dwarf2_cu *);
+static gdb_byte *read_attribute_value (struct attribute *, unsigned,
+ bfd *, gdb_byte *, struct dwarf2_cu *);
-static unsigned int read_1_byte (bfd *, char *);
+static unsigned int read_1_byte (bfd *, gdb_byte *);
-static int read_1_signed_byte (bfd *, char *);
+static int read_1_signed_byte (bfd *, gdb_byte *);
-static unsigned int read_2_bytes (bfd *, char *);
+static unsigned int read_2_bytes (bfd *, gdb_byte *);
-static unsigned int read_4_bytes (bfd *, char *);
+static unsigned int read_4_bytes (bfd *, gdb_byte *);
-static unsigned long read_8_bytes (bfd *, char *);
+static unsigned long read_8_bytes (bfd *, gdb_byte *);
-static CORE_ADDR read_address (bfd *, char *ptr, struct dwarf2_cu *,
- int *bytes_read);
+static CORE_ADDR read_address (bfd *, gdb_byte *ptr, struct dwarf2_cu *,
+ unsigned int *);
-static LONGEST read_initial_length (bfd *, char *,
- struct comp_unit_head *, int *bytes_read);
+static LONGEST read_initial_length (bfd *, gdb_byte *,
+ struct comp_unit_head *, unsigned int *);
-static LONGEST read_offset (bfd *, char *, const struct comp_unit_head *,
- int *bytes_read);
+static LONGEST read_offset (bfd *, gdb_byte *, const struct comp_unit_head *,
+ unsigned int *);
-static char *read_n_bytes (bfd *, char *, unsigned int);
+static gdb_byte *read_n_bytes (bfd *, gdb_byte *, unsigned int);
-static char *read_string (bfd *, char *, unsigned int *);
+static char *read_string (bfd *, gdb_byte *, unsigned int *);
-static char *read_indirect_string (bfd *, char *, const struct comp_unit_head *,
- unsigned int *);
+static char *read_indirect_string (bfd *, gdb_byte *,
+ const struct comp_unit_head *,
+ unsigned int *);
-static unsigned long read_unsigned_leb128 (bfd *, char *, unsigned int *);
+static unsigned long read_unsigned_leb128 (bfd *, gdb_byte *, unsigned int *);
-static long read_signed_leb128 (bfd *, char *, unsigned int *);
+static long read_signed_leb128 (bfd *, gdb_byte *, unsigned int *);
-static char *skip_leb128 (bfd *, char *);
+static gdb_byte *skip_leb128 (bfd *, gdb_byte *);
static void set_cu_language (unsigned int, struct dwarf2_cu *);
static void dwarf_decode_lines (struct line_header *, char *, bfd *,
struct dwarf2_cu *, struct partial_symtab *);
-static void dwarf2_start_subfile (char *, char *);
+static void dwarf2_start_subfile (char *, char *, char *);
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *);
static char *determine_prefix (struct die_info *die, struct dwarf2_cu *);
-static char *typename_concat (struct obstack *, const char *prefix, const char *suffix,
+static char *typename_concat (struct obstack *,
+ const char *prefix,
+ const char *suffix,
struct dwarf2_cu *);
static void read_typedef (struct die_info *, struct dwarf2_cu *);
static void read_subroutine_type (struct die_info *, struct dwarf2_cu *);
-static struct die_info *read_comp_unit (char *, bfd *, struct dwarf2_cu *);
+static struct die_info *read_comp_unit (gdb_byte *, bfd *, struct dwarf2_cu *);
-static struct die_info *read_die_and_children (char *info_ptr, bfd *abfd,
+static struct die_info *read_die_and_children (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *,
- char **new_info_ptr,
+ gdb_byte **new_info_ptr,
struct die_info *parent);
-static struct die_info *read_die_and_siblings (char *info_ptr, bfd *abfd,
+static struct die_info *read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *,
- char **new_info_ptr,
+ gdb_byte **new_info_ptr,
struct die_info *parent);
static void free_die_list (struct die_info *);
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu);
-static char *skip_one_die (char *info_ptr, struct abbrev_info *abbrev,
- struct dwarf2_cu *cu);
+static gdb_byte *skip_one_die (gdb_byte *info_ptr, struct abbrev_info *abbrev,
+ struct dwarf2_cu *cu);
static void free_stack_comp_unit (void *);
-static void *hashtab_obstack_allocate (void *data, size_t size, size_t count);
-
-static void dummy_obstack_deallocate (void *object, void *data);
-
static hashval_t partial_die_hash (const void *item);
static int partial_die_eq (const void *item_lhs, const void *item_rhs);
static void create_all_comp_units (struct objfile *);
-static struct dwarf2_cu *load_full_comp_unit (struct dwarf2_per_cu_data *);
+static struct dwarf2_cu *load_full_comp_unit (struct dwarf2_per_cu_data *,
+ struct objfile *);
static void process_full_comp_unit (struct dwarf2_per_cu_data *);
static void dwarf2_clear_marks (struct dwarf2_per_cu_data *);
+static void read_set_type (struct die_info *, struct dwarf2_cu *);
+
+
/* Try to locate the sections we need for DWARF 2 debugging
information and return true if we have enough to do something. */
in. */
static void
-dwarf2_locate_sections (bfd *ignore_abfd, asection *sectp, void *ignore_ptr)
+dwarf2_locate_sections (bfd *abfd, asection *sectp, void *ignore_ptr)
{
if (strcmp (sectp->name, INFO_SECTION) == 0)
{
dwarf2_per_objfile->ranges_size = bfd_get_section_size (sectp);
dwarf_ranges_section = sectp;
}
+
+ if ((bfd_get_section_flags (abfd, sectp) & SEC_LOAD)
+ && bfd_section_vma (abfd, sectp) == 0)
+ dwarf2_per_objfile->has_section_at_zero = 1;
}
/* Build a partial symbol table. */
while ((pubnames_ptr - pubnames_buffer) < dwarf2_per_objfile->pubnames_size)
{
struct comp_unit_head cu_header;
- int bytes_read;
+ unsigned int bytes_read;
entry_length = read_initial_length (abfd, pubnames_ptr, &cu_header,
- &bytes_read);
+ &bytes_read);
pubnames_ptr += bytes_read;
version = read_1_byte (abfd, pubnames_ptr);
pubnames_ptr += 1;
/* Read in the comp unit header information from the debug_info at
info_ptr. */
-static char *
+static gdb_byte *
read_comp_unit_head (struct comp_unit_head *cu_header,
- char *info_ptr, bfd *abfd)
+ gdb_byte *info_ptr, bfd *abfd)
{
int signed_addr;
- int bytes_read;
+ unsigned int bytes_read;
cu_header->length = read_initial_length (abfd, info_ptr, cu_header,
&bytes_read);
info_ptr += bytes_read;
return info_ptr;
}
-static char *
-partial_read_comp_unit_head (struct comp_unit_head *header, char *info_ptr,
+static gdb_byte *
+partial_read_comp_unit_head (struct comp_unit_head *header, gdb_byte *info_ptr,
bfd *abfd)
{
- char *beg_of_comp_unit = info_ptr;
+ gdb_byte *beg_of_comp_unit = info_ptr;
info_ptr = read_comp_unit_head (header, info_ptr, abfd);
- if (header->version != 2)
+ if (header->version != 2 && header->version != 3)
error (_("Dwarf Error: wrong version in compilation unit header "
"(is %d, should be %d) [in module %s]"), header->version,
2, bfd_get_filename (abfd));
/* Instead of reading this into a big buffer, we should probably use
mmap() on architectures that support it. (FIXME) */
bfd *abfd = objfile->obfd;
- char *info_ptr;
- char *beg_of_comp_unit;
+ gdb_byte *info_ptr;
+ gdb_byte *beg_of_comp_unit;
struct partial_die_info comp_unit_die;
struct partial_symtab *pst;
struct cleanup *back_to;
info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read,
abfd, info_ptr, &cu);
+ if (comp_unit_die.tag == DW_TAG_partial_unit)
+ {
+ info_ptr = (beg_of_comp_unit + cu.header.length
+ + cu.header.initial_length_size);
+ do_cleanups (back_to_inner);
+ continue;
+ }
+
/* Set the language we're debugging */
set_cu_language (comp_unit_die.language, &cu);
also happen.) This happens in VxWorks. */
free_named_symtabs (pst->filename);
+ info_ptr = beg_of_comp_unit + cu.header.length
+ + cu.header.initial_length_size;
+
if (comp_unit_die.has_stmt_list)
{
/* Get the list of files included in the current compilation unit,
dwarf2_build_include_psymtabs (&cu, &comp_unit_die, pst);
}
- info_ptr = beg_of_comp_unit + cu.header.length
- + cu.header.initial_length_size;
-
do_cleanups (back_to_inner);
}
do_cleanups (back_to);
load_comp_unit (struct dwarf2_per_cu_data *this_cu, struct objfile *objfile)
{
bfd *abfd = objfile->obfd;
- char *info_ptr, *beg_of_comp_unit;
+ gdb_byte *info_ptr, *beg_of_comp_unit;
struct partial_die_info comp_unit_die;
struct dwarf2_cu *cu;
struct abbrev_info *abbrev;
int n_allocated;
int n_comp_units;
struct dwarf2_per_cu_data **all_comp_units;
- char *info_ptr = dwarf2_per_objfile->info_buffer;
+ gdb_byte *info_ptr = dwarf2_per_objfile->info_buffer;
n_comp_units = 0;
n_allocated = 10;
while (info_ptr < dwarf2_per_objfile->info_buffer + dwarf2_per_objfile->info_size)
{
struct comp_unit_head cu_header;
- char *beg_of_comp_unit;
+ gdb_byte *beg_of_comp_unit;
struct dwarf2_per_cu_data *this_cu;
unsigned long offset;
- int bytes_read;
+ unsigned int bytes_read;
offset = info_ptr - dwarf2_per_objfile->info_buffer;
/* Read just enough information to find out where the next
compilation unit is. */
+ cu_header.initial_length_size = 0;
cu_header.length = read_initial_length (objfile->obfd, info_ptr,
&cu_header, &bytes_read);
the initial number. */
static struct abbrev_info *
-peek_die_abbrev (char *info_ptr, int *bytes_read, struct dwarf2_cu *cu)
+peek_die_abbrev (gdb_byte *info_ptr, unsigned int *bytes_read,
+ struct dwarf2_cu *cu)
{
bfd *abfd = cu->objfile->obfd;
unsigned int abbrev_number;
pointer to the end of a series of DIEs, terminated by an empty
DIE. Any children of the skipped DIEs will also be skipped. */
-static char *
-skip_children (char *info_ptr, struct dwarf2_cu *cu)
+static gdb_byte *
+skip_children (gdb_byte *info_ptr, struct dwarf2_cu *cu)
{
struct abbrev_info *abbrev;
unsigned int bytes_read;
ABBREV. Returns a pointer to this DIE's sibling, skipping any
children. */
-static char *
-skip_one_die (char *info_ptr, struct abbrev_info *abbrev,
+static gdb_byte *
+skip_one_die (gdb_byte *info_ptr, struct abbrev_info *abbrev,
struct dwarf2_cu *cu)
{
unsigned int bytes_read;
/* Locate ORIG_PDI's sibling; INFO_PTR should point to the start of
the next DIE after ORIG_PDI. */
-static char *
-locate_pdi_sibling (struct partial_die_info *orig_pdi, char *info_ptr,
+static gdb_byte *
+locate_pdi_sibling (struct partial_die_info *orig_pdi, gdb_byte *info_ptr,
bfd *abfd, struct dwarf2_cu *cu)
{
/* Do we know the sibling already? */
{
/* Read in this compilation unit. This may add new items to
the end of the queue. */
- load_full_comp_unit (item->per_cu);
+ load_full_comp_unit (item->per_cu, objfile);
item->per_cu->cu->read_in_chain = dwarf2_per_objfile->read_in_chain;
dwarf2_per_objfile->read_in_chain = item->per_cu;
/* If this compilation unit has already had full symbols created,
reset the TYPE fields in each DIE. */
- if (item->per_cu->psymtab->readin)
+ if (item->per_cu->type_hash)
reset_die_and_siblings_types (item->per_cu->cu->dies,
item->per_cu->cu);
}
them, one at a time, removing from the queue as we finish. */
for (item = dwarf2_queue; item != NULL; dwarf2_queue = item = next_item)
{
- if (!item->per_cu->psymtab->readin)
+ if (item->per_cu->psymtab && !item->per_cu->psymtab->readin)
process_full_comp_unit (item->per_cu);
item->per_cu->queued = 0;
/* Load the DIEs associated with PST and PER_CU into memory. */
static struct dwarf2_cu *
-load_full_comp_unit (struct dwarf2_per_cu_data *per_cu)
+load_full_comp_unit (struct dwarf2_per_cu_data *per_cu, struct objfile *objfile)
{
- struct partial_symtab *pst = per_cu->psymtab;
- bfd *abfd = pst->objfile->obfd;
+ bfd *abfd = objfile->obfd;
struct dwarf2_cu *cu;
unsigned long offset;
- char *info_ptr;
+ gdb_byte *info_ptr;
struct cleanup *back_to, *free_cu_cleanup;
struct attribute *attr;
CORE_ADDR baseaddr;
/* If an error occurs while loading, release our storage. */
free_cu_cleanup = make_cleanup (free_one_comp_unit, cu);
- cu->objfile = pst->objfile;
+ cu->objfile = objfile;
/* read in the comp_unit header */
info_ptr = read_comp_unit_head (&cu->header, info_ptr, abfd);
case DW_TAG_subroutine_type:
read_subroutine_type (die, cu);
break;
+ case DW_TAG_set_type:
+ read_set_type (die, cu);
+ break;
case DW_TAG_array_type:
read_array_type (die, cu);
break;
/* Base address selection entry. */
CORE_ADDR base;
int found_base;
- int dummy;
- char *buffer;
+ unsigned int dummy;
+ gdb_byte *buffer;
CORE_ADDR marker;
int low_set;
labels are not in the output, so the relocs get a value of 0.
If this is a discarded function, mark the pc bounds as invalid,
so that GDB will ignore it. */
- if (low == 0 && (bfd_get_file_flags (obfd) & HAS_RELOC) == 0)
+ if (low == 0 && !dwarf2_per_objfile->has_section_at_zero)
return 0;
*lowpc = low;
if (fip->nbaseclasses)
{
int num_bytes = B_BYTES (fip->nbaseclasses);
- char *pointer;
+ unsigned char *pointer;
ALLOCATE_CPLUS_STRUCT_TYPE (type);
- pointer = (char *) TYPE_ALLOC (type, num_bytes);
- TYPE_FIELD_VIRTUAL_BITS (type) = (B_TYPE *) pointer;
+ pointer = TYPE_ALLOC (type, num_bytes);
+ TYPE_FIELD_VIRTUAL_BITS (type) = pointer;
B_CLRALL (TYPE_FIELD_VIRTUAL_BITS (type), fip->nbaseclasses);
TYPE_N_BASECLASSES (type) = fip->nbaseclasses;
}
TYPE_NFN_FIELDS_TOTAL (type) = total_length;
}
-
/* Returns non-zero if NAME is the name of a vtable member in CU's
language, zero otherwise. */
static int
return 0;
}
+/* GCC outputs unnamed structures that are really pointers to member
+ functions, with the ABI-specified layout. If DIE (from CU) describes
+ such a structure, set its type, and return nonzero. Otherwise return
+ zero.
+
+ GCC shouldn't do this; it should just output pointer to member DIEs.
+ This is GCC PR debug/28767. */
+
+static int
+quirk_gcc_member_function_pointer (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct objfile *objfile = cu->objfile;
+ struct type *type;
+ struct die_info *pfn_die, *delta_die;
+ struct attribute *pfn_name, *delta_name;
+ struct type *pfn_type, *domain_type;
+
+ /* Check for a structure with no name and two children. */
+ if (die->tag != DW_TAG_structure_type
+ || dwarf2_attr (die, DW_AT_name, cu) != NULL
+ || die->child == NULL
+ || die->child->sibling == NULL
+ || (die->child->sibling->sibling != NULL
+ && die->child->sibling->sibling->tag != DW_TAG_padding))
+ return 0;
+
+ /* Check for __pfn and __delta members. */
+ pfn_die = die->child;
+ pfn_name = dwarf2_attr (pfn_die, DW_AT_name, cu);
+ if (pfn_die->tag != DW_TAG_member
+ || pfn_name == NULL
+ || DW_STRING (pfn_name) == NULL
+ || strcmp ("__pfn", DW_STRING (pfn_name)) != 0)
+ return 0;
+
+ delta_die = pfn_die->sibling;
+ delta_name = dwarf2_attr (delta_die, DW_AT_name, cu);
+ if (delta_die->tag != DW_TAG_member
+ || delta_name == NULL
+ || DW_STRING (delta_name) == NULL
+ || strcmp ("__delta", DW_STRING (delta_name)) != 0)
+ return 0;
+
+ /* Find the type of the method. */
+ pfn_type = die_type (pfn_die, cu);
+ if (pfn_type == NULL
+ || TYPE_CODE (pfn_type) != TYPE_CODE_PTR
+ || TYPE_CODE (TYPE_TARGET_TYPE (pfn_type)) != TYPE_CODE_FUNC)
+ return 0;
+
+ /* Look for the "this" argument. */
+ pfn_type = TYPE_TARGET_TYPE (pfn_type);
+ if (TYPE_NFIELDS (pfn_type) == 0
+ || TYPE_CODE (TYPE_FIELD_TYPE (pfn_type, 0)) != TYPE_CODE_PTR)
+ return 0;
+
+ domain_type = TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (pfn_type, 0));
+ type = alloc_type (objfile);
+ smash_to_method_type (type, domain_type, TYPE_TARGET_TYPE (pfn_type),
+ TYPE_FIELDS (pfn_type), TYPE_NFIELDS (pfn_type),
+ TYPE_VARARGS (pfn_type));
+ type = lookup_methodptr_type (type);
+ set_die_type (die, type, cu);
+
+ return 1;
+}
/* Called when we find the DIE that starts a structure or union scope
(definition) to process all dies that define the members of the
if (die->type)
return;
- type = alloc_type (objfile);
+ if (quirk_gcc_member_function_pointer (die, cu))
+ return;
+ type = alloc_type (objfile);
INIT_CPLUS_SPECIFIC (type);
attr = dwarf2_attr (die, DW_AT_name, cu);
if (attr && DW_STRING (attr))
TYPE_VPTR_FIELDNO (type) = TYPE_VPTR_FIELDNO (t);
}
}
+ else if (cu->producer
+ && strncmp (cu->producer,
+ "IBM(R) XL C/C++ Advanced Edition", 32) == 0)
+ {
+ /* The IBM XLC compiler does not provide direct indication
+ of the containing type, but the vtable pointer is
+ always named __vfp. */
+
+ int i;
+
+ for (i = TYPE_NFIELDS (type) - 1;
+ i >= TYPE_N_BASECLASSES (type);
+ --i)
+ {
+ if (strcmp (TYPE_FIELD_NAME (type, i), "__vfp") == 0)
+ {
+ TYPE_VPTR_FIELDNO (type) = i;
+ TYPE_VPTR_BASETYPE (type) = type;
+ break;
+ }
+ }
+ }
}
do_cleanups (back_to);
if (attr)
TYPE_FLAGS (type) |= TYPE_FLAG_VECTOR;
+ attr = dwarf2_attr (die, DW_AT_name, cu);
+ if (attr && DW_STRING (attr))
+ TYPE_NAME (type) = DW_STRING (attr);
+
do_cleanups (back_to);
/* Install the type in the die. */
};
}
+/* Extract all information from a DW_TAG_set_type DIE and put it in
+ the DIE's type field. */
+
+static void
+read_set_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+ if (die->type == NULL)
+ die->type = create_set_type ((struct type *) NULL, die_type (die, cu));
+}
/* First cut: install each common block member as a global variable. */
return;
}
- type = alloc_type (objfile);
to_type = die_type (die, cu);
domain = die_containing_type (die, cu);
- smash_to_member_type (type, domain, to_type);
+
+ if (TYPE_CODE (check_typedef (to_type)) == TYPE_CODE_METHOD)
+ type = lookup_methodptr_type (to_type);
+ else
+ type = lookup_memberptr_type (to_type, domain);
set_die_type (die, type, cu);
}
/* Allocate storage for parameters and fill them in. */
TYPE_NFIELDS (ftype) = nparams;
TYPE_FIELDS (ftype) = (struct field *)
- TYPE_ALLOC (ftype, nparams * sizeof (struct field));
+ TYPE_ZALLOC (ftype, nparams * sizeof (struct field));
child_die = die->child;
while (child_die && child_die->tag)
code = TYPE_CODE_FLT;
break;
case DW_ATE_signed:
- case DW_ATE_signed_char:
break;
case DW_ATE_unsigned:
- case DW_ATE_unsigned_char:
+ type_flags |= TYPE_FLAG_UNSIGNED;
+ break;
+ case DW_ATE_signed_char:
+ if (cu->language == language_m2)
+ code = TYPE_CODE_CHAR;
+ break;
+ case DW_ATE_unsigned_char:
+ if (cu->language == language_m2)
+ code = TYPE_CODE_CHAR;
type_flags |= TYPE_FLAG_UNSIGNED;
break;
default:
set_die_type (die, range_type, cu);
}
+static void
+read_unspecified_type (struct die_info *die, struct dwarf2_cu *cu)
+{
+ struct type *type;
+ struct attribute *attr;
+
+ if (die->type)
+ return;
+
+ /* For now, we only support the C meaning of an unspecified type: void. */
+
+ attr = dwarf2_attr (die, DW_AT_name, cu);
+ type = init_type (TYPE_CODE_VOID, 0, 0, attr ? DW_STRING (attr) : "",
+ cu->objfile);
+
+ set_die_type (die, type, cu);
+}
/* Read a whole compilation unit into a linked list of dies. */
static struct die_info *
-read_comp_unit (char *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
+read_comp_unit (gdb_byte *info_ptr, bfd *abfd, struct dwarf2_cu *cu)
{
return read_die_and_children (info_ptr, abfd, cu, &info_ptr, NULL);
}
is the parent of the die in question. */
static struct die_info *
-read_die_and_children (char *info_ptr, bfd *abfd,
+read_die_and_children (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *cu,
- char **new_info_ptr,
+ gdb_byte **new_info_ptr,
struct die_info *parent)
{
struct die_info *die;
- char *cur_ptr;
+ gdb_byte *cur_ptr;
int has_children;
cur_ptr = read_full_die (&die, abfd, info_ptr, cu, &has_children);
in read_die_and_children. */
static struct die_info *
-read_die_and_siblings (char *info_ptr, bfd *abfd,
+read_die_and_siblings (gdb_byte *info_ptr, bfd *abfd,
struct dwarf2_cu *cu,
- char **new_info_ptr,
+ gdb_byte **new_info_ptr,
struct die_info *parent)
{
struct die_info *first_die, *last_sibling;
- char *cur_ptr;
+ gdb_byte *cur_ptr;
cur_ptr = info_ptr;
first_die = last_sibling = NULL;
/* Read the contents of the section at OFFSET and of size SIZE from the
object file specified by OBJFILE into the objfile_obstack and return it. */
-char *
+gdb_byte *
dwarf2_read_section (struct objfile *objfile, asection *sectp)
{
bfd *abfd = objfile->obfd;
- char *buf, *retbuf;
+ gdb_byte *buf, *retbuf;
bfd_size_type size = bfd_get_section_size (sectp);
if (size == 0)
return NULL;
- buf = (char *) obstack_alloc (&objfile->objfile_obstack, size);
- retbuf
- = (char *) symfile_relocate_debug_section (abfd, sectp, (bfd_byte *) buf);
+ buf = obstack_alloc (&objfile->objfile_obstack, size);
+ retbuf = symfile_relocate_debug_section (abfd, sectp, buf);
if (retbuf != NULL)
return retbuf;
dwarf2_read_abbrevs (bfd *abfd, struct dwarf2_cu *cu)
{
struct comp_unit_head *cu_header = &cu->header;
- char *abbrev_ptr;
+ gdb_byte *abbrev_ptr;
struct abbrev_info *cur_abbrev;
unsigned int abbrev_number, bytes_read, abbrev_name;
unsigned int abbrev_form, hash_number;
/* Load all DIEs that are interesting for partial symbols into memory. */
static struct partial_die_info *
-load_partial_dies (bfd *abfd, char *info_ptr, int building_psymtab,
+load_partial_dies (bfd *abfd, gdb_byte *info_ptr, int building_psymtab,
struct dwarf2_cu *cu)
{
struct partial_die_info *part_die;
struct partial_die_info *parent_die, *last_die, *first_die = NULL;
struct abbrev_info *abbrev;
unsigned int bytes_read;
+ unsigned int load_all = 0;
int nesting_level = 1;
parent_die = NULL;
last_die = NULL;
+ if (cu->per_cu && cu->per_cu->load_all_dies)
+ load_all = 1;
+
cu->partial_dies
= htab_create_alloc_ex (cu->header.length / 12,
partial_die_hash,
continue;
}
- /* Check whether this DIE is interesting enough to save. */
- if (!is_type_tag_for_partial (abbrev->tag)
+ /* Check whether this DIE is interesting enough to save. Normally
+ we would not be interested in members here, but there may be
+ later variables referencing them via DW_AT_specification (for
+ static members). */
+ if (!load_all
+ && !is_type_tag_for_partial (abbrev->tag)
&& abbrev->tag != DW_TAG_enumerator
&& abbrev->tag != DW_TAG_subprogram
&& abbrev->tag != DW_TAG_variable
- && abbrev->tag != DW_TAG_namespace)
+ && abbrev->tag != DW_TAG_namespace
+ && abbrev->tag != DW_TAG_member)
{
/* Otherwise we skip to the next sibling, if any. */
info_ptr = skip_one_die (info_ptr + bytes_read, abbrev, cu);
Adding more things than necessary to the hash table is harmless
except for the performance cost. Adding too few will result in
- internal errors in find_partial_die. */
+ wasted time in find_partial_die, when we reread the compilation
+ unit with load_all_dies set. */
- if (abbrev->tag == DW_TAG_subprogram
+ if (load_all
+ || abbrev->tag == DW_TAG_subprogram
|| abbrev->tag == DW_TAG_variable
|| abbrev->tag == DW_TAG_namespace
|| part_die->is_declaration)
languages we have to, both so that we can get at method physnames
to infer fully qualified class names, and for DW_AT_specification. */
if (last_die->has_children
- && (last_die->tag == DW_TAG_namespace
+ && (load_all
+ || last_die->tag == DW_TAG_namespace
|| last_die->tag == DW_TAG_enumeration_type
|| (cu->language != language_c
&& (last_die->tag == DW_TAG_class_type
/* Read a minimal amount of information into the minimal die structure. */
-static char *
+static gdb_byte *
read_partial_die (struct partial_die_info *part_die,
struct abbrev_info *abbrev,
unsigned int abbrev_len, bfd *abfd,
- char *info_ptr, struct dwarf2_cu *cu)
+ gdb_byte *info_ptr, struct dwarf2_cu *cu)
{
unsigned int bytes_read, i;
struct attribute attr;
if (has_low_pc_attr && has_high_pc_attr
&& part_die->lowpc < part_die->highpc
&& (part_die->lowpc != 0
- || (bfd_get_file_flags (abfd) & HAS_RELOC)))
+ || dwarf2_per_objfile->has_section_at_zero))
part_die->has_pc_info = 1;
return info_ptr;
}
part_die.offset = offset;
lookup_die = htab_find_with_hash (cu->partial_dies, &part_die, offset);
- if (lookup_die == NULL)
- internal_error (__FILE__, __LINE__,
- _("could not find partial DIE in cache\n"));
-
return lookup_die;
}
static struct partial_die_info *
find_partial_die (unsigned long offset, struct dwarf2_cu *cu)
{
- struct dwarf2_per_cu_data *per_cu;
+ struct dwarf2_per_cu_data *per_cu = NULL;
+ struct partial_die_info *pd = NULL;
if (offset >= cu->header.offset
&& offset < cu->header.offset + cu->header.length)
- return find_partial_die_in_comp_unit (offset, cu);
+ {
+ pd = find_partial_die_in_comp_unit (offset, cu);
+ if (pd != NULL)
+ return pd;
+ }
per_cu = dwarf2_find_containing_comp_unit (offset, cu->objfile);
}
per_cu->cu->last_used = 0;
- return find_partial_die_in_comp_unit (offset, per_cu->cu);
+ pd = find_partial_die_in_comp_unit (offset, per_cu->cu);
+
+ if (pd == NULL && per_cu->load_all_dies == 0)
+ {
+ struct cleanup *back_to;
+ struct partial_die_info comp_unit_die;
+ struct abbrev_info *abbrev;
+ unsigned int bytes_read;
+ char *info_ptr;
+
+ per_cu->load_all_dies = 1;
+
+ /* Re-read the DIEs. */
+ back_to = make_cleanup (null_cleanup, 0);
+ if (per_cu->cu->dwarf2_abbrevs == NULL)
+ {
+ dwarf2_read_abbrevs (per_cu->cu->objfile->obfd, per_cu->cu);
+ back_to = make_cleanup (dwarf2_free_abbrev_table, per_cu->cu);
+ }
+ info_ptr = per_cu->cu->header.first_die_ptr;
+ abbrev = peek_die_abbrev (info_ptr, &bytes_read, per_cu->cu);
+ info_ptr = read_partial_die (&comp_unit_die, abbrev, bytes_read,
+ per_cu->cu->objfile->obfd, info_ptr,
+ per_cu->cu);
+ if (comp_unit_die.has_children)
+ load_partial_dies (per_cu->cu->objfile->obfd, info_ptr, 0, per_cu->cu);
+ do_cleanups (back_to);
+
+ pd = find_partial_die_in_comp_unit (offset, per_cu->cu);
+ }
+
+ if (pd == NULL)
+ internal_error (__FILE__, __LINE__,
+ _("could not find partial DIE 0x%lx in cache [from module %s]\n"),
+ offset, bfd_get_filename (cu->objfile->obfd));
+ return pd;
}
/* Adjust PART_DIE before generating a symbol for it. This function
child, sibling, and parent fields. Set HAS_CHILDREN to tell
whether the die has children or not. */
-static char *
-read_full_die (struct die_info **diep, bfd *abfd, char *info_ptr,
+static gdb_byte *
+read_full_die (struct die_info **diep, bfd *abfd, gdb_byte *info_ptr,
struct dwarf2_cu *cu, int *has_children)
{
unsigned int abbrev_number, bytes_read, i, offset;
/* Read an attribute value described by an attribute form. */
-static char *
+static gdb_byte *
read_attribute_value (struct attribute *attr, unsigned form,
- bfd *abfd, char *info_ptr,
+ bfd *abfd, gdb_byte *info_ptr,
struct dwarf2_cu *cu)
{
struct comp_unit_head *cu_header = &cu->header;
/* Read an attribute described by an abbreviated attribute. */
-static char *
+static gdb_byte *
read_attribute (struct attribute *attr, struct attr_abbrev *abbrev,
- bfd *abfd, char *info_ptr, struct dwarf2_cu *cu)
+ bfd *abfd, gdb_byte *info_ptr, struct dwarf2_cu *cu)
{
attr->name = abbrev->name;
return read_attribute_value (attr, abbrev->form, abfd, info_ptr, cu);
/* read dwarf information from a buffer */
static unsigned int
-read_1_byte (bfd *abfd, char *buf)
+read_1_byte (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_8 (abfd, (bfd_byte *) buf);
+ return bfd_get_8 (abfd, buf);
}
static int
-read_1_signed_byte (bfd *abfd, char *buf)
+read_1_signed_byte (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_signed_8 (abfd, (bfd_byte *) buf);
+ return bfd_get_signed_8 (abfd, buf);
}
static unsigned int
-read_2_bytes (bfd *abfd, char *buf)
+read_2_bytes (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_16 (abfd, (bfd_byte *) buf);
+ return bfd_get_16 (abfd, buf);
}
static int
-read_2_signed_bytes (bfd *abfd, char *buf)
+read_2_signed_bytes (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_signed_16 (abfd, (bfd_byte *) buf);
+ return bfd_get_signed_16 (abfd, buf);
}
static unsigned int
-read_4_bytes (bfd *abfd, char *buf)
+read_4_bytes (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_32 (abfd, (bfd_byte *) buf);
+ return bfd_get_32 (abfd, buf);
}
static int
-read_4_signed_bytes (bfd *abfd, char *buf)
+read_4_signed_bytes (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_signed_32 (abfd, (bfd_byte *) buf);
+ return bfd_get_signed_32 (abfd, buf);
}
static unsigned long
-read_8_bytes (bfd *abfd, char *buf)
+read_8_bytes (bfd *abfd, gdb_byte *buf)
{
- return bfd_get_64 (abfd, (bfd_byte *) buf);
+ return bfd_get_64 (abfd, buf);
}
static CORE_ADDR
-read_address (bfd *abfd, char *buf, struct dwarf2_cu *cu, int *bytes_read)
+read_address (bfd *abfd, gdb_byte *buf, struct dwarf2_cu *cu,
+ unsigned int *bytes_read)
{
struct comp_unit_head *cu_header = &cu->header;
CORE_ADDR retval = 0;
switch (cu_header->addr_size)
{
case 2:
- retval = bfd_get_signed_16 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_signed_16 (abfd, buf);
break;
case 4:
- retval = bfd_get_signed_32 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_signed_32 (abfd, buf);
break;
case 8:
- retval = bfd_get_signed_64 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_signed_64 (abfd, buf);
break;
default:
internal_error (__FILE__, __LINE__,
switch (cu_header->addr_size)
{
case 2:
- retval = bfd_get_16 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_16 (abfd, buf);
break;
case 4:
- retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_32 (abfd, buf);
break;
case 8:
- retval = bfd_get_64 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_64 (abfd, buf);
break;
default:
internal_error (__FILE__, __LINE__,
As a side effect, this function sets the fields initial_length_size
and offset_size in cu_header to the values appropriate for the
length field. (The format of the initial length field determines
- the width of file offsets to be fetched later with fetch_offset().)
+ the width of file offsets to be fetched later with read_offset().)
[ Note: read_initial_length() and read_offset() are based on the
document entitled "DWARF Debugging Information Format", revision
] */
static LONGEST
-read_initial_length (bfd *abfd, char *buf, struct comp_unit_head *cu_header,
- int *bytes_read)
+read_initial_length (bfd *abfd, gdb_byte *buf, struct comp_unit_head *cu_header,
+ unsigned int *bytes_read)
{
- LONGEST retval = 0;
-
- retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+ LONGEST length = bfd_get_32 (abfd, buf);
- if (retval == 0xffffffff)
+ if (length == 0xffffffff)
{
- retval = bfd_get_64 (abfd, (bfd_byte *) buf + 4);
+ length = bfd_get_64 (abfd, buf + 4);
*bytes_read = 12;
- if (cu_header != NULL)
- {
- cu_header->initial_length_size = 12;
- cu_header->offset_size = 8;
- }
}
- else if (retval == 0)
+ else if (length == 0)
{
- /* Handle (non-standard) 64-bit DWARF2 formats such as that used
- by IRIX. */
- retval = bfd_get_64 (abfd, (bfd_byte *) buf);
+ /* Handle the (non-standard) 64-bit DWARF2 format used by IRIX. */
+ length = bfd_get_64 (abfd, buf);
*bytes_read = 8;
- if (cu_header != NULL)
- {
- cu_header->initial_length_size = 8;
- cu_header->offset_size = 8;
- }
}
else
{
*bytes_read = 4;
- if (cu_header != NULL)
- {
- cu_header->initial_length_size = 4;
- cu_header->offset_size = 4;
- }
}
- return retval;
+ if (cu_header)
+ {
+ gdb_assert (cu_header->initial_length_size == 0
+ || cu_header->initial_length_size == 4
+ || cu_header->initial_length_size == 8
+ || cu_header->initial_length_size == 12);
+
+ if (cu_header->initial_length_size != 0
+ && cu_header->initial_length_size != *bytes_read)
+ complaint (&symfile_complaints,
+ _("intermixed 32-bit and 64-bit DWARF sections"));
+
+ cu_header->initial_length_size = *bytes_read;
+ cu_header->offset_size = (*bytes_read == 4) ? 4 : 8;
+ }
+
+ return length;
}
/* Read an offset from the data stream. The size of the offset is
given by cu_header->offset_size. */
static LONGEST
-read_offset (bfd *abfd, char *buf, const struct comp_unit_head *cu_header,
- int *bytes_read)
+read_offset (bfd *abfd, gdb_byte *buf, const struct comp_unit_head *cu_header,
+ unsigned int *bytes_read)
{
LONGEST retval = 0;
switch (cu_header->offset_size)
{
case 4:
- retval = bfd_get_32 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_32 (abfd, buf);
*bytes_read = 4;
break;
case 8:
- retval = bfd_get_64 (abfd, (bfd_byte *) buf);
+ retval = bfd_get_64 (abfd, buf);
*bytes_read = 8;
break;
default:
return retval;
}
-static char *
-read_n_bytes (bfd *abfd, char *buf, unsigned int size)
+static gdb_byte *
+read_n_bytes (bfd *abfd, gdb_byte *buf, unsigned int size)
{
/* If the size of a host char is 8 bits, we can return a pointer
to the buffer, otherwise we have to copy the data to a buffer
}
static char *
-read_string (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
+read_string (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{
/* If the size of a host char is 8 bits, we can return a pointer
to the string, otherwise we have to copy the string to a buffer
*bytes_read_ptr = 1;
return NULL;
}
- *bytes_read_ptr = strlen (buf) + 1;
- return buf;
+ *bytes_read_ptr = strlen ((char *) buf) + 1;
+ return (char *) buf;
}
static char *
-read_indirect_string (bfd *abfd, char *buf,
+read_indirect_string (bfd *abfd, gdb_byte *buf,
const struct comp_unit_head *cu_header,
unsigned int *bytes_read_ptr)
{
LONGEST str_offset = read_offset (abfd, buf, cu_header,
- (int *) bytes_read_ptr);
+ bytes_read_ptr);
if (dwarf2_per_objfile->str_buffer == NULL)
{
gdb_assert (HOST_CHAR_BIT == 8);
if (dwarf2_per_objfile->str_buffer[str_offset] == '\0')
return NULL;
- return dwarf2_per_objfile->str_buffer + str_offset;
+ return (char *) (dwarf2_per_objfile->str_buffer + str_offset);
}
static unsigned long
-read_unsigned_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
+read_unsigned_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{
unsigned long result;
unsigned int num_read;
i = 0;
while (1)
{
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ byte = bfd_get_8 (abfd, buf);
buf++;
num_read++;
result |= ((unsigned long)(byte & 127) << shift);
}
static long
-read_signed_leb128 (bfd *abfd, char *buf, unsigned int *bytes_read_ptr)
+read_signed_leb128 (bfd *abfd, gdb_byte *buf, unsigned int *bytes_read_ptr)
{
long result;
- int i, shift, size, num_read;
+ int i, shift, num_read;
unsigned char byte;
result = 0;
shift = 0;
- size = 32;
num_read = 0;
i = 0;
while (1)
{
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ byte = bfd_get_8 (abfd, buf);
buf++;
num_read++;
result |= ((long)(byte & 127) << shift);
break;
}
}
- if ((shift < size) && (byte & 0x40))
- {
- result |= -(1 << shift);
- }
+ if ((shift < 8 * sizeof (result)) && (byte & 0x40))
+ result |= -(((long)1) << shift);
*bytes_read_ptr = num_read;
return result;
}
/* Return a pointer to just past the end of an LEB128 number in BUF. */
-static char *
-skip_leb128 (bfd *abfd, char *buf)
+static gdb_byte *
+skip_leb128 (bfd *abfd, gdb_byte *buf)
{
int byte;
while (1)
{
- byte = bfd_get_8 (abfd, (bfd_byte *) buf);
+ byte = bfd_get_8 (abfd, buf);
buf++;
if ((byte & 128) == 0)
return buf;
case DW_LANG_Ada95:
cu->language = language_ada;
break;
+ case DW_LANG_Modula2:
+ cu->language = language_m2;
+ break;
case DW_LANG_Cobol74:
case DW_LANG_Cobol85:
case DW_LANG_Pascal83:
- case DW_LANG_Modula2:
default:
cu->language = language_minimal;
break;
{
struct cleanup *back_to;
struct line_header *lh;
- char *line_ptr;
- int bytes_read;
+ gdb_byte *line_ptr;
+ unsigned int bytes_read;
int i;
char *cur_dir, *cur_file;
line_ptr = dwarf2_per_objfile->line_buffer + offset;
/* Read in the header. */
- lh->total_length = read_initial_length (abfd, line_ptr, NULL, &bytes_read);
+ lh->total_length =
+ read_initial_length (abfd, line_ptr, &cu->header, &bytes_read);
line_ptr += bytes_read;
if (line_ptr + lh->total_length > (dwarf2_per_objfile->line_buffer
+ dwarf2_per_objfile->line_size))
lh->opcode_base = read_1_byte (abfd, line_ptr);
line_ptr += 1;
lh->standard_opcode_lengths
- = (unsigned char *) xmalloc (lh->opcode_base * sizeof (unsigned char));
+ = xmalloc (lh->opcode_base * sizeof (lh->standard_opcode_lengths[0]));
lh->standard_opcode_lengths[0] = 1; /* This should never be used anyway. */
for (i = 1; i < lh->opcode_base; ++i)
dwarf_decode_lines (struct line_header *lh, char *comp_dir, bfd *abfd,
struct dwarf2_cu *cu, struct partial_symtab *pst)
{
- char *line_ptr;
- char *line_end;
+ gdb_byte *line_ptr;
+ gdb_byte *line_end;
unsigned int bytes_read;
unsigned char op_code, extended_op, adj_opcode;
CORE_ADDR baseaddr;
struct objfile *objfile = cu->objfile;
const int decode_for_pst_p = (pst != NULL);
+ struct subfile *last_subfile = NULL;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
directory and file name numbers in the statement program
are 1-based. */
struct file_entry *fe = &lh->file_names[file - 1];
- char *dir;
+ char *dir = NULL;
if (fe->dir_index)
dir = lh->include_dirs[fe->dir_index - 1];
- else
- dir = comp_dir;
- dwarf2_start_subfile (fe->name, dir);
+
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
}
/* Decode the table. */
lh->file_names[file - 1].included_p = 1;
if (!decode_for_pst_p)
{
+ if (last_subfile != current_subfile)
+ {
+ if (last_subfile)
+ record_line (last_subfile, 0, address);
+ last_subfile = current_subfile;
+ }
/* Append row to matrix using current values. */
record_line (current_subfile, line,
check_cu_functions (address, cu));
case DW_LNS_copy:
lh->file_names[file - 1].included_p = 1;
if (!decode_for_pst_p)
- record_line (current_subfile, line,
- check_cu_functions (address, cu));
+ {
+ if (last_subfile != current_subfile)
+ {
+ if (last_subfile)
+ record_line (last_subfile, 0, address);
+ last_subfile = current_subfile;
+ }
+ record_line (current_subfile, line,
+ check_cu_functions (address, cu));
+ }
basic_block = 0;
break;
case DW_LNS_advance_pc:
0-based, but the directory and file name numbers in
the statement program are 1-based. */
struct file_entry *fe;
- char *dir;
+ char *dir = NULL;
file = read_unsigned_leb128 (abfd, line_ptr, &bytes_read);
line_ptr += bytes_read;
fe = &lh->file_names[file - 1];
if (fe->dir_index)
dir = lh->include_dirs[fe->dir_index - 1];
- else
- dir = comp_dir;
+
if (!decode_for_pst_p)
- dwarf2_start_subfile (fe->name, dir);
+ {
+ last_subfile = current_subfile;
+ dwarf2_start_subfile (fe->name, dir, comp_dir);
+ }
}
break;
case DW_LNS_set_column:
for (file_index = 0; file_index < lh->num_file_names; file_index++)
if (lh->file_names[file_index].included_p == 1)
{
- char *include_name = lh->file_names [file_index].name;
-
- if (strcmp (include_name, pst->filename) != 0)
+ const struct file_entry fe = lh->file_names [file_index];
+ char *include_name = fe.name;
+ char *dir_name = NULL;
+ char *pst_filename = pst->filename;
+
+ if (fe.dir_index)
+ dir_name = lh->include_dirs[fe.dir_index - 1];
+
+ if (!IS_ABSOLUTE_PATH (include_name) && dir_name != NULL)
+ {
+ include_name = concat (dir_name, SLASH_STRING,
+ include_name, (char *)NULL);
+ make_cleanup (xfree, include_name);
+ }
+
+ if (!IS_ABSOLUTE_PATH (pst_filename) && pst->dirname != NULL)
+ {
+ pst_filename = concat (pst->dirname, SLASH_STRING,
+ pst_filename, (char *)NULL);
+ make_cleanup (xfree, pst_filename);
+ }
+
+ if (strcmp (include_name, pst_filename) != 0)
dwarf2_create_include_psymtab (include_name, pst, objfile);
}
}
/* 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.
+ or NULL if not known. COMP_DIR is the compilation directory for the
+ linetable's compilation unit or NULL if not known.
This routine tries to keep line numbers from identical absolute and
relative file names in a common subfile.
files.files[1].dir: /srcdir
The line number information for list0.c has to end up in a single
- subfile, so that `break /srcdir/list0.c:1' works as expected. */
+ subfile, so that `break /srcdir/list0.c:1' works as expected.
+ start_subfile will ensure that this happens provided that we pass the
+ concatenation of files.files[1].dir and files.files[1].name as the
+ subfile's name. */
static void
-dwarf2_start_subfile (char *filename, char *dirname)
+dwarf2_start_subfile (char *filename, char *dirname, char *comp_dir)
{
- /* If the filename isn't absolute, try to match an existing subfile
- with the full pathname. */
+ char *fullname;
+
+ /* 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,
+ 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
+ that represent full path names''. Thus ignoring dirname in the
+ `else' branch below isn't an issue. */
if (!IS_ABSOLUTE_PATH (filename) && dirname != NULL)
- {
- struct subfile *subfile;
- char *fullname = concat (dirname, "/", filename, NULL);
+ fullname = concat (dirname, SLASH_STRING, filename, (char *)NULL);
+ else
+ fullname = filename;
- for (subfile = subfiles; subfile; subfile = subfile->next)
- {
- if (FILENAME_CMP (subfile->name, fullname) == 0)
- {
- current_subfile = subfile;
- xfree (fullname);
- return;
- }
- }
- xfree (fullname);
- }
- start_subfile (filename, dirname);
+ start_subfile (fullname, comp_dir);
+
+ if (fullname != filename)
+ xfree (fullname);
}
static void
&& DW_BLOCK (attr)->size == 1 + cu_header->addr_size
&& DW_BLOCK (attr)->data[0] == DW_OP_addr)
{
- int dummy;
+ unsigned int dummy;
SYMBOL_VALUE_ADDRESS (sym) =
read_address (objfile->obfd, DW_BLOCK (attr)->data + 1, cu, &dummy);
/* Default assumptions.
Use the passed type or decode it from the die. */
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
if (type != NULL)
SYMBOL_TYPE (sym) = type;
else
case DW_TAG_class_type:
case DW_TAG_structure_type:
case DW_TAG_union_type:
+ case DW_TAG_set_type:
case DW_TAG_enumeration_type:
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
this objfile, so we don't need to duplicate it for
the type. */
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
- TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_NATURAL_NAME (sym);
+ TYPE_NAME (SYMBOL_TYPE (sym)) = SYMBOL_SEARCH_NAME (sym);
add_symbol_to_list (typedef_sym, list_to_add);
}
}
cu_header->addr_size,
TYPE_LENGTH (SYMBOL_TYPE
(sym)));
- SYMBOL_VALUE_BYTES (sym) = (char *)
+ SYMBOL_VALUE_BYTES (sym) =
obstack_alloc (&objfile->objfile_obstack, cu_header->addr_size);
/* NOTE: cagney/2003-05-09: In-lined store_address call with
it's body - store_unsigned_integer. */
blk->size,
TYPE_LENGTH (SYMBOL_TYPE
(sym)));
- SYMBOL_VALUE_BYTES (sym) = (char *)
+ SYMBOL_VALUE_BYTES (sym) =
obstack_alloc (&objfile->objfile_obstack, blk->size);
memcpy (SYMBOL_VALUE_BYTES (sym), blk->data, blk->size);
SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
case DW_TAG_array_type:
read_array_type (die, cu);
break;
+ case DW_TAG_set_type:
+ read_set_type (die, cu);
+ break;
case DW_TAG_pointer_type:
read_tag_pointer_type (die, cu);
break;
case DW_TAG_base_type:
read_base_type (die, cu);
break;
+ case DW_TAG_unspecified_type:
+ read_unspecified_type (die, cu);
+ break;
default:
- complaint (&symfile_complaints, _("unexepected tag in read_type_die: '%s'"),
+ complaint (&symfile_complaints, _("unexpected tag in read_type_die: '%s'"),
dwarf_tag_name (die->tag));
break;
}
return "DW_TAG_partial_unit";
case DW_TAG_imported_unit:
return "DW_TAG_imported_unit";
+ case DW_TAG_condition:
+ return "DW_TAG_condition";
+ case DW_TAG_shared_type:
+ return "DW_TAG_shared_type";
case DW_TAG_MIPS_loop:
return "DW_TAG_MIPS_loop";
+ case DW_TAG_HP_array_descriptor:
+ return "DW_TAG_HP_array_descriptor";
case DW_TAG_format_label:
return "DW_TAG_format_label";
case DW_TAG_function_template:
return "DW_TAG_function_template";
case DW_TAG_class_template:
return "DW_TAG_class_template";
+ case DW_TAG_GNU_BINCL:
+ return "DW_TAG_GNU_BINCL";
+ case DW_TAG_GNU_EINCL:
+ return "DW_TAG_GNU_EINCL";
+ case DW_TAG_upc_shared_type:
+ return "DW_TAG_upc_shared_type";
+ case DW_TAG_upc_strict_type:
+ return "DW_TAG_upc_strict_type";
+ case DW_TAG_upc_relaxed_type:
+ return "DW_TAG_upc_relaxed_type";
+ case DW_TAG_PGI_kanji_type:
+ return "DW_TAG_PGI_kanji_type";
+ case DW_TAG_PGI_interface_block:
+ return "DW_TAG_PGI_interface_block";
default:
return "DW_TAG_<unknown>";
}
return "DW_AT_virtuality";
case DW_AT_vtable_elem_location:
return "DW_AT_vtable_elem_location";
+ /* DWARF 3 values. */
case DW_AT_allocated:
return "DW_AT_allocated";
case DW_AT_associated:
return "DW_AT_call_file";
case DW_AT_call_line:
return "DW_AT_call_line";
+ case DW_AT_description:
+ return "DW_AT_description";
+ case DW_AT_binary_scale:
+ return "DW_AT_binary_scale";
+ case DW_AT_decimal_scale:
+ return "DW_AT_decimal_scale";
+ case DW_AT_small:
+ return "DW_AT_small";
+ case DW_AT_decimal_sign:
+ return "DW_AT_decimal_sign";
+ case DW_AT_digit_count:
+ return "DW_AT_digit_count";
+ case DW_AT_picture_string:
+ return "DW_AT_picture_string";
+ case DW_AT_mutable:
+ return "DW_AT_mutable";
+ case DW_AT_threads_scaled:
+ return "DW_AT_threads_scaled";
+ case DW_AT_explicit:
+ return "DW_AT_explicit";
+ case DW_AT_object_pointer:
+ return "DW_AT_object_pointer";
+ case DW_AT_endianity:
+ return "DW_AT_endianity";
+ case DW_AT_elemental:
+ return "DW_AT_elemental";
+ case DW_AT_pure:
+ return "DW_AT_pure";
+ case DW_AT_recursive:
+ return "DW_AT_recursive";
#ifdef MIPS
+ /* SGI/MIPS extensions. */
case DW_AT_MIPS_fde:
return "DW_AT_MIPS_fde";
case DW_AT_MIPS_loop_begin:
return "DW_AT_MIPS_loop_unroll_factor";
case DW_AT_MIPS_software_pipeline_depth:
return "DW_AT_MIPS_software_pipeline_depth";
-#endif
case DW_AT_MIPS_linkage_name:
return "DW_AT_MIPS_linkage_name";
-
+ case DW_AT_MIPS_stride:
+ return "DW_AT_MIPS_stride";
+ case DW_AT_MIPS_abstract_name:
+ return "DW_AT_MIPS_abstract_name";
+ case DW_AT_MIPS_clone_origin:
+ return "DW_AT_MIPS_clone_origin";
+ case DW_AT_MIPS_has_inlines:
+ return "DW_AT_MIPS_has_inlines";
+#endif
+ /* HP extensions. */
+ case DW_AT_HP_block_index:
+ return "DW_AT_HP_block_index";
+ case DW_AT_HP_unmodifiable:
+ return "DW_AT_HP_unmodifiable";
+ case DW_AT_HP_actuals_stmt_list:
+ return "DW_AT_HP_actuals_stmt_list";
+ case DW_AT_HP_proc_per_section:
+ return "DW_AT_HP_proc_per_section";
+ case DW_AT_HP_raw_data_ptr:
+ return "DW_AT_HP_raw_data_ptr";
+ case DW_AT_HP_pass_by_reference:
+ return "DW_AT_HP_pass_by_reference";
+ case DW_AT_HP_opt_level:
+ return "DW_AT_HP_opt_level";
+ case DW_AT_HP_prof_version_id:
+ return "DW_AT_HP_prof_version_id";
+ case DW_AT_HP_opt_flags:
+ return "DW_AT_HP_opt_flags";
+ case DW_AT_HP_cold_region_low_pc:
+ return "DW_AT_HP_cold_region_low_pc";
+ case DW_AT_HP_cold_region_high_pc:
+ return "DW_AT_HP_cold_region_high_pc";
+ case DW_AT_HP_all_variables_modifiable:
+ return "DW_AT_HP_all_variables_modifiable";
+ case DW_AT_HP_linkage_name:
+ return "DW_AT_HP_linkage_name";
+ case DW_AT_HP_prof_flags:
+ return "DW_AT_HP_prof_flags";
+ /* GNU extensions. */
case DW_AT_sf_names:
return "DW_AT_sf_names";
case DW_AT_src_info:
return "DW_AT_body_end";
case DW_AT_GNU_vector:
return "DW_AT_GNU_vector";
+ /* VMS extensions. */
+ case DW_AT_VMS_rtnbeg_pd_address:
+ return "DW_AT_VMS_rtnbeg_pd_address";
+ /* UPC extension. */
+ case DW_AT_upc_threads_scaled:
+ return "DW_AT_upc_threads_scaled";
+ /* PGI (STMicroelectronics) extensions. */
+ case DW_AT_PGI_lbase:
+ return "DW_AT_PGI_lbase";
+ case DW_AT_PGI_soffset:
+ return "DW_AT_PGI_soffset";
+ case DW_AT_PGI_lstride:
+ return "DW_AT_PGI_lstride";
default:
return "DW_AT_<unknown>";
}
return "DW_OP_xderef_size";
case DW_OP_nop:
return "DW_OP_nop";
- /* DWARF 3 extensions. */
+ /* DWARF 3 extensions. */
case DW_OP_push_object_address:
return "DW_OP_push_object_address";
case DW_OP_call2:
return "DW_OP_call4";
case DW_OP_call_ref:
return "DW_OP_call_ref";
- /* GNU extensions. */
+ /* GNU extensions. */
+ case DW_OP_form_tls_address:
+ return "DW_OP_form_tls_address";
+ case DW_OP_call_frame_cfa:
+ return "DW_OP_call_frame_cfa";
+ case DW_OP_bit_piece:
+ return "DW_OP_bit_piece";
case DW_OP_GNU_push_tls_address:
return "DW_OP_GNU_push_tls_address";
+ /* HP extensions. */
+ case DW_OP_HP_is_value:
+ return "DW_OP_HP_is_value";
+ case DW_OP_HP_fltconst4:
+ return "DW_OP_HP_fltconst4";
+ case DW_OP_HP_fltconst8:
+ return "DW_OP_HP_fltconst8";
+ case DW_OP_HP_mod_range:
+ return "DW_OP_HP_mod_range";
+ case DW_OP_HP_unmod_range:
+ return "DW_OP_HP_unmod_range";
+ case DW_OP_HP_tls:
+ return "DW_OP_HP_tls";
default:
return "OP_<unknown>";
}
{
switch (enc)
{
+ case DW_ATE_void:
+ return "DW_ATE_void";
case DW_ATE_address:
return "DW_ATE_address";
case DW_ATE_boolean:
return "DW_ATE_unsigned";
case DW_ATE_unsigned_char:
return "DW_ATE_unsigned_char";
+ /* DWARF 3. */
case DW_ATE_imaginary_float:
return "DW_ATE_imaginary_float";
+ case DW_ATE_packed_decimal:
+ return "DW_ATE_packed_decimal";
+ case DW_ATE_numeric_string:
+ return "DW_ATE_numeric_string";
+ case DW_ATE_edited:
+ return "DW_ATE_edited";
+ case DW_ATE_signed_fixed:
+ return "DW_ATE_signed_fixed";
+ case DW_ATE_unsigned_fixed:
+ return "DW_ATE_unsigned_fixed";
+ case DW_ATE_decimal_float:
+ return "DW_ATE_decimal_float";
+ /* HP extensions. */
+ case DW_ATE_HP_float80:
+ return "DW_ATE_HP_float80";
+ case DW_ATE_HP_complex_float80:
+ return "DW_ATE_HP_complex_float80";
+ case DW_ATE_HP_float128:
+ return "DW_ATE_HP_float128";
+ case DW_ATE_HP_complex_float128:
+ return "DW_ATE_HP_complex_float128";
+ case DW_ATE_HP_floathpintel:
+ return "DW_ATE_HP_floathpintel";
+ case DW_ATE_HP_imaginary_float80:
+ return "DW_ATE_HP_imaginary_float80";
+ case DW_ATE_HP_imaginary_float128:
+ return "DW_ATE_HP_imaginary_float128";
default:
return "DW_ATE_<unknown>";
}
return "DW_CFA_def_cfa_register";
case DW_CFA_def_cfa_offset:
return "DW_CFA_def_cfa_offset";
-
- /* DWARF 3 */
+ /* DWARF 3. */
case DW_CFA_def_cfa_expression:
return "DW_CFA_def_cfa_expression";
case DW_CFA_expression:
return "DW_CFA_def_cfa_sf";
case DW_CFA_def_cfa_offset_sf:
return "DW_CFA_def_cfa_offset_sf";
-
- /* SGI/MIPS specific */
+ case DW_CFA_val_offset:
+ return "DW_CFA_val_offset";
+ case DW_CFA_val_offset_sf:
+ return "DW_CFA_val_offset_sf";
+ case DW_CFA_val_expression:
+ return "DW_CFA_val_expression";
+ /* SGI/MIPS specific. */
case DW_CFA_MIPS_advance_loc8:
return "DW_CFA_MIPS_advance_loc8";
-
- /* GNU extensions */
+ /* GNU extensions. */
case DW_CFA_GNU_window_save:
return "DW_CFA_GNU_window_save";
case DW_CFA_GNU_args_size:
return "DW_CFA_GNU_args_size";
case DW_CFA_GNU_negative_offset_extended:
return "DW_CFA_GNU_negative_offset_extended";
-
default:
return "DW_CFA_<unknown>";
}
case DW_FORM_ref_addr:
case DW_FORM_addr:
fprintf_unfiltered (gdb_stderr, "address: ");
- print_address_numeric (DW_ADDR (&die->attrs[i]), 1, gdb_stderr);
+ deprecated_print_address_numeric (DW_ADDR (&die->attrs[i]), 1, gdb_stderr);
break;
case DW_FORM_block2:
case DW_FORM_block4:
callers will only want a very basic result and this can become a
complaint.
- When the result is a register number, the global isreg flag is set,
- otherwise it is cleared.
-
Note that stack[0] is unused except as a default error return.
Note that stack overflow is not yet handled. */
struct comp_unit_head *cu_header = &cu->header;
int i;
int size = blk->size;
- char *data = blk->data;
+ gdb_byte *data = blk->data;
CORE_ADDR stack[64];
int stacki;
unsigned int bytes_read, unsnd;
- unsigned char op;
+ gdb_byte op;
i = 0;
stacki = 0;
stack[stacki] = 0;
- isreg = 0;
while (i < size)
{
case DW_OP_reg29:
case DW_OP_reg30:
case DW_OP_reg31:
- isreg = 1;
stack[++stacki] = op - DW_OP_reg0;
if (i < size)
dwarf2_complex_location_expr_complaint ();
break;
case DW_OP_regx:
- isreg = 1;
unsnd = read_unsigned_leb128 (NULL, (data + i), &bytes_read);
i += bytes_read;
stack[++stacki] = unsnd;
static char *
file_full_name (int file, struct line_header *lh, const char *comp_dir)
{
- struct file_entry *fe = &lh->file_names[file - 1];
+ /* Is the file number a valid index into the line header's file name
+ table? Remember that file numbers start with one, not zero. */
+ if (1 <= file && file <= lh->num_file_names)
+ {
+ struct file_entry *fe = &lh->file_names[file - 1];
- if (IS_ABSOLUTE_PATH (fe->name))
- return xstrdup (fe->name);
+ if (IS_ABSOLUTE_PATH (fe->name))
+ return xstrdup (fe->name);
+ else
+ {
+ const char *dir;
+ int dir_len;
+ char *full_name;
+
+ if (fe->dir_index)
+ dir = lh->include_dirs[fe->dir_index - 1];
+ else
+ dir = comp_dir;
+
+ if (dir)
+ {
+ dir_len = strlen (dir);
+ full_name = xmalloc (dir_len + 1 + strlen (fe->name) + 1);
+ strcpy (full_name, dir);
+ full_name[dir_len] = '/';
+ strcpy (full_name + dir_len + 1, fe->name);
+ return full_name;
+ }
+ else
+ return xstrdup (fe->name);
+ }
+ }
else
{
- const char *dir;
- int dir_len;
- char *full_name;
+ /* The compiler produced a bogus file number. We can at least
+ record the macro definitions made in the file, even if we
+ won't be able to find the file by name. */
+ char fake_name[80];
+ sprintf (fake_name, "<bad macro file number %d>", file);
- if (fe->dir_index)
- dir = lh->include_dirs[fe->dir_index - 1];
- else
- dir = comp_dir;
+ complaint (&symfile_complaints,
+ _("bad file number in macro information (%d)"),
+ file);
- if (dir)
- {
- dir_len = strlen (dir);
- full_name = xmalloc (dir_len + 1 + strlen (fe->name) + 1);
- strcpy (full_name, dir);
- full_name[dir_len] = '/';
- strcpy (full_name + dir_len + 1, fe->name);
- return full_name;
- }
- else
- return xstrdup (fe->name);
+ return xstrdup (fake_name);
}
}
char *comp_dir, bfd *abfd,
struct dwarf2_cu *cu)
{
- char *mac_ptr, *mac_end;
+ gdb_byte *mac_ptr, *mac_end;
struct macro_source_file *current_file = 0;
if (dwarf2_per_objfile->macinfo_buffer == NULL)
case DW_MACINFO_define:
case DW_MACINFO_undef:
{
- int bytes_read;
+ unsigned int bytes_read;
int line;
char *body;
case DW_MACINFO_start_file:
{
- int bytes_read;
+ unsigned int bytes_read;
int line, file;
line = read_unsigned_leb128 (abfd, mac_ptr, &bytes_read);
case DW_MACINFO_vendor_ext:
{
- int bytes_read;
+ unsigned int bytes_read;
int constant;
char *string;
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
{
- if (attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ if ((attr->form == DW_FORM_data4 || attr->form == DW_FORM_data8)
+ /* ".debug_loc" may not exist at all, or the offset may be outside
+ the section. If so, fall through to the complaint in the
+ other branch. */
+ && DW_UNSND (attr) < dwarf2_per_objfile->loc_size)
{
struct dwarf2_loclist_baton *baton;
}
}
-/* Allocation function for the libiberty hash table which uses an
- obstack. */
-
-static void *
-hashtab_obstack_allocate (void *data, size_t size, size_t count)
-{
- unsigned int total = size * count;
- void *ptr = obstack_alloc ((struct obstack *) data, total);
- memset (ptr, 0, total);
- return ptr;
-}
-
-/* Trivial deallocation function for the libiberty splay tree and hash
- table - don't deallocate anything. Rely on later deletion of the
- obstack. */
-
-static void
-dummy_obstack_deallocate (void *object, void *data)
-{
- return;
-}
-
/* Trivial hash function for partial_die_info: the hash value of a DIE
is its offset in .debug_info for this objfile. */
{
dwarf2_objfile_data_key = register_objfile_data ();
- add_prefix_cmd ("dwarf2", class_maintenance, set_dwarf2_cmd,
- "Set DWARF 2 specific variables.\n"
- "Configure DWARF 2 variables such as the cache size",
+ 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 ",
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",
+ 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 ",
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.",
- "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, /* PRINT: The upper bound on the age of cached dwarf2 compilation units is %d. */
- NULL, NULL, &set_dwarf2_cmdlist,
+ &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."), _("\
+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);
}