/* The name of this DIE. Normally the value of DW_AT_name, but
sometimes a default name for unnamed DIEs. */
- char *name;
+ const char *name;
/* The linkage name, if present. */
const char *linkage_name;
/* The scope to prepend to our children. This is generally
allocated on the comp_unit_obstack, so will disappear
when this compilation unit leaves the cache. */
- char *scope;
+ const char *scope;
/* Some data associated with the partial DIE. The tag determines
which field is live. */
union
{
- char *str;
+ const char *str;
struct dwarf_block *blk;
ULONGEST unsnd;
LONGEST snd;
to the head of the member function field chain. */
struct fnfieldlist
{
- char *name;
+ const char *name;
int length;
struct nextfnfield *head;
}
static void dwarf2_start_subfile (char *, const char *, const char *);
static void dwarf2_start_symtab (struct dwarf2_cu *,
- char *, char *, CORE_ADDR);
+ const char *, const char *, CORE_ADDR);
static struct symbol *new_symbol (struct die_info *, struct type *,
struct dwarf2_cu *);
static void process_die (struct die_info *, struct dwarf2_cu *);
-static char *dwarf2_canonicalize_name (char *, struct dwarf2_cu *,
- struct obstack *);
+static const char *dwarf2_canonicalize_name (const char *, struct dwarf2_cu *,
+ struct obstack *);
-static char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
+static const char *dwarf2_name (struct die_info *die, struct dwarf2_cu *);
-static const char *dwarf2_full_name (char *name,
+static const char *dwarf2_full_name (const char *name,
struct die_info *die,
struct dwarf2_cu *cu);
static struct die_info *dwarf_alloc_die (struct dwarf2_cu *, int);
static void dwarf_decode_macros (struct dwarf2_cu *, unsigned int,
- char *, int);
+ const char *, int);
static int attr_form_is_block (struct attribute *);
static void find_file_and_directory (struct die_info *die,
struct dwarf2_cu *cu,
- char **name, char **comp_dir);
+ const char **name, const char **comp_dir);
static char *file_full_name (int file, struct line_header *lh,
const char *comp_dir);
/* The suffix for an index file. */
#define INDEX_SUFFIX ".gdb-index"
-static const char *dwarf2_physname (char *name, struct die_info *die,
+static const char *dwarf2_physname (const char *name, struct die_info *die,
struct dwarf2_cu *cu);
/* Try to locate the sections we need for DWARF 2 debugging
struct line_header *lh;
struct attribute *attr;
int i;
- char *name, *comp_dir;
+ const char *name, *comp_dir;
void **slot;
struct quick_file_names *qfn;
unsigned int line_offset;
attr = dwarf2_attr (comp_unit_die, DW_AT_GNU_dwo_name, cu);
if (attr)
{
- char *dwo_name = DW_STRING (attr);
+ const char *dwo_name = DW_STRING (attr);
const char *comp_dir_string;
struct dwo_unit *dwo_unit;
ULONGEST signature; /* Or dwo_id. */
compilation unit CU. The result will be allocated on CU's
comp_unit_obstack, or a copy of the already allocated PDI->NAME
field. NULL is returned if no prefix is necessary. */
-static char *
+static const char *
partial_die_parent_scope (struct partial_die_info *pdi,
struct dwarf2_cu *cu)
{
- char *grandparent_scope;
+ const char *grandparent_scope;
struct partial_die_info *parent, *real_pdi;
/* We need to look at our parent DIE; if we have a DW_AT_specification,
partial_die_full_name (struct partial_die_info *pdi,
struct dwarf2_cu *cu)
{
- char *parent_scope;
+ const char *parent_scope;
/* If this is a template instantiation, we can not work out the
template arguments from partial DIEs. So, unfortunately, we have
{
struct objfile *objfile = cu->objfile;
CORE_ADDR addr = 0;
- char *actual_name = NULL;
+ const char *actual_name = NULL;
CORE_ADDR baseaddr;
- int built_actual_name = 0;
+ char *built_actual_name;
baseaddr = ANOFFSET (objfile->section_offsets, SECT_OFF_TEXT (objfile));
- actual_name = partial_die_full_name (pdi, cu);
- if (actual_name)
- built_actual_name = 1;
+ built_actual_name = partial_die_full_name (pdi, cu);
+ if (built_actual_name != NULL)
+ actual_name = built_actual_name;
if (actual_name == NULL)
actual_name = pdi->name;
/* prim_record_minimal_symbol (actual_name, pdi->lowpc + baseaddr,
mst_text, objfile); */
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_BLOCK,
&objfile->global_psymbols,
0, pdi->lowpc + baseaddr,
/* prim_record_minimal_symbol (actual_name, pdi->lowpc + baseaddr,
mst_file_text, objfile); */
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_BLOCK,
&objfile->static_psymbols,
0, pdi->lowpc + baseaddr,
else
list = &objfile->static_psymbols;
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name, VAR_DOMAIN, LOC_STATIC,
+ built_actual_name != NULL, VAR_DOMAIN, LOC_STATIC,
list, 0, 0, cu->language, objfile);
}
break;
if (pdi->d.locdesc || pdi->has_type)
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
&objfile->global_psymbols,
0, addr + baseaddr,
/* Static Variable. Skip symbols without location descriptors. */
if (pdi->d.locdesc == NULL)
{
- if (built_actual_name)
- xfree (actual_name);
+ 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,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_STATIC,
&objfile->static_psymbols,
0, addr + baseaddr,
case DW_TAG_base_type:
case DW_TAG_subrange_type:
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_TYPEDEF,
&objfile->static_psymbols,
0, (CORE_ADDR) 0, cu->language, objfile);
break;
case DW_TAG_namespace:
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_TYPEDEF,
&objfile->global_psymbols,
0, (CORE_ADDR) 0, cu->language, objfile);
and that has a DW_AT_declaration attribute." */
if (!pdi->has_byte_size && pdi->is_declaration)
{
- if (built_actual_name)
- xfree (actual_name);
+ xfree (built_actual_name);
return;
}
/* NOTE: carlton/2003-10-07: See comment in new_symbol about
static vs. global. */
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
STRUCT_DOMAIN, LOC_TYPEDEF,
(cu->language == language_cplus
|| cu->language == language_java)
break;
case DW_TAG_enumerator:
add_psymbol_to_list (actual_name, strlen (actual_name),
- built_actual_name,
+ built_actual_name != NULL,
VAR_DOMAIN, LOC_CONST,
(cu->language == language_cplus
|| cu->language == language_java)
break;
}
- if (built_actual_name)
- xfree (actual_name);
+ xfree (built_actual_name);
}
/* Read a partial die corresponding to a namespace; also, add a symbol
The result is allocated on the objfile_obstack and canonicalized. */
static const char *
-dwarf2_compute_name (char *name, struct die_info *die, struct dwarf2_cu *cu,
+dwarf2_compute_name (const char *name,
+ struct die_info *die, struct dwarf2_cu *cu,
int physname)
{
struct objfile *objfile = cu->objfile;
if (cu->language == language_cplus)
{
- char *cname
+ const char *cname
= dwarf2_canonicalize_name (name, cu,
&objfile->objfile_obstack);
The output string will be canonicalized (if C++/Java). */
static const char *
-dwarf2_full_name (char *name, struct die_info *die, struct dwarf2_cu *cu)
+dwarf2_full_name (const char *name, struct die_info *die, struct dwarf2_cu *cu)
{
return dwarf2_compute_name (name, die, cu, 0);
}
The output string will be canonicalized (if C++/Java). */
static const char *
-dwarf2_physname (char *name, struct die_info *die, struct dwarf2_cu *cu)
+dwarf2_physname (const char *name, struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
struct attribute *attr;
static void
find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu,
- char **name, char **comp_dir)
+ const char **name, const char **comp_dir)
{
struct attribute *attr;
else if (producer_is_gcc_lt_4_3 (cu) && *name != NULL
&& IS_ABSOLUTE_PATH (*name))
{
- *comp_dir = ldirname (*name);
- if (*comp_dir != NULL)
- make_cleanup (xfree, *comp_dir);
+ char *d = ldirname (*name);
+
+ *comp_dir = d;
+ if (d != NULL)
+ make_cleanup (xfree, d);
}
if (*comp_dir != NULL)
{
CORE_ADDR lowpc = ((CORE_ADDR) -1);
CORE_ADDR highpc = ((CORE_ADDR) 0);
struct attribute *attr;
- char *name = NULL;
- char *comp_dir = NULL;
+ const char *name = NULL;
+ const char *comp_dir = NULL;
struct die_info *child_die;
bfd *abfd = objfile->obfd;
CORE_ADDR baseaddr;
CORE_ADDR highpc;
struct die_info *child_die;
struct attribute *attr, *call_line, *call_file;
- char *name;
+ const char *name;
CORE_ADDR baseaddr;
struct block *block;
int inlined_func = (die->tag == DW_TAG_inlined_subroutine);
struct nextfield *new_field;
struct attribute *attr;
struct field *fp;
- char *fieldname = "";
+ const char *fieldname = "";
/* Allocate a new field list entry and link it in. */
new_field = (struct nextfield *) xmalloc (sizeof (struct nextfield));
struct fnfieldlist *flp;
int i;
struct fn_field *fnp;
- char *fieldname;
+ const char *fieldname;
struct nextfnfield *new_fnfield;
struct type *this_type;
enum dwarf_access_attribute accessibility;
struct objfile *objfile = cu->objfile;
struct type *type;
struct attribute *attr;
- char *name;
+ const char *name;
/* If the definition of this type lives in .debug_types, read that type.
Don't follow DW_AT_specification though, that will take us back up
if (cu->language == language_cplus
|| cu->language == language_java)
{
- char *full_name = (char *) dwarf2_full_name (name, die, cu);
+ const char *full_name = dwarf2_full_name (name, die, cu);
/* dwarf2_full_name might have already finished building the DIE's
type. If so, there is no need to continue. */
struct field *fields = NULL;
int num_fields = 0;
int unsigned_enum = 1;
- char *name;
+ const char *name;
int flag_enum = 1;
ULONGEST mask = 0;
struct attribute *attr;
int ndim = 0;
struct cleanup *back_to;
- char *name;
+ const char *name;
element_type = die_type (die, cu);
read_module_type (struct die_info *die, struct dwarf2_cu *cu)
{
struct objfile *objfile = cu->objfile;
- char *module_name;
+ const char *module_name;
struct type *type;
module_name = dwarf2_name (die, cu);
struct type *type;
struct attribute *attr;
int encoding = 0, size = 0;
- char *name;
+ const char *name;
enum type_code code = TYPE_CODE_INT;
int type_flags = 0;
struct type *target_type = NULL;
struct attribute *attr;
LONGEST low, high;
int low_default_is_valid;
- char *name;
+ const char *name;
LONGEST negative_mask;
base_type = die_type (die, cu);
static void
dwarf2_start_symtab (struct dwarf2_cu *cu,
- char *name, char *comp_dir, CORE_ADDR low_pc)
+ const char *name, const char *comp_dir, CORE_ADDR low_pc)
{
start_symtab (name, comp_dir, low_pc);
record_debugformat ("DWARF 2");
{
struct objfile *objfile = cu->objfile;
struct symbol *sym = NULL;
- char *name;
+ const char *name;
struct attribute *attr = NULL;
struct attribute *attr2 = NULL;
CORE_ADDR baseaddr;
if (actual_name != NULL)
{
- char *die_name = dwarf2_name (die, cu);
+ const char *die_name = dwarf2_name (die, cu);
if (die_name != NULL
&& strcmp (die_name, actual_name) != 0)
/* Get name of a die, return NULL if not found. */
-static char *
-dwarf2_canonicalize_name (char *name, struct dwarf2_cu *cu,
+static const char *
+dwarf2_canonicalize_name (const char *name, struct dwarf2_cu *cu,
struct obstack *obstack)
{
if (name && cu->language == language_cplus)
/* Get name of a die, return NULL if not found. */
-static char *
+static const char *
dwarf2_name (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
static void
dwarf_decode_macro_bytes (bfd *abfd, gdb_byte *mac_ptr, gdb_byte *mac_end,
struct macro_source_file *current_file,
- struct line_header *lh, char *comp_dir,
+ struct line_header *lh, const char *comp_dir,
struct dwarf2_section_info *section,
int section_is_gnu, int section_is_dwz,
unsigned int offset_size,
static void
dwarf_decode_macros (struct dwarf2_cu *cu, unsigned int offset,
- char *comp_dir, int section_is_gnu)
+ const char *comp_dir, int section_is_gnu)
{
struct objfile *objfile = dwarf2_per_objfile->objfile;
struct line_header *lh = cu->line_header;