projects
/
deliverable
/
binutils-gdb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
gdb: Convert language la_lookup_symbol_nonlocal field to a method
[deliverable/binutils-gdb.git]
/
binutils
/
wrstabs.c
diff --git
a/binutils/wrstabs.c
b/binutils/wrstabs.c
index abbc6ad87db5c8893708144b1e01c3c8861dec94..0deed3151a3c9032440d8f27b374380ce36da8d9 100644
(file)
--- a/
binutils/wrstabs.c
+++ b/
binutils/wrstabs.c
@@
-1,6
+1,5
@@
/* wrstabs.c -- Output stabs debugging information
/* wrstabs.c -- Output stabs debugging information
- Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007
- Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 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.
@@
-27,6
+26,7
@@
#include <assert.h>
#include "bfd.h"
#include "libiberty.h"
#include <assert.h>
#include "bfd.h"
#include "libiberty.h"
+#include "filenames.h"
#include "safe-ctype.h"
#include "bucomm.h"
#include "debug.h"
#include "safe-ctype.h"
#include "bucomm.h"
#include "debug.h"
@@
-394,13
+394,13
@@
stab_write_symbol (struct stab_write_handle *info, int type, int desc,
static bfd_boolean
stab_push_string (struct stab_write_handle *info, const char *string,
static bfd_boolean
stab_push_string (struct stab_write_handle *info, const char *string,
- long index, bfd_boolean definition, unsigned int size)
+ long
t
index, bfd_boolean definition, unsigned int size)
{
struct stab_type_stack *s;
s = (struct stab_type_stack *) xmalloc (sizeof *s);
s->string = xstrdup (string);
{
struct stab_type_stack *s;
s = (struct stab_type_stack *) xmalloc (sizeof *s);
s->string = xstrdup (string);
- s->index = index;
+ s->index =
t
index;
s->definition = definition;
s->size = size;
s->definition = definition;
s->size = size;
@@
-418,13
+418,13
@@
stab_push_string (struct stab_write_handle *info, const char *string,
/* Push a type index which has already been defined. */
static bfd_boolean
/* Push a type index which has already been defined. */
static bfd_boolean
-stab_push_defined_type (struct stab_write_handle *info, long index,
+stab_push_defined_type (struct stab_write_handle *info, long
t
index,
unsigned int size)
{
char buf[20];
unsigned int size)
{
char buf[20];
- sprintf (buf, "%ld", index);
- return stab_push_string (info, buf, index, FALSE, size);
+ sprintf (buf, "%ld",
t
index);
+ return stab_push_string (info, buf,
t
index, FALSE, size);
}
/* Pop a type off the type stack. The caller is responsible for
}
/* Pop a type off the type stack. The caller is responsible for
@@
-437,7
+437,8
@@
stab_pop_type (struct stab_write_handle *info)
char *ret;
s = info->type_stack;
char *ret;
s = info->type_stack;
- assert (s != NULL);
+ if (s == NULL)
+ return NULL;
info->type_stack = s->next;
info->type_stack = s->next;
@@
-511,7
+512,8
@@
write_stabs_in_sections_debugging_info (bfd *abfd, void *dhandle,
if (! debug_write (dhandle, &stab_fns, (void *) &info))
return FALSE;
if (! debug_write (dhandle, &stab_fns, (void *) &info))
return FALSE;
- assert (info.pending_lbrac == (bfd_vma) -1);
+ if (info.pending_lbrac != (bfd_vma) -1)
+ return FALSE;
/* Output a trailing N_SO. */
if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
/* Output a trailing N_SO. */
if (! stab_write_symbol (&info, N_SO, 0, info.last_text_address,
@@
-586,15
+588,15
@@
stab_empty_type (void *p)
return stab_push_defined_type (info, info->type_cache.void_type, 0);
else
{
return stab_push_defined_type (info, info->type_cache.void_type, 0);
else
{
- long index;
+ long
t
index;
char buf[40];
char buf[40];
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
++info->type_index;
- sprintf (buf, "%ld=%ld",
index,
index);
+ sprintf (buf, "%ld=%ld",
tindex, t
index);
- return stab_push_string (info, buf, index, FALSE, 0);
+ return stab_push_string (info, buf,
t
index, FALSE, 0);
}
}
}
}
@@
-609,17
+611,17
@@
stab_void_type (void *p)
return stab_push_defined_type (info, info->type_cache.void_type, 0);
else
{
return stab_push_defined_type (info, info->type_cache.void_type, 0);
else
{
- long index;
+ long
t
index;
char buf[40];
char buf[40];
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
++info->type_index;
- info->type_cache.void_type = index;
+ info->type_cache.void_type =
t
index;
- sprintf (buf, "%ld=%ld",
index,
index);
+ sprintf (buf, "%ld=%ld",
tindex, t
index);
- return stab_push_string (info, buf, index, TRUE, 0);
+ return stab_push_string (info, buf,
t
index, TRUE, 0);
}
}
}
}
@@
-646,15
+648,15
@@
stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp)
return stab_push_defined_type (info, cache[size - 1], size);
else
{
return stab_push_defined_type (info, cache[size - 1], size);
else
{
- long index;
+ long
t
index;
char buf[100];
char buf[100];
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
++info->type_index;
- cache[size - 1] = index;
+ cache[size - 1] =
t
index;
- sprintf (buf, "%ld=r%ld;",
index,
index);
+ sprintf (buf, "%ld=r%ld;",
tindex, t
index);
if (unsignedp)
{
strcat (buf, "0;");
if (unsignedp)
{
strcat (buf, "0;");
@@
-679,7
+681,7
@@
stab_int_type (void *p, unsigned int size, bfd_boolean unsignedp)
abort ();
}
abort ();
}
- return stab_push_string (info, buf, index, TRUE, size);
+ return stab_push_string (info, buf,
t
index, TRUE, size);
}
}
}
}
@@
-699,7
+701,7
@@
stab_float_type (void *p, unsigned int size)
size);
else
{
size);
else
{
- long index;
+ long
t
index;
char *int_type;
char buf[50];
char *int_type;
char buf[50];
@@
-708,19
+710,19
@@
stab_float_type (void *p, unsigned int size)
return FALSE;
int_type = stab_pop_type (info);
return FALSE;
int_type = stab_pop_type (info);
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
if (size > 0
&& size - 1 < (sizeof info->type_cache.float_types
/ sizeof info->type_cache.float_types[0]))
++info->type_index;
if (size > 0
&& size - 1 < (sizeof info->type_cache.float_types
/ sizeof info->type_cache.float_types[0]))
- info->type_cache.float_types[size - 1] = index;
+ info->type_cache.float_types[size - 1] =
t
index;
- sprintf (buf, "%ld=r%s;%u;0;", index, int_type, size);
+ sprintf (buf, "%ld=r%s;%u;0;",
t
index, int_type, size);
free (int_type);
free (int_type);
- return stab_push_string (info, buf, index, TRUE, size);
+ return stab_push_string (info, buf,
t
index, TRUE, size);
}
}
}
}
@@
-731,14
+733,14
@@
stab_complex_type (void *p, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
char buf[50];
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
char buf[50];
- long index;
+ long
t
index;
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
++info->type_index;
- sprintf (buf, "%ld=r%ld;%u;0;",
index,
index, size);
+ sprintf (buf, "%ld=r%ld;%u;0;",
tindex, t
index, size);
- return stab_push_string (info, buf, index, TRUE, size * 2);
+ return stab_push_string (info, buf,
t
index, TRUE, size * 2);
}
/* Push a bfd_boolean type. We use an XCOFF predefined type, since gdb
}
/* Push a bfd_boolean type. We use an XCOFF predefined type, since gdb
@@
-748,29
+750,29
@@
static bfd_boolean
stab_bool_type (void *p, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
stab_bool_type (void *p, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long
t
index;
switch (size)
{
case 1:
switch (size)
{
case 1:
- index = -21;
+
t
index = -21;
break;
case 2:
break;
case 2:
- index = -22;
+
t
index = -22;
break;
default:
case 4:
break;
default:
case 4:
- index = -16;
+
t
index = -16;
break;
case 8:
break;
case 8:
- index = -33;
+
t
index = -33;
break;
}
break;
}
- return stab_push_defined_type (info, index, size);
+ return stab_push_defined_type (info,
t
index, size);
}
/* Push an enum type. */
}
/* Push an enum type. */
@@
-783,12
+785,13
@@
stab_enum_type (void *p, const char *tag, const char **names,
size_t len;
const char **pn;
char *buf;
size_t len;
const char **pn;
char *buf;
- long index = 0;
+ long
t
index = 0;
bfd_signed_vma *pv;
if (names == NULL)
{
bfd_signed_vma *pv;
if (names == NULL)
{
- assert (tag != NULL);
+ if (tag == NULL)
+ return FALSE;
buf = (char *) xmalloc (10 + strlen (tag));
sprintf (buf, "xe%s:", tag);
buf = (char *) xmalloc (10 + strlen (tag));
sprintf (buf, "xe%s:", tag);
@@
-811,9
+814,9
@@
stab_enum_type (void *p, const char *tag, const char **names,
strcpy (buf, "e");
else
{
strcpy (buf, "e");
else
{
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
++info->type_index;
- sprintf (buf, "%s:T%ld=e", tag, index);
+ sprintf (buf, "%s:T%ld=e", tag,
t
index);
}
for (pn = names, pv = vals; *pn != NULL; pn++, pv++)
}
for (pn = names, pv = vals; *pn != NULL; pn++, pv++)
@@
-830,7
+833,7
@@
stab_enum_type (void *p, const char *tag, const char **names,
{
/* FIXME: The size is just a guess. */
if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
{
/* FIXME: The size is just a guess. */
if (! stab_write_symbol (info, N_LSYM, 0, 0, buf)
- || ! stab_push_defined_type (info, index, 4))
+ || ! stab_push_defined_type (info,
t
index, 4))
return FALSE;
}
return FALSE;
}
@@
-847,10
+850,11
@@
stab_modify_type (struct stab_write_handle *info, int mod,
unsigned int size, long **cache, size_t *cache_alloc)
{
long targindex;
unsigned int size, long **cache, size_t *cache_alloc)
{
long targindex;
- long index;
+ long
t
index;
char *s, *buf;
char *s, *buf;
- assert (info->type_stack != NULL);
+ if (info->type_stack == NULL)
+ return FALSE;
targindex = info->type_stack->index;
if (targindex <= 0
targindex = info->type_stack->index;
if (targindex <= 0
@@
-887,8
+891,8
@@
stab_modify_type (struct stab_write_handle *info, int mod,
*cache_alloc = alloc;
}
*cache_alloc = alloc;
}
- index = (*cache)[targindex];
- if (index != 0 && ! info->type_stack->definition)
+
t
index = (*cache)[targindex];
+ if (
t
index != 0 && ! info->type_stack->definition)
{
/* We have already defined a modification of this type, and
the entry on the type stack is not a definition, so we
{
/* We have already defined a modification of this type, and
the entry on the type stack is not a definition, so we
@@
-897,22
+901,22
@@
stab_modify_type (struct stab_write_handle *info, int mod,
is a struct which we did not define at the time it was
referenced). */
free (stab_pop_type (info));
is a struct which we did not define at the time it was
referenced). */
free (stab_pop_type (info));
- if (! stab_push_defined_type (info, index, size))
+ if (! stab_push_defined_type (info,
t
index, size))
return FALSE;
}
else
{
return FALSE;
}
else
{
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (s) + 20);
++info->type_index;
s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (s) + 20);
- sprintf (buf, "%ld=%c%s", index, mod, s);
+ sprintf (buf, "%ld=%c%s",
t
index, mod, s);
free (s);
free (s);
- (*cache)[targindex] = index;
+ (*cache)[targindex] =
t
index;
- if (! stab_push_string (info, buf, index, TRUE, size))
+ if (! stab_push_string (info, buf,
t
index, TRUE, size))
return FALSE;
free (buf);
return FALSE;
free (buf);
@@
-1019,7
+1023,7
@@
stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
bfd_boolean definition;
unsigned int element_size;
char *range, *element, *buf;
bfd_boolean definition;
unsigned int element_size;
char *range, *element, *buf;
- long index;
+ long
t
index;
unsigned int size;
definition = info->type_stack->definition;
unsigned int size;
definition = info->type_stack->definition;
@@
-1033,17
+1037,17
@@
stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
if (! stringp)
{
if (! stringp)
{
- index = 0;
+
t
index = 0;
*buf = '\0';
}
else
{
/* We need to define a type in order to include the string
attribute. */
*buf = '\0';
}
else
{
/* We need to define a type in order to include the string
attribute. */
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
definition = TRUE;
++info->type_index;
definition = TRUE;
- sprintf (buf, "%ld=@S;", index);
+ sprintf (buf, "%ld=@S;",
t
index);
}
sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s",
}
sprintf (buf + strlen (buf), "ar%s;%ld;%ld;%s",
@@
-1055,7
+1059,7
@@
stab_array_type (void *p, bfd_signed_vma low, bfd_signed_vma high,
size = 0;
else
size = element_size * ((high - low) + 1);
size = 0;
else
size = element_size * ((high - low) + 1);
- if (! stab_push_string (info, buf, index, definition, size))
+ if (! stab_push_string (info, buf,
t
index, definition, size))
return FALSE;
free (buf);
return FALSE;
free (buf);
@@
-1071,7
+1075,7
@@
stab_set_type (void *p, bfd_boolean bitstringp)
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition;
char *s, *buf;
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition;
char *s, *buf;
- long index;
+ long
t
index;
definition = info->type_stack->definition;
definition = info->type_stack->definition;
@@
-1081,22
+1085,22
@@
stab_set_type (void *p, bfd_boolean bitstringp)
if (! bitstringp)
{
*buf = '\0';
if (! bitstringp)
{
*buf = '\0';
- index = 0;
+
t
index = 0;
}
else
{
/* We need to define a type in order to include the string
attribute. */
}
else
{
/* We need to define a type in order to include the string
attribute. */
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
definition = TRUE;
++info->type_index;
definition = TRUE;
- sprintf (buf, "%ld=@S;", index);
+ sprintf (buf, "%ld=@S;",
t
index);
}
sprintf (buf + strlen (buf), "S%s", s);
free (s);
}
sprintf (buf + strlen (buf), "S%s", s);
free (s);
- if (! stab_push_string (info, buf, index, definition, 0))
+ if (! stab_push_string (info, buf,
t
index, definition, 0))
return FALSE;
free (buf);
return FALSE;
free (buf);
@@
-1220,8
+1224,7
@@
stab_method_type (void *p, bfd_boolean domainp, int argcount,
}
strcat (buf, ";");
}
strcat (buf, ";");
- if (args != NULL)
- free (args);
+ free (args);
if (! stab_push_string (info, buf, 0, definition, 0))
return FALSE;
if (! stab_push_string (info, buf, 0, definition, 0))
return FALSE;
@@
-1309,25
+1312,23
@@
stab_start_struct_type (void *p, const char *tag, unsigned int id,
bfd_boolean structp, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean structp, unsigned int size)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long
t
index;
bfd_boolean definition;
bfd_boolean definition;
- char *buf;
-
- buf = (char *) xmalloc (40);
+ char buf[40];
if (id == 0)
{
if (id == 0)
{
- index = 0;
+
t
index = 0;
*buf = '\0';
definition = FALSE;
}
else
{
*buf = '\0';
definition = FALSE;
}
else
{
- index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
+
t
index = stab_get_struct_index (info, tag, id, DEBUG_KIND_ILLEGAL,
&size);
&size);
- if (index < 0)
+ if (
t
index < 0)
return FALSE;
return FALSE;
- sprintf (buf, "%ld=", index);
+ sprintf (buf, "%ld=",
t
index);
definition = TRUE;
}
definition = TRUE;
}
@@
-1335,7
+1336,7
@@
stab_start_struct_type (void *p, const char *tag, unsigned int id,
structp ? 's' : 'u',
size);
structp ? 's' : 'u',
size);
- if (! stab_push_string (info, buf, index, definition, size))
+ if (! stab_push_string (info, buf,
t
index, definition, size))
return FALSE;
info->type_stack->fields = (char *) xmalloc (1);
return FALSE;
info->type_stack->fields = (char *) xmalloc (1);
@@
-1362,8
+1363,9
@@
stab_struct_field (void *p, const char *name, bfd_vma bitpos,
/* Add this field to the end of the current struct fields, which is
currently on the top of the stack. */
/* Add this field to the end of the current struct fields, which is
currently on the top of the stack. */
+ if (info->type_stack->fields == NULL)
+ return FALSE;
- assert (info->type_stack->fields != NULL);
n = (char *) xmalloc (strlen (info->type_stack->fields)
+ strlen (name)
+ strlen (s)
n = (char *) xmalloc (strlen (info->type_stack->fields)
+ strlen (name)
+ strlen (s)
@@
-1414,14
+1416,15
@@
stab_end_struct_type (void *p)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition;
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
bfd_boolean definition;
- long index;
+ long
t
index;
unsigned int size;
char *fields, *first, *buf;
unsigned int size;
char *fields, *first, *buf;
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL || info->type_stack->fields == NULL)
+ return FALSE;
definition = info->type_stack->definition;
definition = info->type_stack->definition;
- index = info->type_stack->index;
+
t
index = info->type_stack->index;
size = info->type_stack->size;
fields = info->type_stack->fields;
first = stab_pop_type (info);
size = info->type_stack->size;
fields = info->type_stack->fields;
first = stab_pop_type (info);
@@
-1431,7
+1434,7
@@
stab_end_struct_type (void *p)
free (first);
free (fields);
free (first);
free (fields);
- if (! stab_push_string (info, buf, index, definition, size))
+ if (! stab_push_string (info, buf,
t
index, definition, size))
return FALSE;
free (buf);
return FALSE;
free (buf);
@@
-1442,18
+1445,15
@@
stab_end_struct_type (void *p)
/* Start outputting a class. */
static bfd_boolean
/* Start outputting a class. */
static bfd_boolean
-stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean structp, unsigned int size, bfd_boolean vptr, bfd_boolean ownvptr)
+stab_start_class_type (void *p, const char *tag, unsigned int id,
+ bfd_boolean structp, unsigned int size,
+ bfd_boolean vptr, bfd_boolean ownvptr)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- bfd_boolean definition;
- char *vstring;
+ bfd_boolean definition
= FALSE
;
+ char *vstring
= NULL
;
- if (! vptr || ownvptr)
- {
- definition = FALSE;
- vstring = NULL;
- }
- else
+ if (vptr && !ownvptr)
{
definition = info->type_stack->definition;
vstring = stab_pop_type (info);
{
definition = info->type_stack->definition;
vstring = stab_pop_type (info);
@@
-1468,23
+1468,24
@@
stab_start_class_type (void *p, const char *tag, unsigned int id, bfd_boolean st
if (ownvptr)
{
if (ownvptr)
{
- assert (info->type_stack->index > 0);
+ if (info->type_stack->index < 1)
+ return FALSE;
vtable = (char *) xmalloc (20);
sprintf (vtable, "~%%%ld", info->type_stack->index);
}
else
{
vtable = (char *) xmalloc (20);
sprintf (vtable, "~%%%ld", info->type_stack->index);
}
else
{
+ if (vstring == NULL)
+ return FALSE;
vtable = (char *) xmalloc (strlen (vstring) + 3);
sprintf (vtable, "~%%%s", vstring);
free (vstring);
vtable = (char *) xmalloc (strlen (vstring) + 3);
sprintf (vtable, "~%%%s", vstring);
free (vstring);
+ if (definition)
+ info->type_stack->definition = TRUE;
}
}
-
info->type_stack->vtable = vtable;
}
info->type_stack->vtable = vtable;
}
- if (definition)
- info->type_stack->definition = TRUE;
-
return TRUE;
}
return TRUE;
}
@@
-1505,7
+1506,8
@@
stab_class_static_member (void *p, const char *name, const char *physname,
/* Add this field to the end of the current struct fields, which is
currently on the top of the stack. */
/* Add this field to the end of the current struct fields, which is
currently on the top of the stack. */
- assert (info->type_stack->fields != NULL);
+ if (info->type_stack->fields == NULL)
+ return FALSE;
n = (char *) xmalloc (strlen (info->type_stack->fields)
+ strlen (name)
+ strlen (s)
n = (char *) xmalloc (strlen (info->type_stack->fields)
+ strlen (name)
+ strlen (s)
@@
-1545,7
+1547,7
@@
stab_class_static_member (void *p, const char *name, const char *physname,
/* Add a base class to the class on the type stack. */
static bfd_boolean
/* Add a base class to the class on the type stack. */
static bfd_boolean
-stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual,
+stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean
is_
virtual,
enum debug_visibility visibility)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
enum debug_visibility visibility)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
@@
-1561,7
+1563,7
@@
stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual,
/* Build the base class specifier. */
buf = (char *) xmalloc (strlen (s) + 25);
/* Build the base class specifier. */
buf = (char *) xmalloc (strlen (s) + 25);
- buf[0] = virtual ? '1' : '0';
+ buf[0] =
is_
virtual ? '1' : '0';
switch (visibility)
{
default:
switch (visibility)
{
default:
@@
-1585,7
+1587,8
@@
stab_class_baseclass (void *p, bfd_vma bitpos, bfd_boolean virtual,
/* Add the new baseclass to the existing ones. */
/* Add the new baseclass to the existing ones. */
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL || info->type_stack->fields == NULL)
+ return FALSE;
if (info->type_stack->baseclasses == NULL)
c = 0;
if (info->type_stack->baseclasses == NULL)
c = 0;
@@
-1617,7
+1620,8
@@
stab_class_start_method (void *p, const char *name)
struct stab_write_handle *info = (struct stab_write_handle *) p;
char *m;
struct stab_write_handle *info = (struct stab_write_handle *) p;
char *m;
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL || info->type_stack->fields == NULL)
+ return FALSE;
if (info->type_stack->methods == NULL)
{
if (info->type_stack->methods == NULL)
{
@@
-1662,7
+1666,8
@@
stab_class_method_var (struct stab_write_handle *info, const char *physname,
context = stab_pop_type (info);
}
context = stab_pop_type (info);
}
- assert (info->type_stack != NULL && info->type_stack->methods != NULL);
+ if (info->type_stack == NULL || info->type_stack->methods == NULL)
+ return FALSE;
switch (visibility)
{
switch (visibility)
{
@@
-1763,7
+1768,8
@@
stab_class_end_method (void *p)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- assert (info->type_stack != NULL && info->type_stack->methods != NULL);
+ if (info->type_stack == NULL || info->type_stack->methods == NULL)
+ return FALSE;
/* We allocated enough room on info->type_stack->methods to add the
trailing semicolon. */
/* We allocated enough room on info->type_stack->methods to add the
trailing semicolon. */
@@
-1782,7
+1788,10
@@
stab_end_class_type (void *p)
unsigned int i = 0;
char *buf;
unsigned int i = 0;
char *buf;
- assert (info->type_stack != NULL && info->type_stack->fields != NULL);
+ if (info->type_stack == NULL
+ || info->type_stack->string == NULL
+ || info->type_stack->fields == NULL)
+ return FALSE;
/* Work out the size we need to allocate for the class definition. */
/* Work out the size we need to allocate for the class definition. */
@@
-1855,7
+1864,8
@@
stab_typedef_type (void *p, const char *name)
struct string_hash_entry *h;
h = string_hash_lookup (&info->typedef_hash, name, FALSE, FALSE);
struct string_hash_entry *h;
h = string_hash_lookup (&info->typedef_hash, name, FALSE, FALSE);
- assert (h != NULL && h->index > 0);
+ if (h == NULL || h->index < 1)
+ return FALSE;
return stab_push_defined_type (info, h->index, h->size);
}
return stab_push_defined_type (info, h->index, h->size);
}
@@
-1867,14
+1877,14
@@
stab_tag_type (void *p, const char *name, unsigned int id,
enum debug_type_kind kind)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
enum debug_type_kind kind)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long
t
index;
unsigned int size = 0;
unsigned int size = 0;
- index = stab_get_struct_index (info, name, id, kind, &size);
- if (index < 0)
+
t
index = stab_get_struct_index (info, name, id, kind, &size);
+ if (
t
index < 0)
return FALSE;
return FALSE;
- return stab_push_defined_type (info, index, size);
+ return stab_push_defined_type (info,
t
index, size);
}
/* Define a typedef. */
}
/* Define a typedef. */
@@
-1883,24
+1893,24
@@
static bfd_boolean
stab_typdef (void *p, const char *name)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
stab_typdef (void *p, const char *name)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- long index;
+ long
t
index;
unsigned int size;
char *s, *buf;
struct string_hash_entry *h;
unsigned int size;
char *s, *buf;
struct string_hash_entry *h;
- index = info->type_stack->index;
+
t
index = info->type_stack->index;
size = info->type_stack->size;
s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
size = info->type_stack->size;
s = stab_pop_type (info);
buf = (char *) xmalloc (strlen (name) + strlen (s) + 20);
- if (index > 0)
+ if (
t
index > 0)
sprintf (buf, "%s:t%s", name, s);
else
{
sprintf (buf, "%s:t%s", name, s);
else
{
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
++info->type_index;
- sprintf (buf, "%s:t%ld=%s", name, index, s);
+ sprintf (buf, "%s:t%ld=%s", name,
t
index, s);
}
free (s);
}
free (s);
@@
-1920,7
+1930,7
@@
stab_typdef (void *p, const char *name)
/* I don't think we care about redefinitions. */
/* I don't think we care about redefinitions. */
- h->index = index;
+ h->index =
t
index;
h->size = size;
return TRUE;
h->size = size;
return TRUE;
@@
-2050,12
+2060,12
@@
stab_variable (void *p, const char *name, enum debug_var_kind kind,
if (! ISDIGIT (*s))
{
char *n;
if (! ISDIGIT (*s))
{
char *n;
- long index;
+ long
t
index;
- index = info->type_index;
+
t
index = info->type_index;
++info->type_index;
n = (char *) xmalloc (strlen (s) + 20);
++info->type_index;
n = (char *) xmalloc (strlen (s) + 20);
- sprintf (n, "%ld=%s", index, s);
+ sprintf (n, "%ld=%s",
t
index, s);
free (s);
s = n;
}
free (s);
s = n;
}
@@
-2087,7
+2097,8
@@
stab_start_function (void *p, const char *name, bfd_boolean globalp)
struct stab_write_handle *info = (struct stab_write_handle *) p;
char *rettype, *buf;
struct stab_write_handle *info = (struct stab_write_handle *) p;
char *rettype, *buf;
- assert (info->nesting == 0 && info->fun_offset == -1);
+ if (info->nesting != 0 || info->fun_offset != -1)
+ return FALSE;
rettype = stab_pop_type (info);
rettype = stab_pop_type (info);
@@
-2229,7
+2240,8
@@
stab_end_block (void *p, bfd_vma addr)
info->pending_lbrac = (bfd_vma) -1;
}
info->pending_lbrac = (bfd_vma) -1;
}
- assert (info->nesting > 0);
+ if (info->nesting < 1)
+ return FALSE;
--info->nesting;
--info->nesting;
@@
-2256,12
+2268,13
@@
stab_lineno (void *p, const char *file, unsigned long lineno, bfd_vma addr)
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
{
struct stab_write_handle *info = (struct stab_write_handle *) p;
- assert (info->lineno_filename != NULL);
+ if (info->lineno_filename == NULL)
+ return FALSE;
if (addr > info->last_text_address)
info->last_text_address = addr;
if (addr > info->last_text_address)
info->last_text_address = addr;
- if (
str
cmp (file, info->lineno_filename) != 0)
+ if (
filename_
cmp (file, info->lineno_filename) != 0)
{
if (! stab_write_symbol (info, N_SOL, 0, addr, file))
return FALSE;
{
if (! stab_write_symbol (info, N_SOL, 0, addr, file))
return FALSE;
This page took
0.03452 seconds
and
4
git commands to generate.