binutils-gdb/binutils/rdcoff.c

839 lines
20 KiB
C
Raw Normal View History

1999-05-03 07:29:11 +00:00
/* stabs.c -- Parse COFF debugging information
Copyright (C) 1996-2023 Free Software Foundation, Inc.
1999-05-03 07:29:11 +00:00
Written by Ian Lance Taylor <ian@cygnus.com>.
This file is part of GNU Binutils.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
2007-07-05 16:54:46 +00:00
the Free Software Foundation; either version 3 of the License, or
1999-05-03 07:29:11 +00:00
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
2005-05-08 14:17:41 +00:00
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
1999-05-03 07:29:11 +00:00
/* This file contains code which parses COFF debugging information. */
#include "sysdep.h"
1999-05-03 07:29:11 +00:00
#include "bfd.h"
#include "coff/internal.h"
#include "libiberty.h"
#include "bucomm.h"
1999-05-03 07:29:11 +00:00
#include "debug.h"
#include "budbg.h"
/* FIXME: We should not need this BFD internal file. We need it for
the N_BTMASK, etc., values. */
#include "libcoff.h"
/* These macros extract the right mask and shifts for this BFD. They
assume that there is a local variable named ABFD. This is so that
macros like ISFCN and DECREF, from coff/internal.h, will work
without modification. */
#define N_BTMASK (coff_data (abfd)->local_n_btmask)
#define N_BTSHFT (coff_data (abfd)->local_n_btshft)
#define N_TMASK (coff_data (abfd)->local_n_tmask)
#define N_TSHIFT (coff_data (abfd)->local_n_tshift)
/* This structure is used to hold the symbols, as well as the current
location within the symbols. */
struct coff_symbols
{
/* The symbols. */
asymbol **syms;
/* The number of symbols. */
long symcount;
/* The index of the current symbol. */
long symno;
/* The index of the current symbol in the COFF symbol table (where
each auxent counts as a symbol). */
long coff_symno;
};
/* This structure is used to map symbol indices to types. */
1999-05-03 07:29:11 +00:00
struct coff_types
1999-05-03 07:29:11 +00:00
{
/* Next set of slots. */
struct coff_types *next;
/* Where the TYPES array starts. */
unsigned int base_index;
1999-05-03 07:29:11 +00:00
/* Slots. */
#define COFF_SLOTS (16)
debug_type types[COFF_SLOTS];
1999-05-03 07:29:11 +00:00
};
static debug_type parse_coff_base_type
(bfd *, struct coff_symbols *, struct coff_types **, long, int,
union internal_auxent *, void *);
1999-05-03 07:29:11 +00:00
static debug_type parse_coff_struct_type
(bfd *, struct coff_symbols *, struct coff_types **, int,
union internal_auxent *, void *);
1999-05-03 07:29:11 +00:00
static debug_type parse_coff_enum_type
(bfd *, struct coff_symbols *, struct coff_types **,
union internal_auxent *, void *);
1999-05-03 07:29:11 +00:00
/* Return the slot for a type. */
static debug_type *
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
coff_get_slot (void *dhandle, struct coff_types **types, long indx)
1999-05-03 07:29:11 +00:00
{
unsigned int base_index;
1999-05-03 07:29:11 +00:00
base_index = indx / COFF_SLOTS * COFF_SLOTS;
indx -= base_index;
1999-05-03 07:29:11 +00:00
while (*types && (*types)->base_index < base_index)
types = &(*types)->next;
if (*types == NULL || (*types)->base_index != base_index)
1999-05-03 07:29:11 +00:00
{
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
struct coff_types *n = debug_xzalloc (dhandle, sizeof (*n));
n->next = *types;
n->base_index = base_index;
*types = n;
1999-05-03 07:29:11 +00:00
}
return (*types)->types + indx;
1999-05-03 07:29:11 +00:00
}
/* Parse a COFF type code in NTYPE. */
static debug_type
parse_coff_type (bfd *abfd, struct coff_symbols *symbols,
struct coff_types **types, long coff_symno, int ntype,
union internal_auxent *pauxent, bool useaux,
void *dhandle)
1999-05-03 07:29:11 +00:00
{
debug_type type;
if ((ntype & ~N_BTMASK) != 0)
{
int newtype;
newtype = DECREF (ntype);
if (ISPTR (ntype))
{
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
pauxent, useaux, dhandle);
type = debug_make_pointer_type (dhandle, type);
}
else if (ISFCN (ntype))
{
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
pauxent, useaux, dhandle);
type = debug_make_function_type (dhandle, type, (debug_type *) NULL,
false);
1999-05-03 07:29:11 +00:00
}
else if (ISARY (ntype))
{
int n;
if (pauxent == NULL)
n = 0;
else
{
unsigned short *dim;
int i;
/* FIXME: If pauxent->x_sym.x_tagndx.l == 0, gdb sets
the c_naux field of the syment to 0. */
/* Move the dimensions down, so that the next array
picks up the next one. */
dim = pauxent->x_sym.x_fcnary.x_ary.x_dimen;
n = dim[0];
for (i = 0; *dim != 0 && i < DIMNUM - 1; i++, dim++)
*dim = *(dim + 1);
*dim = 0;
}
type = parse_coff_type (abfd, symbols, types, coff_symno, newtype,
pauxent, false, dhandle);
1999-05-03 07:29:11 +00:00
type = debug_make_array_type (dhandle, type,
parse_coff_base_type (abfd, symbols,
types,
coff_symno,
T_INT,
NULL, dhandle),
0, n - 1, false);
1999-05-03 07:29:11 +00:00
}
else
{
non_fatal (_("parse_coff_type: Bad type code 0x%x"), ntype);
1999-05-03 07:29:11 +00:00
return DEBUG_TYPE_NULL;
}
return type;
}
if (pauxent != NULL && (int32_t) pauxent->x_sym.x_tagndx.u32 > 0)
1999-05-03 07:29:11 +00:00
{
debug_type *slot;
/* This is a reference to an existing type. FIXME: gdb checks
that the class is not C_STRTAG, nor C_UNTAG, nor C_ENTAG. */
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
slot = coff_get_slot (dhandle, types, pauxent->x_sym.x_tagndx.u32);
1999-05-03 07:29:11 +00:00
if (*slot != DEBUG_TYPE_NULL)
return *slot;
else
return debug_make_indirect_type (dhandle, slot, (const char *) NULL);
}
/* If the aux entry has already been used for something, useaux will
have been set to false, indicating that parse_coff_base_type
should not use it. We need to do it this way, rather than simply
passing pauxent as NULL, because we need to be able handle
multiple array dimensions while still discarding pauxent after
having handled all of them. */
if (! useaux)
pauxent = NULL;
return parse_coff_base_type (abfd, symbols, types, coff_symno, ntype,
pauxent, dhandle);
}
/* Parse a basic COFF type in NTYPE. */
static debug_type
parse_coff_base_type (bfd *abfd, struct coff_symbols *symbols,
struct coff_types **types, long coff_symno, int ntype,
union internal_auxent *pauxent, void *dhandle)
1999-05-03 07:29:11 +00:00
{
debug_type ret;
const char *name = NULL;
1999-05-03 07:29:11 +00:00
switch (ntype)
{
default:
ret = debug_make_void_type (dhandle);
break;
case T_NULL:
case T_VOID:
ret = debug_make_void_type (dhandle);
name = "void";
break;
case T_CHAR:
ret = debug_make_int_type (dhandle, 1, false);
1999-05-03 07:29:11 +00:00
name = "char";
break;
case T_SHORT:
ret = debug_make_int_type (dhandle, 2, false);
1999-05-03 07:29:11 +00:00
name = "short";
break;
case T_INT:
/* FIXME: Perhaps the size should depend upon the architecture. */
ret = debug_make_int_type (dhandle, 4, false);
1999-05-03 07:29:11 +00:00
name = "int";
break;
case T_LONG:
ret = debug_make_int_type (dhandle, 4, false);
1999-05-03 07:29:11 +00:00
name = "long";
break;
case T_FLOAT:
ret = debug_make_float_type (dhandle, 4);
name = "float";
break;
case T_DOUBLE:
ret = debug_make_float_type (dhandle, 8);
name = "double";
break;
case T_LNGDBL:
ret = debug_make_float_type (dhandle, 12);
name = "long double";
break;
case T_UCHAR:
ret = debug_make_int_type (dhandle, 1, true);
1999-05-03 07:29:11 +00:00
name = "unsigned char";
break;
case T_USHORT:
ret = debug_make_int_type (dhandle, 2, true);
1999-05-03 07:29:11 +00:00
name = "unsigned short";
break;
case T_UINT:
ret = debug_make_int_type (dhandle, 4, true);
1999-05-03 07:29:11 +00:00
name = "unsigned int";
break;
case T_ULONG:
ret = debug_make_int_type (dhandle, 4, true);
1999-05-03 07:29:11 +00:00
name = "unsigned long";
break;
case T_STRUCT:
if (pauxent == NULL)
ret = debug_make_struct_type (dhandle, true, 0,
1999-05-03 07:29:11 +00:00
(debug_field *) NULL);
else
ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
dhandle);
break;
case T_UNION:
if (pauxent == NULL)
ret = debug_make_struct_type (dhandle, false, 0, (debug_field *) NULL);
1999-05-03 07:29:11 +00:00
else
ret = parse_coff_struct_type (abfd, symbols, types, ntype, pauxent,
dhandle);
break;
case T_ENUM:
if (pauxent == NULL)
ret = debug_make_enum_type (dhandle, (const char **) NULL,
(bfd_signed_vma *) NULL);
else
ret = parse_coff_enum_type (abfd, symbols, types, pauxent, dhandle);
break;
}
if (name != NULL)
ret = debug_name_type (dhandle, name, ret);
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
debug_type *slot = coff_get_slot (dhandle, types, coff_symno);
*slot = ret;
1999-05-03 07:29:11 +00:00
return ret;
}
/* Parse a struct type. */
static debug_type
parse_coff_struct_type (bfd *abfd, struct coff_symbols *symbols,
struct coff_types **types, int ntype,
union internal_auxent *pauxent, void *dhandle)
1999-05-03 07:29:11 +00:00
{
long symend;
int alloc;
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
debug_field *fields, *xfields;
1999-05-03 07:29:11 +00:00
int count;
bool done;
1999-05-03 07:29:11 +00:00
symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.u32;
1999-05-03 07:29:11 +00:00
alloc = 10;
fields = (debug_field *) xmalloc (alloc * sizeof *fields);
count = 0;
done = false;
1999-05-03 07:29:11 +00:00
while (! done
&& symbols->coff_symno < symend
&& symbols->symno < symbols->symcount)
{
asymbol *sym;
long this_coff_symno;
struct internal_syment syment;
union internal_auxent auxent;
union internal_auxent *psubaux;
bfd_vma bitpos = 0, bitsize = 0;
sym = symbols->syms[symbols->symno];
if (! bfd_coff_get_syment (abfd, sym, &syment))
{
non_fatal (_("bfd_coff_get_syment failed: %s"),
bfd_errmsg (bfd_get_error ()));
free (fields);
1999-05-03 07:29:11 +00:00
return DEBUG_TYPE_NULL;
}
this_coff_symno = symbols->coff_symno;
++symbols->symno;
symbols->coff_symno += 1 + syment.n_numaux;
if (syment.n_numaux == 0)
psubaux = NULL;
else
{
if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
{
non_fatal (_("bfd_coff_get_auxent failed: %s"),
bfd_errmsg (bfd_get_error ()));
free (fields);
1999-05-03 07:29:11 +00:00
return DEBUG_TYPE_NULL;
}
psubaux = &auxent;
}
switch (syment.n_sclass)
{
case C_MOS:
case C_MOU:
bitpos = 8 * bfd_asymbol_value (sym);
bitsize = 0;
break;
case C_FIELD:
bitpos = bfd_asymbol_value (sym);
if (psubaux != NULL)
bitsize = psubaux->x_sym.x_misc.x_lnsz.x_size;
1999-05-03 07:29:11 +00:00
break;
case C_EOS:
done = true;
1999-05-03 07:29:11 +00:00
break;
}
if (! done)
{
debug_type ftype;
debug_field f;
ftype = parse_coff_type (abfd, symbols, types, this_coff_symno,
syment.n_type, psubaux, true, dhandle);
1999-05-03 07:29:11 +00:00
f = debug_make_field (dhandle, bfd_asymbol_name (sym), ftype,
bitpos, bitsize, DEBUG_VISIBILITY_PUBLIC);
if (f == DEBUG_FIELD_NULL)
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
{
free (fields);
return DEBUG_TYPE_NULL;
}
1999-05-03 07:29:11 +00:00
if (count + 1 >= alloc)
{
alloc += 10;
fields = ((debug_field *)
xrealloc (fields, alloc * sizeof *fields));
}
fields[count] = f;
++count;
}
}
fields[count] = DEBUG_FIELD_NULL;
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
xfields = debug_xalloc (dhandle, (count + 1) * sizeof (*fields));
memcpy (xfields, fields, (count + 1) * sizeof (*fields));
free (fields);
1999-05-03 07:29:11 +00:00
return debug_make_struct_type (dhandle, ntype == T_STRUCT,
pauxent->x_sym.x_misc.x_lnsz.x_size,
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
xfields);
1999-05-03 07:29:11 +00:00
}
/* Parse an enum type. */
static debug_type
parse_coff_enum_type (bfd *abfd, struct coff_symbols *symbols,
struct coff_types **types ATTRIBUTE_UNUSED,
union internal_auxent *pauxent, void *dhandle)
1999-05-03 07:29:11 +00:00
{
long symend;
int alloc;
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
const char **names, **xnames;
bfd_signed_vma *vals, *xvals;
1999-05-03 07:29:11 +00:00
int count;
bool done;
1999-05-03 07:29:11 +00:00
symend = pauxent->x_sym.x_fcnary.x_fcn.x_endndx.u32;
1999-05-03 07:29:11 +00:00
alloc = 10;
names = (const char **) xmalloc (alloc * sizeof *names);
vals = (bfd_signed_vma *) xmalloc (alloc * sizeof *vals);
count = 0;
done = false;
1999-05-03 07:29:11 +00:00
while (! done
&& symbols->coff_symno < symend
&& symbols->symno < symbols->symcount)
{
asymbol *sym;
struct internal_syment syment;
sym = symbols->syms[symbols->symno];
if (! bfd_coff_get_syment (abfd, sym, &syment))
{
non_fatal (_("bfd_coff_get_syment failed: %s"),
bfd_errmsg (bfd_get_error ()));
free (names);
free (vals);
1999-05-03 07:29:11 +00:00
return DEBUG_TYPE_NULL;
}
++symbols->symno;
symbols->coff_symno += 1 + syment.n_numaux;
switch (syment.n_sclass)
{
case C_MOE:
if (count + 1 >= alloc)
{
alloc += 10;
names = ((const char **)
xrealloc (names, alloc * sizeof *names));
vals = ((bfd_signed_vma *)
xrealloc (vals, alloc * sizeof *vals));
}
names[count] = bfd_asymbol_name (sym);
vals[count] = bfd_asymbol_value (sym);
++count;
break;
case C_EOS:
done = true;
1999-05-03 07:29:11 +00:00
break;
}
}
names[count] = NULL;
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
vals[count] = 0;
xnames = debug_xalloc (dhandle, (count + 1) * sizeof (*names));
memcpy (xnames, names, (count + 1) * sizeof (*names));
free (names);
xvals = debug_xalloc (dhandle, (count + 1) * sizeof (*vals));
memcpy (xvals, vals, (count + 1) * sizeof (*vals));
free (vals);
return debug_make_enum_type (dhandle, xnames, xvals);
1999-05-03 07:29:11 +00:00
}
/* Handle a single COFF symbol. */
static bool
parse_coff_symbol (bfd *abfd ATTRIBUTE_UNUSED, struct coff_types **types,
asymbol *sym, long coff_symno,
struct internal_syment *psyment, void *dhandle,
debug_type type, bool within_function)
1999-05-03 07:29:11 +00:00
{
switch (psyment->n_sclass)
{
case C_NULL:
break;
case C_AUTO:
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
DEBUG_LOCAL, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
break;
2000-06-25 16:39:45 +00:00
case C_WEAKEXT:
1999-05-03 07:29:11 +00:00
case C_EXT:
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
DEBUG_GLOBAL, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_STAT:
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
(within_function
? DEBUG_LOCAL_STATIC
: DEBUG_STATIC),
bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_REG:
/* FIXME: We may need to convert the register number. */
if (! debug_record_variable (dhandle, bfd_asymbol_name (sym), type,
DEBUG_REGISTER, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_LABEL:
break;
case C_ARG:
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
DEBUG_PARM_STACK, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_REGPARM:
/* FIXME: We may need to convert the register number. */
if (! debug_record_parameter (dhandle, bfd_asymbol_name (sym), type,
DEBUG_PARM_REG, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_TPDEF:
type = debug_name_type (dhandle, bfd_asymbol_name (sym), type);
if (type == DEBUG_TYPE_NULL)
return false;
1999-05-03 07:29:11 +00:00
break;
case C_STRTAG:
case C_UNTAG:
case C_ENTAG:
{
debug_type *slot;
type = debug_tag_type (dhandle, bfd_asymbol_name (sym), type);
if (type == DEBUG_TYPE_NULL)
return false;
1999-05-03 07:29:11 +00:00
/* Store the named type into the slot, so that references get
the name. */
Use bfd_alloc memory for read_debugging_info storage Trying to free malloc'd memory used by the stabs and coff debug info parsers is complicated, and traversing the trees generated requires a lot of code. It's better to bfd_alloc the memory which allows it all to be freed without fuss when the bfd is closed. In the process of doing this I reverted most of commit a6336913332. Some of the stabs handling code grows arrays of pointers with realloc, to deal with arbitrary numbers of fields, function args, etc. The code still does that but copies over to bfd_alloc memory when finished. The alternative is to parse twice, once to size, then again to populate the arrays. I think that complication is unwarranted. Note that there is a greater than zero chance this patch breaks something, eg. that I missed an attempt to free obj_alloc memory. Also it seems there are no tests in the binutils testsuite aimed at exercising objdump --debugging. * budbg.h (finish_stab, parse_stab): Update prototypes * debug.c: Include bucomm.h. (struct debug_handle): Add "abfd" field. (debug_init): Add "abfd" param. bfd_alloc handle. (debug_xalloc, debug_xzalloc): New functions. Use throughout in place of xmalloc and memset. (debug_start_source): Remove "name_used" param. * debug.h (debug_init, debug_start_source): Update prototypes. (debug_xalloc, debug_xzalloc): Declare. * objcopy.c (copy_object): Don't free dhandle. * objdump.c (dump_bfd): Likewise. * rdcoff.c (coff_get_slot): Add dhandle arg. debug_xzalloc memory in place of xcalloc. Update callers. (parse_coff_struct_type): Don't leak on error return. Copy fields over to debug_xalloc memory. (parse_coff_enum_type): Copy names and vals over the debug_xalloc memory. * rddbg.c (read_debugging_info): Adjust debug_init call. Don't free dhandle. (read_section_stabs_debugging_info): Don't free shandle. Adjust parse_stab call. Call finish_stab on error return. (read_symbol_stabs_debugging_info): Similarly. * stabs.c (savestring): Delete unnecessary forward declaration. Add dhandle param. debug_xalloc memory. Update callers. (start_stab): Delete unnecessary casts. (finish_stab): Add "emit" param. Free file_types, so_string, and stabs handle. (parse_stab): Delete string_used param. Revert code dealing with string_used. Copy so_string passed to debug_set_filename and stored as main_filename to debug_xalloc memory. Similarly for string passed to debug_start_source and push_bincl. Copy args to debug_xalloc memory. Don't leak args. (parse_stab_enum_type): Copy names and values to debug_xalloc memory. Don't free name. (parse_stab_struct_type): Don't free fields. (parse_stab_baseclasses): Delete unnecessary cast. (parse_stab_struct_fields): Return debug_xalloc fields. (parse_stab_cpp_abbrev): Use debug_xalloc for _vb$ type name. (parse_stab_one_struct_field): Don't free name. (parse_stab_members): Copy variants and methods to debug_xalloc memory. Don't free name or argtypes. (parse_stab_argtypes): Use debug_xalloc memory for physname and args. (push_bincl): Add dhandle param. Use debug_xalloc memory. (stab_record_variable): Use debug_xalloc memory. (stab_emit_pending_vars): Don't free var list. (stab_find_slot): Add dhandle param. Use debug_xzalloc memory. Update all callers. (stab_find_tagged_type): Don't free name. Use debug_xzalloc. (stab_demangle_qualified): Don't free name. (stab_demangle_template): Don't free s1. (stab_demangle_args): Tidy pvarargs refs. Copy *pargs on success to debug_xalloc memory, free on failure. (stab_demangle_fund_type): Don't free name. (stab_demangle_v3_arglist): Copy args to debug_xalloc memory. Don't free dt.
2023-04-03 22:21:59 +09:30
slot = coff_get_slot (dhandle, types, coff_symno);
1999-05-03 07:29:11 +00:00
*slot = type;
}
break;
default:
break;
}
return true;
1999-05-03 07:29:11 +00:00
}
2000-06-25 16:39:45 +00:00
/* Determine if a symbol has external visibility. */
static bool
external_coff_symbol_p (int sym_class)
2000-06-25 16:39:45 +00:00
{
switch (sym_class)
{
case C_EXT:
case C_WEAKEXT:
return true;
2000-06-25 16:39:45 +00:00
default:
break;
}
return false;
2000-06-25 16:39:45 +00:00
}
1999-05-03 07:29:11 +00:00
/* This is the main routine. It looks through all the symbols and
handles them. */
bool
parse_coff (bfd *abfd, asymbol **syms, long symcount, void *dhandle)
1999-05-03 07:29:11 +00:00
{
struct coff_symbols symbols;
struct coff_types *types;
1999-05-03 07:29:11 +00:00
long next_c_file;
const char *fnname;
int fnclass;
int fntype;
bfd_vma fnend;
alent *linenos;
bool within_function;
1999-05-03 07:29:11 +00:00
long this_coff_symno;
symbols.syms = syms;
symbols.symcount = symcount;
symbols.symno = 0;
symbols.coff_symno = 0;
types= NULL;
1999-05-03 07:29:11 +00:00
next_c_file = -1;
fnname = NULL;
fnclass = 0;
fntype = 0;
fnend = 0;
linenos = NULL;
within_function = false;
1999-05-03 07:29:11 +00:00
while (symbols.symno < symcount)
{
asymbol *sym;
const char *name;
struct internal_syment syment;
union internal_auxent auxent;
union internal_auxent *paux;
debug_type type;
sym = syms[symbols.symno];
if (! bfd_coff_get_syment (abfd, sym, &syment))
{
non_fatal (_("bfd_coff_get_syment failed: %s"),
bfd_errmsg (bfd_get_error ()));
return false;
1999-05-03 07:29:11 +00:00
}
name = bfd_asymbol_name (sym);
this_coff_symno = symbols.coff_symno;
++symbols.symno;
symbols.coff_symno += 1 + syment.n_numaux;
/* We only worry about the first auxent, because that is the
only one which is relevant for debugging information. */
if (syment.n_numaux == 0)
paux = NULL;
else
{
if (! bfd_coff_get_auxent (abfd, sym, 0, &auxent))
{
non_fatal (_("bfd_coff_get_auxent failed: %s"),
bfd_errmsg (bfd_get_error ()));
return false;
1999-05-03 07:29:11 +00:00
}
paux = &auxent;
}
if (this_coff_symno == next_c_file && syment.n_sclass != C_FILE)
{
/* The last C_FILE symbol points to the first external
symbol. */
if (! debug_set_filename (dhandle, "*globals*"))
return false;
1999-05-03 07:29:11 +00:00
}
switch (syment.n_sclass)
{
case C_EFCN:
case C_EXTDEF:
case C_ULABEL:
case C_USTATIC:
case C_LINE:
case C_ALIAS:
case C_HIDDEN:
/* Just ignore these classes. */
break;
case C_FILE:
next_c_file = syment.n_value;
if (! debug_set_filename (dhandle, name))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_STAT:
/* Ignore static symbols with a type of T_NULL. These
represent section entries. */
if (syment.n_type == T_NULL)
break;
/* Fall through. */
case C_WEAKEXT:
1999-05-03 07:29:11 +00:00
case C_EXT:
if (ISFCN (syment.n_type))
{
fnname = name;
fnclass = syment.n_sclass;
fntype = syment.n_type;
if (syment.n_numaux > 0)
fnend = bfd_asymbol_value (sym) + auxent.x_sym.x_misc.x_fsize;
else
fnend = 0;
linenos = BFD_SEND (abfd, _get_lineno, (abfd, sym));
break;
}
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
syment.n_type, paux, true, dhandle);
1999-05-03 07:29:11 +00:00
if (type == DEBUG_TYPE_NULL)
return false;
1999-05-03 07:29:11 +00:00
if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
dhandle, type, within_function))
return false;
1999-05-03 07:29:11 +00:00
break;
case C_FCN:
if (strcmp (name, ".bf") == 0)
{
if (fnname == NULL)
{
non_fatal (_("%ld: .bf without preceding function"),
this_coff_symno);
return false;
1999-05-03 07:29:11 +00:00
}
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
DECREF (fntype), paux, false, dhandle);
1999-05-03 07:29:11 +00:00
if (type == DEBUG_TYPE_NULL)
return false;
1999-05-03 07:29:11 +00:00
if (! debug_record_function (dhandle, fnname, type,
2000-06-25 16:39:45 +00:00
external_coff_symbol_p (fnclass),
1999-05-03 07:29:11 +00:00
bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
if (linenos != NULL)
{
int base;
bfd_vma addr;
if (syment.n_numaux == 0)
base = 0;
else
base = auxent.x_sym.x_misc.x_lnsz.x_lnno - 1;
bfd_section_* macros This large patch removes the unnecessary bfd parameter from various bfd section macros and functions. The bfd is hardly ever used and if needed for the bfd_set_section_* or bfd_rename_section functions can be found via section->owner except for the com, und, abs, and ind std_section special sections. Those sections shouldn't be modified anyway. The patch also removes various bfd_get_section_<field> macros, replacing their use with bfd_section_<field>, and adds bfd_set_section_lma. I've also fixed a minor bug in gas where compressed section renaming was done directly rather than calling bfd_rename_section. This would have broken bfd_get_section_by_name and similar functions, but that hardly mattered at such a late stage in gas processing. bfd/ * bfd-in.h (bfd_get_section_name, bfd_get_section_vma), (bfd_get_section_lma, bfd_get_section_alignment), (bfd_get_section_size, bfd_get_section_flags), (bfd_get_section_userdata): Delete. (bfd_section_name, bfd_section_size, bfd_section_vma), (bfd_section_lma, bfd_section_alignment): Lose bfd parameter. (bfd_section_flags, bfd_section_userdata): New. (bfd_is_com_section): Rename parameter. * section.c (bfd_set_section_userdata, bfd_set_section_vma), (bfd_set_section_alignment, bfd_set_section_flags, bfd_rename_section), (bfd_set_section_size): Delete bfd parameter, rename section parameter. (bfd_set_section_lma): New. * bfd-in2.h: Regenerate. * mach-o.c (bfd_mach_o_init_section_from_mach_o): Delete bfd param, update callers. * aoutx.h, * bfd.c, * coff-alpha.c, * coff-arm.c, * coff-mips.c, * coff64-rs6000.c, * coffcode.h, * coffgen.c, * cofflink.c, * compress.c, * ecoff.c, * elf-eh-frame.c, * elf-hppa.h, * elf-ifunc.c, * elf-m10200.c, * elf-m10300.c, * elf-properties.c, * elf-s390-common.c, * elf-vxworks.c, * elf.c, * elf32-arc.c, * elf32-arm.c, * elf32-avr.c, * elf32-bfin.c, * elf32-cr16.c, * elf32-cr16c.c, * elf32-cris.c, * elf32-crx.c, * elf32-csky.c, * elf32-d10v.c, * elf32-epiphany.c, * elf32-fr30.c, * elf32-frv.c, * elf32-ft32.c, * elf32-h8300.c, * elf32-hppa.c, * elf32-i386.c, * elf32-ip2k.c, * elf32-iq2000.c, * elf32-lm32.c, * elf32-m32c.c, * elf32-m32r.c, * elf32-m68hc1x.c, * elf32-m68k.c, * elf32-mcore.c, * elf32-mep.c, * elf32-metag.c, * elf32-microblaze.c, * elf32-moxie.c, * elf32-msp430.c, * elf32-mt.c, * elf32-nds32.c, * elf32-nios2.c, * elf32-or1k.c, * elf32-ppc.c, * elf32-pru.c, * elf32-rl78.c, * elf32-rx.c, * elf32-s390.c, * elf32-score.c, * elf32-score7.c, * elf32-sh.c, * elf32-spu.c, * elf32-tic6x.c, * elf32-tilepro.c, * elf32-v850.c, * elf32-vax.c, * elf32-visium.c, * elf32-xstormy16.c, * elf32-xtensa.c, * elf64-alpha.c, * elf64-bpf.c, * elf64-hppa.c, * elf64-ia64-vms.c, * elf64-mmix.c, * elf64-ppc.c, * elf64-s390.c, * elf64-sparc.c, * elf64-x86-64.c, * elflink.c, * elfnn-aarch64.c, * elfnn-ia64.c, * elfnn-riscv.c, * elfxx-aarch64.c, * elfxx-mips.c, * elfxx-sparc.c, * elfxx-tilegx.c, * elfxx-x86.c, * i386msdos.c, * linker.c, * mach-o.c, * mmo.c, * opncls.c, * pdp11.c, * pei-x86_64.c, * peicode.h, * reloc.c, * section.c, * syms.c, * vms-alpha.c, * xcofflink.c: Update throughout for bfd section macro and function changes. binutils/ * addr2line.c, * bucomm.c, * coffgrok.c, * dlltool.c, * nm.c, * objcopy.c, * objdump.c, * od-elf32_avr.c, * od-macho.c, * od-xcoff.c, * prdbg.c, * rdcoff.c, * rddbg.c, * rescoff.c, * resres.c, * size.c, * srconv.c, * strings.c, * windmc.c: Update throughout for bfd section macro and function changes. gas/ * as.c, * as.h, * dw2gencfi.c, * dwarf2dbg.c, * ecoff.c, * read.c, * stabs.c, * subsegs.c, * subsegs.h, * write.c, * config/obj-coff-seh.c, * config/obj-coff.c, * config/obj-ecoff.c, * config/obj-elf.c, * config/obj-macho.c, * config/obj-som.c, * config/tc-aarch64.c, * config/tc-alpha.c, * config/tc-arc.c, * config/tc-arm.c, * config/tc-avr.c, * config/tc-bfin.c, * config/tc-bpf.c, * config/tc-d10v.c, * config/tc-d30v.c, * config/tc-epiphany.c, * config/tc-fr30.c, * config/tc-frv.c, * config/tc-h8300.c, * config/tc-hppa.c, * config/tc-i386.c, * config/tc-ia64.c, * config/tc-ip2k.c, * config/tc-iq2000.c, * config/tc-lm32.c, * config/tc-m32c.c, * config/tc-m32r.c, * config/tc-m68hc11.c, * config/tc-mep.c, * config/tc-microblaze.c, * config/tc-mips.c, * config/tc-mmix.c, * config/tc-mn10200.c, * config/tc-mn10300.c, * config/tc-msp430.c, * config/tc-mt.c, * config/tc-nds32.c, * config/tc-or1k.c, * config/tc-ppc.c, * config/tc-pru.c, * config/tc-rl78.c, * config/tc-rx.c, * config/tc-s12z.c, * config/tc-s390.c, * config/tc-score.c, * config/tc-score7.c, * config/tc-sh.c, * config/tc-sparc.c, * config/tc-spu.c, * config/tc-tic4x.c, * config/tc-tic54x.c, * config/tc-tic6x.c, * config/tc-tilegx.c, * config/tc-tilepro.c, * config/tc-v850.c, * config/tc-visium.c, * config/tc-wasm32.c, * config/tc-xc16x.c, * config/tc-xgate.c, * config/tc-xstormy16.c, * config/tc-xtensa.c, * config/tc-z8k.c: Update throughout for bfd section macro and function changes. * write.c (compress_debug): Use bfd_rename_section. gdb/ * aarch64-linux-tdep.c, * arm-tdep.c, * auto-load.c, * coff-pe-read.c, * coffread.c, * corelow.c, * dbxread.c, * dicos-tdep.c, * dwarf2-frame.c, * dwarf2read.c, * elfread.c, * exec.c, * fbsd-tdep.c, * gcore.c, * gdb_bfd.c, * gdb_bfd.h, * hppa-tdep.c, * i386-cygwin-tdep.c, * i386-fbsd-tdep.c, * i386-linux-tdep.c, * jit.c, * linux-tdep.c, * machoread.c, * maint.c, * mdebugread.c, * minidebug.c, * mips-linux-tdep.c, * mips-sde-tdep.c, * mips-tdep.c, * mipsread.c, * nto-tdep.c, * objfiles.c, * objfiles.h, * osabi.c, * ppc-linux-tdep.c, * ppc64-tdep.c, * record-btrace.c, * record-full.c, * remote.c, * rs6000-aix-tdep.c, * rs6000-tdep.c, * s390-linux-tdep.c, * s390-tdep.c, * solib-aix.c, * solib-dsbt.c, * solib-frv.c, * solib-spu.c, * solib-svr4.c, * solib-target.c, * spu-linux-nat.c, * spu-tdep.c, * symfile-mem.c, * symfile.c, * symmisc.c, * symtab.c, * target.c, * windows-nat.c, * xcoffread.c, * cli/cli-dump.c, * compile/compile-object-load.c, * mi/mi-interp.c: Update throughout for bfd section macro and function changes. * gcore (gcore_create_callback): Use bfd_set_section_lma. * spu-tdep.c (spu_overlay_new_objfile): Likewise. gprof/ * corefile.c, * symtab.c: Update throughout for bfd section macro and function changes. ld/ * ldcref.c, * ldctor.c, * ldelf.c, * ldlang.c, * pe-dll.c, * emultempl/aarch64elf.em, * emultempl/aix.em, * emultempl/armcoff.em, * emultempl/armelf.em, * emultempl/cr16elf.em, * emultempl/cskyelf.em, * emultempl/m68hc1xelf.em, * emultempl/m68kelf.em, * emultempl/mipself.em, * emultempl/mmix-elfnmmo.em, * emultempl/mmo.em, * emultempl/msp430.em, * emultempl/nios2elf.em, * emultempl/pe.em, * emultempl/pep.em, * emultempl/ppc64elf.em, * emultempl/xtensaelf.em: Update throughout for bfd section macro and function changes. libctf/ * ctf-open-bfd.c: Update throughout for bfd section macro changes. opcodes/ * arc-ext.c: Update throughout for bfd section macro changes. sim/ * common/sim-load.c, * common/sim-utils.c, * cris/sim-if.c, * erc32/func.c, * lm32/sim-if.c, * m32c/load.c, * m32c/trace.c, * m68hc11/interp.c, * ppc/hw_htab.c, * ppc/hw_init.c, * rl78/load.c, * rl78/trace.c, * rx/gdb-if.c, * rx/load.c, * rx/trace.c: Update throughout for bfd section macro changes.
2019-09-16 20:25:17 +09:30
addr = bfd_section_vma (bfd_asymbol_section (sym));
1999-05-03 07:29:11 +00:00
++linenos;
while (linenos->line_number != 0)
{
if (! debug_record_line (dhandle,
linenos->line_number + base,
linenos->u.offset + addr))
return false;
1999-05-03 07:29:11 +00:00
++linenos;
}
}
fnname = NULL;
linenos = NULL;
fnclass = 0;
fntype = 0;
within_function = true;
1999-05-03 07:29:11 +00:00
}
else if (strcmp (name, ".ef") == 0)
{
if (! within_function)
{
non_fatal (_("%ld: unexpected .ef\n"), this_coff_symno);
return false;
1999-05-03 07:29:11 +00:00
}
if (bfd_asymbol_value (sym) > fnend)
fnend = bfd_asymbol_value (sym);
if (! debug_end_function (dhandle, fnend))
return false;
1999-05-03 07:29:11 +00:00
fnend = 0;
within_function = false;
1999-05-03 07:29:11 +00:00
}
break;
case C_BLOCK:
if (strcmp (name, ".bb") == 0)
{
if (! debug_start_block (dhandle, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
}
else if (strcmp (name, ".eb") == 0)
{
if (! debug_end_block (dhandle, bfd_asymbol_value (sym)))
return false;
1999-05-03 07:29:11 +00:00
}
break;
default:
type = parse_coff_type (abfd, &symbols, &types, this_coff_symno,
syment.n_type, paux, true, dhandle);
1999-05-03 07:29:11 +00:00
if (type == DEBUG_TYPE_NULL)
return false;
1999-05-03 07:29:11 +00:00
if (! parse_coff_symbol (abfd, &types, sym, this_coff_symno, &syment,
dhandle, type, within_function))
return false;
1999-05-03 07:29:11 +00:00
break;
}
}
return true;
1999-05-03 07:29:11 +00:00
}