/* wrstabs.c -- Output stabs debugging information
- Copyright (C) 1996-2019 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.
char *ret;
s = info->type_stack;
- assert (s != NULL);
+ if (s == NULL)
+ return NULL;
info->type_stack = s->next;
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,
if (names == NULL)
{
- assert (tag != NULL);
+ if (tag == NULL)
+ return FALSE;
buf = (char *) xmalloc (10 + strlen (tag));
sprintf (buf, "xe%s:", tag);
long tindex;
char *s, *buf;
- assert (info->type_stack != NULL);
+ if (info->type_stack == NULL)
+ return FALSE;
targindex = info->type_stack->index;
if (targindex <= 0
}
strcat (buf, ";");
- if (args != NULL)
- free (args);
+ free (args);
if (! stab_push_string (info, buf, 0, definition, 0))
return FALSE;
/* 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)
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;
tindex = info->type_stack->index;
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
{
- assert (vstring);
+ if (vstring == NULL)
+ return FALSE;
vtable = (char *) xmalloc (strlen (vstring) + 3);
sprintf (vtable, "~%%%s", vstring);
free (vstring);
/* 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)
/* 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;
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)
{
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)
{
{
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. */
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. */
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);
}
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);
info->pending_lbrac = (bfd_vma) -1;
}
- assert (info->nesting > 0);
+ if (info->nesting < 1)
+ return FALSE;
--info->nesting;
{
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;