1991-10-24 11:28:54 +00:00
|
|
|
/* DWARF debugging format support for GDB.
|
1996-01-08 17:55:25 +00:00
|
|
|
Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996
|
|
|
|
Free Software Foundation, Inc.
|
1992-02-22 01:46:16 +00:00
|
|
|
Written by Fred Fish at Cygnus Support. Portions based on dbxread.c,
|
1991-10-24 11:28:54 +00:00
|
|
|
mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
|
|
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
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(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
|
1995-08-02 03:41:12 +00:00
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
1993-06-09 01:28:54 +00:00
|
|
|
FIXME: Do we need to generate dependencies in partial symtabs?
|
|
|
|
(Perhaps we don't need to).
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
FIXME: Resolve minor differences between what information we put in the
|
|
|
|
partial symbol table and what dbxread puts in. For example, we don't yet
|
|
|
|
put enum constants there. And dbxread seems to invent a lot of typedefs
|
|
|
|
we never see. Use the new printpsym command to see the partial symbol table
|
|
|
|
contents.
|
|
|
|
|
|
|
|
FIXME: Figure out a better way to tell gdb about the name of the function
|
|
|
|
contain the user's entry point (I.E. main())
|
|
|
|
|
|
|
|
FIXME: See other FIXME's and "ifdef 0" scattered throughout the code for
|
|
|
|
other things to work on, if you get bored. :-)
|
|
|
|
|
|
|
|
*/
|
1992-01-11 01:41:23 +00:00
|
|
|
|
1992-03-03 23:26:26 +00:00
|
|
|
#include "defs.h"
|
1991-10-24 11:28:54 +00:00
|
|
|
#include "symtab.h"
|
1992-02-22 01:46:16 +00:00
|
|
|
#include "gdbtypes.h"
|
1991-10-24 11:28:54 +00:00
|
|
|
#include "symfile.h"
|
1992-03-21 01:56:01 +00:00
|
|
|
#include "objfiles.h"
|
1991-12-01 06:47:23 +00:00
|
|
|
#include "elf/dwarf.h"
|
1992-01-11 01:41:23 +00:00
|
|
|
#include "buildsym.h"
|
1992-07-14 02:13:12 +00:00
|
|
|
#include "demangle.h"
|
1992-12-03 20:28:16 +00:00
|
|
|
#include "expression.h" /* Needed for enum exp_opcode in language.h, sigh... */
|
|
|
|
#include "language.h"
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
#include "complaints.h"
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-10-15 13:40:40 +00:00
|
|
|
#include <fcntl.h>
|
* configure.in: Check for working mmap, ansi headers, string.h,
strings.h, and memory.h.
* configure: Regenerated.
* gdb_stat.h: New file, "portable" <sys/stat.h>.
* gdb_string.h: New file, "portable" <string.h>.
* altos-xdep.c, arm-tdep.c, arm-xdep.c, convex-tdep.c,
convex-xdep.c, coredep.c, cxux-nat.c, dbxread.c, exec.c,
gould-xdep.c, hppa-tdep.c, i386aix-nat.c, i386b-nat.c,
i386mach-nat.c, i386v-nat.c, infptrace.c, m88k-nat.c, main.c,
mdebugread.c, objfiles.c, os9kread.c, procfs.c, pyr-xdep.c,
rs6000-nat.c, source.c, standalone.c, stuff.c, sun386-nat.c,
symfile.c, symm-nat.c, symm-tdep.c, symtab.c, top.c, ultra3-nat.c,
ultra3-xdep.c, umax-xdep.c, xcoffread.c: Include "gdb_stat.h"
instead of <sys/stat.h>.
* alpha-tdep.c, breakpoint.c, buildsym.c, c-typeprint.c,
ch-typeprint.c, coffread.c, command.c, core-sol2.c, core-svr4.c,
core.c, corelow.c, cp-valprint.c, dbxread.c, dcache.c, demangle.c,
dpx2-nat.c, dstread.c, dwarfread.c, elfread.c, environ.c, eval.c,
exec.c, f-lang.c, f-typeprint.c, f-valprint.c, findvar.c,
fork-child.c, gdbtypes.c, hpread.c, i386-tdep.c, infcmd.c,
inflow.c, infptrace.c, infrun.c, irix5-nat.c, language.c,
m2-typeprint.c, main.c, mdebugread.c, minsyms.c, mipsread.c,
monitor.c, nlmread.c, objfiles.c, os9kread.c, osfsolib.c, parse.c,
printcmd.c, procfs.c, regex.c, remote-adapt.c, remote-arc.c,
remote-array.c, remote-bug.c, remote-e7000.c, remote-eb.c,
remote-es.c, remote-hms.c, remote-mm.c, remote-os9k.c,
remote-pa.c, remote-sim.c, remote-st.c, remote-udi.c,
remote-utils.c, remote-vx.c, remote-vx29k.c, remote-vx68.c,
remote-vx960.c, remote-vxmips.c, remote-vxsparc.c, remote.c,
solib.c, somread.c, source.c, stabsread.c, stack.c, symfile.c,
symmisc.c, symtab.c, target.c, top.c, typeprint.c, utils.c,
valarith.c, valops.c, valprint.c, values.c, xcoffread.c: Include
"gdb_string.h" instead of <string.h>.
* gdbtk.c: Likewise.
* config/xm-sysv4.h, i386/xm-ptx.h, m68k/xm-sun3os4.h,
sparc/xm-sun4os4.h (HAVE_MMAP): Removed.
* config/xm-lynx.h, config/i386/xm-ptx.h,
config/m68k/nm-apollo68b.h, config/m68k/xm-hp300hpux.h,
config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/mips/xm-news-mips.h, config/mips/xm-riscos.h,
config/pa/hppah.h, config/rs6000/xm-rs6000.h,
config/sparc/xm-sun4os4.h, config/sparc/xm-sun4sol2.h,
config/vax/xm-vaxbsd.h, config/vax/xm-vaxult.h,
config/vax/xm-vaxult2.h (MEM_FNS_DECLARED): Removed.
* config/mips/xm-irix3.h, config/mips/xm-mips.h,
config/pa/xm-hppah.h (memcpy, memset): Removed declarations.
1995-08-01 20:14:27 +00:00
|
|
|
#include "gdb_string.h"
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
|
1992-10-15 13:40:40 +00:00
|
|
|
#ifndef NO_SYS_FILE
|
|
|
|
#include <sys/file.h>
|
|
|
|
#endif
|
|
|
|
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
/* Some macros to provide DIE info for complaints. */
|
|
|
|
|
|
|
|
#define DIE_ID (curdie!=NULL ? curdie->die_ref : 0)
|
|
|
|
#define DIE_NAME (curdie!=NULL && curdie->at_name!=NULL) ? curdie->at_name : ""
|
|
|
|
|
|
|
|
/* Complaints that can be issued during DWARF debug info reading. */
|
|
|
|
|
|
|
|
struct complaint no_bfd_get_N =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", no bfd support for %d byte data object", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint malformed_die =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", malformed DIE, bad length (%d bytes)", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint bad_die_ref =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint unknown_attribute_form =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", unknown attribute form (0x%x)", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint unknown_attribute_length =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint unexpected_fund_type =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint unknown_type_modifier =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", unknown type modifier %u", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint volatile_ignored =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", type modifier 'volatile' ignored", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint const_ignored =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", type modifier 'const' ignored", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint botched_modified_type =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint op_deref2 =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%x not handled", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint op_deref4 =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%x not handled", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint basereg_not_handled =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", BASEREG %d not handled", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint dup_user_type_allocation =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", internal error: duplicate user type allocation", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint dup_user_type_definition =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", internal error: duplicate user type definition", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint missing_tag =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", missing class, structure, or union tag", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint bad_array_element_type =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", bad array element type attribute 0x%x", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint subscript_data_items =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", can't decode subscript data items", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint unhandled_array_subscript_format =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint unknown_array_subscript_format =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", unknown array subscript format %x", 0, 0
|
|
|
|
};
|
|
|
|
|
|
|
|
struct complaint not_row_major =
|
|
|
|
{
|
|
|
|
"DIE @ 0x%x \"%s\", array not row major; not handled correctly", 0, 0
|
|
|
|
};
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
typedef unsigned int DIE_REF; /* Reference to a DIE */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-01-11 01:41:23 +00:00
|
|
|
#ifndef GCC_PRODUCER
|
|
|
|
#define GCC_PRODUCER "GNU C "
|
|
|
|
#endif
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-07-14 02:13:12 +00:00
|
|
|
#ifndef GPLUS_PRODUCER
|
|
|
|
#define GPLUS_PRODUCER "GNU C++ "
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef LCC_PRODUCER
|
* cplus-dem.c (cplus_markers): Add table for gnu style and
use throughout, in place of compile time constant CPLUS_MARKER.
* cplus-dem.c (ARM_VTABLE_STRING, ARM_VTABLE_STRLEN): Add.
* cplus-dem.c (cfront_special): New function, as suggested
by pfieland@stratus.com.
* cplus-dem.c (forget_types): New function.
* cplus-dem.c (cplus_demangle): Call gnu_special, moved from
demangle_prefix().
* cplus-dem.c (mop_up): Call forget_types().
* cplus-dem.c (AUTO_DEMANGLING, GNU_DEMANGLING, LUCID_DEMANGLING):
Use throughout, instead of checking current_demangling_style.
* cplus-dem.c (demangle_signature): When finding an explicit
start of function args, forget all remembered types for
lucid/cfront style demangling.
* cplus-dem.c (demangle_prefix): In a sequence of two or more
underbar characters, use last pair as the delimiter. Hoist
gnu_special() call up to cplus_demangle(). Call cfront_special()
when appropriate.
* cplus-dem.c (cplus_special): Fix virtual table name demangling
for inherited classes.
* cplus-dem.c (demangle_args): Document quirks of numbered
references to previously seen types.
* dbxread.c (read_ofile_symtab, process_one_symbol):
Use AUTO_DEMANGLING rather than explicitly checking
current_demangling_style.
* demangle.h: Add some comments.
* demangle.h (AUTO_DEMANGLING, GNU_DEMANGLING, LUCID_DEMANGLING,
CFRONT_DEMANGLING): New macros.
* dwarfread.c (LCC_PRODUCER): Remove trailing space, which is
not found in the actual producer string produced by lcc.
* dwarfread.c (handle_producer): Use AUTO_DEMANGLING rather
than explicitly checking current_demangling_style.
1992-08-14 19:14:15 +00:00
|
|
|
#define LCC_PRODUCER "NCR C/C++"
|
1992-07-14 02:13:12 +00:00
|
|
|
#endif
|
|
|
|
|
1992-12-02 01:10:49 +00:00
|
|
|
#ifndef CHILL_PRODUCER
|
|
|
|
#define CHILL_PRODUCER "GNU Chill "
|
|
|
|
#endif
|
|
|
|
|
1994-12-17 10:46:32 +00:00
|
|
|
/* Provide a default mapping from a DWARF register number to a gdb REGNUM. */
|
|
|
|
#ifndef DWARF_REG_TO_REGNUM
|
|
|
|
#define DWARF_REG_TO_REGNUM(num) (num)
|
|
|
|
#endif
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
/* Flags to target_to_host() that tell whether or not the data object is
|
|
|
|
expected to be signed. Used, for example, when fetching a signed
|
|
|
|
integer in the target environment which is used as a signed integer
|
|
|
|
in the host environment, and the two environments have different sized
|
|
|
|
ints. In this case, *somebody* has to sign extend the smaller sized
|
|
|
|
int. */
|
|
|
|
|
|
|
|
#define GET_UNSIGNED 0 /* No sign extension required */
|
|
|
|
#define GET_SIGNED 1 /* Sign extension required */
|
|
|
|
|
|
|
|
/* Defines for things which are specified in the document "DWARF Debugging
|
|
|
|
Information Format" published by UNIX International, Programming Languages
|
|
|
|
SIG. These defines are based on revision 1.0.0, Jan 20, 1992. */
|
|
|
|
|
|
|
|
#define SIZEOF_DIE_LENGTH 4
|
|
|
|
#define SIZEOF_DIE_TAG 2
|
|
|
|
#define SIZEOF_ATTRIBUTE 2
|
|
|
|
#define SIZEOF_FORMAT_SPECIFIER 1
|
|
|
|
#define SIZEOF_FMT_FT 2
|
|
|
|
#define SIZEOF_LINETBL_LENGTH 4
|
|
|
|
#define SIZEOF_LINETBL_LINENO 4
|
|
|
|
#define SIZEOF_LINETBL_STMT 2
|
|
|
|
#define SIZEOF_LINETBL_DELTA 4
|
|
|
|
#define SIZEOF_LOC_ATOM_CODE 1
|
|
|
|
|
|
|
|
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */
|
|
|
|
|
|
|
|
/* Macros that return the sizes of various types of data in the target
|
|
|
|
environment.
|
|
|
|
|
1992-04-17 02:59:43 +00:00
|
|
|
FIXME: Currently these are just compile time constants (as they are in
|
|
|
|
other parts of gdb as well). They need to be able to get the right size
|
|
|
|
either from the bfd or possibly from the DWARF info. It would be nice if
|
|
|
|
the DWARF producer inserted DIES that describe the fundamental types in
|
|
|
|
the target environment into the DWARF info, similar to the way dbx stabs
|
|
|
|
producers produce information about their fundamental types. */
|
|
|
|
|
|
|
|
#define TARGET_FT_POINTER_SIZE(objfile) (TARGET_PTR_BIT / TARGET_CHAR_BIT)
|
|
|
|
#define TARGET_FT_LONG_SIZE(objfile) (TARGET_LONG_BIT / TARGET_CHAR_BIT)
|
1992-04-11 06:27:53 +00:00
|
|
|
|
1991-11-20 13:07:12 +00:00
|
|
|
/* The Amiga SVR4 header file <dwarf.h> defines AT_element_list as a
|
|
|
|
FORM_BLOCK2, and this is the value emitted by the AT&T compiler.
|
|
|
|
However, the Issue 2 DWARF specification from AT&T defines it as
|
|
|
|
a FORM_BLOCK4, as does the latest specification from UI/PLSIG.
|
|
|
|
For backwards compatibility with the AT&T compiler produced executables
|
|
|
|
we define AT_short_element_list for this variant. */
|
|
|
|
|
|
|
|
#define AT_short_element_list (0x00f0|FORM_BLOCK2)
|
|
|
|
|
|
|
|
/* External variables referenced. */
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
extern int info_verbose; /* From main.c; nonzero => verbose */
|
1992-03-15 01:09:14 +00:00
|
|
|
extern char *warning_pre_print; /* From utils.c */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
/* The DWARF debugging information consists of two major pieces,
|
|
|
|
one is a block of DWARF Information Entries (DIE's) and the other
|
|
|
|
is a line number table. The "struct dieinfo" structure contains
|
|
|
|
the information for a single DIE, the one currently being processed.
|
|
|
|
|
|
|
|
In order to make it easier to randomly access the attribute fields
|
1992-04-14 04:09:00 +00:00
|
|
|
of the current DIE, which are specifically unordered within the DIE,
|
1991-10-24 11:28:54 +00:00
|
|
|
each DIE is scanned and an instance of the "struct dieinfo"
|
|
|
|
structure is initialized.
|
|
|
|
|
|
|
|
Initialization is done in two levels. The first, done by basicdieinfo(),
|
|
|
|
just initializes those fields that are vital to deciding whether or not
|
|
|
|
to use this DIE, how to skip past it, etc. The second, done by the
|
|
|
|
function completedieinfo(), fills in the rest of the information.
|
|
|
|
|
|
|
|
Attributes which have block forms are not interpreted at the time
|
|
|
|
the DIE is scanned, instead we just save pointers to the start
|
|
|
|
of their value fields.
|
|
|
|
|
|
|
|
Some fields have a flag <name>_p that is set when the value of the
|
|
|
|
field is valid (I.E. we found a matching attribute in the DIE). Since
|
|
|
|
we may want to test for the presence of some attributes in the DIE,
|
1991-11-18 08:07:43 +00:00
|
|
|
such as AT_low_pc, without restricting the values of the field,
|
1991-10-24 11:28:54 +00:00
|
|
|
we need someway to note that we found such an attribute.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef char BLOCK;
|
|
|
|
|
|
|
|
struct dieinfo {
|
1992-04-14 04:09:00 +00:00
|
|
|
char * die; /* Pointer to the raw DIE data */
|
|
|
|
unsigned long die_length; /* Length of the raw DIE data */
|
|
|
|
DIE_REF die_ref; /* Offset of this DIE */
|
|
|
|
unsigned short die_tag; /* Tag for this DIE */
|
|
|
|
unsigned long at_padding;
|
|
|
|
unsigned long at_sibling;
|
|
|
|
BLOCK * at_location;
|
|
|
|
char * at_name;
|
|
|
|
unsigned short at_fund_type;
|
|
|
|
BLOCK * at_mod_fund_type;
|
|
|
|
unsigned long at_user_def_type;
|
|
|
|
BLOCK * at_mod_u_d_type;
|
|
|
|
unsigned short at_ordering;
|
|
|
|
BLOCK * at_subscr_data;
|
|
|
|
unsigned long at_byte_size;
|
|
|
|
unsigned short at_bit_offset;
|
|
|
|
unsigned long at_bit_size;
|
|
|
|
BLOCK * at_element_list;
|
|
|
|
unsigned long at_stmt_list;
|
1995-03-03 06:26:25 +00:00
|
|
|
CORE_ADDR at_low_pc;
|
|
|
|
CORE_ADDR at_high_pc;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned long at_language;
|
|
|
|
unsigned long at_member;
|
|
|
|
unsigned long at_discr;
|
|
|
|
BLOCK * at_discr_value;
|
|
|
|
BLOCK * at_string_length;
|
|
|
|
char * at_comp_dir;
|
|
|
|
char * at_producer;
|
|
|
|
unsigned long at_start_scope;
|
|
|
|
unsigned long at_stride_size;
|
|
|
|
unsigned long at_src_info;
|
|
|
|
char * at_prototyped;
|
|
|
|
unsigned int has_at_low_pc:1;
|
|
|
|
unsigned int has_at_stmt_list:1;
|
1992-08-09 06:14:59 +00:00
|
|
|
unsigned int has_at_byte_size:1;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned int short_element_list:1;
|
1991-10-24 11:28:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static int diecount; /* Approximate count of dies for compilation unit */
|
|
|
|
static struct dieinfo *curdie; /* For warnings and such */
|
|
|
|
|
|
|
|
static char *dbbase; /* Base pointer to dwarf info */
|
1992-10-01 17:33:21 +00:00
|
|
|
static int dbsize; /* Size of dwarf info in bytes */
|
1991-10-24 11:28:54 +00:00
|
|
|
static int dbroff; /* Relative offset from start of .debug section */
|
|
|
|
static char *lnbase; /* Base pointer to line section */
|
|
|
|
static int isreg; /* Kludge to identify register variables */
|
1995-07-20 05:52:42 +00:00
|
|
|
static int optimized_out; /* Kludge to identify optimized out variables */
|
1993-08-24 21:38:24 +00:00
|
|
|
/* Kludge to identify basereg references. Nonzero if we have an offset
|
|
|
|
relative to a basereg. */
|
|
|
|
static int offreg;
|
|
|
|
/* Which base register is it relative to? */
|
|
|
|
static int basereg;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-07-04 13:59:03 +00:00
|
|
|
/* This value is added to each symbol value. FIXME: Generalize to
|
1993-03-26 14:59:43 +00:00
|
|
|
the section_offsets structure used by dbxread (once this is done,
|
|
|
|
pass the appropriate section number to end_symtab). */
|
1991-10-24 11:28:54 +00:00
|
|
|
static CORE_ADDR baseaddr; /* Add to each symbol value */
|
|
|
|
|
1992-07-04 13:59:03 +00:00
|
|
|
/* The section offsets used in the current psymtab or symtab. FIXME,
|
|
|
|
only used to pass one value (baseaddr) at the moment. */
|
|
|
|
static struct section_offsets *base_section_offsets;
|
|
|
|
|
1995-05-13 21:00:17 +00:00
|
|
|
/* We put a pointer to this structure in the read_symtab_private field
|
|
|
|
of the psymtab. */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
struct dwfinfo {
|
1995-04-21 13:19:22 +00:00
|
|
|
/* Always the absolute file offset to the start of the ".debug"
|
|
|
|
section for the file containing the DIE's being accessed. */
|
|
|
|
file_ptr dbfoff;
|
|
|
|
/* Relative offset from the start of the ".debug" section to the
|
|
|
|
first DIE to be accessed. When building the partial symbol
|
|
|
|
table, this value will be zero since we are accessing the
|
|
|
|
entire ".debug" section. When expanding a partial symbol
|
|
|
|
table entry, this value will be the offset to the first
|
|
|
|
DIE for the compilation unit containing the symbol that
|
|
|
|
triggers the expansion. */
|
|
|
|
int dbroff;
|
|
|
|
/* The size of the chunk of DIE's being examined, in bytes. */
|
|
|
|
int dblength;
|
|
|
|
/* The absolute file offset to the line table fragment. Ignored
|
|
|
|
when building partial symbol tables, but used when expanding
|
|
|
|
them, and contains the absolute file offset to the fragment
|
|
|
|
of the ".line" section containing the line numbers for the
|
|
|
|
current compilation unit. */
|
|
|
|
file_ptr lnfoff;
|
1991-10-24 11:28:54 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#define DBFOFF(p) (((struct dwfinfo *)((p)->read_symtab_private))->dbfoff)
|
|
|
|
#define DBROFF(p) (((struct dwfinfo *)((p)->read_symtab_private))->dbroff)
|
|
|
|
#define DBLENGTH(p) (((struct dwfinfo *)((p)->read_symtab_private))->dblength)
|
|
|
|
#define LNFOFF(p) (((struct dwfinfo *)((p)->read_symtab_private))->lnfoff)
|
|
|
|
|
1992-01-11 01:41:23 +00:00
|
|
|
/* The generic symbol table building routines have separate lists for
|
|
|
|
file scope symbols and all all other scopes (local scopes). So
|
|
|
|
we need to select the right one to pass to add_symbol_to_list().
|
|
|
|
We do it by keeping a pointer to the correct list in list_in_scope.
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-01-11 01:41:23 +00:00
|
|
|
FIXME: The original dwarf code just treated the file scope as the first
|
|
|
|
local scope, and all other local scopes as nested local scopes, and worked
|
|
|
|
fine. Check to see if we really need to distinguish these in buildsym.c */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-01-24 06:32:43 +00:00
|
|
|
struct pending **list_in_scope = &file_symbols;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
/* DIES which have user defined types or modified user defined types refer to
|
|
|
|
other DIES for the type information. Thus we need to associate the offset
|
|
|
|
of a DIE for a user defined type with a pointer to the type information.
|
|
|
|
|
|
|
|
Originally this was done using a simple but expensive algorithm, with an
|
|
|
|
array of unsorted structures, each containing an offset/type-pointer pair.
|
|
|
|
This array was scanned linearly each time a lookup was done. The result
|
|
|
|
was that gdb was spending over half it's startup time munging through this
|
|
|
|
array of pointers looking for a structure that had the right offset member.
|
|
|
|
|
|
|
|
The second attempt used the same array of structures, but the array was
|
|
|
|
sorted using qsort each time a new offset/type was recorded, and a binary
|
|
|
|
search was used to find the type pointer for a given DIE offset. This was
|
|
|
|
even slower, due to the overhead of sorting the array each time a new
|
|
|
|
offset/type pair was entered.
|
|
|
|
|
|
|
|
The third attempt uses a fixed size array of type pointers, indexed by a
|
|
|
|
value derived from the DIE offset. Since the minimum DIE size is 4 bytes,
|
|
|
|
we can divide any DIE offset by 4 to obtain a unique index into this fixed
|
|
|
|
size array. Since each element is a 4 byte pointer, it takes exactly as
|
|
|
|
much memory to hold this array as to hold the DWARF info for a given
|
1992-12-03 20:28:16 +00:00
|
|
|
compilation unit. But it gets freed as soon as we are done with it.
|
|
|
|
This has worked well in practice, as a reasonable tradeoff between memory
|
|
|
|
consumption and speed, without having to resort to much more complicated
|
|
|
|
algorithms. */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type **utypes; /* Pointer to array of user type pointers */
|
|
|
|
static int numutypes; /* Max number of user type pointers */
|
|
|
|
|
1992-12-03 20:28:16 +00:00
|
|
|
/* Maintain an array of referenced fundamental types for the current
|
|
|
|
compilation unit being read. For DWARF version 1, we have to construct
|
|
|
|
the fundamental types on the fly, since no information about the
|
|
|
|
fundamental types is supplied. Each such fundamental type is created by
|
|
|
|
calling a language dependent routine to create the type, and then a
|
|
|
|
pointer to that type is then placed in the array at the index specified
|
|
|
|
by it's FT_<TYPENAME> value. The array has a fixed size set by the
|
|
|
|
FT_NUM_MEMBERS compile time constant, which is the number of predefined
|
|
|
|
fundamental types gdb knows how to construct. */
|
|
|
|
|
|
|
|
static struct type *ftypes[FT_NUM_MEMBERS]; /* Fundamental types */
|
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
/* Record the language for the compilation unit which is currently being
|
|
|
|
processed. We know it once we have seen the TAG_compile_unit DIE,
|
|
|
|
and we need it while processing the DIE's for that compilation unit.
|
|
|
|
It is eventually saved in the symtab structure, but we don't finalize
|
|
|
|
the symtab struct until we have processed all the DIE's for the
|
1992-12-03 20:28:16 +00:00
|
|
|
compilation unit. We also need to get and save a pointer to the
|
|
|
|
language struct for this language, so we can call the language
|
|
|
|
dependent routines for doing things such as creating fundamental
|
|
|
|
types. */
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
|
|
|
|
static enum language cu_language;
|
1992-12-03 20:28:16 +00:00
|
|
|
static const struct language_defn *cu_language_defn;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Forward declarations of static functions so we don't have to worry
|
1992-02-22 01:46:16 +00:00
|
|
|
about ordering within this file. */
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
static int
|
|
|
|
attribute_size PARAMS ((unsigned int));
|
|
|
|
|
1995-03-03 06:26:25 +00:00
|
|
|
static CORE_ADDR
|
1992-04-14 04:09:00 +00:00
|
|
|
target_to_host PARAMS ((char *, int, int, struct objfile *));
|
1992-04-11 06:27:53 +00:00
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
static void
|
|
|
|
add_enum_psymbol PARAMS ((struct dieinfo *, struct objfile *));
|
|
|
|
|
1992-07-14 02:13:12 +00:00
|
|
|
static void
|
|
|
|
handle_producer PARAMS ((char *));
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
static void
|
|
|
|
read_file_scope PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1991-11-15 23:23:11 +00:00
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_func_scope PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_lexical_block_scope PARAMS ((struct dieinfo *, char *, char *,
|
|
|
|
struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
scan_partial_symbols PARAMS ((char *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-10-15 13:40:40 +00:00
|
|
|
scan_compilation_units PARAMS ((char *, char *, file_ptr,
|
|
|
|
file_ptr, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
add_partial_symbol PARAMS ((struct dieinfo *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-04-11 06:27:53 +00:00
|
|
|
basicdieinfo PARAMS ((struct dieinfo *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo PARAMS ((struct dieinfo *, struct objfile *));
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
dwarf_psymtab_to_symtab PARAMS ((struct partial_symtab *));
|
|
|
|
|
|
|
|
static void
|
|
|
|
psymtab_to_symtab_1 PARAMS ((struct partial_symtab *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1993-05-31 00:21:41 +00:00
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_ofile_symtab PARAMS ((struct partial_symtab *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
process_dies PARAMS ((char *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_structure_scope PARAMS ((struct dieinfo *, char *, char *,
|
|
|
|
struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
Create and use macros for iterating on symtabs, psymtabs, msymbols.
* minsyms.c (iterate_over_msymbols): Remove; clunky and slow.
* symfile.h, symtab.h (iterate_over_msymbols): Remove prototype
* coffread.c (coff_symfile_read): iterate_over_symtabs => ALL_SYMTABS.
(patch_opaque_types): Avoid dummy args and result.
* objfiles.c (have_partial_symbols, have_full_symbols,
have_minimal_symbols): explicit iteration => ALL_OBJFILES; simplify.
(iterate_over_objfiles, iterate_over_symtabs,
iterate_over_psymtabs): Remove, clunky and slow.
* objfiles.h: Replace iterate_over_* prototypes with ALL_SYMTABS,
ALL_PSYMTABS, and ALL_MSYMBOLS macros.
* symmisc.c (dump_symtab, dump_psymtab, dump_msymbols,
dump_objfile): Remove dummy args and results. Move filename
comparisons to callers.
(printsyms_command, printpsyms_command, printmsyms_command,
printobjfiles_command): iterate_over_* => ALL_*. Compare filenames.
* symtab.c (lookup_symtab_1, lookup_symtab, lookup_partial_symtab,
lookup_symbol, find_main_psymtab, find_pc_symtab, sources_info,
list_symbols, make_symbol_completion_list): Replace explicit
iteration with ALL_SYMTABS, ALL_PSYMTABS, or ALL_MSYMBOLS.
Eliminate Dijkstra flag crap, break out of loops with gotos.
(lookup_symtab_1): Protect '/' tests from short filenames.
(cplus_mangled_symbol): Move inline into lookup_symbol.
* xcoffexec.c (relocate_objfile_msymbols): Remove poor hack.
(relocate_minimal_symbol): Move inline to vmap_symtab.
(vmap_symtab): Replace iteration with ALL_OBJFILES,
iterate_over_msymbols with ALL_MSYMBOLS.
Misc cleanup prior to release.
* dwarfread.c (dwarf_build_psymtabs): Remove mainline test.
* mipsread.c (compare_symtabs, compare_psymtabs): Remove, unused.
* mipsread.c: Add prototypes for all static functions.
* symmisc.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove, unused.
* xcoffread.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove 2nd
unused copy!
* buildsym.c (define_symbol): Handle global register variables
(from Pierre Willard). Complain if register numbers are too large.
1992-03-29 23:17:36 +00:00
|
|
|
decode_array_element_type PARAMS ((char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-12-15 02:52:11 +00:00
|
|
|
decode_subscript_data_item PARAMS ((char *, char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
dwarf_read_array_type PARAMS ((struct dieinfo *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-02-17 23:26:54 +00:00
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_tag_pointer_type PARAMS ((struct dieinfo *dip));
|
1992-02-17 23:26:54 +00:00
|
|
|
|
1993-01-19 23:00:19 +00:00
|
|
|
static void
|
|
|
|
read_tag_string_type PARAMS ((struct dieinfo *dip));
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_subroutine_type PARAMS ((struct dieinfo *, char *, char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_enumeration PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
struct_type PARAMS ((struct dieinfo *, char *, char *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
enum_type PARAMS ((struct dieinfo *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_line_numbers PARAMS ((char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_die_type PARAMS ((struct dieinfo *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_mod_fund_type PARAMS ((char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_mod_u_d_type PARAMS ((char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-06-15 14:26:57 +00:00
|
|
|
decode_modified_type PARAMS ((char *, unsigned int, int));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_fund_type PARAMS ((unsigned int));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static char *
|
1992-02-22 01:46:16 +00:00
|
|
|
create_name PARAMS ((char *, struct obstack *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-04-14 04:09:00 +00:00
|
|
|
lookup_utype PARAMS ((DIE_REF));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct type *
|
1992-04-14 04:09:00 +00:00
|
|
|
alloc_utype PARAMS ((DIE_REF, struct type *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
static struct symbol *
|
1992-02-22 01:46:16 +00:00
|
|
|
new_symbol PARAMS ((struct dieinfo *, struct objfile *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
static void
|
|
|
|
synthesize_typedef PARAMS ((struct dieinfo *, struct objfile *,
|
|
|
|
struct type *));
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
static int
|
1992-02-22 01:46:16 +00:00
|
|
|
locval PARAMS ((char *));
|
1991-10-24 11:28:54 +00:00
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
static void
|
|
|
|
set_cu_language PARAMS ((struct dieinfo *));
|
|
|
|
|
1992-12-03 20:28:16 +00:00
|
|
|
static struct type *
|
|
|
|
dwarf_fundamental_type PARAMS ((struct objfile *, int));
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
dwarf_fundamental_type -- lookup or create a fundamental type
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
struct type *
|
|
|
|
dwarf_fundamental_type (struct objfile *objfile, int typeid)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
DWARF version 1 doesn't supply any fundamental type information,
|
|
|
|
so gdb has to construct such types. It has a fixed number of
|
|
|
|
fundamental types that it knows how to construct, which is the
|
|
|
|
union of all types that it knows how to construct for all languages
|
|
|
|
that it knows about. These are enumerated in gdbtypes.h.
|
|
|
|
|
|
|
|
As an example, assume we find a DIE that references a DWARF
|
|
|
|
fundamental type of FT_integer. We first look in the ftypes
|
|
|
|
array to see if we already have such a type, indexed by the
|
|
|
|
gdb internal value of FT_INTEGER. If so, we simply return a
|
|
|
|
pointer to that type. If not, then we ask an appropriate
|
|
|
|
language dependent routine to create a type FT_INTEGER, using
|
|
|
|
defaults reasonable for the current target machine, and install
|
|
|
|
that type in ftypes for future reference.
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
|
|
|
|
Pointer to a fundamental type.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
|
|
|
dwarf_fundamental_type (objfile, typeid)
|
|
|
|
struct objfile *objfile;
|
|
|
|
int typeid;
|
|
|
|
{
|
|
|
|
if (typeid < 0 || typeid >= FT_NUM_MEMBERS)
|
|
|
|
{
|
|
|
|
error ("internal error - invalid fundamental type id %d", typeid);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Look for this particular type in the fundamental type vector. If one is
|
|
|
|
not found, create and install one appropriate for the current language
|
|
|
|
and the current target machine. */
|
|
|
|
|
|
|
|
if (ftypes[typeid] == NULL)
|
|
|
|
{
|
|
|
|
ftypes[typeid] = cu_language_defn -> la_fund_type(objfile, typeid);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ftypes[typeid]);
|
|
|
|
}
|
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
set_cu_language -- set local copy of language for compilation unit
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
void
|
|
|
|
set_cu_language (struct dieinfo *dip)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Decode the language attribute for a compilation unit DIE and
|
|
|
|
remember what the language was. We use this at various times
|
|
|
|
when processing DIE's for a given compilation unit.
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
|
|
|
|
No return value.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_cu_language (dip)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
{
|
|
|
|
switch (dip -> at_language)
|
|
|
|
{
|
|
|
|
case LANG_C89:
|
|
|
|
case LANG_C:
|
|
|
|
cu_language = language_c;
|
|
|
|
break;
|
|
|
|
case LANG_C_PLUS_PLUS:
|
|
|
|
cu_language = language_cplus;
|
|
|
|
break;
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
case LANG_CHILL:
|
|
|
|
cu_language = language_chill;
|
|
|
|
break;
|
|
|
|
case LANG_MODULA2:
|
|
|
|
cu_language = language_m2;
|
|
|
|
break;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case LANG_ADA83:
|
|
|
|
case LANG_COBOL74:
|
|
|
|
case LANG_COBOL85:
|
|
|
|
case LANG_FORTRAN77:
|
|
|
|
case LANG_FORTRAN90:
|
|
|
|
case LANG_PASCAL83:
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
/* We don't know anything special about these yet. */
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
cu_language = language_unknown;
|
|
|
|
break;
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
default:
|
|
|
|
/* If no at_language, try to deduce one from the filename */
|
|
|
|
cu_language = deduce_language_from_filename (dip -> at_name);
|
|
|
|
break;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
}
|
1992-12-03 20:28:16 +00:00
|
|
|
cu_language_defn = language_def (cu_language);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
}
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
GLOBAL FUNCTION
|
|
|
|
|
|
|
|
dwarf_build_psymtabs -- build partial symtabs from DWARF debug info
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-10-15 13:40:40 +00:00
|
|
|
void dwarf_build_psymtabs (struct objfile *objfile,
|
1992-07-04 13:59:03 +00:00
|
|
|
struct section_offsets *section_offsets,
|
1992-10-15 13:40:40 +00:00
|
|
|
int mainline, file_ptr dbfoff, unsigned int dbfsize,
|
|
|
|
file_ptr lnoffset, unsigned int lnsize)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
This function is called upon to build partial symtabs from files
|
|
|
|
containing DIE's (Dwarf Information Entries) and DWARF line numbers.
|
|
|
|
|
1992-10-15 13:40:40 +00:00
|
|
|
It is passed a bfd* containing the DIES
|
1991-10-24 11:28:54 +00:00
|
|
|
and line number information, the corresponding filename for that
|
|
|
|
file, a base address for relocating the symbols, a flag indicating
|
|
|
|
whether or not this debugging information is from a "main symbol
|
|
|
|
table" rather than a shared library or dynamically linked file,
|
|
|
|
and file offset/size pairs for the DIE information and line number
|
|
|
|
information.
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
|
|
|
|
No return value.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
void
|
1992-10-15 13:40:40 +00:00
|
|
|
dwarf_build_psymtabs (objfile, section_offsets, mainline, dbfoff, dbfsize,
|
|
|
|
lnoffset, lnsize)
|
|
|
|
struct objfile *objfile;
|
1992-07-04 13:59:03 +00:00
|
|
|
struct section_offsets *section_offsets;
|
1992-02-22 01:46:16 +00:00
|
|
|
int mainline;
|
1992-10-15 13:40:40 +00:00
|
|
|
file_ptr dbfoff;
|
1992-10-01 17:33:21 +00:00
|
|
|
unsigned int dbfsize;
|
1992-10-15 13:40:40 +00:00
|
|
|
file_ptr lnoffset;
|
1992-02-22 01:46:16 +00:00
|
|
|
unsigned int lnsize;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-10-15 13:40:40 +00:00
|
|
|
bfd *abfd = objfile->obfd;
|
1991-10-24 11:28:54 +00:00
|
|
|
struct cleanup *back_to;
|
|
|
|
|
1992-04-11 06:27:53 +00:00
|
|
|
current_objfile = objfile;
|
1992-10-01 17:33:21 +00:00
|
|
|
dbsize = dbfsize;
|
1991-10-24 11:28:54 +00:00
|
|
|
dbbase = xmalloc (dbsize);
|
|
|
|
dbroff = 0;
|
1995-10-19 19:54:44 +00:00
|
|
|
if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) ||
|
1992-10-15 13:40:40 +00:00
|
|
|
(bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
free (dbbase);
|
1992-10-15 13:40:40 +00:00
|
|
|
error ("can't read DWARF data from '%s'", bfd_get_filename (abfd));
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
back_to = make_cleanup (free, dbbase);
|
|
|
|
|
|
|
|
/* If we are reinitializing, or if we have never loaded syms yet, init.
|
|
|
|
Since we have no idea how many DIES we are looking at, we just guess
|
|
|
|
some arbitrary value. */
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
if (mainline || objfile -> global_psymbols.size == 0 ||
|
|
|
|
objfile -> static_psymbols.size == 0)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
init_psymbol_list (objfile, 1024);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
Create and use macros for iterating on symtabs, psymtabs, msymbols.
* minsyms.c (iterate_over_msymbols): Remove; clunky and slow.
* symfile.h, symtab.h (iterate_over_msymbols): Remove prototype
* coffread.c (coff_symfile_read): iterate_over_symtabs => ALL_SYMTABS.
(patch_opaque_types): Avoid dummy args and result.
* objfiles.c (have_partial_symbols, have_full_symbols,
have_minimal_symbols): explicit iteration => ALL_OBJFILES; simplify.
(iterate_over_objfiles, iterate_over_symtabs,
iterate_over_psymtabs): Remove, clunky and slow.
* objfiles.h: Replace iterate_over_* prototypes with ALL_SYMTABS,
ALL_PSYMTABS, and ALL_MSYMBOLS macros.
* symmisc.c (dump_symtab, dump_psymtab, dump_msymbols,
dump_objfile): Remove dummy args and results. Move filename
comparisons to callers.
(printsyms_command, printpsyms_command, printmsyms_command,
printobjfiles_command): iterate_over_* => ALL_*. Compare filenames.
* symtab.c (lookup_symtab_1, lookup_symtab, lookup_partial_symtab,
lookup_symbol, find_main_psymtab, find_pc_symtab, sources_info,
list_symbols, make_symbol_completion_list): Replace explicit
iteration with ALL_SYMTABS, ALL_PSYMTABS, or ALL_MSYMBOLS.
Eliminate Dijkstra flag crap, break out of loops with gotos.
(lookup_symtab_1): Protect '/' tests from short filenames.
(cplus_mangled_symbol): Move inline into lookup_symbol.
* xcoffexec.c (relocate_objfile_msymbols): Remove poor hack.
(relocate_minimal_symbol): Move inline to vmap_symtab.
(vmap_symtab): Replace iteration with ALL_OBJFILES,
iterate_over_msymbols with ALL_MSYMBOLS.
Misc cleanup prior to release.
* dwarfread.c (dwarf_build_psymtabs): Remove mainline test.
* mipsread.c (compare_symtabs, compare_psymtabs): Remove, unused.
* mipsread.c: Add prototypes for all static functions.
* symmisc.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove, unused.
* xcoffread.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove 2nd
unused copy!
* buildsym.c (define_symbol): Handle global register variables
(from Pierre Willard). Complain if register numbers are too large.
1992-03-29 23:17:36 +00:00
|
|
|
/* Save the relocation factor where everybody can see it. */
|
1991-12-16 20:57:28 +00:00
|
|
|
|
1992-07-04 13:59:03 +00:00
|
|
|
base_section_offsets = section_offsets;
|
|
|
|
baseaddr = ANOFFSET (section_offsets, 0);
|
1991-12-16 20:57:28 +00:00
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Follow the compilation unit sibling chain, building a partial symbol
|
|
|
|
table entry for each one. Save enough information about each compilation
|
|
|
|
unit to locate the full DWARF information later. */
|
|
|
|
|
1992-10-15 13:40:40 +00:00
|
|
|
scan_compilation_units (dbbase, dbbase + dbsize, dbfoff, lnoffset, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
do_cleanups (back_to);
|
1992-04-11 06:27:53 +00:00
|
|
|
current_objfile = NULL;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_lexical_block_scope -- process all dies in a lexical block
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void read_lexical_block_scope (struct dieinfo *dip,
|
|
|
|
char *thisdie, char *enddie)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Process all the DIES contained within a lexical block scope.
|
|
|
|
Start a new scope, process the dies, and then close the scope.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_lexical_block_scope (dip, thisdie, enddie, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-01-11 01:41:23 +00:00
|
|
|
register struct context_stack *new;
|
|
|
|
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
push_context (0, dip -> at_low_pc);
|
1992-04-14 04:09:00 +00:00
|
|
|
process_dies (thisdie + dip -> die_length, enddie, objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
new = pop_context ();
|
|
|
|
if (local_symbols != NULL)
|
|
|
|
{
|
|
|
|
finish_block (0, &local_symbols, new -> old_blocks, new -> start_addr,
|
1992-02-22 01:46:16 +00:00
|
|
|
dip -> at_high_pc, objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
}
|
|
|
|
local_symbols = new -> locals;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
lookup_utype -- look up a user defined type from die reference
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
static type *lookup_utype (DIE_REF die_ref)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a DIE reference, lookup the user defined type associated with
|
|
|
|
that DIE, if it has been registered already. If not registered, then
|
|
|
|
return NULL. Alloc_utype() can be called to register an empty
|
|
|
|
type for this reference, which will be filled in later when the
|
|
|
|
actual referenced DIE is processed.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-04-14 04:09:00 +00:00
|
|
|
lookup_utype (die_ref)
|
|
|
|
DIE_REF die_ref;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type = NULL;
|
|
|
|
int utypeidx;
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
utypeidx = (die_ref - dbroff) / 4;
|
1991-10-24 11:28:54 +00:00
|
|
|
if ((utypeidx < 0) || (utypeidx >= numutypes))
|
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&bad_die_ref, DIE_ID, DIE_NAME);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
type = *(utypes + utypeidx);
|
|
|
|
}
|
|
|
|
return (type);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
alloc_utype -- add a user defined type for die reference
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
static type *alloc_utype (DIE_REF die_ref, struct type *utypep)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
Given a die reference DIE_REF, and a possible pointer to a user
|
1991-10-24 11:28:54 +00:00
|
|
|
defined type UTYPEP, register that this reference has a user
|
|
|
|
defined type and either use the specified type in UTYPEP or
|
|
|
|
make a new empty type that will be filled in later.
|
|
|
|
|
|
|
|
We should only be called after calling lookup_utype() to verify that
|
1992-04-14 04:09:00 +00:00
|
|
|
there is not currently a type registered for DIE_REF.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-04-14 04:09:00 +00:00
|
|
|
alloc_utype (die_ref, utypep)
|
|
|
|
DIE_REF die_ref;
|
1992-02-22 01:46:16 +00:00
|
|
|
struct type *utypep;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type **typep;
|
|
|
|
int utypeidx;
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
utypeidx = (die_ref - dbroff) / 4;
|
1991-10-24 11:28:54 +00:00
|
|
|
typep = utypes + utypeidx;
|
|
|
|
if ((utypeidx < 0) || (utypeidx >= numutypes))
|
|
|
|
{
|
1992-12-03 20:28:16 +00:00
|
|
|
utypep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&bad_die_ref, DIE_ID, DIE_NAME);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else if (*typep != NULL)
|
|
|
|
{
|
|
|
|
utypep = *typep;
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&dup_user_type_allocation, DIE_ID, DIE_NAME);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (utypep == NULL)
|
|
|
|
{
|
1992-07-09 04:40:39 +00:00
|
|
|
utypep = alloc_type (current_objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
*typep = utypep;
|
|
|
|
}
|
|
|
|
return (utypep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_die_type -- return a type for a specified die
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static struct type *decode_die_type (struct dieinfo *dip)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to a die information structure DIP, decode the
|
|
|
|
type of the die and return a pointer to the decoded type. All
|
|
|
|
dies without specific types default to type int.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_die_type (dip)
|
|
|
|
struct dieinfo *dip;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type = NULL;
|
|
|
|
|
|
|
|
if (dip -> at_fund_type != 0)
|
|
|
|
{
|
|
|
|
type = decode_fund_type (dip -> at_fund_type);
|
|
|
|
}
|
|
|
|
else if (dip -> at_mod_fund_type != NULL)
|
|
|
|
{
|
|
|
|
type = decode_mod_fund_type (dip -> at_mod_fund_type);
|
|
|
|
}
|
|
|
|
else if (dip -> at_user_def_type)
|
|
|
|
{
|
|
|
|
if ((type = lookup_utype (dip -> at_user_def_type)) == NULL)
|
|
|
|
{
|
|
|
|
type = alloc_utype (dip -> at_user_def_type, NULL);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dip -> at_mod_u_d_type)
|
|
|
|
{
|
|
|
|
type = decode_mod_u_d_type (dip -> at_mod_u_d_type);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-12-03 20:28:16 +00:00
|
|
|
type = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
return (type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
struct_type -- compute and return the type for a struct or union
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static struct type *struct_type (struct dieinfo *dip, char *thisdie,
|
1991-12-04 23:40:07 +00:00
|
|
|
char *enddie, struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given pointer to a die information structure for a die which
|
1991-12-06 02:22:10 +00:00
|
|
|
defines a union or structure (and MUST define one or the other),
|
|
|
|
and pointers to the raw die data that define the range of dies which
|
|
|
|
define the members, compute and return the user defined type for the
|
|
|
|
structure or union.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
struct_type (dip, thisdie, enddie, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
struct nextfield {
|
|
|
|
struct nextfield *next;
|
|
|
|
struct field field;
|
|
|
|
};
|
|
|
|
struct nextfield *list = NULL;
|
|
|
|
struct nextfield *new;
|
|
|
|
int nfields = 0;
|
|
|
|
int n;
|
|
|
|
struct dieinfo mbr;
|
1991-12-04 23:40:07 +00:00
|
|
|
char *nextdie;
|
1992-08-09 06:14:59 +00:00
|
|
|
int anonymous_size;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
if ((type = lookup_utype (dip -> die_ref)) == NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1991-12-06 16:37:20 +00:00
|
|
|
/* No forward references created an empty type, so install one now */
|
1992-04-14 04:09:00 +00:00
|
|
|
type = alloc_utype (dip -> die_ref, NULL);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1991-12-28 19:37:55 +00:00
|
|
|
INIT_CPLUS_SPECIFIC(type);
|
1992-04-14 04:09:00 +00:00
|
|
|
switch (dip -> die_tag)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case TAG_class_type:
|
|
|
|
TYPE_CODE (type) = TYPE_CODE_CLASS;
|
|
|
|
break;
|
1991-12-06 02:22:10 +00:00
|
|
|
case TAG_structure_type:
|
1991-12-06 16:37:20 +00:00
|
|
|
TYPE_CODE (type) = TYPE_CODE_STRUCT;
|
1991-12-06 02:22:10 +00:00
|
|
|
break;
|
|
|
|
case TAG_union_type:
|
|
|
|
TYPE_CODE (type) = TYPE_CODE_UNION;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Should never happen */
|
|
|
|
TYPE_CODE (type) = TYPE_CODE_UNDEF;
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&missing_tag, DIE_ID, DIE_NAME);
|
1991-12-06 02:22:10 +00:00
|
|
|
break;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1991-12-06 16:37:20 +00:00
|
|
|
/* Some compilers try to be helpful by inventing "fake" names for
|
|
|
|
anonymous enums, structures, and unions, like "~0fake" or ".0fake".
|
|
|
|
Thanks, but no thanks... */
|
1991-12-06 02:22:10 +00:00
|
|
|
if (dip -> at_name != NULL
|
|
|
|
&& *dip -> at_name != '~'
|
|
|
|
&& *dip -> at_name != '.')
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1993-07-02 02:57:06 +00:00
|
|
|
TYPE_TAG_NAME (type) = obconcat (&objfile -> type_obstack,
|
|
|
|
"", "", dip -> at_name);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1992-08-09 06:14:59 +00:00
|
|
|
/* Use whatever size is known. Zero is a valid size. We might however
|
|
|
|
wish to check has_at_byte_size to make sure that some byte size was
|
|
|
|
given explicitly, but DWARF doesn't specify that explicit sizes of
|
|
|
|
zero have to present, so complaining about missing sizes should
|
|
|
|
probably not be the default. */
|
|
|
|
TYPE_LENGTH (type) = dip -> at_byte_size;
|
1992-04-14 04:09:00 +00:00
|
|
|
thisdie += dip -> die_length;
|
1991-10-24 11:28:54 +00:00
|
|
|
while (thisdie < enddie)
|
|
|
|
{
|
1992-04-11 06:27:53 +00:00
|
|
|
basicdieinfo (&mbr, thisdie, objfile);
|
|
|
|
completedieinfo (&mbr, objfile);
|
1992-04-14 04:09:00 +00:00
|
|
|
if (mbr.die_length <= SIZEOF_DIE_LENGTH)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
1991-12-04 23:40:07 +00:00
|
|
|
else if (mbr.at_sibling != 0)
|
|
|
|
{
|
|
|
|
nextdie = dbbase + mbr.at_sibling - dbroff;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nextdie = thisdie + mbr.die_length;
|
1991-12-04 23:40:07 +00:00
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
switch (mbr.die_tag)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
case TAG_member:
|
|
|
|
/* Get space to record the next field's data. */
|
|
|
|
new = (struct nextfield *) alloca (sizeof (struct nextfield));
|
|
|
|
new -> next = list;
|
|
|
|
list = new;
|
|
|
|
/* Save the data. */
|
1992-06-25 19:10:49 +00:00
|
|
|
list -> field.name =
|
|
|
|
obsavestring (mbr.at_name, strlen (mbr.at_name),
|
|
|
|
&objfile -> type_obstack);
|
1991-10-24 11:28:54 +00:00
|
|
|
list -> field.type = decode_die_type (&mbr);
|
|
|
|
list -> field.bitpos = 8 * locval (mbr.at_location);
|
1992-05-03 23:05:07 +00:00
|
|
|
/* Handle bit fields. */
|
|
|
|
list -> field.bitsize = mbr.at_bit_size;
|
* defs.h: If TARGET_BYTE_ORDER_SELECTABLE is defined by tm.h,
define TARGET_BYTE_ORDER as target_byte_order, and declare
target_byte_order as an extern int, and define BITS_BIG_ENDIAN as
a test of TARGET_BYTE_ORDER.
* top.c: Several additions if TARGET_BYTE_ORDER_SELECTABLE is
defined:
(endianlist, target_byte_order): New variables.
(set_endian, set_endian_big, set_endian_little): New functions.
(show_endian): New function.
(init_cmd_lists): Initialize endianlist.
(init_main): Add commands ``set endian big'', ``set endian
little'', and ``show endian''.
* a29k-pinsn.c: Rewrite uses of TARGET_BYTE_ORDER and
BITS_BIG_ENDIAN to switch at run time rather than at compile time.
* coffread.c, dwarfread.c, findvar.c, mips-tdep.c: Likewise.
* remote-os9k.c, stabsread.c, valarith.c, valprint.c: Likewise.
* values.c: Likewise.
* mips-tdep.c: Rewrite uses of GDB_TARGET_IS_MIPS64 to switch at
run time rather than at compile time.
1994-10-06 16:47:32 +00:00
|
|
|
if (BITS_BIG_ENDIAN)
|
1992-05-03 23:05:07 +00:00
|
|
|
{
|
* defs.h: If TARGET_BYTE_ORDER_SELECTABLE is defined by tm.h,
define TARGET_BYTE_ORDER as target_byte_order, and declare
target_byte_order as an extern int, and define BITS_BIG_ENDIAN as
a test of TARGET_BYTE_ORDER.
* top.c: Several additions if TARGET_BYTE_ORDER_SELECTABLE is
defined:
(endianlist, target_byte_order): New variables.
(set_endian, set_endian_big, set_endian_little): New functions.
(show_endian): New function.
(init_cmd_lists): Initialize endianlist.
(init_main): Add commands ``set endian big'', ``set endian
little'', and ``show endian''.
* a29k-pinsn.c: Rewrite uses of TARGET_BYTE_ORDER and
BITS_BIG_ENDIAN to switch at run time rather than at compile time.
* coffread.c, dwarfread.c, findvar.c, mips-tdep.c: Likewise.
* remote-os9k.c, stabsread.c, valarith.c, valprint.c: Likewise.
* values.c: Likewise.
* mips-tdep.c: Rewrite uses of GDB_TARGET_IS_MIPS64 to switch at
run time rather than at compile time.
1994-10-06 16:47:32 +00:00
|
|
|
/* For big endian bits, the at_bit_offset gives the
|
|
|
|
additional bit offset from the MSB of the containing
|
|
|
|
anonymous object to the MSB of the field. We don't
|
|
|
|
have to do anything special since we don't need to
|
|
|
|
know the size of the anonymous object. */
|
|
|
|
list -> field.bitpos += mbr.at_bit_offset;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* For little endian bits, we need to have a non-zero
|
|
|
|
at_bit_size, so that we know we are in fact dealing
|
|
|
|
with a bitfield. Compute the bit offset to the MSB
|
|
|
|
of the anonymous object, subtract off the number of
|
|
|
|
bits from the MSB of the field to the MSB of the
|
|
|
|
object, and then subtract off the number of bits of
|
|
|
|
the field itself. The result is the bit offset of
|
|
|
|
the LSB of the field. */
|
|
|
|
if (mbr.at_bit_size > 0)
|
1992-08-09 06:14:59 +00:00
|
|
|
{
|
* defs.h: If TARGET_BYTE_ORDER_SELECTABLE is defined by tm.h,
define TARGET_BYTE_ORDER as target_byte_order, and declare
target_byte_order as an extern int, and define BITS_BIG_ENDIAN as
a test of TARGET_BYTE_ORDER.
* top.c: Several additions if TARGET_BYTE_ORDER_SELECTABLE is
defined:
(endianlist, target_byte_order): New variables.
(set_endian, set_endian_big, set_endian_little): New functions.
(show_endian): New function.
(init_cmd_lists): Initialize endianlist.
(init_main): Add commands ``set endian big'', ``set endian
little'', and ``show endian''.
* a29k-pinsn.c: Rewrite uses of TARGET_BYTE_ORDER and
BITS_BIG_ENDIAN to switch at run time rather than at compile time.
* coffread.c, dwarfread.c, findvar.c, mips-tdep.c: Likewise.
* remote-os9k.c, stabsread.c, valarith.c, valprint.c: Likewise.
* values.c: Likewise.
* mips-tdep.c: Rewrite uses of GDB_TARGET_IS_MIPS64 to switch at
run time rather than at compile time.
1994-10-06 16:47:32 +00:00
|
|
|
if (mbr.has_at_byte_size)
|
|
|
|
{
|
|
|
|
/* The size of the anonymous object containing
|
|
|
|
the bit field is explicit, so use the
|
|
|
|
indicated size (in bytes). */
|
|
|
|
anonymous_size = mbr.at_byte_size;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* The size of the anonymous object containing
|
|
|
|
the bit field matches the size of an object
|
|
|
|
of the bit field's type. DWARF allows
|
|
|
|
at_byte_size to be left out in such cases, as
|
|
|
|
a debug information size optimization. */
|
|
|
|
anonymous_size = TYPE_LENGTH (list -> field.type);
|
|
|
|
}
|
|
|
|
list -> field.bitpos +=
|
|
|
|
anonymous_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
|
1992-08-09 06:14:59 +00:00
|
|
|
}
|
1992-05-03 23:05:07 +00:00
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
nfields++;
|
|
|
|
break;
|
|
|
|
default:
|
1991-12-04 23:40:07 +00:00
|
|
|
process_dies (thisdie, nextdie, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
}
|
1991-12-04 23:40:07 +00:00
|
|
|
thisdie = nextdie;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1991-12-06 16:37:20 +00:00
|
|
|
/* Now create the vector of fields, and record how big it is. We may
|
|
|
|
not even have any fields, if this DIE was generated due to a reference
|
|
|
|
to an anonymous structure or union. In this case, TYPE_FLAG_STUB is
|
|
|
|
set, which clues gdb in to the fact that it needs to search elsewhere
|
|
|
|
for the full structure definition. */
|
|
|
|
if (nfields == 0)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1991-12-06 16:37:20 +00:00
|
|
|
TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TYPE_NFIELDS (type) = nfields;
|
|
|
|
TYPE_FIELDS (type) = (struct field *)
|
* coffread.c (decode_type): Call alloc_type to alloc new
types.
* stabsread.c (read_array_type, read_range_type, define_symbol):
Call alloc_type to alloc new types.
* stabsread.c (define_symbol): Move dbl_valu symbol field data
from type_obstack to symbol_obstack.
* stabsread.c (define_symbol): Move typedef_sym from type_obstack
to symbol_obstack.
* gdbtypes.h (TYPE_ALLOC): New macro to allocate space for data
associated with a type, using the same mechanism as was used to
allocate space for the type structure itself.
* coffread.c (patch_type, coff_read_struct_type,
coff_read_enum_type): Use TYPE_ALLOC.
* dwarfread.c (struct_type): Use TYPE_ALLOC.
* gdbtypes.c (create_array_type, check_stub_method,
allocate_cplus_struct_type): Use TYPE_ALLOC.
* mipsread.c (parse_symbol, parse_type): Use TYPE_ALLOC.
* stabsread.c (read_struct_type, read_array_type, read_enum_type,
read_range_type): Use TYPE_ALLOC.
1992-08-24 00:13:11 +00:00
|
|
|
TYPE_ALLOC (type, sizeof (struct field) * nfields);
|
1991-12-06 16:37:20 +00:00
|
|
|
/* Copy the saved-up fields into the field vector. */
|
|
|
|
for (n = nfields; list; list = list -> next)
|
|
|
|
{
|
|
|
|
TYPE_FIELD (type, --n) = list -> field;
|
|
|
|
}
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
return (type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_structure_scope -- process all dies within struct or union
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void read_structure_scope (struct dieinfo *dip,
|
1991-12-04 23:40:07 +00:00
|
|
|
char *thisdie, char *enddie, struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Called when we find the DIE that starts a structure or union
|
|
|
|
scope (definition) to process all dies that define the members
|
|
|
|
of the structure or union. DIP is a pointer to the die info
|
|
|
|
struct for the DIE that names the structure or union.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
Note that we need to call struct_type regardless of whether or not
|
1991-12-06 19:51:01 +00:00
|
|
|
the DIE has an at_name attribute, since it might be an anonymous
|
|
|
|
structure or union. This gets the type entered into our set of
|
|
|
|
user defined types.
|
|
|
|
|
|
|
|
However, if the structure is incomplete (an opaque struct/union)
|
|
|
|
then suppress creating a symbol table entry for it since gdb only
|
|
|
|
wants to find the one with the complete definition. Note that if
|
|
|
|
it is complete, we just call new_symbol, which does it's own
|
|
|
|
checking about whether the struct/union is anonymous or not (and
|
|
|
|
suppresses creating a symbol table entry itself).
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_structure_scope (dip, thisdie, enddie, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
struct symbol *sym;
|
|
|
|
|
1991-12-04 23:40:07 +00:00
|
|
|
type = struct_type (dip, thisdie, enddie, objfile);
|
1991-12-06 19:51:01 +00:00
|
|
|
if (!(TYPE_FLAGS (type) & TYPE_FLAG_STUB))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
sym = new_symbol (dip, objfile);
|
|
|
|
if (sym != NULL)
|
1991-12-06 19:51:01 +00:00
|
|
|
{
|
|
|
|
SYMBOL_TYPE (sym) = type;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
if (cu_language == language_cplus)
|
|
|
|
{
|
|
|
|
synthesize_typedef (dip, objfile, type);
|
|
|
|
}
|
1991-12-06 19:51:01 +00:00
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_array_element_type -- decode type of the array elements
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static struct type *decode_array_element_type (char *scan, char *end)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
As the last step in decoding the array subscript information for an
|
|
|
|
array DIE, we need to decode the type of the array elements. We are
|
|
|
|
passed a pointer to this last part of the subscript information and
|
|
|
|
must return the appropriate type. If the type attribute is not
|
|
|
|
recognized, just warn about the problem and return type int.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
Create and use macros for iterating on symtabs, psymtabs, msymbols.
* minsyms.c (iterate_over_msymbols): Remove; clunky and slow.
* symfile.h, symtab.h (iterate_over_msymbols): Remove prototype
* coffread.c (coff_symfile_read): iterate_over_symtabs => ALL_SYMTABS.
(patch_opaque_types): Avoid dummy args and result.
* objfiles.c (have_partial_symbols, have_full_symbols,
have_minimal_symbols): explicit iteration => ALL_OBJFILES; simplify.
(iterate_over_objfiles, iterate_over_symtabs,
iterate_over_psymtabs): Remove, clunky and slow.
* objfiles.h: Replace iterate_over_* prototypes with ALL_SYMTABS,
ALL_PSYMTABS, and ALL_MSYMBOLS macros.
* symmisc.c (dump_symtab, dump_psymtab, dump_msymbols,
dump_objfile): Remove dummy args and results. Move filename
comparisons to callers.
(printsyms_command, printpsyms_command, printmsyms_command,
printobjfiles_command): iterate_over_* => ALL_*. Compare filenames.
* symtab.c (lookup_symtab_1, lookup_symtab, lookup_partial_symtab,
lookup_symbol, find_main_psymtab, find_pc_symtab, sources_info,
list_symbols, make_symbol_completion_list): Replace explicit
iteration with ALL_SYMTABS, ALL_PSYMTABS, or ALL_MSYMBOLS.
Eliminate Dijkstra flag crap, break out of loops with gotos.
(lookup_symtab_1): Protect '/' tests from short filenames.
(cplus_mangled_symbol): Move inline into lookup_symbol.
* xcoffexec.c (relocate_objfile_msymbols): Remove poor hack.
(relocate_minimal_symbol): Move inline to vmap_symtab.
(vmap_symtab): Replace iteration with ALL_OBJFILES,
iterate_over_msymbols with ALL_MSYMBOLS.
Misc cleanup prior to release.
* dwarfread.c (dwarf_build_psymtabs): Remove mainline test.
* mipsread.c (compare_symtabs, compare_psymtabs): Remove, unused.
* mipsread.c: Add prototypes for all static functions.
* symmisc.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove, unused.
* xcoffread.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove 2nd
unused copy!
* buildsym.c (define_symbol): Handle global register variables
(from Pierre Willard). Complain if register numbers are too large.
1992-03-29 23:17:36 +00:00
|
|
|
decode_array_element_type (scan)
|
1992-02-22 01:46:16 +00:00
|
|
|
char *scan;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *typep;
|
1992-04-14 04:09:00 +00:00
|
|
|
DIE_REF die_ref;
|
|
|
|
unsigned short attribute;
|
1991-10-24 11:28:54 +00:00
|
|
|
unsigned short fundtype;
|
1992-04-14 04:09:00 +00:00
|
|
|
int nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
attribute = target_to_host (scan, SIZEOF_ATTRIBUTE, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
scan += SIZEOF_ATTRIBUTE;
|
|
|
|
if ((nbytes = attribute_size (attribute)) == -1)
|
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
1992-04-14 04:09:00 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (attribute)
|
|
|
|
{
|
|
|
|
case AT_fund_type:
|
|
|
|
fundtype = target_to_host (scan, nbytes, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
typep = decode_fund_type (fundtype);
|
|
|
|
break;
|
|
|
|
case AT_mod_fund_type:
|
|
|
|
typep = decode_mod_fund_type (scan);
|
|
|
|
break;
|
|
|
|
case AT_user_def_type:
|
|
|
|
die_ref = target_to_host (scan, nbytes, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
if ((typep = lookup_utype (die_ref)) == NULL)
|
|
|
|
{
|
|
|
|
typep = alloc_utype (die_ref, NULL);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case AT_mod_u_d_type:
|
|
|
|
typep = decode_mod_u_d_type (scan);
|
|
|
|
break;
|
|
|
|
default:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&bad_array_element_type, DIE_ID, DIE_NAME, attribute);
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
1992-04-14 04:09:00 +00:00
|
|
|
break;
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
return (typep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
1992-12-15 02:52:11 +00:00
|
|
|
decode_subscript_data_item -- decode array subscript item
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-12-15 02:52:11 +00:00
|
|
|
static struct type *
|
|
|
|
decode_subscript_data_item (char *scan, char *end)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
The array subscripts and the data type of the elements of an
|
|
|
|
array are described by a list of data items, stored as a block
|
|
|
|
of contiguous bytes. There is a data item describing each array
|
|
|
|
dimension, and a final data item describing the element type.
|
|
|
|
The data items are ordered the same as their appearance in the
|
|
|
|
source (I.E. leftmost dimension first, next to leftmost second,
|
|
|
|
etc).
|
|
|
|
|
1992-12-15 02:52:11 +00:00
|
|
|
The data items describing each array dimension consist of four
|
|
|
|
parts: (1) a format specifier, (2) type type of the subscript
|
|
|
|
index, (3) a description of the low bound of the array dimension,
|
|
|
|
and (4) a description of the high bound of the array dimension.
|
|
|
|
|
|
|
|
The last data item is the description of the type of each of
|
|
|
|
the array elements.
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
We are passed a pointer to the start of the block of bytes
|
1992-12-15 02:52:11 +00:00
|
|
|
containing the remaining data items, and a pointer to the first
|
|
|
|
byte past the data. This function recursively decodes the
|
|
|
|
remaining data items and returns a type.
|
|
|
|
|
|
|
|
If we somehow fail to decode some data, we complain about it
|
|
|
|
and return a type "array of int".
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
BUGS
|
|
|
|
FIXME: This code only implements the forms currently used
|
|
|
|
by the AT&T and GNU C compilers.
|
|
|
|
|
|
|
|
The end pointer is supplied for error checking, maybe we should
|
|
|
|
use it for that...
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-12-15 02:52:11 +00:00
|
|
|
decode_subscript_data_item (scan, end)
|
1992-02-22 01:46:16 +00:00
|
|
|
char *scan;
|
|
|
|
char *end;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-12-15 02:52:11 +00:00
|
|
|
struct type *typep = NULL; /* Array type we are building */
|
|
|
|
struct type *nexttype; /* Type of each element (may be array) */
|
|
|
|
struct type *indextype; /* Type of this index */
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
struct type *rangetype;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned int format;
|
|
|
|
unsigned short fundtype;
|
|
|
|
unsigned long lowbound;
|
|
|
|
unsigned long highbound;
|
|
|
|
int nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
format = target_to_host (scan, SIZEOF_FORMAT_SPECIFIER, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
scan += SIZEOF_FORMAT_SPECIFIER;
|
1991-10-24 11:28:54 +00:00
|
|
|
switch (format)
|
|
|
|
{
|
|
|
|
case FMT_ET:
|
Create and use macros for iterating on symtabs, psymtabs, msymbols.
* minsyms.c (iterate_over_msymbols): Remove; clunky and slow.
* symfile.h, symtab.h (iterate_over_msymbols): Remove prototype
* coffread.c (coff_symfile_read): iterate_over_symtabs => ALL_SYMTABS.
(patch_opaque_types): Avoid dummy args and result.
* objfiles.c (have_partial_symbols, have_full_symbols,
have_minimal_symbols): explicit iteration => ALL_OBJFILES; simplify.
(iterate_over_objfiles, iterate_over_symtabs,
iterate_over_psymtabs): Remove, clunky and slow.
* objfiles.h: Replace iterate_over_* prototypes with ALL_SYMTABS,
ALL_PSYMTABS, and ALL_MSYMBOLS macros.
* symmisc.c (dump_symtab, dump_psymtab, dump_msymbols,
dump_objfile): Remove dummy args and results. Move filename
comparisons to callers.
(printsyms_command, printpsyms_command, printmsyms_command,
printobjfiles_command): iterate_over_* => ALL_*. Compare filenames.
* symtab.c (lookup_symtab_1, lookup_symtab, lookup_partial_symtab,
lookup_symbol, find_main_psymtab, find_pc_symtab, sources_info,
list_symbols, make_symbol_completion_list): Replace explicit
iteration with ALL_SYMTABS, ALL_PSYMTABS, or ALL_MSYMBOLS.
Eliminate Dijkstra flag crap, break out of loops with gotos.
(lookup_symtab_1): Protect '/' tests from short filenames.
(cplus_mangled_symbol): Move inline into lookup_symbol.
* xcoffexec.c (relocate_objfile_msymbols): Remove poor hack.
(relocate_minimal_symbol): Move inline to vmap_symtab.
(vmap_symtab): Replace iteration with ALL_OBJFILES,
iterate_over_msymbols with ALL_MSYMBOLS.
Misc cleanup prior to release.
* dwarfread.c (dwarf_build_psymtabs): Remove mainline test.
* mipsread.c (compare_symtabs, compare_psymtabs): Remove, unused.
* mipsread.c: Add prototypes for all static functions.
* symmisc.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove, unused.
* xcoffread.c (dump_symtab_lines, dump_symtabs, dump_last_symtab,
dump_blockvector, dump_block, dump_addrchass, dump_namespace,
dump_symbol, dump_type, dump_linetable, dump_strtbl): Remove 2nd
unused copy!
* buildsym.c (define_symbol): Handle global register variables
(from Pierre Willard). Complain if register numbers are too large.
1992-03-29 23:17:36 +00:00
|
|
|
typep = decode_array_element_type (scan);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FMT_FT_C_C:
|
1992-04-14 04:09:00 +00:00
|
|
|
fundtype = target_to_host (scan, SIZEOF_FMT_FT, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
1992-12-15 02:52:11 +00:00
|
|
|
indextype = decode_fund_type (fundtype);
|
1992-04-14 04:09:00 +00:00
|
|
|
scan += SIZEOF_FMT_FT;
|
1992-12-08 21:47:49 +00:00
|
|
|
nbytes = TARGET_FT_LONG_SIZE (current_objfile);
|
|
|
|
lowbound = target_to_host (scan, nbytes, GET_UNSIGNED, current_objfile);
|
|
|
|
scan += nbytes;
|
|
|
|
highbound = target_to_host (scan, nbytes, GET_UNSIGNED, current_objfile);
|
|
|
|
scan += nbytes;
|
1992-12-15 02:52:11 +00:00
|
|
|
nexttype = decode_subscript_data_item (scan, end);
|
|
|
|
if (nexttype == NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-12-15 02:52:11 +00:00
|
|
|
/* Munged subscript data or other problem, fake it. */
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&subscript_data_items, DIE_ID, DIE_NAME);
|
1992-12-15 02:52:11 +00:00
|
|
|
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
|
|
|
}
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
rangetype = create_range_type ((struct type *) NULL, indextype,
|
|
|
|
lowbound, highbound);
|
|
|
|
typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FMT_FT_C_X:
|
|
|
|
case FMT_FT_X_C:
|
|
|
|
case FMT_FT_X_X:
|
|
|
|
case FMT_UT_C_C:
|
|
|
|
case FMT_UT_C_X:
|
|
|
|
case FMT_UT_X_C:
|
|
|
|
case FMT_UT_X_X:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unhandled_array_subscript_format, DIE_ID, DIE_NAME, format);
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
|
|
|
rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0);
|
|
|
|
typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unknown_array_subscript_format, DIE_ID, DIE_NAME, format);
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
|
|
|
rangetype = create_range_type ((struct type *) NULL, nexttype, 0, 0);
|
|
|
|
typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (typep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
1992-01-11 01:41:23 +00:00
|
|
|
dwarf_read_array_type -- read TAG_array_type DIE
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-01-11 01:41:23 +00:00
|
|
|
static void dwarf_read_array_type (struct dieinfo *dip)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Extract all information from a TAG_array_type DIE and add to
|
|
|
|
the user defined type vector.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
dwarf_read_array_type (dip)
|
|
|
|
struct dieinfo *dip;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type;
|
1992-02-17 15:23:05 +00:00
|
|
|
struct type *utype;
|
1991-10-24 11:28:54 +00:00
|
|
|
char *sub;
|
|
|
|
char *subend;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned short blocksz;
|
|
|
|
int nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
if (dip -> at_ordering != ORD_row_major)
|
|
|
|
{
|
|
|
|
/* FIXME: Can gdb even handle column major arrays? */
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (¬_row_major, DIE_ID, DIE_NAME);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
if ((sub = dip -> at_subscr_data) != NULL)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_subscr_data);
|
|
|
|
blocksz = target_to_host (sub, nbytes, GET_UNSIGNED, current_objfile);
|
|
|
|
subend = sub + nbytes + blocksz;
|
|
|
|
sub += nbytes;
|
1992-12-15 02:52:11 +00:00
|
|
|
type = decode_subscript_data_item (sub, subend);
|
|
|
|
if ((utype = lookup_utype (dip -> die_ref)) == NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-12-15 02:52:11 +00:00
|
|
|
/* Install user defined type that has not been referenced yet. */
|
|
|
|
alloc_utype (dip -> die_ref, type);
|
|
|
|
}
|
|
|
|
else if (TYPE_CODE (utype) == TYPE_CODE_UNDEF)
|
|
|
|
{
|
|
|
|
/* Ick! A forward ref has already generated a blank type in our
|
|
|
|
slot, and this type probably already has things pointing to it
|
|
|
|
(which is what caused it to be created in the first place).
|
|
|
|
If it's just a place holder we can plop our fully defined type
|
|
|
|
on top of it. We can't recover the space allocated for our
|
|
|
|
new type since it might be on an obstack, but we could reuse
|
|
|
|
it if we kept a list of them, but it might not be worth it
|
|
|
|
(FIXME). */
|
|
|
|
*utype = *type;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-12-15 02:52:11 +00:00
|
|
|
/* Double ick! Not only is a type already in our slot, but
|
|
|
|
someone has decorated it. Complain and leave it alone. */
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1992-02-17 23:26:54 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_tag_pointer_type -- read TAG_pointer_type DIE
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void read_tag_pointer_type (struct dieinfo *dip)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Extract all information from a TAG_pointer_type DIE and add to
|
|
|
|
the user defined type vector.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_tag_pointer_type (dip)
|
|
|
|
struct dieinfo *dip;
|
1992-02-17 23:26:54 +00:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
struct type *utype;
|
|
|
|
|
|
|
|
type = decode_die_type (dip);
|
1992-04-14 04:09:00 +00:00
|
|
|
if ((utype = lookup_utype (dip -> die_ref)) == NULL)
|
1992-02-17 23:26:54 +00:00
|
|
|
{
|
|
|
|
utype = lookup_pointer_type (type);
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
alloc_utype (dip -> die_ref, utype);
|
1992-02-17 23:26:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
TYPE_TARGET_TYPE (utype) = type;
|
|
|
|
TYPE_POINTER_TYPE (type) = utype;
|
|
|
|
|
|
|
|
/* We assume the machine has only one representation for pointers! */
|
|
|
|
/* FIXME: This confuses host<->target data representations, and is a
|
|
|
|
poor assumption besides. */
|
|
|
|
|
|
|
|
TYPE_LENGTH (utype) = sizeof (char *);
|
|
|
|
TYPE_CODE (utype) = TYPE_CODE_PTR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1993-01-19 23:00:19 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_tag_string_type -- read TAG_string_type DIE
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void read_tag_string_type (struct dieinfo *dip)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Extract all information from a TAG_string_type DIE and add to
|
|
|
|
the user defined type vector. It isn't really a user defined
|
|
|
|
type, but it behaves like one, with other DIE's using an
|
|
|
|
AT_user_def_type attribute to reference it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
read_tag_string_type (dip)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
{
|
|
|
|
struct type *utype;
|
|
|
|
struct type *indextype;
|
|
|
|
struct type *rangetype;
|
|
|
|
unsigned long lowbound = 0;
|
|
|
|
unsigned long highbound;
|
|
|
|
|
1993-02-23 19:30:22 +00:00
|
|
|
if (dip -> has_at_byte_size)
|
1993-01-19 23:00:19 +00:00
|
|
|
{
|
1993-02-23 19:30:22 +00:00
|
|
|
/* A fixed bounds string */
|
|
|
|
highbound = dip -> at_byte_size - 1;
|
1993-01-19 23:00:19 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1993-02-23 19:30:22 +00:00
|
|
|
/* A varying length string. Stub for now. (FIXME) */
|
|
|
|
highbound = 1;
|
|
|
|
}
|
|
|
|
indextype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
|
|
|
rangetype = create_range_type ((struct type *) NULL, indextype, lowbound,
|
|
|
|
highbound);
|
|
|
|
|
|
|
|
utype = lookup_utype (dip -> die_ref);
|
|
|
|
if (utype == NULL)
|
|
|
|
{
|
|
|
|
/* No type defined, go ahead and create a blank one to use. */
|
|
|
|
utype = alloc_utype (dip -> die_ref, (struct type *) NULL);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Already a type in our slot due to a forward reference. Make sure it
|
|
|
|
is a blank one. If not, complain and leave it alone. */
|
|
|
|
if (TYPE_CODE (utype) != TYPE_CODE_UNDEF)
|
1993-01-19 23:00:19 +00:00
|
|
|
{
|
1993-02-23 19:30:22 +00:00
|
|
|
complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
|
|
|
|
return;
|
1993-01-19 23:00:19 +00:00
|
|
|
}
|
|
|
|
}
|
1993-02-23 19:30:22 +00:00
|
|
|
|
|
|
|
/* Create the string type using the blank type we either found or created. */
|
|
|
|
utype = create_string_type (utype, rangetype);
|
1993-01-19 23:00:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_subroutine_type -- process TAG_subroutine_type dies
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void read_subroutine_type (struct dieinfo *dip, char thisdie,
|
|
|
|
char *enddie)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Handle DIES due to C code like:
|
|
|
|
|
|
|
|
struct foo {
|
|
|
|
int (*funcp)(int a, long l); (Generates TAG_subroutine_type DIE)
|
|
|
|
int b;
|
|
|
|
};
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
The parameter DIES are currently ignored. See if gdb has a way to
|
|
|
|
include this info in it's type system, and decode them if so. Is
|
|
|
|
this what the type structure's "arg_types" field is for? (FIXME)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_subroutine_type (dip, thisdie, enddie)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-02-17 15:23:05 +00:00
|
|
|
struct type *type; /* Type that this function returns */
|
|
|
|
struct type *ftype; /* Function that returns above type */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-02-17 15:23:05 +00:00
|
|
|
/* Decode the type that this subroutine returns */
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
type = decode_die_type (dip);
|
1992-02-17 15:23:05 +00:00
|
|
|
|
|
|
|
/* Check to see if we already have a partially constructed user
|
|
|
|
defined type for this DIE, from a forward reference. */
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
if ((ftype = lookup_utype (dip -> die_ref)) == NULL)
|
1992-02-17 15:23:05 +00:00
|
|
|
{
|
|
|
|
/* This is the first reference to one of these types. Make
|
|
|
|
a new one and place it in the user defined types. */
|
|
|
|
ftype = lookup_function_type (type);
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
alloc_utype (dip -> die_ref, ftype);
|
1992-02-17 15:23:05 +00:00
|
|
|
}
|
1992-12-15 02:52:11 +00:00
|
|
|
else if (TYPE_CODE (ftype) == TYPE_CODE_UNDEF)
|
1992-02-17 15:23:05 +00:00
|
|
|
{
|
|
|
|
/* We have an existing partially constructed type, so bash it
|
|
|
|
into the correct type. */
|
|
|
|
TYPE_TARGET_TYPE (ftype) = type;
|
|
|
|
TYPE_LENGTH (ftype) = 1;
|
|
|
|
TYPE_CODE (ftype) = TYPE_CODE_FUNC;
|
|
|
|
}
|
1992-12-15 02:52:11 +00:00
|
|
|
else
|
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&dup_user_type_definition, DIE_ID, DIE_NAME);
|
1992-12-15 02:52:11 +00:00
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_enumeration -- process dies which define an enumeration
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void read_enumeration (struct dieinfo *dip, char *thisdie,
|
1992-02-22 01:46:16 +00:00
|
|
|
char *enddie, struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to a die which begins an enumeration, process all
|
|
|
|
the dies that define the members of the enumeration.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
Note that we need to call enum_type regardless of whether or not we
|
|
|
|
have a symbol, since we might have an enum without a tag name (thus
|
|
|
|
no symbol for the tagname).
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_enumeration (dip, thisdie, enddie, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
struct symbol *sym;
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
type = enum_type (dip, objfile);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
sym = new_symbol (dip, objfile);
|
|
|
|
if (sym != NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
SYMBOL_TYPE (sym) = type;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
if (cu_language == language_cplus)
|
|
|
|
{
|
|
|
|
synthesize_typedef (dip, objfile, type);
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
enum_type -- decode and return a type for an enumeration
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
static type *enum_type (struct dieinfo *dip, struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to a die information structure for the die which
|
|
|
|
starts an enumeration, process all the dies that define the members
|
|
|
|
of the enumeration and return a type pointer for the enumeration.
|
1991-12-05 05:09:20 +00:00
|
|
|
|
1991-12-06 02:22:10 +00:00
|
|
|
At the same time, for each member of the enumeration, create a
|
|
|
|
symbol for it with namespace VAR_NAMESPACE and class LOC_CONST,
|
|
|
|
and give it the type of the enumeration itself.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
1991-12-05 05:09:20 +00:00
|
|
|
Note that the DWARF specification explicitly mandates that enum
|
|
|
|
constants occur in reverse order from the source program order,
|
|
|
|
for "consistency" and because this ordering is easier for many
|
1992-02-22 01:46:16 +00:00
|
|
|
compilers to generate. (Draft 6, sec 3.8.5, Enumeration type
|
1991-12-06 02:22:10 +00:00
|
|
|
Entries). Because gdb wants to see the enum members in program
|
|
|
|
source order, we have to ensure that the order gets reversed while
|
1991-12-05 05:09:20 +00:00
|
|
|
we are processing them.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
enum_type (dip, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *type;
|
|
|
|
struct nextfield {
|
|
|
|
struct nextfield *next;
|
|
|
|
struct field field;
|
|
|
|
};
|
|
|
|
struct nextfield *list = NULL;
|
|
|
|
struct nextfield *new;
|
|
|
|
int nfields = 0;
|
|
|
|
int n;
|
|
|
|
char *scan;
|
|
|
|
char *listend;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned short blocksz;
|
1991-12-06 02:22:10 +00:00
|
|
|
struct symbol *sym;
|
1992-04-14 04:09:00 +00:00
|
|
|
int nbytes;
|
1995-10-21 13:14:53 +00:00
|
|
|
int unsigned_enum = 1;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
if ((type = lookup_utype (dip -> die_ref)) == NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1991-12-06 19:51:01 +00:00
|
|
|
/* No forward references created an empty type, so install one now */
|
1992-04-14 04:09:00 +00:00
|
|
|
type = alloc_utype (dip -> die_ref, NULL);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
TYPE_CODE (type) = TYPE_CODE_ENUM;
|
1991-12-06 19:51:01 +00:00
|
|
|
/* Some compilers try to be helpful by inventing "fake" names for
|
|
|
|
anonymous enums, structures, and unions, like "~0fake" or ".0fake".
|
|
|
|
Thanks, but no thanks... */
|
1991-12-06 02:22:10 +00:00
|
|
|
if (dip -> at_name != NULL
|
|
|
|
&& *dip -> at_name != '~'
|
|
|
|
&& *dip -> at_name != '.')
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1993-07-02 02:57:06 +00:00
|
|
|
TYPE_TAG_NAME (type) = obconcat (&objfile -> type_obstack,
|
|
|
|
"", "", dip -> at_name);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1991-12-06 02:22:10 +00:00
|
|
|
if (dip -> at_byte_size != 0)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
TYPE_LENGTH (type) = dip -> at_byte_size;
|
|
|
|
}
|
|
|
|
if ((scan = dip -> at_element_list) != NULL)
|
|
|
|
{
|
1991-11-20 13:07:12 +00:00
|
|
|
if (dip -> short_element_list)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_short_element_list);
|
1991-11-20 13:07:12 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_element_list);
|
1991-11-20 13:07:12 +00:00
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
blocksz = target_to_host (scan, nbytes, GET_UNSIGNED, objfile);
|
|
|
|
listend = scan + nbytes + blocksz;
|
|
|
|
scan += nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
while (scan < listend)
|
|
|
|
{
|
|
|
|
new = (struct nextfield *) alloca (sizeof (struct nextfield));
|
|
|
|
new -> next = list;
|
|
|
|
list = new;
|
|
|
|
list -> field.type = NULL;
|
|
|
|
list -> field.bitsize = 0;
|
1992-04-14 04:09:00 +00:00
|
|
|
list -> field.bitpos =
|
|
|
|
target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED,
|
|
|
|
objfile);
|
|
|
|
scan += TARGET_FT_LONG_SIZE (objfile);
|
1992-06-25 19:10:49 +00:00
|
|
|
list -> field.name = obsavestring (scan, strlen (scan),
|
|
|
|
&objfile -> type_obstack);
|
1991-10-24 11:28:54 +00:00
|
|
|
scan += strlen (scan) + 1;
|
|
|
|
nfields++;
|
1991-12-06 02:22:10 +00:00
|
|
|
/* Handcraft a new symbol for this enum member. */
|
1992-02-22 01:46:16 +00:00
|
|
|
sym = (struct symbol *) obstack_alloc (&objfile->symbol_obstack,
|
1991-12-06 02:22:10 +00:00
|
|
|
sizeof (struct symbol));
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
memset (sym, 0, sizeof (struct symbol));
|
1992-04-14 04:09:00 +00:00
|
|
|
SYMBOL_NAME (sym) = create_name (list -> field.name,
|
|
|
|
&objfile->symbol_obstack);
|
* tm-sun4sol2.h (CPLUS_MARKER): Remove, now set in tm-sysv4.h.
* tm-sysv4.h (CPLUS_MARKER): By default, g++ uses '.' as the
CPLUS_MARKER for all SVR4 systems, so follow suit.
* defs.h (strdup_demangled): Remove prototype.
* dwarfread.c (enum_type, synthesize_typedef): Use new macro
SYMBOL_INIT_LANGUAGE_SPECIFIC.
* dwarfread.c (new_symbol): Use SYMBOL_INIT_DEMANGLED_NAME.
* minsyms.c (install_minimal_symbols, prim_record_minimal_symbol,
prim_record_minimal_symbol_and_info): Use new macro
SYMBOL_INIT_LANGUAGE_SPECIFIC.
* minsyms.c (install_minimal_symbols): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* stabsread.c (define_symbol): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Use new macro SYMBOL_INIT_DEMANGLED_NAME.
* symfile.h (ADD_PSYMBOL_VT_TO_LIST): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* symmisc.c (dump_msymbols, dump_symtab, print_partial_symbol):
SYMBOL_DEMANGLED_NAME now tests language itself.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): SYMBOL_DEMANGLED_NAME
now tests language itself.
* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): New macro that does
what SYMBOL_DEMANGLED_NAME used to do, directly access the C++
mangled name member in the language dependent portion of a symbol.
* symtab.h (SYMBOL_DEMANGLED_NAME): New macro that returns the
mangled name member appropriate for a symbol's language.
* symtab.h (SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME,
SYMBOL_MATCHES_NAME, SYMBOL_MATCHES_REGEXP):
SYMBOL_DEMANGLED_NAME now tests language itself.
* symtab.h (SYMBOL_INIT_LANGUAGE_SPECIFIC): New macro that
initializes language dependent portion of symbol.
* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): New macro that
demangles and caches the demangled form of symbol names.
* utils.c (fputs_demangled, fprint_symbol): Use current language
to select an appropriate demangling algorithm.
* utils.c (strdup_demangled): Remove, no longer used.
**** start-sanitize-chill ****
* symtab.h (SYMBOL_CHILL_DEMANGLED_NAME): New macro that directly
access the Chill mangled name member in the language dependent
portion of a symbol.
* ch-lang.c (chill_demangle): New function, simple demangler.
* defs.h (chill_demangle): Add prototype.
* symtab.h (language_dependent_info): Add struct for Chill.
**** end-sanitize-chill ****
1993-01-01 20:29:41 +00:00
|
|
|
SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
|
1991-12-06 02:22:10 +00:00
|
|
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
|
|
|
SYMBOL_CLASS (sym) = LOC_CONST;
|
|
|
|
SYMBOL_TYPE (sym) = type;
|
|
|
|
SYMBOL_VALUE (sym) = list -> field.bitpos;
|
1995-10-21 13:14:53 +00:00
|
|
|
if (SYMBOL_VALUE (sym) < 0)
|
|
|
|
unsigned_enum = 0;
|
1992-01-11 01:41:23 +00:00
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1991-12-06 19:51:01 +00:00
|
|
|
/* Now create the vector of fields, and record how big it is. This is
|
1992-06-23 03:33:47 +00:00
|
|
|
where we reverse the order, by pulling the members off the list in
|
1991-12-06 19:51:01 +00:00
|
|
|
reverse order from how they were inserted. If we have no fields
|
|
|
|
(this is apparently possible in C++) then skip building a field
|
|
|
|
vector. */
|
|
|
|
if (nfields > 0)
|
|
|
|
{
|
1995-10-21 13:14:53 +00:00
|
|
|
if (unsigned_enum)
|
|
|
|
TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
|
1991-12-06 19:51:01 +00:00
|
|
|
TYPE_NFIELDS (type) = nfields;
|
|
|
|
TYPE_FIELDS (type) = (struct field *)
|
1992-02-22 01:46:16 +00:00
|
|
|
obstack_alloc (&objfile->symbol_obstack, sizeof (struct field) * nfields);
|
1991-12-06 19:51:01 +00:00
|
|
|
/* Copy the saved-up fields into the field vector. */
|
|
|
|
for (n = 0; (n < nfields) && (list != NULL); list = list -> next)
|
|
|
|
{
|
|
|
|
TYPE_FIELD (type, n++) = list -> field;
|
|
|
|
}
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
return (type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_func_scope -- process all dies within a function scope
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Process all dies within a given function scope. We are passed
|
|
|
|
a die information structure pointer DIP for the die which
|
|
|
|
starts the function scope, and pointers into the raw die data
|
|
|
|
that define the dies within the function scope.
|
|
|
|
|
|
|
|
For now, we ignore lexical block scopes within the function.
|
|
|
|
The problem is that AT&T cc does not define a DWARF lexical
|
|
|
|
block scope for the function itself, while gcc defines a
|
|
|
|
lexical block scope for the function. We need to think about
|
|
|
|
how to handle this difference, or if it is even a problem.
|
|
|
|
(FIXME)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_func_scope (dip, thisdie, enddie, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-01-11 01:41:23 +00:00
|
|
|
register struct context_stack *new;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-03-21 01:56:01 +00:00
|
|
|
if (objfile -> ei.entry_point >= dip -> at_low_pc &&
|
|
|
|
objfile -> ei.entry_point < dip -> at_high_pc)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-03-21 01:56:01 +00:00
|
|
|
objfile -> ei.entry_func_lowpc = dip -> at_low_pc;
|
|
|
|
objfile -> ei.entry_func_highpc = dip -> at_high_pc;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1992-01-11 01:41:23 +00:00
|
|
|
if (STREQ (dip -> at_name, "main")) /* FIXME: hardwired name */
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-03-21 01:56:01 +00:00
|
|
|
objfile -> ei.main_func_lowpc = dip -> at_low_pc;
|
|
|
|
objfile -> ei.main_func_highpc = dip -> at_high_pc;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1992-01-11 01:41:23 +00:00
|
|
|
new = push_context (0, dip -> at_low_pc);
|
1992-02-22 01:46:16 +00:00
|
|
|
new -> name = new_symbol (dip, objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
list_in_scope = &local_symbols;
|
1992-04-14 04:09:00 +00:00
|
|
|
process_dies (thisdie + dip -> die_length, enddie, objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
new = pop_context ();
|
|
|
|
/* Make a block for the local symbols within. */
|
|
|
|
finish_block (new -> name, &local_symbols, new -> old_blocks,
|
1992-02-22 01:46:16 +00:00
|
|
|
new -> start_addr, dip -> at_high_pc, objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
list_in_scope = &file_symbols;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
1992-07-14 02:13:12 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
handle_producer -- process the AT_producer attribute
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Perform any operations that depend on finding a particular
|
|
|
|
AT_producer attribute.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
handle_producer (producer)
|
|
|
|
char *producer;
|
|
|
|
{
|
|
|
|
|
|
|
|
/* If this compilation unit was compiled with g++ or gcc, then set the
|
|
|
|
processing_gcc_compilation flag. */
|
|
|
|
|
|
|
|
processing_gcc_compilation =
|
|
|
|
STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER))
|
1992-12-02 01:10:49 +00:00
|
|
|
|| STREQN (producer, CHILL_PRODUCER, strlen (CHILL_PRODUCER))
|
1992-07-14 02:13:12 +00:00
|
|
|
|| STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER));
|
|
|
|
|
|
|
|
/* Select a demangling style if we can identify the producer and if
|
|
|
|
the current style is auto. We leave the current style alone if it
|
|
|
|
is not auto. We also leave the demangling style alone if we find a
|
|
|
|
gcc (cc1) producer, as opposed to a g++ (cc1plus) producer. */
|
|
|
|
|
* cplus-dem.c (cplus_markers): Add table for gnu style and
use throughout, in place of compile time constant CPLUS_MARKER.
* cplus-dem.c (ARM_VTABLE_STRING, ARM_VTABLE_STRLEN): Add.
* cplus-dem.c (cfront_special): New function, as suggested
by pfieland@stratus.com.
* cplus-dem.c (forget_types): New function.
* cplus-dem.c (cplus_demangle): Call gnu_special, moved from
demangle_prefix().
* cplus-dem.c (mop_up): Call forget_types().
* cplus-dem.c (AUTO_DEMANGLING, GNU_DEMANGLING, LUCID_DEMANGLING):
Use throughout, instead of checking current_demangling_style.
* cplus-dem.c (demangle_signature): When finding an explicit
start of function args, forget all remembered types for
lucid/cfront style demangling.
* cplus-dem.c (demangle_prefix): In a sequence of two or more
underbar characters, use last pair as the delimiter. Hoist
gnu_special() call up to cplus_demangle(). Call cfront_special()
when appropriate.
* cplus-dem.c (cplus_special): Fix virtual table name demangling
for inherited classes.
* cplus-dem.c (demangle_args): Document quirks of numbered
references to previously seen types.
* dbxread.c (read_ofile_symtab, process_one_symbol):
Use AUTO_DEMANGLING rather than explicitly checking
current_demangling_style.
* demangle.h: Add some comments.
* demangle.h (AUTO_DEMANGLING, GNU_DEMANGLING, LUCID_DEMANGLING,
CFRONT_DEMANGLING): New macros.
* dwarfread.c (LCC_PRODUCER): Remove trailing space, which is
not found in the actual producer string produced by lcc.
* dwarfread.c (handle_producer): Use AUTO_DEMANGLING rather
than explicitly checking current_demangling_style.
1992-08-14 19:14:15 +00:00
|
|
|
if (AUTO_DEMANGLING)
|
1992-07-14 02:13:12 +00:00
|
|
|
{
|
|
|
|
if (STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)))
|
|
|
|
{
|
|
|
|
set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
|
|
|
|
}
|
|
|
|
else if (STREQN (producer, LCC_PRODUCER, strlen (LCC_PRODUCER)))
|
|
|
|
{
|
|
|
|
set_demangling_style (LUCID_DEMANGLING_STYLE_STRING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_file_scope -- process all dies within a file scope
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Process all dies within a given file scope. We are passed a
|
|
|
|
pointer to the die information structure for the die which
|
|
|
|
starts the file scope, and pointers into the raw die data which
|
|
|
|
mark the range of dies within the file scope.
|
|
|
|
|
|
|
|
When the partial symbol table is built, the file offset for the line
|
|
|
|
number table for each compilation unit is saved in the partial symbol
|
|
|
|
table entry for that compilation unit. As the symbols for each
|
|
|
|
compilation unit are read, the line number table is read into memory
|
|
|
|
and the variable lnbase is set to point to it. Thus all we have to
|
|
|
|
do is use lnbase to access the line number table for the current
|
|
|
|
compilation unit.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_file_scope (dip, thisdie, enddie, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct cleanup *back_to;
|
1992-01-11 01:41:23 +00:00
|
|
|
struct symtab *symtab;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-03-21 01:56:01 +00:00
|
|
|
if (objfile -> ei.entry_point >= dip -> at_low_pc &&
|
|
|
|
objfile -> ei.entry_point < dip -> at_high_pc)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-03-21 01:56:01 +00:00
|
|
|
objfile -> ei.entry_file_lowpc = dip -> at_low_pc;
|
|
|
|
objfile -> ei.entry_file_highpc = dip -> at_high_pc;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
set_cu_language (dip);
|
1992-01-11 01:41:23 +00:00
|
|
|
if (dip -> at_producer != NULL)
|
|
|
|
{
|
1992-07-14 02:13:12 +00:00
|
|
|
handle_producer (dip -> at_producer);
|
1992-01-11 01:41:23 +00:00
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
numutypes = (enddie - thisdie) / 4;
|
|
|
|
utypes = (struct type **) xmalloc (numutypes * sizeof (struct type *));
|
|
|
|
back_to = make_cleanup (free, utypes);
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
memset (utypes, 0, numutypes * sizeof (struct type *));
|
1992-12-03 20:28:16 +00:00
|
|
|
memset (ftypes, 0, FT_NUM_MEMBERS * sizeof (struct type *));
|
1992-07-17 17:16:26 +00:00
|
|
|
start_symtab (dip -> at_name, dip -> at_comp_dir, dip -> at_low_pc);
|
1991-10-24 11:28:54 +00:00
|
|
|
decode_line_numbers (lnbase);
|
1992-04-14 04:09:00 +00:00
|
|
|
process_dies (thisdie + dip -> die_length, enddie, objfile);
|
1993-03-26 14:59:43 +00:00
|
|
|
|
1996-01-08 17:55:25 +00:00
|
|
|
symtab = end_symtab (dip -> at_high_pc, objfile, 0);
|
1992-08-12 18:17:48 +00:00
|
|
|
if (symtab != NULL)
|
1992-01-11 01:41:23 +00:00
|
|
|
{
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
symtab -> language = cu_language;
|
1992-08-12 18:17:48 +00:00
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
do_cleanups (back_to);
|
|
|
|
utypes = NULL;
|
|
|
|
numutypes = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
process_dies -- process a range of DWARF Information Entries
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1991-12-04 23:40:07 +00:00
|
|
|
static void process_dies (char *thisdie, char *enddie,
|
|
|
|
struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Process all DIE's in a specified range. May be (and almost
|
|
|
|
certainly will be) called recursively.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
process_dies (thisdie, enddie, objfile)
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
char *nextdie;
|
|
|
|
struct dieinfo di;
|
|
|
|
|
|
|
|
while (thisdie < enddie)
|
|
|
|
{
|
1992-04-11 06:27:53 +00:00
|
|
|
basicdieinfo (&di, thisdie, objfile);
|
1992-04-14 04:09:00 +00:00
|
|
|
if (di.die_length < SIZEOF_DIE_LENGTH)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
else if (di.die_tag == TAG_padding)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nextdie = thisdie + di.die_length;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo (&di, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
if (di.at_sibling != 0)
|
|
|
|
{
|
|
|
|
nextdie = dbbase + di.at_sibling - dbroff;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nextdie = thisdie + di.die_length;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1994-01-28 16:25:25 +00:00
|
|
|
#ifdef SMASH_TEXT_ADDRESS
|
|
|
|
/* I think that these are always text, not data, addresses. */
|
|
|
|
SMASH_TEXT_ADDRESS (di.at_low_pc);
|
|
|
|
SMASH_TEXT_ADDRESS (di.at_high_pc);
|
|
|
|
#endif
|
1992-04-14 04:09:00 +00:00
|
|
|
switch (di.die_tag)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
case TAG_compile_unit:
|
1994-02-04 09:19:35 +00:00
|
|
|
/* Skip Tag_compile_unit if we are already inside a compilation
|
|
|
|
unit, we are unable to handle nested compilation units
|
|
|
|
properly (FIXME). */
|
|
|
|
if (current_subfile == NULL)
|
|
|
|
read_file_scope (&di, thisdie, nextdie, objfile);
|
|
|
|
else
|
|
|
|
nextdie = thisdie + di.die_length;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_global_subroutine:
|
|
|
|
case TAG_subroutine:
|
1991-11-18 08:07:43 +00:00
|
|
|
if (di.has_at_low_pc)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1991-11-09 10:50:07 +00:00
|
|
|
read_func_scope (&di, thisdie, nextdie, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TAG_lexical_block:
|
1991-11-09 10:50:07 +00:00
|
|
|
read_lexical_block_scope (&di, thisdie, nextdie, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case TAG_class_type:
|
1991-10-24 11:28:54 +00:00
|
|
|
case TAG_structure_type:
|
|
|
|
case TAG_union_type:
|
1991-12-04 23:40:07 +00:00
|
|
|
read_structure_scope (&di, thisdie, nextdie, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_enumeration_type:
|
1992-02-22 01:46:16 +00:00
|
|
|
read_enumeration (&di, thisdie, nextdie, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_subroutine_type:
|
|
|
|
read_subroutine_type (&di, thisdie, nextdie);
|
|
|
|
break;
|
|
|
|
case TAG_array_type:
|
1992-01-11 01:41:23 +00:00
|
|
|
dwarf_read_array_type (&di);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
1992-02-17 23:26:54 +00:00
|
|
|
case TAG_pointer_type:
|
|
|
|
read_tag_pointer_type (&di);
|
|
|
|
break;
|
1993-01-19 23:00:19 +00:00
|
|
|
case TAG_string_type:
|
|
|
|
read_tag_string_type (&di);
|
|
|
|
break;
|
1991-10-24 11:28:54 +00:00
|
|
|
default:
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
new_symbol (&di, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
thisdie = nextdie;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_line_numbers -- decode a line number table fragment
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void decode_line_numbers (char *tblscan, char *tblend,
|
|
|
|
long length, long base, long line, long pc)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Translate the DWARF line number information to gdb form.
|
|
|
|
|
|
|
|
The ".line" section contains one or more line number tables, one for
|
|
|
|
each ".line" section from the objects that were linked.
|
|
|
|
|
|
|
|
The AT_stmt_list attribute for each TAG_source_file entry in the
|
|
|
|
".debug" section contains the offset into the ".line" section for the
|
|
|
|
start of the table for that file.
|
|
|
|
|
|
|
|
The table itself has the following structure:
|
|
|
|
|
|
|
|
<table length><base address><source statement entry>
|
|
|
|
4 bytes 4 bytes 10 bytes
|
|
|
|
|
|
|
|
The table length is the total size of the table, including the 4 bytes
|
|
|
|
for the length information.
|
|
|
|
|
|
|
|
The base address is the address of the first instruction generated
|
|
|
|
for the source file.
|
|
|
|
|
|
|
|
Each source statement entry has the following structure:
|
|
|
|
|
|
|
|
<line number><statement position><address delta>
|
|
|
|
4 bytes 2 bytes 4 bytes
|
|
|
|
|
|
|
|
The line number is relative to the start of the file, starting with
|
|
|
|
line 1.
|
|
|
|
|
|
|
|
The statement position either -1 (0xFFFF) or the number of characters
|
|
|
|
from the beginning of the line to the beginning of the statement.
|
|
|
|
|
|
|
|
The address delta is the difference between the base address and
|
|
|
|
the address of the first instruction for the statement.
|
|
|
|
|
|
|
|
Note that we must copy the bytes from the packed table to our local
|
|
|
|
variables before attempting to use them, to avoid alignment problems
|
|
|
|
on some machines, particularly RISC processors.
|
|
|
|
|
|
|
|
BUGS
|
|
|
|
|
|
|
|
Does gdb expect the line numbers to be sorted? They are now by
|
|
|
|
chance/luck, but are not required to be. (FIXME)
|
|
|
|
|
|
|
|
The line with number 0 is unused, gdb apparently can discover the
|
|
|
|
span of the last line some other way. How? (FIXME)
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_line_numbers (linetable)
|
|
|
|
char *linetable;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
char *tblscan;
|
|
|
|
char *tblend;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned long length;
|
|
|
|
unsigned long base;
|
|
|
|
unsigned long line;
|
|
|
|
unsigned long pc;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
if (linetable != NULL)
|
|
|
|
{
|
|
|
|
tblscan = tblend = linetable;
|
1992-04-14 04:09:00 +00:00
|
|
|
length = target_to_host (tblscan, SIZEOF_LINETBL_LENGTH, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
tblscan += SIZEOF_LINETBL_LENGTH;
|
1991-10-24 11:28:54 +00:00
|
|
|
tblend += length;
|
1992-04-14 04:09:00 +00:00
|
|
|
base = target_to_host (tblscan, TARGET_FT_POINTER_SIZE (objfile),
|
|
|
|
GET_UNSIGNED, current_objfile);
|
|
|
|
tblscan += TARGET_FT_POINTER_SIZE (objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
base += baseaddr;
|
|
|
|
while (tblscan < tblend)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
line = target_to_host (tblscan, SIZEOF_LINETBL_LINENO, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
tblscan += SIZEOF_LINETBL_LINENO + SIZEOF_LINETBL_STMT;
|
|
|
|
pc = target_to_host (tblscan, SIZEOF_LINETBL_DELTA, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
tblscan += SIZEOF_LINETBL_DELTA;
|
1991-10-24 11:28:54 +00:00
|
|
|
pc += base;
|
1992-04-14 04:09:00 +00:00
|
|
|
if (line != 0)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-01-11 01:41:23 +00:00
|
|
|
record_line (current_subfile, line, pc);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
locval -- compute the value of a location attribute
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static int locval (char *loc)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given pointer to a string of bytes that define a location, compute
|
|
|
|
the location and return the value.
|
1995-07-20 05:52:42 +00:00
|
|
|
A location description containing no atoms indicates that the
|
|
|
|
object is optimized out. The global optimized_out flag is set for
|
|
|
|
those, the return value is meaningless.
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
When computing values involving the current value of the frame pointer,
|
|
|
|
the value zero is used, which results in a value relative to the frame
|
|
|
|
pointer, rather than the absolute value. This is what GDB wants
|
|
|
|
anyway.
|
|
|
|
|
|
|
|
When the result is a register number, the global isreg flag is set,
|
|
|
|
otherwise it is cleared. This is a kludge until we figure out a better
|
|
|
|
way to handle the problem. Gdb's design does not mesh well with the
|
|
|
|
DWARF notion of a location computing interpreter, which is a shame
|
|
|
|
because the flexibility goes unused.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
Note that stack[0] is unused except as a default error return.
|
|
|
|
Note that stack overflow is not yet handled.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
1992-02-22 01:46:16 +00:00
|
|
|
locval (loc)
|
|
|
|
char *loc;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
unsigned short nbytes;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned short locsize;
|
|
|
|
auto long stack[64];
|
1991-10-24 11:28:54 +00:00
|
|
|
int stacki;
|
|
|
|
char *end;
|
1992-04-14 04:09:00 +00:00
|
|
|
int loc_atom_code;
|
|
|
|
int loc_value_size;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_location);
|
|
|
|
locsize = target_to_host (loc, nbytes, GET_UNSIGNED, current_objfile);
|
|
|
|
loc += nbytes;
|
|
|
|
end = loc + locsize;
|
1991-10-24 11:28:54 +00:00
|
|
|
stacki = 0;
|
|
|
|
stack[stacki] = 0;
|
|
|
|
isreg = 0;
|
1992-01-15 06:42:32 +00:00
|
|
|
offreg = 0;
|
1995-07-20 05:52:42 +00:00
|
|
|
optimized_out = 1;
|
1992-04-14 04:09:00 +00:00
|
|
|
loc_value_size = TARGET_FT_LONG_SIZE (current_objfile);
|
|
|
|
while (loc < end)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1995-07-20 05:52:42 +00:00
|
|
|
optimized_out = 0;
|
1992-04-14 04:09:00 +00:00
|
|
|
loc_atom_code = target_to_host (loc, SIZEOF_LOC_ATOM_CODE, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
loc += SIZEOF_LOC_ATOM_CODE;
|
|
|
|
switch (loc_atom_code)
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
/* error */
|
|
|
|
loc = end;
|
|
|
|
break;
|
|
|
|
case OP_REG:
|
|
|
|
/* push register (number) */
|
1994-12-17 10:46:32 +00:00
|
|
|
stack[++stacki]
|
|
|
|
= DWARF_REG_TO_REGNUM (target_to_host (loc, loc_value_size,
|
|
|
|
GET_UNSIGNED,
|
|
|
|
current_objfile));
|
1992-04-14 04:09:00 +00:00
|
|
|
loc += loc_value_size;
|
|
|
|
isreg = 1;
|
|
|
|
break;
|
|
|
|
case OP_BASEREG:
|
|
|
|
/* push value of register (number) */
|
1993-08-24 21:38:24 +00:00
|
|
|
/* Actually, we compute the value as if register has 0, so the
|
|
|
|
value ends up being the offset from that register. */
|
1992-04-14 04:09:00 +00:00
|
|
|
offreg = 1;
|
1993-08-24 21:38:24 +00:00
|
|
|
basereg = target_to_host (loc, loc_value_size, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
1992-04-14 04:09:00 +00:00
|
|
|
loc += loc_value_size;
|
1993-08-24 21:38:24 +00:00
|
|
|
stack[++stacki] = 0;
|
1992-04-14 04:09:00 +00:00
|
|
|
break;
|
|
|
|
case OP_ADDR:
|
|
|
|
/* push address (relocated address) */
|
|
|
|
stack[++stacki] = target_to_host (loc, loc_value_size,
|
|
|
|
GET_UNSIGNED, current_objfile);
|
|
|
|
loc += loc_value_size;
|
|
|
|
break;
|
|
|
|
case OP_CONST:
|
|
|
|
/* push constant (number) FIXME: signed or unsigned! */
|
|
|
|
stack[++stacki] = target_to_host (loc, loc_value_size,
|
|
|
|
GET_SIGNED, current_objfile);
|
|
|
|
loc += loc_value_size;
|
|
|
|
break;
|
|
|
|
case OP_DEREF2:
|
|
|
|
/* pop, deref and push 2 bytes (as a long) */
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&op_deref2, DIE_ID, DIE_NAME, stack[stacki]);
|
1992-04-14 04:09:00 +00:00
|
|
|
break;
|
|
|
|
case OP_DEREF4: /* pop, deref and push 4 bytes (as a long) */
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&op_deref4, DIE_ID, DIE_NAME, stack[stacki]);
|
1992-04-14 04:09:00 +00:00
|
|
|
break;
|
|
|
|
case OP_ADD: /* pop top 2 items, add, push result */
|
|
|
|
stack[stacki - 1] += stack[stacki];
|
|
|
|
stacki--;
|
|
|
|
break;
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
return (stack[stacki]);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
read_ofile_symtab -- build a full symtab entry from chunk of DIE's
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1993-05-31 00:21:41 +00:00
|
|
|
static void read_ofile_symtab (struct partial_symtab *pst)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
When expanding a partial symbol table entry to a full symbol table
|
|
|
|
entry, this is the function that gets called to read in the symbols
|
1993-05-31 00:21:41 +00:00
|
|
|
for the compilation unit. A pointer to the newly constructed symtab,
|
|
|
|
which is now the new first one on the objfile's symtab list, is
|
|
|
|
stashed in the partial symbol table entry.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
1993-05-31 00:21:41 +00:00
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
read_ofile_symtab (pst)
|
|
|
|
struct partial_symtab *pst;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct cleanup *back_to;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned long lnsize;
|
1992-10-15 13:40:40 +00:00
|
|
|
file_ptr foffset;
|
1992-02-22 01:46:16 +00:00
|
|
|
bfd *abfd;
|
1992-04-14 04:09:00 +00:00
|
|
|
char lnsizedata[SIZEOF_LINETBL_LENGTH];
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
abfd = pst -> objfile -> obfd;
|
|
|
|
current_objfile = pst -> objfile;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Allocate a buffer for the entire chunk of DIE's for this compilation
|
|
|
|
unit, seek to the location in the file, and read in all the DIE's. */
|
|
|
|
|
|
|
|
diecount = 0;
|
1992-10-01 17:33:21 +00:00
|
|
|
dbsize = DBLENGTH (pst);
|
|
|
|
dbbase = xmalloc (dbsize);
|
1991-10-24 11:28:54 +00:00
|
|
|
dbroff = DBROFF(pst);
|
|
|
|
foffset = DBFOFF(pst) + dbroff;
|
1992-07-04 13:59:03 +00:00
|
|
|
base_section_offsets = pst->section_offsets;
|
|
|
|
baseaddr = ANOFFSET (pst->section_offsets, 0);
|
1995-10-19 19:54:44 +00:00
|
|
|
if (bfd_seek (abfd, foffset, SEEK_SET) ||
|
1992-10-01 17:33:21 +00:00
|
|
|
(bfd_read (dbbase, dbsize, 1, abfd) != dbsize))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
free (dbbase);
|
|
|
|
error ("can't read DWARF data");
|
|
|
|
}
|
|
|
|
back_to = make_cleanup (free, dbbase);
|
|
|
|
|
|
|
|
/* If there is a line number table associated with this compilation unit
|
1992-04-14 04:09:00 +00:00
|
|
|
then read the size of this fragment in bytes, from the fragment itself.
|
|
|
|
Allocate a buffer for the fragment and read it in for future
|
1991-10-24 11:28:54 +00:00
|
|
|
processing. */
|
|
|
|
|
|
|
|
lnbase = NULL;
|
|
|
|
if (LNFOFF (pst))
|
|
|
|
{
|
1995-10-19 19:54:44 +00:00
|
|
|
if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
|
1992-04-14 04:09:00 +00:00
|
|
|
(bfd_read ((PTR) lnsizedata, sizeof (lnsizedata), 1, abfd) !=
|
|
|
|
sizeof (lnsizedata)))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
error ("can't read DWARF line number table size");
|
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
lnsize = target_to_host (lnsizedata, SIZEOF_LINETBL_LENGTH,
|
|
|
|
GET_UNSIGNED, pst -> objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
lnbase = xmalloc (lnsize);
|
1995-10-19 19:54:44 +00:00
|
|
|
if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
|
1991-11-09 10:50:07 +00:00
|
|
|
(bfd_read (lnbase, lnsize, 1, abfd) != lnsize))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
free (lnbase);
|
|
|
|
error ("can't read DWARF line numbers");
|
|
|
|
}
|
|
|
|
make_cleanup (free, lnbase);
|
|
|
|
}
|
|
|
|
|
1992-10-01 17:33:21 +00:00
|
|
|
process_dies (dbbase, dbbase + dbsize, pst -> objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
do_cleanups (back_to);
|
1992-02-22 01:46:16 +00:00
|
|
|
current_objfile = NULL;
|
1993-05-31 00:21:41 +00:00
|
|
|
pst -> symtab = pst -> objfile -> symtabs;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
psymtab_to_symtab_1 -- do grunt work for building a full symtab entry
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1991-11-09 10:50:07 +00:00
|
|
|
static void psymtab_to_symtab_1 (struct partial_symtab *pst)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Called once for each partial symbol table entry that needs to be
|
|
|
|
expanded into a full symbol table entry.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
psymtab_to_symtab_1 (pst)
|
|
|
|
struct partial_symtab *pst;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
int i;
|
1992-07-28 04:22:18 +00:00
|
|
|
struct cleanup *old_chain;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
if (pst != NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
if (pst->readin)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-03-15 01:09:14 +00:00
|
|
|
warning ("psymtab for %s already read in. Shouldn't happen.",
|
1992-02-22 01:46:16 +00:00
|
|
|
pst -> filename);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Read in all partial symtabs on which this one is dependent */
|
|
|
|
for (i = 0; i < pst -> number_of_dependencies; i++)
|
|
|
|
{
|
|
|
|
if (!pst -> dependencies[i] -> readin)
|
|
|
|
{
|
|
|
|
/* Inform about additional files that need to be read in. */
|
|
|
|
if (info_verbose)
|
|
|
|
{
|
1993-11-01 22:25:23 +00:00
|
|
|
fputs_filtered (" ", gdb_stdout);
|
1992-02-22 01:46:16 +00:00
|
|
|
wrap_here ("");
|
1993-11-01 22:25:23 +00:00
|
|
|
fputs_filtered ("and ", gdb_stdout);
|
1992-02-22 01:46:16 +00:00
|
|
|
wrap_here ("");
|
|
|
|
printf_filtered ("%s...",
|
|
|
|
pst -> dependencies[i] -> filename);
|
|
|
|
wrap_here ("");
|
1993-11-01 22:25:23 +00:00
|
|
|
gdb_flush (gdb_stdout); /* Flush output */
|
1992-02-22 01:46:16 +00:00
|
|
|
}
|
|
|
|
psymtab_to_symtab_1 (pst -> dependencies[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (DBLENGTH (pst)) /* Otherwise it's a dummy */
|
|
|
|
{
|
1992-07-28 04:22:18 +00:00
|
|
|
buildsym_init ();
|
|
|
|
old_chain = make_cleanup (really_free_pendings, 0);
|
1993-05-31 00:21:41 +00:00
|
|
|
read_ofile_symtab (pst);
|
1992-02-22 01:46:16 +00:00
|
|
|
if (info_verbose)
|
|
|
|
{
|
|
|
|
printf_filtered ("%d DIE's, sorting...", diecount);
|
|
|
|
wrap_here ("");
|
1993-11-01 22:25:23 +00:00
|
|
|
gdb_flush (gdb_stdout);
|
1992-02-22 01:46:16 +00:00
|
|
|
}
|
|
|
|
sort_symtab_syms (pst -> symtab);
|
1992-07-28 04:22:18 +00:00
|
|
|
do_cleanups (old_chain);
|
1992-02-22 01:46:16 +00:00
|
|
|
}
|
|
|
|
pst -> readin = 1;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
dwarf_psymtab_to_symtab -- build a full symtab entry from partial one
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void dwarf_psymtab_to_symtab (struct partial_symtab *pst)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
This is the DWARF support entry point for building a full symbol
|
|
|
|
table entry from a partial symbol table entry. We are passed a
|
|
|
|
pointer to the partial symbol table entry that needs to be expanded.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
dwarf_psymtab_to_symtab (pst)
|
|
|
|
struct partial_symtab *pst;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
* defs.h: Incorporate param.h. All users changed.
* param-no-tm.h: Change users to define TM_FILE_OVERRIDE instead.
* param.h, param-no-tm.h: Removed.
* Update copyrights in all changed files.
* dbxread.c, dwarfread.c, inflow.c, infrun.c, m2-exp.y, putenv.c,
solib.c, symtab.h, tm-umax.h, valprint.c: Lint.
* tm-convex.h, tm-hp300hpux.h, tm-merlin.h, tm-sparc.h,
xm-merlin.h: Avoid host include files in target descriptions.
* getpagesize.h: Removed, libiberty copes now.
1991-11-21 18:42:05 +00:00
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
if (pst != NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
if (pst -> readin)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-03-15 01:09:14 +00:00
|
|
|
warning ("psymtab for %s already read in. Shouldn't happen.",
|
1992-02-22 01:46:16 +00:00
|
|
|
pst -> filename);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1992-02-22 01:46:16 +00:00
|
|
|
else
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
if (DBLENGTH (pst) || pst -> number_of_dependencies)
|
|
|
|
{
|
|
|
|
/* Print the message now, before starting serious work, to avoid
|
|
|
|
disconcerting pauses. */
|
|
|
|
if (info_verbose)
|
|
|
|
{
|
|
|
|
printf_filtered ("Reading in symbols for %s...",
|
|
|
|
pst -> filename);
|
1993-11-01 22:25:23 +00:00
|
|
|
gdb_flush (gdb_stdout);
|
1992-02-22 01:46:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
psymtab_to_symtab_1 (pst);
|
|
|
|
|
|
|
|
#if 0 /* FIXME: Check to see what dbxread is doing here and see if
|
|
|
|
we need to do an equivalent or is this something peculiar to
|
|
|
|
stabs/a.out format.
|
|
|
|
Match with global symbols. This only needs to be done once,
|
|
|
|
after all of the symtabs and dependencies have been read in.
|
|
|
|
*/
|
|
|
|
scan_file_globals (pst -> objfile);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Finish up the verbose info message. */
|
|
|
|
if (info_verbose)
|
|
|
|
{
|
|
|
|
printf_filtered ("done.\n");
|
1993-11-01 22:25:23 +00:00
|
|
|
gdb_flush (gdb_stdout);
|
1992-02-22 01:46:16 +00:00
|
|
|
}
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1991-12-06 02:22:10 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
add_enum_psymbol -- add enumeration members to partial symbol table
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given pointer to a DIE that is known to be for an enumeration,
|
|
|
|
extract the symbolic names of the enumeration members and add
|
|
|
|
partial symbols for them.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
add_enum_psymbol (dip, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
struct objfile *objfile;
|
1991-12-06 02:22:10 +00:00
|
|
|
{
|
|
|
|
char *scan;
|
|
|
|
char *listend;
|
1992-04-14 04:09:00 +00:00
|
|
|
unsigned short blocksz;
|
|
|
|
int nbytes;
|
1991-12-06 02:22:10 +00:00
|
|
|
|
|
|
|
if ((scan = dip -> at_element_list) != NULL)
|
|
|
|
{
|
|
|
|
if (dip -> short_element_list)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_short_element_list);
|
1991-12-06 02:22:10 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_element_list);
|
1991-12-06 02:22:10 +00:00
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
blocksz = target_to_host (scan, nbytes, GET_UNSIGNED, objfile);
|
|
|
|
scan += nbytes;
|
|
|
|
listend = scan + blocksz;
|
1991-12-06 02:22:10 +00:00
|
|
|
while (scan < listend)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
scan += TARGET_FT_LONG_SIZE (objfile);
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (scan, strlen (scan), VAR_NAMESPACE, LOC_CONST,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
objfile -> static_psymbols, 0, cu_language,
|
|
|
|
objfile);
|
1991-12-06 02:22:10 +00:00
|
|
|
scan += strlen (scan) + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
add_partial_symbol -- add symbol to partial symbol table
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a DIE, if it is one of the types that we want to
|
|
|
|
add to a partial symbol table, finish filling in the die info
|
|
|
|
and then add a partial symbol table entry for it.
|
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
NOTES
|
|
|
|
|
|
|
|
The caller must ensure that the DIE has a valid name attribute.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
add_partial_symbol (dip, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
switch (dip -> die_tag)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
case TAG_global_subroutine:
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
1992-02-22 01:46:16 +00:00
|
|
|
VAR_NAMESPACE, LOC_BLOCK,
|
|
|
|
objfile -> global_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
dip -> at_low_pc, cu_language, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_global_variable:
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
1992-02-22 01:46:16 +00:00
|
|
|
VAR_NAMESPACE, LOC_STATIC,
|
|
|
|
objfile -> global_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
0, cu_language, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_subroutine:
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
1992-02-22 01:46:16 +00:00
|
|
|
VAR_NAMESPACE, LOC_BLOCK,
|
|
|
|
objfile -> static_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
dip -> at_low_pc, cu_language, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_local_variable:
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
1992-02-22 01:46:16 +00:00
|
|
|
VAR_NAMESPACE, LOC_STATIC,
|
|
|
|
objfile -> static_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
0, cu_language, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_typedef:
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
1992-02-22 01:46:16 +00:00
|
|
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
|
|
|
objfile -> static_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
0, cu_language, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case TAG_class_type:
|
1991-10-24 11:28:54 +00:00
|
|
|
case TAG_structure_type:
|
|
|
|
case TAG_union_type:
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case TAG_enumeration_type:
|
1994-02-04 09:19:35 +00:00
|
|
|
/* Do not add opaque aggregate definitions to the psymtab. */
|
|
|
|
if (!dip -> has_at_byte_size)
|
|
|
|
break;
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
1992-02-22 01:46:16 +00:00
|
|
|
STRUCT_NAMESPACE, LOC_TYPEDEF,
|
|
|
|
objfile -> static_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
0, cu_language, objfile);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
if (cu_language == language_cplus)
|
1991-12-06 02:22:10 +00:00
|
|
|
{
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
/* For C++, these implicitly act as typedefs as well. */
|
1991-12-27 03:55:12 +00:00
|
|
|
ADD_PSYMBOL_TO_LIST (dip -> at_name, strlen (dip -> at_name),
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
VAR_NAMESPACE, LOC_TYPEDEF,
|
1992-02-22 01:46:16 +00:00
|
|
|
objfile -> static_psymbols,
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
0, cu_language, objfile);
|
1991-12-06 02:22:10 +00:00
|
|
|
}
|
|
|
|
break;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
scan_partial_symbols -- scan DIE's within a single compilation unit
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Process the DIE's within a single compilation unit, looking for
|
|
|
|
interesting DIE's that contribute to the partial symbol table entry
|
1992-08-11 05:29:41 +00:00
|
|
|
for this compilation unit.
|
1991-10-24 11:28:54 +00:00
|
|
|
|
1991-11-18 08:07:43 +00:00
|
|
|
NOTES
|
|
|
|
|
1992-08-11 05:29:41 +00:00
|
|
|
There are some DIE's that may appear both at file scope and within
|
|
|
|
the scope of a function. We are only interested in the ones at file
|
|
|
|
scope, and the only way to tell them apart is to keep track of the
|
|
|
|
scope. For example, consider the test case:
|
|
|
|
|
|
|
|
static int i;
|
|
|
|
main () { int j; }
|
|
|
|
|
|
|
|
for which the relevant DWARF segment has the structure:
|
|
|
|
|
|
|
|
0x51:
|
|
|
|
0x23 global subrtn sibling 0x9b
|
|
|
|
name main
|
|
|
|
fund_type FT_integer
|
|
|
|
low_pc 0x800004cc
|
|
|
|
high_pc 0x800004d4
|
|
|
|
|
|
|
|
0x74:
|
|
|
|
0x23 local var sibling 0x97
|
|
|
|
name j
|
|
|
|
fund_type FT_integer
|
|
|
|
location OP_BASEREG 0xe
|
|
|
|
OP_CONST 0xfffffffc
|
|
|
|
OP_ADD
|
|
|
|
0x97:
|
|
|
|
0x4
|
|
|
|
|
|
|
|
0x9b:
|
|
|
|
0x1d local var sibling 0xb8
|
|
|
|
name i
|
|
|
|
fund_type FT_integer
|
|
|
|
location OP_ADDR 0x800025dc
|
|
|
|
|
|
|
|
0xb8:
|
|
|
|
0x4
|
|
|
|
|
|
|
|
We want to include the symbol 'i' in the partial symbol table, but
|
|
|
|
not the symbol 'j'. In essence, we want to skip all the dies within
|
|
|
|
the scope of a TAG_global_subroutine DIE.
|
|
|
|
|
1991-12-06 02:22:10 +00:00
|
|
|
Don't attempt to add anonymous structures or unions since they have
|
|
|
|
no name. Anonymous enumerations however are processed, because we
|
|
|
|
want to extract their member names (the check for a tag name is
|
|
|
|
done later).
|
1991-11-18 08:07:43 +00:00
|
|
|
|
1991-12-06 02:22:10 +00:00
|
|
|
Also, for variables and subroutines, check that this is the place
|
|
|
|
where the actual definition occurs, rather than just a reference
|
|
|
|
to an external.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-02-22 01:46:16 +00:00
|
|
|
scan_partial_symbols (thisdie, enddie, objfile)
|
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
char *nextdie;
|
1992-08-11 05:29:41 +00:00
|
|
|
char *temp;
|
1991-10-24 11:28:54 +00:00
|
|
|
struct dieinfo di;
|
|
|
|
|
|
|
|
while (thisdie < enddie)
|
|
|
|
{
|
1992-04-11 06:27:53 +00:00
|
|
|
basicdieinfo (&di, thisdie, objfile);
|
1992-04-14 04:09:00 +00:00
|
|
|
if (di.die_length < SIZEOF_DIE_LENGTH)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nextdie = thisdie + di.die_length;
|
1991-12-06 02:22:10 +00:00
|
|
|
/* To avoid getting complete die information for every die, we
|
|
|
|
only do it (below) for the cases we are interested in. */
|
1992-04-14 04:09:00 +00:00
|
|
|
switch (di.die_tag)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
case TAG_global_subroutine:
|
|
|
|
case TAG_subroutine:
|
1992-08-11 05:29:41 +00:00
|
|
|
completedieinfo (&di, objfile);
|
|
|
|
if (di.at_name && (di.has_at_low_pc || di.at_location))
|
|
|
|
{
|
|
|
|
add_partial_symbol (&di, objfile);
|
|
|
|
/* If there is a sibling attribute, adjust the nextdie
|
|
|
|
pointer to skip the entire scope of the subroutine.
|
|
|
|
Apply some sanity checking to make sure we don't
|
|
|
|
overrun or underrun the range of remaining DIE's */
|
|
|
|
if (di.at_sibling != 0)
|
|
|
|
{
|
|
|
|
temp = dbbase + di.at_sibling - dbroff;
|
|
|
|
if ((temp < thisdie) || (temp >= enddie))
|
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&bad_die_ref, DIE_ID, DIE_NAME,
|
|
|
|
di.at_sibling);
|
1992-08-11 05:29:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
nextdie = temp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
1991-11-18 08:07:43 +00:00
|
|
|
case TAG_global_variable:
|
1991-10-24 11:28:54 +00:00
|
|
|
case TAG_local_variable:
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo (&di, objfile);
|
1991-11-18 08:07:43 +00:00
|
|
|
if (di.at_name && (di.has_at_low_pc || di.at_location))
|
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
add_partial_symbol (&di, objfile);
|
1991-11-18 08:07:43 +00:00
|
|
|
}
|
|
|
|
break;
|
1991-10-24 11:28:54 +00:00
|
|
|
case TAG_typedef:
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case TAG_class_type:
|
1991-10-24 11:28:54 +00:00
|
|
|
case TAG_structure_type:
|
|
|
|
case TAG_union_type:
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo (&di, objfile);
|
1991-11-18 08:07:43 +00:00
|
|
|
if (di.at_name)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
add_partial_symbol (&di, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
break;
|
1991-12-06 02:22:10 +00:00
|
|
|
case TAG_enumeration_type:
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo (&di, objfile);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
if (di.at_name)
|
|
|
|
{
|
|
|
|
add_partial_symbol (&di, objfile);
|
|
|
|
}
|
|
|
|
add_enum_psymbol (&di, objfile);
|
1991-12-06 02:22:10 +00:00
|
|
|
break;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
thisdie = nextdie;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
scan_compilation_units -- build a psymtab entry for each compilation
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
This is the top level dwarf parsing routine for building partial
|
|
|
|
symbol tables.
|
|
|
|
|
|
|
|
It scans from the beginning of the DWARF table looking for the first
|
|
|
|
TAG_compile_unit DIE, and then follows the sibling chain to locate
|
|
|
|
each additional TAG_compile_unit DIE.
|
|
|
|
|
|
|
|
For each TAG_compile_unit DIE it creates a partial symtab structure,
|
|
|
|
calls a subordinate routine to collect all the compilation unit's
|
|
|
|
global DIE's, file scope DIEs, typedef DIEs, etc, and then links the
|
|
|
|
new partial symtab structure into the partial symbol table. It also
|
|
|
|
records the appropriate information in the partial symbol table entry
|
|
|
|
to allow the chunk of DIE's and line number table for this compilation
|
|
|
|
unit to be located and re-read later, to generate a complete symbol
|
|
|
|
table entry for the compilation unit.
|
|
|
|
|
|
|
|
Thus it effectively partitions up a chunk of DIE's for multiple
|
|
|
|
compilation units into smaller DIE chunks and line number tables,
|
|
|
|
and associates them with a partial symbol table entry.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
If any compilation unit has no line number table associated with
|
|
|
|
it for some reason (a missing at_stmt_list attribute, rather than
|
|
|
|
just one with a value of zero, which is valid) then we ensure that
|
|
|
|
the recorded file offset is zero so that the routine which later
|
|
|
|
reads line number table fragments knows that there is no fragment
|
|
|
|
to read.
|
|
|
|
|
|
|
|
RETURNS
|
|
|
|
|
|
|
|
Returns no value.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-10-15 13:40:40 +00:00
|
|
|
scan_compilation_units (thisdie, enddie, dbfoff, lnoffset, objfile)
|
1992-02-22 01:46:16 +00:00
|
|
|
char *thisdie;
|
|
|
|
char *enddie;
|
1992-10-15 13:40:40 +00:00
|
|
|
file_ptr dbfoff;
|
|
|
|
file_ptr lnoffset;
|
1992-02-22 01:46:16 +00:00
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
char *nextdie;
|
|
|
|
struct dieinfo di;
|
|
|
|
struct partial_symtab *pst;
|
|
|
|
int culength;
|
|
|
|
int curoff;
|
1992-10-15 13:40:40 +00:00
|
|
|
file_ptr curlnoffset;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
while (thisdie < enddie)
|
|
|
|
{
|
1992-04-11 06:27:53 +00:00
|
|
|
basicdieinfo (&di, thisdie, objfile);
|
1992-04-14 04:09:00 +00:00
|
|
|
if (di.die_length < SIZEOF_DIE_LENGTH)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
else if (di.die_tag != TAG_compile_unit)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nextdie = thisdie + di.die_length;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo (&di, objfile);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
set_cu_language (&di);
|
1991-10-24 11:28:54 +00:00
|
|
|
if (di.at_sibling != 0)
|
|
|
|
{
|
|
|
|
nextdie = dbbase + di.at_sibling - dbroff;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
nextdie = thisdie + di.die_length;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
curoff = thisdie - dbbase;
|
|
|
|
culength = nextdie - thisdie;
|
1991-11-18 08:07:43 +00:00
|
|
|
curlnoffset = di.has_at_stmt_list ? lnoffset + di.at_stmt_list : 0;
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
/* First allocate a new partial symbol table structure */
|
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
pst = start_psymtab_common (objfile, base_section_offsets,
|
|
|
|
di.at_name, di.at_low_pc,
|
1992-02-22 01:46:16 +00:00
|
|
|
objfile -> global_psymbols.next,
|
|
|
|
objfile -> static_psymbols.next);
|
|
|
|
|
|
|
|
pst -> texthigh = di.at_high_pc;
|
|
|
|
pst -> read_symtab_private = (char *)
|
|
|
|
obstack_alloc (&objfile -> psymbol_obstack,
|
|
|
|
sizeof (struct dwfinfo));
|
|
|
|
DBFOFF (pst) = dbfoff;
|
|
|
|
DBROFF (pst) = curoff;
|
|
|
|
DBLENGTH (pst) = culength;
|
|
|
|
LNFOFF (pst) = curlnoffset;
|
|
|
|
pst -> read_symtab = dwarf_psymtab_to_symtab;
|
|
|
|
|
|
|
|
/* Now look for partial symbols */
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
scan_partial_symbols (thisdie + di.die_length, nextdie, objfile);
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
pst -> n_global_syms = objfile -> global_psymbols.next -
|
|
|
|
(objfile -> global_psymbols.list + pst -> globals_offset);
|
|
|
|
pst -> n_static_syms = objfile -> static_psymbols.next -
|
|
|
|
(objfile -> static_psymbols.list + pst -> statics_offset);
|
|
|
|
sort_pst_symbols (pst);
|
1991-10-24 11:28:54 +00:00
|
|
|
/* If there is already a psymtab or symtab for a file of this name,
|
|
|
|
remove it. (If there is a symtab, more drastic things also
|
|
|
|
happen.) This happens in VxWorks. */
|
|
|
|
free_named_symtabs (pst -> filename);
|
|
|
|
}
|
|
|
|
thisdie = nextdie;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
new_symbol -- make a symbol table entry for a new symbol
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
static struct symbol *new_symbol (struct dieinfo *dip,
|
|
|
|
struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to a DWARF information entry, figure out if we need
|
|
|
|
to make a symbol table entry for it, and if so, create a new entry
|
|
|
|
and return a pointer to it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct symbol *
|
1992-02-22 01:46:16 +00:00
|
|
|
new_symbol (dip, objfile)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct symbol *sym = NULL;
|
|
|
|
|
|
|
|
if (dip -> at_name != NULL)
|
|
|
|
{
|
1992-02-22 01:46:16 +00:00
|
|
|
sym = (struct symbol *) obstack_alloc (&objfile -> symbol_obstack,
|
1991-10-24 11:28:54 +00:00
|
|
|
sizeof (struct symbol));
|
* defs.h: Delete extraneous whitespace at end of file.
* symfile.h: Move #include of demangle.h outside conditional.
* objfiles.h (struct objstats, OBJSTAT, OBJSTATS): New struct
and macros to hold per-objfile statistics for internal instrumentation.
(struct objfile): Add OBJSTATS member, which is optional.
* buildsym.h (next_symbol_text_func): Now takes objfile argument.
Also update copyright to 1995.
* dbxread.c (dbx_next_symbol_text): Now takes objfile argument.
(dbx_symfile_init, coffstab_build_psymtabs, elfstab_build_psymtabs,
stabsect_build_psymtabs): Accumulate string table size.
(dbx_next_symbol_text, read_dbx_symtab, read_ofile_symtab):
Accumulate number of stabs symbols read.
* dwarfread.c (new_symbol, symthesize_typedef):
Accumulate number of full symbols created.
* gdbtypes.c (alloc_type): Accumulate number of types.
* maint.c (maintenance_print_statistics): New function.
* mdebugread.c (mdebug_next_symbol_text): Now takes objfile argument.
* minsyms.c (prim_record_minimal_symbol_and_info): Accumulate
number of minimal symbols read.
* os9kread.c (read_os9k_psymtab): next_symbol_text takes objfile arg.
* partial-stab.h: next_symbol_text takes objfile arg.
* stabsread.c (error_type, STABS_CONTINUE): Now takes objfile arg and
uses it to call next_symbol_text.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Accumulate number of partial symbols created.
* symfile.h (ADD_PSYMBOL_VT_TO_LIST): Accumulate number of partial
symbols created.
* symmisc.c (print_objfile_statistics): Print the per-objfile
internal instrumentation statistics gathered.
* xcoffread.c (xcoff_next_symbol_text): Now takes objfile argument.
1995-12-21 04:08:27 +00:00
|
|
|
OBJSTAT (objfile, n_syms++);
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
memset (sym, 0, sizeof (struct symbol));
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
SYMBOL_NAME (sym) = create_name (dip -> at_name,
|
|
|
|
&objfile->symbol_obstack);
|
1991-10-24 11:28:54 +00:00
|
|
|
/* default assumptions */
|
|
|
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
|
|
|
SYMBOL_CLASS (sym) = LOC_STATIC;
|
|
|
|
SYMBOL_TYPE (sym) = decode_die_type (dip);
|
* defs.h (STRCMP, STREQ, STREQN): New macros.
* defs.h (demangle_and_match): Remove prototype.
* dwarfread.c (STREQ, STREQN): Remove macros, replaced with STREQ
and STREQN defined in defs.h.
* dwarfread.c (set_cu_language): For completely unknown languages,
try to deduce the language from the filename. Retain behavior
that for known languages we don't know how to handle, we use
language_unknown.
* dwarfread.c (enum_type, symthesize_typedef): Initialize language
and demangled name fields in symbol.
* dwarfread.c, mipsread.c, partial-stab.h: For all usages of
ADD_PSYMBOL_TO_LIST, add language and objfile parameters.
* dwarfread.c (new_symbol): Attempt to demangle C++ symbol names
and cache the results in SYMBOL_DEMANGLED_NAME for the symbol.
* elfread.c (STREQ): Remove macro, use STREQ defined in defs.h.
Replace usages throughout.
* elfread.c (demangle.h): Include.
* elfread.c (record_minimal_symbol): Remove prototype and function.
* gdbtypes.h, symtab.h (B_SET, B_CLR, B_TST, B_TYPE, B_BYTES,
B_CLRALL): Moved from symtab.h to gdbtypes.h.
* infcmd.c (jump_command): Remove code to demangle name and add
it to a cleanup list. Now just use SYMBOL_DEMANGLED_NAME.
* minsyms.c (demangle.h): Include.
* minsyms.c (lookup_minimal_symbol): Indent comment to match code.
* minsyms.c (install_minimal_symbols): Attempt to demangle symbol
names as C++ names, and cache them in SYMBOL_DEMANGLED_NAME.
* mipsread.c (psymtab_language): Add static variable.
* stabsread.c (demangle.h): Include.
* stabsread.c (define_symbol): Attempt to demangle C++ symbol
names and cache them in the SYMBOL_DEMANGLED_NAME field.
* stack.c (return_command): Remove explicit demangling of name
and use of cleanups. Just use SYMBOL_DEMANGLED_NAME.
* symfile.c (demangle.h): Include.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list): Fix
to match macros in symfile.h and allow them to be compiled
if INLINE_ADD_PSYMBOL is not true.
* symfile.h (INLINE_ADD_PSYMBOL): Default to true if not set.
* symfile.h (ADD_PSYMBOL_*): Add language and objfile parameters.
Add code to demangle and cache C++ symbol names. Use macro form
if INLINE_ADD_PSYMBOL is true, otherwise use C function form.
* symmisc.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Remove, also defined in symfile.c, which we already fixed.
* symtab.c (expensive_mangler): Remove prototype and function.
* symtab.c (find_methods): Remove physnames parameter and fix
prototype to match.
* symtab.c (completion_list_add_symbol): Name changed to
completion_list_add_name.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): New macro, adds both
the normal symbol name and the cached C++ demangled name.
* symtab.c (lookup_demangled_partial_symbol,
lookup_demangled_block_symbol): Remove prototypes and functions.
* symtab.c (lookup_symbol): Remove use of expensive_mangler,
use lookup_block_symbol instead of lookup_demangled_block_symbol.
Remove code to try demangling names and matching them.
* symtab.c (lookup_partial_symbol, lookup_block_symbol):
Fix to try matching the cached demangled name if no match is
found using the regular symbol name.
* symtab.c (find_methods): Remove unused physnames array.
* symtab.c (name_match, NAME_MATCH): Remove function and macro,
replaced with SYMBOL_MATCHES_REGEXP from symtab.h.
* symtab.c (completion_list_add_symbol): Rewrite to use cached
C++ demangled symbol names.
* symtab.h: Much reformatting of structures and such to add
whitespace to make them more readable, and make them more
consistent with other gdb structure definitions.
* symtab.h (general_symbol_info): New struct containing fields
common to all symbols.
* symtab.h (SYMBOL_LANGUAGE, SYMBOL_DEMANGLED_NAME,
SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME, SYMBOL_MATCHES_NAME,
SYMBOL_MATCHES_REGEXP, MSYMBOL_INFO, MSYMBOL_TYPE): New macros.
* symtab. (struct minimal_symbol, struct partial_symbol, struct
symbol): Use general_symbol_info struct.
* utils.c (demangle_and_match): Remove, no longer used.
* valops.c (demangle.h): Include.
* xcoffexec.c (eq): Remove macro, replace usages with STREQ.
* blockframe.c, breakpoint.c, c-exp.y, c-valprint.c, dbxread.c,
infcmd.c, m2-exp.y, minsyms.c, objfiles.h, solib.c, stack.c,
symmisc.c, symtab.c, valops.c: Replace references to minimal
symbol fields with appropriate macros.
* breakpoint.c, buildsym.c, c-exp.y, c-typeprint.c, c-valprint.c,
coffread.c, command.c, convex-tdep.c, cp-valprint.c, dbxread.c,
demangle.c, elfread.c, energize.c, environ.c, exec.c,
gdbtypes.c, i960-tdep.c, infrun.c, infrun-hacked.c, language.c,
main.c, minsyms.c, mipsread.c, partial-stab.h, remote-es1800.c,
remote-nindy.c, remote-udi.c, rs6000-tdep.c, solib.c, source.c,
sparc-pinsn.c, stabsread.c, standalone.c, state.c, stuff.c,
symfile.c, symmisc.c, symtab.c, symtab.h, tm-sysv4.h,
tm-ultra3.h, values.c, xcoffexec.c, xcoffread.c: Replace strcmp
and strncmp usages with STREQ, STREQN, or STRCMP as appropriate.
* breakpoint.c, buildsym.c, c-typeprint.c, expprint.c, findvar.c,
mipsread.c, printcmd.c, source.c, stabsread.c, stack.c,
symmisc.c, tm-29k.h, valops.c, values.c: Replace SYMBOL_NAME
references with SYMBOL_SOURCE_NAME or SYMBOL_LINKAGE_NAME as
appropriate.
* buildsym.c (start_subfile, patch_subfile_names): Default the
source language to what can be deduced from the filename.
* buildsym.c (end_symtab): Update the source language in the
allocated symtab to match what we have been using.
* buildsym.h (struct subfile): Add a language field.
* c-typeprint.c (c_print_type): Remove code to do explicit
demangling.
* dbxread.c (psymtab_language): Add static variable.
* dbxread.c (start_psymtab): Initialize psymtab_language using
deduce_language_from_filename.
1992-12-23 06:34:57 +00:00
|
|
|
|
|
|
|
/* If this symbol is from a C++ compilation, then attempt to cache the
|
|
|
|
demangled form for future reference. This is a typical time versus
|
|
|
|
space tradeoff, that was decided in favor of time because it sped up
|
|
|
|
C++ symbol lookups by a factor of about 20. */
|
|
|
|
|
|
|
|
SYMBOL_LANGUAGE (sym) = cu_language;
|
* tm-sun4sol2.h (CPLUS_MARKER): Remove, now set in tm-sysv4.h.
* tm-sysv4.h (CPLUS_MARKER): By default, g++ uses '.' as the
CPLUS_MARKER for all SVR4 systems, so follow suit.
* defs.h (strdup_demangled): Remove prototype.
* dwarfread.c (enum_type, synthesize_typedef): Use new macro
SYMBOL_INIT_LANGUAGE_SPECIFIC.
* dwarfread.c (new_symbol): Use SYMBOL_INIT_DEMANGLED_NAME.
* minsyms.c (install_minimal_symbols, prim_record_minimal_symbol,
prim_record_minimal_symbol_and_info): Use new macro
SYMBOL_INIT_LANGUAGE_SPECIFIC.
* minsyms.c (install_minimal_symbols): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* stabsread.c (define_symbol): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Use new macro SYMBOL_INIT_DEMANGLED_NAME.
* symfile.h (ADD_PSYMBOL_VT_TO_LIST): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* symmisc.c (dump_msymbols, dump_symtab, print_partial_symbol):
SYMBOL_DEMANGLED_NAME now tests language itself.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): SYMBOL_DEMANGLED_NAME
now tests language itself.
* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): New macro that does
what SYMBOL_DEMANGLED_NAME used to do, directly access the C++
mangled name member in the language dependent portion of a symbol.
* symtab.h (SYMBOL_DEMANGLED_NAME): New macro that returns the
mangled name member appropriate for a symbol's language.
* symtab.h (SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME,
SYMBOL_MATCHES_NAME, SYMBOL_MATCHES_REGEXP):
SYMBOL_DEMANGLED_NAME now tests language itself.
* symtab.h (SYMBOL_INIT_LANGUAGE_SPECIFIC): New macro that
initializes language dependent portion of symbol.
* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): New macro that
demangles and caches the demangled form of symbol names.
* utils.c (fputs_demangled, fprint_symbol): Use current language
to select an appropriate demangling algorithm.
* utils.c (strdup_demangled): Remove, no longer used.
**** start-sanitize-chill ****
* symtab.h (SYMBOL_CHILL_DEMANGLED_NAME): New macro that directly
access the Chill mangled name member in the language dependent
portion of a symbol.
* ch-lang.c (chill_demangle): New function, simple demangler.
* defs.h (chill_demangle): Add prototype.
* symtab.h (language_dependent_info): Add struct for Chill.
**** end-sanitize-chill ****
1993-01-01 20:29:41 +00:00
|
|
|
SYMBOL_INIT_DEMANGLED_NAME (sym, &objfile -> symbol_obstack);
|
1992-04-14 04:09:00 +00:00
|
|
|
switch (dip -> die_tag)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
case TAG_label:
|
1992-01-11 01:41:23 +00:00
|
|
|
SYMBOL_VALUE (sym) = dip -> at_low_pc;
|
1991-10-24 11:28:54 +00:00
|
|
|
SYMBOL_CLASS (sym) = LOC_LABEL;
|
|
|
|
break;
|
|
|
|
case TAG_global_subroutine:
|
|
|
|
case TAG_subroutine:
|
1992-01-11 01:41:23 +00:00
|
|
|
SYMBOL_VALUE (sym) = dip -> at_low_pc;
|
1991-10-24 11:28:54 +00:00
|
|
|
SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
|
|
|
|
SYMBOL_CLASS (sym) = LOC_BLOCK;
|
1992-04-14 04:09:00 +00:00
|
|
|
if (dip -> die_tag == TAG_global_subroutine)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
add_symbol_to_list (sym, &global_symbols);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-01-11 01:41:23 +00:00
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TAG_global_variable:
|
|
|
|
if (dip -> at_location != NULL)
|
|
|
|
{
|
|
|
|
SYMBOL_VALUE (sym) = locval (dip -> at_location);
|
|
|
|
add_symbol_to_list (sym, &global_symbols);
|
|
|
|
SYMBOL_CLASS (sym) = LOC_STATIC;
|
|
|
|
SYMBOL_VALUE (sym) += baseaddr;
|
|
|
|
}
|
1992-01-15 06:42:32 +00:00
|
|
|
break;
|
|
|
|
case TAG_local_variable:
|
|
|
|
if (dip -> at_location != NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-01-15 06:42:32 +00:00
|
|
|
SYMBOL_VALUE (sym) = locval (dip -> at_location);
|
1992-01-11 01:41:23 +00:00
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
1995-07-20 05:52:42 +00:00
|
|
|
if (optimized_out)
|
|
|
|
{
|
|
|
|
SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
|
|
|
|
}
|
|
|
|
else if (isreg)
|
1992-01-15 06:42:32 +00:00
|
|
|
{
|
|
|
|
SYMBOL_CLASS (sym) = LOC_REGISTER;
|
|
|
|
}
|
|
|
|
else if (offreg)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1993-08-24 21:38:24 +00:00
|
|
|
SYMBOL_CLASS (sym) = LOC_BASEREG;
|
|
|
|
SYMBOL_BASEREG (sym) = basereg;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SYMBOL_CLASS (sym) = LOC_STATIC;
|
|
|
|
SYMBOL_VALUE (sym) += baseaddr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TAG_formal_parameter:
|
|
|
|
if (dip -> at_location != NULL)
|
|
|
|
{
|
|
|
|
SYMBOL_VALUE (sym) = locval (dip -> at_location);
|
|
|
|
}
|
1992-01-11 01:41:23 +00:00
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
1991-10-24 11:28:54 +00:00
|
|
|
if (isreg)
|
|
|
|
{
|
|
|
|
SYMBOL_CLASS (sym) = LOC_REGPARM;
|
|
|
|
}
|
1993-08-24 21:38:24 +00:00
|
|
|
else if (offreg)
|
|
|
|
{
|
|
|
|
SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
|
|
|
|
SYMBOL_BASEREG (sym) = basereg;
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
SYMBOL_CLASS (sym) = LOC_ARG;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TAG_unspecified_parameters:
|
|
|
|
/* From varargs functions; gdb doesn't seem to have any interest in
|
|
|
|
this information, so just ignore it for now. (FIXME?) */
|
|
|
|
break;
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
case TAG_class_type:
|
1991-10-24 11:28:54 +00:00
|
|
|
case TAG_structure_type:
|
|
|
|
case TAG_union_type:
|
|
|
|
case TAG_enumeration_type:
|
|
|
|
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
|
|
|
SYMBOL_NAMESPACE (sym) = STRUCT_NAMESPACE;
|
1992-01-11 01:41:23 +00:00
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case TAG_typedef:
|
|
|
|
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
|
|
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
1992-01-11 01:41:23 +00:00
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Not a tag we recognize. Hopefully we aren't processing trash
|
|
|
|
data, but since we must specifically ignore things we don't
|
|
|
|
recognize, there is nothing else we should do at this point. */
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return (sym);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
synthesize_typedef -- make a symbol table entry for a "fake" typedef
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static void synthesize_typedef (struct dieinfo *dip,
|
|
|
|
struct objfile *objfile,
|
|
|
|
struct type *type);
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to a DWARF information entry, synthesize a typedef
|
|
|
|
for the name in the DIE, using the specified type.
|
|
|
|
|
|
|
|
This is used for C++ class, structs, unions, and enumerations to
|
|
|
|
set up the tag name as a type.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
|
|
|
synthesize_typedef (dip, objfile, type)
|
|
|
|
struct dieinfo *dip;
|
|
|
|
struct objfile *objfile;
|
|
|
|
struct type *type;
|
|
|
|
{
|
|
|
|
struct symbol *sym = NULL;
|
|
|
|
|
|
|
|
if (dip -> at_name != NULL)
|
|
|
|
{
|
|
|
|
sym = (struct symbol *)
|
|
|
|
obstack_alloc (&objfile -> symbol_obstack, sizeof (struct symbol));
|
* defs.h: Delete extraneous whitespace at end of file.
* symfile.h: Move #include of demangle.h outside conditional.
* objfiles.h (struct objstats, OBJSTAT, OBJSTATS): New struct
and macros to hold per-objfile statistics for internal instrumentation.
(struct objfile): Add OBJSTATS member, which is optional.
* buildsym.h (next_symbol_text_func): Now takes objfile argument.
Also update copyright to 1995.
* dbxread.c (dbx_next_symbol_text): Now takes objfile argument.
(dbx_symfile_init, coffstab_build_psymtabs, elfstab_build_psymtabs,
stabsect_build_psymtabs): Accumulate string table size.
(dbx_next_symbol_text, read_dbx_symtab, read_ofile_symtab):
Accumulate number of stabs symbols read.
* dwarfread.c (new_symbol, symthesize_typedef):
Accumulate number of full symbols created.
* gdbtypes.c (alloc_type): Accumulate number of types.
* maint.c (maintenance_print_statistics): New function.
* mdebugread.c (mdebug_next_symbol_text): Now takes objfile argument.
* minsyms.c (prim_record_minimal_symbol_and_info): Accumulate
number of minimal symbols read.
* os9kread.c (read_os9k_psymtab): next_symbol_text takes objfile arg.
* partial-stab.h: next_symbol_text takes objfile arg.
* stabsread.c (error_type, STABS_CONTINUE): Now takes objfile arg and
uses it to call next_symbol_text.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Accumulate number of partial symbols created.
* symfile.h (ADD_PSYMBOL_VT_TO_LIST): Accumulate number of partial
symbols created.
* symmisc.c (print_objfile_statistics): Print the per-objfile
internal instrumentation statistics gathered.
* xcoffread.c (xcoff_next_symbol_text): Now takes objfile argument.
1995-12-21 04:08:27 +00:00
|
|
|
OBJSTAT (objfile, n_syms++);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
memset (sym, 0, sizeof (struct symbol));
|
|
|
|
SYMBOL_NAME (sym) = create_name (dip -> at_name,
|
|
|
|
&objfile->symbol_obstack);
|
* tm-sun4sol2.h (CPLUS_MARKER): Remove, now set in tm-sysv4.h.
* tm-sysv4.h (CPLUS_MARKER): By default, g++ uses '.' as the
CPLUS_MARKER for all SVR4 systems, so follow suit.
* defs.h (strdup_demangled): Remove prototype.
* dwarfread.c (enum_type, synthesize_typedef): Use new macro
SYMBOL_INIT_LANGUAGE_SPECIFIC.
* dwarfread.c (new_symbol): Use SYMBOL_INIT_DEMANGLED_NAME.
* minsyms.c (install_minimal_symbols, prim_record_minimal_symbol,
prim_record_minimal_symbol_and_info): Use new macro
SYMBOL_INIT_LANGUAGE_SPECIFIC.
* minsyms.c (install_minimal_symbols): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* stabsread.c (define_symbol): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list):
Use new macro SYMBOL_INIT_DEMANGLED_NAME.
* symfile.h (ADD_PSYMBOL_VT_TO_LIST): Use new macro
SYMBOL_INIT_DEMANGLED_NAME.
* symmisc.c (dump_msymbols, dump_symtab, print_partial_symbol):
SYMBOL_DEMANGLED_NAME now tests language itself.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): SYMBOL_DEMANGLED_NAME
now tests language itself.
* symtab.h (SYMBOL_CPLUS_DEMANGLED_NAME): New macro that does
what SYMBOL_DEMANGLED_NAME used to do, directly access the C++
mangled name member in the language dependent portion of a symbol.
* symtab.h (SYMBOL_DEMANGLED_NAME): New macro that returns the
mangled name member appropriate for a symbol's language.
* symtab.h (SYMBOL_SOURCE_NAME, SYMBOL_LINKAGE_NAME,
SYMBOL_MATCHES_NAME, SYMBOL_MATCHES_REGEXP):
SYMBOL_DEMANGLED_NAME now tests language itself.
* symtab.h (SYMBOL_INIT_LANGUAGE_SPECIFIC): New macro that
initializes language dependent portion of symbol.
* symtab.h (SYMBOL_INIT_DEMANGLED_NAME): New macro that
demangles and caches the demangled form of symbol names.
* utils.c (fputs_demangled, fprint_symbol): Use current language
to select an appropriate demangling algorithm.
* utils.c (strdup_demangled): Remove, no longer used.
**** start-sanitize-chill ****
* symtab.h (SYMBOL_CHILL_DEMANGLED_NAME): New macro that directly
access the Chill mangled name member in the language dependent
portion of a symbol.
* ch-lang.c (chill_demangle): New function, simple demangler.
* defs.h (chill_demangle): Add prototype.
* symtab.h (language_dependent_info): Add struct for Chill.
**** end-sanitize-chill ****
1993-01-01 20:29:41 +00:00
|
|
|
SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
|
* dwarfread.c (cu_language): New local variable to record
language for current compilation unit being processed.
* dwarfread.c (set_cu_language): New local function to decode
and record language for current compilation unit being processed.
* dwarfread.c (synthesize_typedef): Add local function to
synthesize a typedef for C++ classes, structs, unions, and
enumerations.
* dwarfread.c (read_structure_scope): Synthesize typedefs
for C++ classes, structs and unions.
* dwarfread.c (read_enumeration): Synthesize typedefs for
C++ enumerations.
* dwarfread.c (read_file_scope): Call set_cu_language to
record language for current compilation unit. After symtab
is built, save this recorded language.
* dwarfread.c (process_dies, add_partial_symbol, struct_type,
scan_partial_symbols, new_symbol): Recognize TAG_class_type.
* dwarfread.c (add_partial_symbol): Synthesize partial symbol
typedefs for C++ classes, structs, unions, and enumerations.
* dwarfread.c (scan_compilation_units): Call set_cu_language
to record language for current compilation unit.
* dwarfread.c (scan_partial_symbols): Call add_enum_psymbol here
for TAG_enumeration_types, rather than in add_partial_symbol.
* dwarfread.c (add_partial_symbol): Combine TAG_enumeration_type
case with class, struct, and union type cases, now that they are
the same. Remove tests for non-NULL name attributes, now done
by callers.
* gdbtypes.h (TYPE_CODE_CLASS): Add type for C++ classes, but
treat as alias for TYPE_CODE_STRUCT for now.
1992-08-31 20:50:45 +00:00
|
|
|
SYMBOL_TYPE (sym) = type;
|
|
|
|
SYMBOL_CLASS (sym) = LOC_TYPEDEF;
|
|
|
|
SYMBOL_NAMESPACE (sym) = VAR_NAMESPACE;
|
|
|
|
add_symbol_to_list (sym, list_in_scope);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_mod_fund_type -- decode a modified fundamental type
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static struct type *decode_mod_fund_type (char *typedata)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Decode a block of data containing a modified fundamental
|
|
|
|
type specification. TYPEDATA is a pointer to the block,
|
1992-04-14 04:09:00 +00:00
|
|
|
which starts with a length containing the size of the rest
|
|
|
|
of the block. At the end of the block is a fundmental type
|
|
|
|
code value that gives the fundamental type. Everything
|
1991-10-24 11:28:54 +00:00
|
|
|
in between are type modifiers.
|
|
|
|
|
|
|
|
We simply compute the number of modifiers and call the general
|
|
|
|
function decode_modified_type to do the actual work.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_mod_fund_type (typedata)
|
|
|
|
char *typedata;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *typep = NULL;
|
|
|
|
unsigned short modcount;
|
1992-04-14 04:09:00 +00:00
|
|
|
int nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
/* Get the total size of the block, exclusive of the size itself */
|
1992-04-14 04:09:00 +00:00
|
|
|
|
|
|
|
nbytes = attribute_size (AT_mod_fund_type);
|
|
|
|
modcount = target_to_host (typedata, nbytes, GET_UNSIGNED, current_objfile);
|
|
|
|
typedata += nbytes;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Deduct the size of the fundamental type bytes at the end of the block. */
|
1992-04-14 04:09:00 +00:00
|
|
|
|
|
|
|
modcount -= attribute_size (AT_fund_type);
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Now do the actual decoding */
|
1992-04-14 04:09:00 +00:00
|
|
|
|
|
|
|
typep = decode_modified_type (typedata, modcount, AT_mod_fund_type);
|
1991-10-24 11:28:54 +00:00
|
|
|
return (typep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_mod_u_d_type -- decode a modified user defined type
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static struct type *decode_mod_u_d_type (char *typedata)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Decode a block of data containing a modified user defined
|
|
|
|
type specification. TYPEDATA is a pointer to the block,
|
|
|
|
which consists of a two byte length, containing the size
|
|
|
|
of the rest of the block. At the end of the block is a
|
|
|
|
four byte value that gives a reference to a user defined type.
|
|
|
|
Everything in between are type modifiers.
|
|
|
|
|
|
|
|
We simply compute the number of modifiers and call the general
|
|
|
|
function decode_modified_type to do the actual work.
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_mod_u_d_type (typedata)
|
|
|
|
char *typedata;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *typep = NULL;
|
|
|
|
unsigned short modcount;
|
1992-04-14 04:09:00 +00:00
|
|
|
int nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
/* Get the total size of the block, exclusive of the size itself */
|
1992-04-14 04:09:00 +00:00
|
|
|
|
|
|
|
nbytes = attribute_size (AT_mod_u_d_type);
|
|
|
|
modcount = target_to_host (typedata, nbytes, GET_UNSIGNED, current_objfile);
|
|
|
|
typedata += nbytes;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Deduct the size of the reference type bytes at the end of the block. */
|
1992-04-14 04:09:00 +00:00
|
|
|
|
|
|
|
modcount -= attribute_size (AT_user_def_type);
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
/* Now do the actual decoding */
|
1992-04-14 04:09:00 +00:00
|
|
|
|
|
|
|
typep = decode_modified_type (typedata, modcount, AT_mod_u_d_type);
|
1991-10-24 11:28:54 +00:00
|
|
|
return (typep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_modified_type -- decode modified user or fundamental type
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-06-15 14:26:57 +00:00
|
|
|
static struct type *decode_modified_type (char *modifiers,
|
1991-10-24 11:28:54 +00:00
|
|
|
unsigned short modcount, int mtype)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Decode a modified type, either a modified fundamental type or
|
|
|
|
a modified user defined type. MODIFIERS is a pointer to the
|
|
|
|
block of bytes that define MODCOUNT modifiers. Immediately
|
|
|
|
following the last modifier is a short containing the fundamental
|
|
|
|
type or a long containing the reference to the user defined
|
|
|
|
type. Which one is determined by MTYPE, which is either
|
|
|
|
AT_mod_fund_type or AT_mod_u_d_type to indicate what modified
|
|
|
|
type we are generating.
|
|
|
|
|
|
|
|
We call ourself recursively to generate each modified type,`
|
|
|
|
until MODCOUNT reaches zero, at which point we have consumed
|
|
|
|
all the modifiers and generate either the fundamental type or
|
|
|
|
user defined type. When the recursion unwinds, each modifier
|
|
|
|
is applied in turn to generate the full modified type.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
If we find a modifier that we don't recognize, and it is not one
|
|
|
|
of those reserved for application specific use, then we issue a
|
|
|
|
warning and simply ignore the modifier.
|
|
|
|
|
|
|
|
BUGS
|
|
|
|
|
|
|
|
We currently ignore MOD_const and MOD_volatile. (FIXME)
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_modified_type (modifiers, modcount, mtype)
|
1992-06-15 14:26:57 +00:00
|
|
|
char *modifiers;
|
1992-02-22 01:46:16 +00:00
|
|
|
unsigned int modcount;
|
|
|
|
int mtype;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *typep = NULL;
|
|
|
|
unsigned short fundtype;
|
1992-04-14 04:09:00 +00:00
|
|
|
DIE_REF die_ref;
|
1992-06-15 14:26:57 +00:00
|
|
|
char modifier;
|
1992-04-14 04:09:00 +00:00
|
|
|
int nbytes;
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
if (modcount == 0)
|
|
|
|
{
|
|
|
|
switch (mtype)
|
|
|
|
{
|
|
|
|
case AT_mod_fund_type:
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_fund_type);
|
|
|
|
fundtype = target_to_host (modifiers, nbytes, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
typep = decode_fund_type (fundtype);
|
|
|
|
break;
|
|
|
|
case AT_mod_u_d_type:
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = attribute_size (AT_user_def_type);
|
|
|
|
die_ref = target_to_host (modifiers, nbytes, GET_UNSIGNED,
|
|
|
|
current_objfile);
|
|
|
|
if ((typep = lookup_utype (die_ref)) == NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
typep = alloc_utype (die_ref, NULL);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&botched_modified_type, DIE_ID, DIE_NAME, mtype);
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
modifier = *modifiers++;
|
|
|
|
typep = decode_modified_type (modifiers, --modcount, mtype);
|
|
|
|
switch (modifier)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
case MOD_pointer_to:
|
|
|
|
typep = lookup_pointer_type (typep);
|
|
|
|
break;
|
|
|
|
case MOD_reference_to:
|
|
|
|
typep = lookup_reference_type (typep);
|
|
|
|
break;
|
|
|
|
case MOD_const:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&const_ignored, DIE_ID, DIE_NAME); /* FIXME */
|
1992-04-14 04:09:00 +00:00
|
|
|
break;
|
|
|
|
case MOD_volatile:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&volatile_ignored, DIE_ID, DIE_NAME); /* FIXME */
|
1992-04-14 04:09:00 +00:00
|
|
|
break;
|
|
|
|
default:
|
1992-06-15 14:26:57 +00:00
|
|
|
if (!(MOD_lo_user <= (unsigned char) modifier
|
|
|
|
&& (unsigned char) modifier <= MOD_hi_user))
|
1992-04-14 04:09:00 +00:00
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unknown_type_modifier, DIE_ID, DIE_NAME, modifier);
|
1992-04-14 04:09:00 +00:00
|
|
|
}
|
|
|
|
break;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return (typep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
decode_fund_type -- translate basic DWARF type to gdb base type
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given an integer that is one of the fundamental DWARF types,
|
|
|
|
translate it to one of the basic internal gdb types and return
|
|
|
|
a pointer to the appropriate gdb type (a "struct type *").
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
1992-12-15 02:52:11 +00:00
|
|
|
For robustness, if we are asked to translate a fundamental
|
|
|
|
type that we are unprepared to deal with, we return int so
|
|
|
|
callers can always depend upon a valid type being returned,
|
|
|
|
and so gdb may at least do something reasonable by default.
|
|
|
|
If the type is not in the range of those types defined as
|
|
|
|
application specific types, we also issue a warning.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static struct type *
|
1992-02-22 01:46:16 +00:00
|
|
|
decode_fund_type (fundtype)
|
|
|
|
unsigned int fundtype;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
struct type *typep = NULL;
|
|
|
|
|
|
|
|
switch (fundtype)
|
|
|
|
{
|
|
|
|
|
|
|
|
case FT_void:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_VOID);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
case FT_boolean: /* Was FT_set in AT&T version */
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_BOOLEAN);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
case FT_pointer: /* (void *) */
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_VOID);
|
1992-02-22 01:46:16 +00:00
|
|
|
typep = lookup_pointer_type (typep);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_char:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_CHAR);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
case FT_signed_char:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_CHAR);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_unsigned_char:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_CHAR);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_short:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_SHORT);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
case FT_signed_short:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_SHORT);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_unsigned_short:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_SHORT);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_integer:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
case FT_signed_integer:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_INTEGER);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_unsigned_integer:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_long:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_LONG);
|
1992-02-22 01:46:16 +00:00
|
|
|
break;
|
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
case FT_signed_long:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_LONG);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
case FT_unsigned_long:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
case FT_long_long:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_LONG_LONG);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
case FT_signed_long_long:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_LONG_LONG);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
case FT_unsigned_long_long:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
1992-02-22 01:46:16 +00:00
|
|
|
|
|
|
|
case FT_float:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_FLOAT);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
case FT_dbl_prec_float:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_ext_prec_float:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_complex:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_COMPLEX);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case FT_dbl_prec_complex:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_DBL_PREC_COMPLEX);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
|
1992-02-22 01:46:16 +00:00
|
|
|
case FT_ext_prec_complex:
|
1992-12-03 20:28:16 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_EXT_PREC_COMPLEX);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
1992-02-22 01:46:16 +00:00
|
|
|
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
1992-12-15 02:52:11 +00:00
|
|
|
if (typep == NULL)
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-12-15 02:52:11 +00:00
|
|
|
typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
|
|
|
|
if (!(FT_lo_user <= fundtype && fundtype <= FT_hi_user))
|
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unexpected_fund_type, DIE_ID, DIE_NAME, fundtype);
|
1992-12-15 02:52:11 +00:00
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (typep);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
create_name -- allocate a fresh copy of a string on an obstack
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to a string and a pointer to an obstack, allocates
|
|
|
|
a fresh copy of the string on the specified obstack.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static char *
|
1992-02-22 01:46:16 +00:00
|
|
|
create_name (name, obstackp)
|
|
|
|
char *name;
|
|
|
|
struct obstack *obstackp;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
int length;
|
|
|
|
char *newname;
|
|
|
|
|
|
|
|
length = strlen (name) + 1;
|
|
|
|
newname = (char *) obstack_alloc (obstackp, length);
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
strcpy (newname, name);
|
1991-10-24 11:28:54 +00:00
|
|
|
return (newname);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
basicdieinfo -- extract the minimal die info from raw die data
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-04-11 06:27:53 +00:00
|
|
|
void basicdieinfo (char *diep, struct dieinfo *dip,
|
|
|
|
struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to raw DIE data, and a pointer to an instance of a
|
|
|
|
die info structure, this function extracts the basic information
|
|
|
|
from the DIE data required to continue processing this DIE, along
|
|
|
|
with some bookkeeping information about the DIE.
|
|
|
|
|
|
|
|
The information we absolutely must have includes the DIE tag,
|
|
|
|
and the DIE length. If we need the sibling reference, then we
|
|
|
|
will have to call completedieinfo() to process all the remaining
|
|
|
|
DIE information.
|
|
|
|
|
|
|
|
Note that since there is no guarantee that the data is properly
|
|
|
|
aligned in memory for the type of access required (indirection
|
1992-04-11 06:27:53 +00:00
|
|
|
through anything other than a char pointer), and there is no
|
|
|
|
guarantee that it is in the same byte order as the gdb host,
|
|
|
|
we call a function which deals with both alignment and byte
|
|
|
|
swapping issues. Possibly inefficient, but quite portable.
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
We also take care of some other basic things at this point, such
|
|
|
|
as ensuring that the instance of the die info structure starts
|
|
|
|
out completely zero'd and that curdie is initialized for use
|
|
|
|
in error reporting if we have a problem with the current die.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
All DIE's must have at least a valid length, thus the minimum
|
1992-04-14 04:09:00 +00:00
|
|
|
DIE size is SIZEOF_DIE_LENGTH. In order to have a valid tag, the
|
|
|
|
DIE size must be at least SIZEOF_DIE_TAG larger, otherwise they
|
1991-10-24 11:28:54 +00:00
|
|
|
are forced to be TAG_padding DIES.
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
Padding DIES must be at least SIZEOF_DIE_LENGTH in length, implying
|
|
|
|
that if a padding DIE is used for alignment and the amount needed is
|
|
|
|
less than SIZEOF_DIE_LENGTH, then the padding DIE has to be big
|
|
|
|
enough to align to the next alignment boundry.
|
1992-10-01 17:33:21 +00:00
|
|
|
|
|
|
|
We do some basic sanity checking here, such as verifying that the
|
|
|
|
length of the die would not cause it to overrun the recorded end of
|
|
|
|
the buffer holding the DIE info. If we find a DIE that is either
|
|
|
|
too small or too large, we force it's length to zero which should
|
|
|
|
cause the caller to take appropriate action.
|
1991-10-24 11:28:54 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-04-11 06:27:53 +00:00
|
|
|
basicdieinfo (dip, diep, objfile)
|
1992-02-22 01:46:16 +00:00
|
|
|
struct dieinfo *dip;
|
|
|
|
char *diep;
|
1992-04-11 06:27:53 +00:00
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
curdie = dip;
|
* breakpoint.c, buildsym.c, c-exp.y, coffread.c, command.c,
core.c, cplus-dem.c, dbxread.c, dwarfread.c, elfread.c, environ.c,
eval.c, findvar.c, gdbtypes.c, hppabsd-tdep.c, hppahpux-tdep.c,
i386-tdep.c, ieee-float.c, infcmd.c, inflow.c, infptrace.c,
infrun.c, m2-exp.y, mipsread.c, objfiles.c, parse.c, procfs.c,
putenv.c, remote-mm.c, remote-vx.c, solib.c, sparc-tdep.c,
sparc-xdep.c, stack.c, symfile.c, symtab.c, symtab.h, target.c,
tm-i386v.h, tm-sparc.h, utils.c, valarith.c, valops.c, valprint.c,
values.c, xcoffread.c:
Remove "(void)" casts from function calls where the return value
is ignored, in accordance with GNU coding standards.
1992-07-04 03:22:08 +00:00
|
|
|
memset (dip, 0, sizeof (struct dieinfo));
|
1991-10-24 11:28:54 +00:00
|
|
|
dip -> die = diep;
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> die_ref = dbroff + (diep - dbbase);
|
|
|
|
dip -> die_length = target_to_host (diep, SIZEOF_DIE_LENGTH, GET_UNSIGNED,
|
|
|
|
objfile);
|
1992-10-01 17:33:21 +00:00
|
|
|
if ((dip -> die_length < SIZEOF_DIE_LENGTH) ||
|
|
|
|
((diep + dip -> die_length) > (dbbase + dbsize)))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&malformed_die, DIE_ID, DIE_NAME, dip -> die_length);
|
1992-10-01 17:33:21 +00:00
|
|
|
dip -> die_length = 0;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
else if (dip -> die_length < (SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG))
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> die_tag = TAG_padding;
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
diep += SIZEOF_DIE_LENGTH;
|
|
|
|
dip -> die_tag = target_to_host (diep, SIZEOF_DIE_TAG, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
completedieinfo -- finish reading the information for a given DIE
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
1992-04-11 06:27:53 +00:00
|
|
|
void completedieinfo (struct dieinfo *dip, struct objfile *objfile)
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a pointer to an already partially initialized die info structure,
|
|
|
|
scan the raw DIE data and finish filling in the die info structure
|
|
|
|
from the various attributes found.
|
|
|
|
|
|
|
|
Note that since there is no guarantee that the data is properly
|
|
|
|
aligned in memory for the type of access required (indirection
|
1992-04-11 06:27:53 +00:00
|
|
|
through anything other than a char pointer), and there is no
|
|
|
|
guarantee that it is in the same byte order as the gdb host,
|
|
|
|
we call a function which deals with both alignment and byte
|
|
|
|
swapping issues. Possibly inefficient, but quite portable.
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
Each time we are called, we increment the diecount variable, which
|
|
|
|
keeps an approximate count of the number of dies processed for
|
|
|
|
each compilation unit. This information is presented to the user
|
|
|
|
if the info_verbose flag is set.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static void
|
1992-04-11 06:27:53 +00:00
|
|
|
completedieinfo (dip, objfile)
|
1992-02-22 01:46:16 +00:00
|
|
|
struct dieinfo *dip;
|
1992-04-11 06:27:53 +00:00
|
|
|
struct objfile *objfile;
|
1991-10-24 11:28:54 +00:00
|
|
|
{
|
|
|
|
char *diep; /* Current pointer into raw DIE data */
|
|
|
|
char *end; /* Terminate DIE scan here */
|
|
|
|
unsigned short attr; /* Current attribute being scanned */
|
|
|
|
unsigned short form; /* Form of the attribute */
|
1992-04-14 04:09:00 +00:00
|
|
|
int nbytes; /* Size of next field to read */
|
1991-10-24 11:28:54 +00:00
|
|
|
|
|
|
|
diecount++;
|
|
|
|
diep = dip -> die;
|
1992-04-14 04:09:00 +00:00
|
|
|
end = diep + dip -> die_length;
|
|
|
|
diep += SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG;
|
1991-10-24 11:28:54 +00:00
|
|
|
while (diep < end)
|
|
|
|
{
|
1992-04-14 04:09:00 +00:00
|
|
|
attr = target_to_host (diep, SIZEOF_ATTRIBUTE, GET_UNSIGNED, objfile);
|
|
|
|
diep += SIZEOF_ATTRIBUTE;
|
|
|
|
if ((nbytes = attribute_size (attr)) == -1)
|
|
|
|
{
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unknown_attribute_length, DIE_ID, DIE_NAME);
|
1992-04-14 04:09:00 +00:00
|
|
|
diep = end;
|
|
|
|
continue;
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
switch (attr)
|
|
|
|
{
|
|
|
|
case AT_fund_type:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_fund_type = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_ordering:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_ordering = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_bit_offset:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_bit_offset = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_sibling:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_sibling = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_stmt_list:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_stmt_list = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-11-18 08:07:43 +00:00
|
|
|
dip -> has_at_stmt_list = 1;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_low_pc:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_low_pc = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
dip -> at_low_pc += baseaddr;
|
1991-11-18 08:07:43 +00:00
|
|
|
dip -> has_at_low_pc = 1;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_high_pc:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_high_pc = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1992-01-11 01:41:23 +00:00
|
|
|
dip -> at_high_pc += baseaddr;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_language:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_language = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_user_def_type:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_user_def_type = target_to_host (diep, nbytes,
|
|
|
|
GET_UNSIGNED, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_byte_size:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_byte_size = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1992-08-09 06:14:59 +00:00
|
|
|
dip -> has_at_byte_size = 1;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_bit_size:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_bit_size = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_member:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_member = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_discr:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_discr = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_location:
|
|
|
|
dip -> at_location = diep;
|
|
|
|
break;
|
|
|
|
case AT_mod_fund_type:
|
|
|
|
dip -> at_mod_fund_type = diep;
|
|
|
|
break;
|
|
|
|
case AT_subscr_data:
|
|
|
|
dip -> at_subscr_data = diep;
|
|
|
|
break;
|
|
|
|
case AT_mod_u_d_type:
|
|
|
|
dip -> at_mod_u_d_type = diep;
|
|
|
|
break;
|
|
|
|
case AT_element_list:
|
|
|
|
dip -> at_element_list = diep;
|
1991-11-20 13:07:12 +00:00
|
|
|
dip -> short_element_list = 0;
|
|
|
|
break;
|
|
|
|
case AT_short_element_list:
|
|
|
|
dip -> at_element_list = diep;
|
|
|
|
dip -> short_element_list = 1;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_discr_value:
|
|
|
|
dip -> at_discr_value = diep;
|
|
|
|
break;
|
|
|
|
case AT_string_length:
|
|
|
|
dip -> at_string_length = diep;
|
|
|
|
break;
|
|
|
|
case AT_name:
|
|
|
|
dip -> at_name = diep;
|
|
|
|
break;
|
|
|
|
case AT_comp_dir:
|
1992-07-17 17:16:26 +00:00
|
|
|
/* For now, ignore any "hostname:" portion, since gdb doesn't
|
|
|
|
know how to deal with it. (FIXME). */
|
|
|
|
dip -> at_comp_dir = strrchr (diep, ':');
|
|
|
|
if (dip -> at_comp_dir != NULL)
|
|
|
|
{
|
|
|
|
dip -> at_comp_dir++;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dip -> at_comp_dir = diep;
|
|
|
|
}
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_producer:
|
|
|
|
dip -> at_producer = diep;
|
|
|
|
break;
|
|
|
|
case AT_start_scope:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_start_scope = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_stride_size:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_stride_size = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_src_info:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_src_info = target_to_host (diep, nbytes, GET_UNSIGNED,
|
|
|
|
objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case AT_prototyped:
|
1992-04-14 04:09:00 +00:00
|
|
|
dip -> at_prototyped = diep;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* Found an attribute that we are unprepared to handle. However
|
|
|
|
it is specifically one of the design goals of DWARF that
|
|
|
|
consumers should ignore unknown attributes. As long as the
|
|
|
|
form is one that we recognize (so we know how to skip it),
|
|
|
|
we can just ignore the unknown attribute. */
|
|
|
|
break;
|
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
form = FORM_FROM_ATTR (attr);
|
1991-10-24 11:28:54 +00:00
|
|
|
switch (form)
|
|
|
|
{
|
|
|
|
case FORM_DATA2:
|
1992-04-14 04:09:00 +00:00
|
|
|
diep += 2;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FORM_DATA4:
|
1992-04-14 04:09:00 +00:00
|
|
|
case FORM_REF:
|
|
|
|
diep += 4;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FORM_DATA8:
|
1992-04-14 04:09:00 +00:00
|
|
|
diep += 8;
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FORM_ADDR:
|
1992-04-14 04:09:00 +00:00
|
|
|
diep += TARGET_FT_POINTER_SIZE (objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FORM_BLOCK2:
|
1992-04-14 04:09:00 +00:00
|
|
|
diep += 2 + target_to_host (diep, nbytes, GET_UNSIGNED, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FORM_BLOCK4:
|
1992-04-14 04:09:00 +00:00
|
|
|
diep += 4 + target_to_host (diep, nbytes, GET_UNSIGNED, objfile);
|
1991-10-24 11:28:54 +00:00
|
|
|
break;
|
|
|
|
case FORM_STRING:
|
|
|
|
diep += strlen (diep) + 1;
|
|
|
|
break;
|
|
|
|
default:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
|
1991-10-24 11:28:54 +00:00
|
|
|
diep = end;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
1992-04-11 06:27:53 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
/*
|
1992-04-11 06:27:53 +00:00
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
target_to_host -- swap in target data to host
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
target_to_host (char *from, int nbytes, int signextend,
|
|
|
|
struct objfile *objfile)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given pointer to data in target format in FROM, a byte count for
|
|
|
|
the size of the data in NBYTES, a flag indicating whether or not
|
|
|
|
the data is signed in SIGNEXTEND, and a pointer to the current
|
|
|
|
objfile in OBJFILE, convert the data to host format and return
|
|
|
|
the converted value.
|
|
|
|
|
|
|
|
NOTES
|
|
|
|
|
|
|
|
FIXME: If we read data that is known to be signed, and expect to
|
|
|
|
use it as signed data, then we need to explicitly sign extend the
|
|
|
|
result until the bfd library is able to do this for us.
|
|
|
|
|
1995-03-03 06:26:25 +00:00
|
|
|
FIXME: Would a 32 bit target ever need an 8 byte result?
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
*/
|
|
|
|
|
1995-03-03 06:26:25 +00:00
|
|
|
static CORE_ADDR
|
1992-04-14 04:09:00 +00:00
|
|
|
target_to_host (from, nbytes, signextend, objfile)
|
1992-04-11 06:27:53 +00:00
|
|
|
char *from;
|
|
|
|
int nbytes;
|
1992-04-14 04:09:00 +00:00
|
|
|
int signextend; /* FIXME: Unused */
|
1992-04-11 06:27:53 +00:00
|
|
|
struct objfile *objfile;
|
|
|
|
{
|
1995-03-03 06:26:25 +00:00
|
|
|
CORE_ADDR rtnval;
|
1992-04-11 06:27:53 +00:00
|
|
|
|
|
|
|
switch (nbytes)
|
|
|
|
{
|
|
|
|
case 8:
|
1992-04-14 04:09:00 +00:00
|
|
|
rtnval = bfd_get_64 (objfile -> obfd, (bfd_byte *) from);
|
1992-04-11 06:27:53 +00:00
|
|
|
break;
|
|
|
|
case 4:
|
1992-04-14 04:09:00 +00:00
|
|
|
rtnval = bfd_get_32 (objfile -> obfd, (bfd_byte *) from);
|
1992-04-11 06:27:53 +00:00
|
|
|
break;
|
|
|
|
case 2:
|
1992-04-14 04:09:00 +00:00
|
|
|
rtnval = bfd_get_16 (objfile -> obfd, (bfd_byte *) from);
|
1992-04-11 06:27:53 +00:00
|
|
|
break;
|
|
|
|
case 1:
|
1992-04-14 04:09:00 +00:00
|
|
|
rtnval = bfd_get_8 (objfile -> obfd, (bfd_byte *) from);
|
1992-04-11 06:27:53 +00:00
|
|
|
break;
|
|
|
|
default:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&no_bfd_get_N, DIE_ID, DIE_NAME, nbytes);
|
1992-04-14 04:09:00 +00:00
|
|
|
rtnval = 0;
|
1992-04-11 06:27:53 +00:00
|
|
|
break;
|
|
|
|
}
|
1992-04-14 04:09:00 +00:00
|
|
|
return (rtnval);
|
1992-04-11 06:27:53 +00:00
|
|
|
}
|
|
|
|
|
1992-04-14 04:09:00 +00:00
|
|
|
/*
|
|
|
|
|
|
|
|
LOCAL FUNCTION
|
|
|
|
|
|
|
|
attribute_size -- compute size of data for a DWARF attribute
|
|
|
|
|
|
|
|
SYNOPSIS
|
|
|
|
|
|
|
|
static int attribute_size (unsigned int attr)
|
|
|
|
|
|
|
|
DESCRIPTION
|
|
|
|
|
|
|
|
Given a DWARF attribute in ATTR, compute the size of the first
|
|
|
|
piece of data associated with this attribute and return that
|
|
|
|
size.
|
|
|
|
|
|
|
|
Returns -1 for unrecognized attributes.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
static int
|
|
|
|
attribute_size (attr)
|
|
|
|
unsigned int attr;
|
|
|
|
{
|
|
|
|
int nbytes; /* Size of next data for this attribute */
|
|
|
|
unsigned short form; /* Form of the attribute */
|
|
|
|
|
|
|
|
form = FORM_FROM_ATTR (attr);
|
|
|
|
switch (form)
|
|
|
|
{
|
|
|
|
case FORM_STRING: /* A variable length field is next */
|
|
|
|
nbytes = 0;
|
|
|
|
break;
|
|
|
|
case FORM_DATA2: /* Next 2 byte field is the data itself */
|
|
|
|
case FORM_BLOCK2: /* Next 2 byte field is a block length */
|
|
|
|
nbytes = 2;
|
|
|
|
break;
|
|
|
|
case FORM_DATA4: /* Next 4 byte field is the data itself */
|
|
|
|
case FORM_BLOCK4: /* Next 4 byte field is a block length */
|
|
|
|
case FORM_REF: /* Next 4 byte field is a DIE offset */
|
|
|
|
nbytes = 4;
|
|
|
|
break;
|
|
|
|
case FORM_DATA8: /* Next 8 byte field is the data itself */
|
|
|
|
nbytes = 8;
|
|
|
|
break;
|
|
|
|
case FORM_ADDR: /* Next field size is target sizeof(void *) */
|
|
|
|
nbytes = TARGET_FT_POINTER_SIZE (objfile);
|
|
|
|
break;
|
|
|
|
default:
|
* complaints.c: New file, code moved from utils.c.
* complaints.c (complain): Made into a varargs function.
* complaints.h: New file, code moved from symfile.h.
* Makefile.in (SFILES_MAINDIR): Add complaints.c.
* Makefile.in (HFILES): Add complaints.h.
* Makefile.in (OBS): Add complaints.o.
* symfile.c (complaint_root, stop_whining, complaint_series,
complain, clear_complaints, add_show_from_set for stop_whining):
Moved to complaints.c.
* symfile.h (struct complaint, complaint_root decl, complain
prototype, clear_complaints prototype): Moved to complaints.h.
* buildsym.c, coffread.c, dbxread.c, dwarfread.c, elfread.c,
gdbtypes.c, mipsread.c, stbsread.c, symfile.c: Include
complaints.h. Remove casts from arguments to complain(),
which is now a varargs function, and remove unnecessary
placeholder zero args.
* defs.h (begin_line): Add prototype.
* defs.h (vprintf_filtered): Add prototype.
* dwarfread.c (varargs.h): Remove, no longer needed.
* dwarfread.c (dwarfwarn): Remove prototype and function.
* dwarfread.c (complaints): Define a bunch of complaints.
* dwarfread.c (SQUAWK): Remove macro defs, convert all
usages to standard complain() calls.
* utils.c (begin_line): New function that ensures that
whatever gets filter-printed next starts on its own line.
* utils.c (vprintf_filtered): New func, like vfprintf_filtered,
but to stdout (calls vfprintf_filtered internally).
1992-12-15 12:18:53 +00:00
|
|
|
complain (&unknown_attribute_form, DIE_ID, DIE_NAME, form);
|
1992-04-14 04:09:00 +00:00
|
|
|
nbytes = -1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return (nbytes);
|
|
|
|
}
|