/* Support routines for decoding "stabs" debugging information format.
- Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
- 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
- 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ Copyright (C) 1986-2012 Free Software Foundation, Inc.
This file is part of GDB.
#include "buildsym.h"
#include "complaints.h"
#include "demangle.h"
+#include "gdb-demangle.h"
#include "language.h"
#include "doublest.h"
#include "cp-abi.h"
patch_block_stabs (struct pending *, struct pending_stabs *,
struct objfile *);
-static void fix_common_block (struct symbol *, int);
+static void fix_common_block (struct symbol *, CORE_ADDR);
static int read_type_number (char **, int *);
{
p += 2;
p = strchr (p, ':');
+ if (p == NULL)
+ {
+ complaint (&symfile_complaints,
+ _("Bad stabs string '%s'"), string);
+ return NULL;
+ }
}
/* If a nameless stab entry, all we need is the type, not the symbol.
SYMBOL_SET_NAMES (sym, string, p - string, 1, objfile);
if (SYMBOL_LANGUAGE (sym) == language_cplus)
- cp_scan_for_anonymous_namespaces (sym);
+ cp_scan_for_anonymous_namespaces (sym, objfile);
}
p++;
NULL, objfile);
if (msym != NULL)
{
- char *new_name = gdbarch_static_transform_name
+ const char *new_name = gdbarch_static_transform_name
(gdbarch, SYMBOL_LINKAGE_NAME (sym));
SYMBOL_SET_LINKAGE_NAME (sym, new_name);
NULL, objfile);
if (msym != NULL)
{
- char *new_name = gdbarch_static_transform_name
+ const char *new_name = gdbarch_static_transform_name
(gdbarch, SYMBOL_LINKAGE_NAME (sym));
SYMBOL_SET_LINKAGE_NAME (sym, new_name);
case 9:
rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
"unsigned", objfile);
+ break;
case 10:
rettype = init_type (TYPE_CODE_INT, 4, TYPE_FLAG_UNSIGNED,
"unsigned long", objfile);
\f
/* This page contains subroutines of read_type. */
-/* Replace *OLD_NAME with the method name portion of PHYSNAME. */
+/* Wrapper around method_name_from_physname to flag a complaint
+ if there is an error. */
-static void
-update_method_name_from_physname (char **old_name, char *physname)
+static char *
+stabs_method_name_from_physname (const char *physname)
{
char *method_name;
{
complaint (&symfile_complaints,
_("Method has bad physname %s\n"), physname);
- return;
+ return NULL;
}
- if (strcmp (*old_name, method_name) != 0)
- {
- xfree (*old_name);
- *old_name = method_name;
- }
- else
- xfree (method_name);
+ return method_name;
}
/* Read member function stabs info for C++ classes. The form of each member
{
int nfn_fields = 0;
int length = 0;
- /* Total number of member functions defined in this class. If the class
- defines two `f' functions, and one `g' function, then this will have
- the value 3. */
- int total_length = 0;
int i;
struct next_fnfield
{
destr_fnlist->next = fip->fnlist;
fip->fnlist = destr_fnlist;
nfn_fields++;
- total_length += has_destructor;
length -= has_destructor;
}
else if (is_v3)
- in -gstabs instead of -gstabs+
- or for static methods, which are output as a function type
instead of a method type. */
+ char *new_method_name =
+ stabs_method_name_from_physname (sublist->fn_field.physname);
- update_method_name_from_physname (&new_fnlist->fn_fieldlist.name,
- sublist->fn_field.physname);
+ if (new_method_name != NULL
+ && strcmp (new_method_name,
+ new_fnlist->fn_fieldlist.name) != 0)
+ {
+ new_fnlist->fn_fieldlist.name = new_method_name;
+ xfree (main_fn_name);
+ }
+ else
+ xfree (new_method_name);
}
else if (has_destructor && new_fnlist->fn_fieldlist.name[0] != '~')
{
new_fnlist->fn_fieldlist.name =
- concat ("~", main_fn_name, (char *)NULL);
+ obconcat (&objfile->objfile_obstack,
+ "~", main_fn_name, (char *)NULL);
xfree (main_fn_name);
}
else if (!has_stub)
new_fnlist->fn_fieldlist.name
= obsavestring (dem_opname, strlen (dem_opname),
&objfile->objfile_obstack);
+ xfree (main_fn_name);
}
new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
new_fnlist->next = fip->fnlist;
fip->fnlist = new_fnlist;
nfn_fields++;
- total_length += length;
}
}
memset (TYPE_FN_FIELDLISTS (type), 0,
sizeof (struct fn_fieldlist) * nfn_fields);
TYPE_NFN_FIELDS (type) = nfn_fields;
- TYPE_NFN_FIELDS_TOTAL (type) = total_length;
}
return 1;
struct objfile *objfile)
{
char *p;
- char *name;
+ const char *name;
char cpp_abbrev;
struct type *context;
i >= TYPE_N_BASECLASSES (t);
--i)
{
- char *name = TYPE_FIELD_NAME (t, i);
+ const char *name = TYPE_FIELD_NAME (t, i);
if (!strncmp (name, vptr_name, sizeof (vptr_name) - 2)
&& is_cplus_marker (name[sizeof (vptr_name) - 2]))
static void
complain_about_struct_wipeout (struct type *type)
{
- char *name = "";
- char *kind = "";
+ const char *name = "";
+ const char *kind = "";
if (TYPE_TAG_NAME (type))
{
SYMBOL_TYPE (xsym) = type;
TYPE_FIELD_NAME (type, n) = SYMBOL_LINKAGE_NAME (xsym);
- TYPE_FIELD_BITPOS (type, n) = SYMBOL_VALUE (xsym);
+ SET_FIELD_BITPOS (TYPE_FIELD (type, n), SYMBOL_VALUE (xsym));
TYPE_FIELD_BITSIZE (type, n) = 0;
}
if (syms == osyms)
the common block name). */
static void
-fix_common_block (struct symbol *sym, int valu)
+fix_common_block (struct symbol *sym, CORE_ADDR valu)
{
struct pending *next = (struct pending *) SYMBOL_TYPE (sym);
struct pending *ppt;
int i;
/* Name of the type, without "struct" or "union". */
- char *typename = TYPE_TAG_NAME (*type);
+ const char *typename = TYPE_TAG_NAME (*type);
if (typename == NULL)
{