projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[AArch64] Print spaces after commas in addresses
[deliverable/binutils-gdb.git]
/
binutils
/
stabs.c
diff --git
a/binutils/stabs.c
b/binutils/stabs.c
index c2bb26615dede8b81631b51c5db7a8a810ef899c..aebde7afe97214d0d4fce7ad351c4dc22ee6c3ea 100644
(file)
--- a/
binutils/stabs.c
+++ b/
binutils/stabs.c
@@
-1,6
+1,5
@@
/* stabs.c -- Parse stabs debugging information
/* stabs.c -- Parse stabs debugging information
- Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+ Copyright (C) 1995-2016 Free Software Foundation, Inc.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
@@
-677,7
+676,7
@@
parse_stab (void *dhandle, void *handle, int type, int desc, bfd_vma value,
static bfd_boolean
parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
static bfd_boolean
parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
- int desc, bfd_vma value, const char *string)
+ int desc
ATTRIBUTE_UNUSED
, bfd_vma value, const char *string)
{
const char *p;
char *name;
{
const char *p;
char *name;
@@
-685,7
+684,6
@@
parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
debug_type dtype;
bfd_boolean synonym;
bfd_boolean self_crossref;
debug_type dtype;
bfd_boolean synonym;
bfd_boolean self_crossref;
- unsigned int lineno;
debug_type *slot;
p = strchr (string, ':');
debug_type *slot;
p = strchr (string, ':');
@@
-703,14
+701,6
@@
parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
}
}
}
}
- /* GCC 2.x puts the line number in desc. SunOS apparently puts in
- the number of bytes occupied by a type or object, which we
- ignore. */
- if (info->gcc_compiled >= 2)
- lineno = desc;
- else
- lineno = 0;
-
/* FIXME: Sometimes the special C++ names start with '.'. */
name = NULL;
if (string[0] == '$')
/* FIXME: Sometimes the special C++ names start with '.'. */
name = NULL;
if (string[0] == '$')
@@
-846,8
+836,6
@@
parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
case 'G':
{
case 'G':
{
- char leading;
- long c;
asymbol **ps;
/* A global symbol. The value must be extracted from the
asymbol **ps;
/* A global symbol. The value must be extracted from the
@@
-856,19
+844,27
@@
parse_stab_string (void *dhandle, struct stab_handle *info, int stabtype,
(debug_type **) NULL);
if (dtype == DEBUG_TYPE_NULL)
return FALSE;
(debug_type **) NULL);
if (dtype == DEBUG_TYPE_NULL)
return FALSE;
- leading = bfd_get_symbol_leading_char (info->abfd);
- for (c = info->symcount, ps = info->syms; c > 0; --c, ++ps)
+ if (name != NULL)
{
{
- const char *n;
+ char leading;
+ long c;
- n = bfd_asymbol_name (*ps);
- if (leading != '\0' && *n == leading)
- ++n;
- if (*n == *name && strcmp (n, name) == 0)
- break;
+ leading = bfd_get_symbol_leading_char (info->abfd);
+ for (c = info->symcount, ps = info->syms; c > 0; --c, ++ps)
+ {
+ const char *n;
+
+ n = bfd_asymbol_name (*ps);
+ if (leading != '\0' && *n == leading)
+ ++n;
+ if (*n == *name && strcmp (n, name) == 0)
+ break;
+ }
+
+ if (c > 0)
+ value = bfd_asymbol_value (*ps);
}
}
- if (c > 0)
- value = bfd_asymbol_value (*ps);
+
if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_GLOBAL,
value))
return FALSE;
if (! stab_record_variable (dhandle, info, name, dtype, DEBUG_GLOBAL,
value))
return FALSE;
@@
-1778,7
+1774,7
@@
parse_stab_range_type (void *dhandle, struct stab_handle *info, const char *type
else if (n3 == (bfd_signed_vma) 0xffffffff)
return debug_make_int_type (dhandle, 4, TRUE);
#ifdef BFD64
else if (n3 == (bfd_signed_vma) 0xffffffff)
return debug_make_int_type (dhandle, 4, TRUE);
#ifdef BFD64
- else if (n3 == (
(((bfd_signed_vma) 0xffffffff) << 32) | 0xffffffff)
)
+ else if (n3 == (
bfd_signed_vma) 0xffffffffffffffffLL
)
return debug_make_int_type (dhandle, 8, TRUE);
#endif
}
return debug_make_int_type (dhandle, 8, TRUE);
#endif
}
@@
-1989,6
+1985,9
@@
parse_stab_enum_type (void *dhandle, const char **pp)
if (**pp != ',')
{
bad_stab (orig);
if (**pp != ',')
{
bad_stab (orig);
+ free (name);
+ free (names);
+ free (values);
return DEBUG_TYPE_NULL;
}
++*pp;
return DEBUG_TYPE_NULL;
}
++*pp;
@@
-2028,17
+2027,14
@@
parse_stab_struct_type (void *dhandle, struct stab_handle *info,
const char *tagname, const char **pp,
bfd_boolean structp, const int *typenums)
{
const char *tagname, const char **pp,
bfd_boolean structp, const int *typenums)
{
- const char *orig;
bfd_vma size;
debug_baseclass *baseclasses;
bfd_vma size;
debug_baseclass *baseclasses;
- debug_field *fields;
+ debug_field *fields
= NULL
;
bfd_boolean statics;
debug_method *methods;
debug_type vptrbase;
bfd_boolean ownvptr;
bfd_boolean statics;
debug_method *methods;
debug_type vptrbase;
bfd_boolean ownvptr;
- orig = *pp;
-
/* Get the size. */
size = parse_number (pp, (bfd_boolean *) NULL);
/* Get the size. */
size = parse_number (pp, (bfd_boolean *) NULL);
@@
-2048,7
+2044,11
@@
parse_stab_struct_type (void *dhandle, struct stab_handle *info,
|| ! parse_stab_members (dhandle, info, tagname, pp, typenums, &methods)
|| ! parse_stab_tilde_field (dhandle, info, pp, typenums, &vptrbase,
&ownvptr))
|| ! parse_stab_members (dhandle, info, tagname, pp, typenums, &methods)
|| ! parse_stab_tilde_field (dhandle, info, pp, typenums, &vptrbase,
&ownvptr))
- return DEBUG_TYPE_NULL;
+ {
+ if (fields != NULL)
+ free (fields);
+ return DEBUG_TYPE_NULL;
+ }
if (! statics
&& baseclasses == NULL
if (! statics
&& baseclasses == NULL
@@
-2252,7
+2252,10
@@
parse_stab_struct_fields (void *dhandle, struct stab_handle *info,
{
++*pp;
if (! parse_stab_cpp_abbrev (dhandle, info, pp, fields + c))
{
++*pp;
if (! parse_stab_cpp_abbrev (dhandle, info, pp, fields + c))
- return FALSE;
+ {
+ free (fields);
+ return FALSE;
+ }
++c;
continue;
}
++c;
continue;
}
@@
-2266,6
+2269,7
@@
parse_stab_struct_fields (void *dhandle, struct stab_handle *info,
if (p == NULL)
{
bad_stab (orig);
if (p == NULL)
{
bad_stab (orig);
+ free (fields);
return FALSE;
}
return FALSE;
}
@@
-2427,7
+2431,10
@@
parse_stab_one_struct_field (void *dhandle, struct stab_handle *info,
type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
(debug_type **) NULL);
if (type == DEBUG_TYPE_NULL)
type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
(debug_type **) NULL);
if (type == DEBUG_TYPE_NULL)
- return FALSE;
+ {
+ free (name);
+ return FALSE;
+ }
if (**pp == ':')
{
if (**pp == ':')
{
@@
-2439,6
+2446,7
@@
parse_stab_one_struct_field (void *dhandle, struct stab_handle *info,
if (p == NULL)
{
bad_stab (orig);
if (p == NULL)
{
bad_stab (orig);
+ free (name);
return FALSE;
}
return FALSE;
}
@@
-2456,6
+2464,7
@@
parse_stab_one_struct_field (void *dhandle, struct stab_handle *info,
if (**pp != ',')
{
bad_stab (orig);
if (**pp != ',')
{
bad_stab (orig);
+ free (name);
return FALSE;
}
++*pp;
return FALSE;
}
++*pp;
@@
-2464,6
+2473,7
@@
parse_stab_one_struct_field (void *dhandle, struct stab_handle *info,
if (**pp != ',')
{
bad_stab (orig);
if (**pp != ',')
{
bad_stab (orig);
+ free (name);
return FALSE;
}
++*pp;
return FALSE;
}
++*pp;
@@
-2472,6
+2482,7
@@
parse_stab_one_struct_field (void *dhandle, struct stab_handle *info,
if (**pp != ';')
{
bad_stab (orig);
if (**pp != ';')
{
bad_stab (orig);
+ free (name);
return FALSE;
}
++*pp;
return FALSE;
}
++*pp;
@@
-2523,6
+2534,9
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
debug_method *methods;
unsigned int c;
unsigned int alloc;
debug_method *methods;
unsigned int c;
unsigned int alloc;
+ char *name = NULL;
+ debug_method_variant *variants = NULL;
+ char *argtypes = NULL;
*retp = NULL;
*retp = NULL;
@@
-2535,8
+2549,6
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
while (**pp != ';')
{
const char *p;
while (**pp != ';')
{
const char *p;
- char *name;
- debug_method_variant *variants;
unsigned int cvars;
unsigned int allocvars;
debug_type look_ahead_type;
unsigned int cvars;
unsigned int allocvars;
debug_type look_ahead_type;
@@
-2565,7
+2577,7
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
if (*p != '.')
{
bad_stab (orig);
if (*p != '.')
{
bad_stab (orig);
-
return FALSE
;
+
goto fail
;
}
name = savestring (*pp, p - *pp);
*pp = p + 1;
}
name = savestring (*pp, p - *pp);
*pp = p + 1;
@@
-2582,7
+2594,6
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
{
debug_type type;
bfd_boolean stub;
{
debug_type type;
bfd_boolean stub;
- char *argtypes;
enum debug_visibility visibility;
bfd_boolean constp, volatilep, staticp;
bfd_vma voffset;
enum debug_visibility visibility;
bfd_boolean constp, volatilep, staticp;
bfd_vma voffset;
@@
-2601,11
+2612,12
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
(debug_type **) NULL);
if (type == DEBUG_TYPE_NULL)
type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
(debug_type **) NULL);
if (type == DEBUG_TYPE_NULL)
- return FALSE;
+ goto fail;
+
if (**pp != ':')
{
bad_stab (orig);
if (**pp != ':')
{
bad_stab (orig);
-
return FALSE
;
+
goto fail
;
}
}
}
}
@@
-2614,7
+2626,7
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
if (p == NULL)
{
bad_stab (orig);
if (p == NULL)
{
bad_stab (orig);
-
return FALSE
;
+
goto fail
;
}
stub = FALSE;
}
stub = FALSE;
@@
-2685,7
+2697,7
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
if (**pp != ';')
{
bad_stab (orig);
if (**pp != ';')
{
bad_stab (orig);
-
return FALSE
;
+
goto fail
;
}
++*pp;
voffset &= 0x7fffffff;
}
++*pp;
voffset &= 0x7fffffff;
@@
-2716,7
+2728,7
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
if (**pp != ';')
{
bad_stab (orig);
if (**pp != ';')
{
bad_stab (orig);
-
return FALSE
;
+
goto fail
;
}
++*pp;
}
}
++*pp;
}
@@
-2751,26
+2763,25
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
argtypes string is the mangled form of the argument
types, and the full type and the physical name must be
extracted from them. */
argtypes string is the mangled form of the argument
types, and the full type and the physical name must be
extracted from them. */
- if (! stub)
- physname = argtypes;
- else
+ physname = argtypes;
+ if (stub)
{
debug_type class_type, return_type;
class_type = stab_find_type (dhandle, info, typenums);
if (class_type == DEBUG_TYPE_NULL)
{
debug_type class_type, return_type;
class_type = stab_find_type (dhandle, info, typenums);
if (class_type == DEBUG_TYPE_NULL)
-
return FALSE
;
+
goto fail
;
return_type = debug_get_return_type (dhandle, type);
if (return_type == DEBUG_TYPE_NULL)
{
bad_stab (orig);
return_type = debug_get_return_type (dhandle, type);
if (return_type == DEBUG_TYPE_NULL)
{
bad_stab (orig);
-
return FALSE
;
+
goto fail
;
}
type = parse_stab_argtypes (dhandle, info, class_type, name,
tagname, return_type, argtypes,
constp, volatilep, &physname);
if (type == DEBUG_TYPE_NULL)
}
type = parse_stab_argtypes (dhandle, info, class_type, name,
tagname, return_type, argtypes,
constp, volatilep, &physname);
if (type == DEBUG_TYPE_NULL)
-
return FALSE
;
+
goto fail
;
}
if (cvars + 1 >= allocvars)
}
if (cvars + 1 >= allocvars)
@@
-2794,7
+2805,7
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
constp,
volatilep);
if (variants[cvars] == DEBUG_METHOD_VARIANT_NULL)
constp,
volatilep);
if (variants[cvars] == DEBUG_METHOD_VARIANT_NULL)
-
return FALSE
;
+
goto fail
;
++cvars;
}
++cvars;
}
@@
-2823,6
+2834,15
@@
parse_stab_members (void *dhandle, struct stab_handle *info,
*retp = methods;
return TRUE;
*retp = methods;
return TRUE;
+
+ fail:
+ if (name != NULL)
+ free (name);
+ if (variants != NULL)
+ free (variants);
+ if (argtypes != NULL)
+ free (argtypes);
+ return FALSE;
}
/* Parse a string representing argument types for a method. Stabs
}
/* Parse a string representing argument types for a method. Stabs
@@
-2863,9
+2883,7
@@
parse_stab_argtypes (void *dhandle, struct stab_handle *info,
|| CONST_STRNEQ (argtypes, "__dt"));
is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
|| CONST_STRNEQ (argtypes, "__dt"));
is_v3 = argtypes[0] == '_' && argtypes[1] == 'Z';
- if (is_destructor || is_full_physname_constructor || is_v3)
- *pphysname = argtypes;
- else
+ if (!(is_destructor || is_full_physname_constructor || is_v3))
{
unsigned int len;
const char *const_prefix;
{
unsigned int len;
const char *const_prefix;
@@
-3277,26
+3295,26
@@
static debug_type *
stab_find_slot (struct stab_handle *info, const int *typenums)
{
int filenum;
stab_find_slot (struct stab_handle *info, const int *typenums)
{
int filenum;
- int index;
+ int
t
index;
struct stab_types **ps;
filenum = typenums[0];
struct stab_types **ps;
filenum = typenums[0];
- index = typenums[1];
+
t
index = typenums[1];
if (filenum < 0 || (unsigned int) filenum >= info->files)
{
fprintf (stderr, _("Type file number %d out of range\n"), filenum);
return NULL;
}
if (filenum < 0 || (unsigned int) filenum >= info->files)
{
fprintf (stderr, _("Type file number %d out of range\n"), filenum);
return NULL;
}
- if (index < 0)
+ if (
t
index < 0)
{
{
- fprintf (stderr, _("Type index number %d out of range\n"), index);
+ fprintf (stderr, _("Type index number %d out of range\n"),
t
index);
return NULL;
}
ps = info->file_types + filenum;
return NULL;
}
ps = info->file_types + filenum;
- while (index >= STAB_TYPES_SLOTS)
+ while (
t
index >= STAB_TYPES_SLOTS)
{
if (*ps == NULL)
{
{
if (*ps == NULL)
{
@@
-3304,7
+3322,7
@@
stab_find_slot (struct stab_handle *info, const int *typenums)
memset (*ps, 0, sizeof **ps);
}
ps = &(*ps)->next;
memset (*ps, 0, sizeof **ps);
}
ps = &(*ps)->next;
- index -= STAB_TYPES_SLOTS;
+
t
index -= STAB_TYPES_SLOTS;
}
if (*ps == NULL)
{
}
if (*ps == NULL)
{
@@
-3312,7
+3330,7
@@
stab_find_slot (struct stab_handle *info, const int *typenums)
memset (*ps, 0, sizeof **ps);
}
memset (*ps, 0, sizeof **ps);
}
- return (*ps)->types + index;
+ return (*ps)->types +
t
index;
}
/* Find a type given a type number. If the type has not been
}
/* Find a type given a type number. If the type has not been
@@
-4120,7
+4138,10
@@
stab_demangle_qualified (struct stab_demangle_info *minfo, const char **pp,
ft = debug_get_field_type (minfo->dhandle, *fields);
if (ft == NULL)
ft = debug_get_field_type (minfo->dhandle, *fields);
if (ft == NULL)
- return FALSE;
+ {
+ free (name);
+ return FALSE;
+ }
dn = debug_get_type_name (minfo->dhandle, ft);
if (dn != NULL && strcmp (dn, name) == 0)
{
dn = debug_get_type_name (minfo->dhandle, ft);
if (dn != NULL && strcmp (dn, name) == 0)
{
@@
-4667,7
+4688,7
@@
stab_demangle_type (struct stab_demangle_info *minfo, const char **pp,
case 'M':
case 'O':
{
case 'M':
case 'O':
{
- bfd_boolean memberp
, constp, volatilep
;
+ bfd_boolean memberp;
debug_type class_type = DEBUG_TYPE_NULL;
debug_type *args;
bfd_boolean varargs;
debug_type class_type = DEBUG_TYPE_NULL;
debug_type *args;
bfd_boolean varargs;
@@
-4675,8
+4696,6
@@
stab_demangle_type (struct stab_demangle_info *minfo, const char **pp,
const char *name;
memberp = **pp == 'M';
const char *name;
memberp = **pp == 'M';
- constp = FALSE;
- volatilep = FALSE;
args = NULL;
varargs = FALSE;
args = NULL;
varargs = FALSE;
@@
-4720,12
+4739,10
@@
stab_demangle_type (struct stab_demangle_info *minfo, const char **pp,
{
if (**pp == 'C')
{
{
if (**pp == 'C')
{
- constp = TRUE;
++*pp;
}
else if (**pp == 'V')
{
++*pp;
}
else if (**pp == 'V')
{
- volatilep = TRUE;
++*pp;
}
if (**pp != 'F')
++*pp;
}
if (**pp != 'F')
@@
-4786,9
+4803,6
@@
stab_demangle_type (struct stab_demangle_info *minfo, const char **pp,
case 'Q':
{
case 'Q':
{
- const char *hold;
-
- hold = *pp;
if (! stab_demangle_qualified (minfo, pp, ptype))
return FALSE;
}
if (! stab_demangle_qualified (minfo, pp, ptype))
return FALSE;
}
@@
-5157,6
+5171,11
@@
stab_demangle_v3_arglist (void *dhandle, struct stab_handle *info,
return NULL;
}
return NULL;
}
+ /* PR 13925: Cope if the demangler returns an empty
+ context for a function with no arguments. */
+ if (dc->u.s_binary.left == NULL)
+ break;
+
arg = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left,
NULL, &varargs);
if (arg == NULL)
arg = stab_demangle_v3_arg (dhandle, info, dc->u.s_binary.left,
NULL, &varargs);
if (arg == NULL)
This page took
0.030328 seconds
and
4
git commands to generate.