aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog20
-rw-r--r--gdb/MAINTAINERS2
-rw-r--r--gdb/Makefile.in17
-rw-r--r--gdb/NEWS15
-rw-r--r--gdb/abug-rom.c182
-rw-r--r--gdb/config/d10v/d10v.mt4
-rw-r--r--gdb/config/m68k/monitor.mt4
-rw-r--r--gdb/configure.tgt3
-rw-r--r--gdb/cpu32bug-rom.c180
-rw-r--r--gdb/d10v-tdep.c1579
-rw-r--r--gdb/doc/ChangeLog6
-rw-r--r--gdb/doc/gdb.texinfo28
-rw-r--r--gdb/doc/gdbint.texinfo16
-rw-r--r--gdb/dwarf2read.c2
-rw-r--r--gdb/dwarfread.c3820
-rw-r--r--gdb/elfread.c25
-rw-r--r--gdb/remote-est.c186
-rw-r--r--gdb/rom68k-rom.c264
-rw-r--r--gdb/symfile.h5
-rw-r--r--gdb/testsuite/ChangeLog6
-rw-r--r--gdb/testsuite/gdb.asm/asm-source.exp3
-rw-r--r--gdb/testsuite/gdb.asm/d10v.inc55
-rw-r--r--gdb/testsuite/lib/gdb.exp3
23 files changed, 57 insertions, 6368 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1cb44c7..7f24ce1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,25 @@
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+ * MAINTAINERS: Remove d10v entry.
+ * Makefile.in (SFILES): Remove dwarfread.c.
+ (COMMON_OBS): Remove dwarfread.o.
+ (gdb_sim_d10v_h, abug-rom.o, cpu32bug-rom.o, d10v-tdep.o, dwarfread.o)
+ (remote-est.o, rom68k-rom.o): Delete.
+ * NEWS: Mention removal of d10v, target abug, target cpu32bug,
+ target est, target rom68k, and DWARF 1.
+ * configure.tgt: Mark d10v as removed.
+ * dwarf2read.c: Doc update.
+ * elfread.c (struct elfinfo): Remove dboffset, dbsize, lnoffset,
+ and lnsize.
+ (elf_locate_sections): Do not set them.
+ (elf_symfile_read): Do not call dwarf_build_psymtabs.
+ * symfile.h (dwarf_build_psymtabs): Delete prototype.
+ * config/m68k/monitor.mt (TDEPFILES): Prune.
+ * abug-rom.c, cpu32bug-rom.c, d10v-tdep.c, dwarfread.c,
+ remote-est.c, rom68k-rom.c, config/d10v/d10v.mt: Delete.
+
+2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+
* doublest.c (convert_floatformat_to_doublest): Use
floatformat_classify.
(floatformat_is_nan): Rename to...
diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS
index ab1e033..021f456 100644
--- a/gdb/MAINTAINERS
+++ b/gdb/MAINTAINERS
@@ -259,8 +259,6 @@ the native maintainer when resolving ABI issues.
cris --target=cris-elf ,-Werror ,
(sim does not build with -Werror)
- d10v OBSOLETE
-
frv --target=frv-elf ,-Werror
h8300 --target=h8300-elf ,-Werror
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index e275147..c200ce9 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -532,7 +532,7 @@ SFILES = ada-exp.y ada-lang.c ada-typeprint.c ada-valprint.c \
cp-abi.c cp-support.c cp-namespace.c cp-valprint.c \
cp-name-parser.y \
dbxread.c demangle.c dictionary.c disasm.c doublest.c dummy-frame.c \
- dwarfread.c dwarf2expr.c dwarf2loc.c dwarf2read.c dwarf2-frame.c \
+ dwarf2expr.c dwarf2loc.c dwarf2read.c dwarf2-frame.c \
elfread.c environ.c eval.c event-loop.c event-top.c expprint.c \
f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c frame.c \
frame-base.c \
@@ -611,7 +611,6 @@ mep_opc_h = $(OPCODES_SRC)/mep-opc.h
sh_opc_h = $(OPCODES_SRC)/sh-opc.h
gdb_callback_h = $(INCLUDE_DIR)/gdb/callback.h
gdb_sim_arm_h = $(INCLUDE_DIR)/gdb/sim-arm.h
-gdb_sim_d10v_h = $(INCLUDE_DIR)/gdb/sim-d10v.h
gdb_sim_frv_h = $(INCLUDE_DIR)/gdb/sim-frv.h
gdb_sim_m32c_h = $(INCLUDE_DIR)/gdb/sim-m32c.h
gdb_sim_ppc_h = $(INCLUDE_DIR)/gdb/sim-ppc.h
@@ -956,7 +955,7 @@ COMMON_OBS = $(DEPFILES) $(CONFIG_OBS) $(YYOBJ) \
gdb-events.o \
exec.o bcache.o objfiles.o observer.o minsyms.o maint.o demangle.o \
dbxread.o coffread.o coff-pe-read.o elfread.o \
- dwarfread.o dwarf2read.o mipsread.o stabsread.o corefile.o \
+ dwarf2read.o mipsread.o stabsread.o corefile.o \
dwarf2expr.o dwarf2loc.o dwarf2-frame.o \
ada-lang.o c-lang.o f-lang.o objc-lang.o \
ui-out.o cli-out.o \
@@ -1705,8 +1704,6 @@ stamp-xml: $(srcdir)/features/feature_to_c.sh Makefile $(XMLFILES)
# gdb/ dependencies
#
-abug-rom.o: abug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h) $(m68k_tdep_h)
ada-exp.o: ada-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
$(parser_defs_h) $(language_h) $(ada_lang_h) $(bfd_h) $(symfile_h) \
$(objfiles_h) $(frame_h) $(block_h) $(ada_lex_c)
@@ -1918,8 +1915,6 @@ cp-support.o: cp-support.c $(defs_h) $(cp_support_h) $(gdb_string_h) \
$(demangle_h) $(gdb_assert_h) $(gdbcmd_h) $(dictionary_h) \
$(objfiles_h) $(frame_h) $(symtab_h) $(block_h) $(complaints_h) \
$(gdbtypes_h)
-cpu32bug-rom.o: cpu32bug-rom.c $(defs_h) $(gdbcore_h) $(target_h) \
- $(monitor_h) $(serial_h) $(regcache_h) $(m68k_tdep_h)
cp-valprint.o: cp-valprint.c $(defs_h) $(gdb_obstack_h) $(symtab_h) \
$(gdbtypes_h) $(expression_h) $(value_h) $(command_h) $(gdbcmd_h) \
$(demangle_h) $(annotate_h) $(gdb_string_h) $(c_lang_h) $(target_h) \
@@ -1937,7 +1932,6 @@ c-typeprint.o: c-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
c-valprint.o: c-valprint.c $(defs_h) $(gdb_string_h) $(symtab_h) \
$(gdbtypes_h) $(expression_h) $(value_h) $(valprint_h) $(language_h) \
$(c_lang_h) $(cp_abi_h) $(target_h)
-# OBSOLETE d10v-tdep.o: d10v-tdep.c
dbug-rom.o: dbug-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
$(serial_h) $(regcache_h) $(m68k_tdep_h)
dbxread.o: dbxread.c $(defs_h) $(gdb_string_h) $(gdb_obstack_h) \
@@ -1979,9 +1973,6 @@ dwarf2read.o: dwarf2read.c $(defs_h) $(bfd_h) $(symtab_h) $(gdbtypes_h) \
$(complaints_h) $(bcache_h) $(dwarf2expr_h) $(dwarf2loc_h) \
$(cp_support_h) $(hashtab_h) $(command_h) $(gdbcmd_h) \
$(gdb_string_h) $(gdb_assert_h)
-dwarfread.o: dwarfread.c $(defs_h) $(symtab_h) $(gdbtypes_h) $(objfiles_h) \
- $(elf_dwarf_h) $(buildsym_h) $(demangle_h) $(expression_h) \
- $(language_h) $(complaints_h) $(gdb_string_h)
elfread.o: elfread.c $(defs_h) $(bfd_h) $(gdb_string_h) $(elf_bfd_h) \
$(elf_mips_h) $(symtab_h) $(symfile_h) $(objfiles_h) $(buildsym_h) \
$(stabsread_h) $(gdb_stabs_h) $(complaints_h) $(demangle_h)
@@ -2537,8 +2528,6 @@ remote-e7000.o: remote-e7000.c $(defs_h) $(gdbcore_h) $(gdbarch_h) \
$(inferior_h) $(target_h) $(value_h) $(command_h) $(gdb_string_h) \
$(exceptions_h) $(gdbcmd_h) $(serial_h) $(remote_utils_h) \
$(symfile_h) $(regcache_h)
-remote-est.o: remote-est.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h) $(m68k_tdep_h)
remote-fileio.o: remote-fileio.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) \
$(remote_h) $(gdb_fileio_h) $(gdb_wait_h) $(gdb_stat_h) \
$(exceptions_h) $(remote_fileio_h)
@@ -2558,8 +2547,6 @@ remote-sim.o: remote-sim.c $(defs_h) $(inferior_h) $(value_h) \
remote-utils.o: remote-utils.c $(defs_h) $(gdb_string_h) $(gdbcmd_h) \
$(target_h) $(serial_h) $(gdbcore_h) $(inferior_h) $(remote_utils_h) \
$(regcache_h)
-rom68k-rom.o: rom68k-rom.c $(defs_h) $(gdbcore_h) $(target_h) $(monitor_h) \
- $(serial_h) $(regcache_h) $(value_h) $(m68k_tdep_h)
rs6000-nat.o: rs6000-nat.c $(defs_h) $(inferior_h) $(target_h) $(gdbcore_h) \
$(xcoffsolib_h) $(symfile_h) $(objfiles_h) $(libbfd_h) $(bfd_h) \
$(exceptions_h) $(gdb_stabs_h) $(regcache_h) $(arch_utils_h) \
diff --git a/gdb/NEWS b/gdb/NEWS
index e1d04e4..9aa3e94 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -87,6 +87,7 @@ qXfer:features:read:
Support for these obsolete configurations has been removed.
+d10v-*-*
hppa*-*-hiux*
i[34567]86-ncr-*
i[34567]86-*-dgux*
@@ -106,6 +107,20 @@ m68*-cisco*-*
m68*-tandem-*
rs6000-*-lynxos*
+* Other removed features
+
+target abug
+target cpu32bug
+target est
+target rom68k
+
+ Various m68k-only ROM monitors.
+
+DWARF 1 support
+
+ A debug information format. The predecessor to DWARF 2 and
+ DWARF 3, which are still supported.
+
*** Changes in GDB 6.6
* New targets
diff --git a/gdb/abug-rom.c b/gdb/abug-rom.c
deleted file mode 100644
index 1d11f8c..0000000
--- a/gdb/abug-rom.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Remote debugging interface for ABug Rom monitor for GDB, the GNU debugger.
- Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2007
- Free Software Foundation, Inc.
-
- Written by Rob Savoye of Cygnus Support
-
- 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
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "regcache.h"
-
-#include "m68k-tdep.h"
-
-/* Prototypes for local functions. */
-
-static void abug_open (char *args, int from_tty);
-
-static void
-abug_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
- int regno;
-
- if (regnamelen != 2)
- return;
-
- switch (regname[0])
- {
- case 'S':
- if (regname[1] != 'R')
- return;
- regno = PS_REGNUM;
- break;
- case 'P':
- if (regname[1] != 'C')
- return;
- regno = PC_REGNUM;
- break;
- case 'D':
- if (regname[1] < '0' || regname[1] > '7')
- return;
- regno = regname[1] - '0' + M68K_D0_REGNUM;
- break;
- case 'A':
- if (regname[1] < '0' || regname[1] > '7')
- return;
- regno = regname[1] - '0' + M68K_A0_REGNUM;
- break;
- default:
- return;
- }
-
- monitor_supply_register (regno, val);
-}
-
-/*
- * This array of registers needs to match the indexes used by GDB. The
- * whole reason this exists is because the various ROM monitors use
- * different names than GDB does, and don't support all the
- * registers either. So, typing "info reg sp" becomes an "A7".
- */
-
-static const char *
-abug_regname (int index)
-{
- static char *regnames[] =
- {
- "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
- "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
- "PC",
- };
-
- if ((index >= (sizeof (regnames) / sizeof (regnames[0])))
- || (index < 0) || (index >= NUM_REGS))
- return NULL;
- else
- return regnames[index];
-}
-
-/*
- * Define the monitor command strings. Since these are passed directly
- * through to a printf style function, we need can include formatting
- * strings. We also need a CR or LF on the end.
- */
-
-static struct target_ops abug_ops;
-
-static char *abug_inits[] =
-{"\r", NULL};
-
-static struct monitor_ops abug_cmds;
-
-static void
-init_abug_cmds (void)
-{
- abug_cmds.flags = MO_CLR_BREAK_USES_ADDR;
- abug_cmds.init = abug_inits; /* Init strings */
- abug_cmds.cont = "g\r"; /* continue command */
- abug_cmds.step = "t\r"; /* single step */
- abug_cmds.stop = NULL; /* interrupt command */
- abug_cmds.set_break = "br %x\r"; /* set a breakpoint */
- abug_cmds.clr_break = "nobr %x\r"; /* clear a breakpoint */
- abug_cmds.clr_all_break = "nobr\r"; /* clear all breakpoints */
- abug_cmds.fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
- abug_cmds.setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
- abug_cmds.setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
- abug_cmds.setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
- abug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
- abug_cmds.setmem.resp_delim = NULL; /* setreg.resp_delim */
- abug_cmds.setmem.term = NULL; /* setreg.term */
- abug_cmds.setmem.term_cmd = NULL; /* setreg.term_cmd */
- abug_cmds.getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
- abug_cmds.getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
- abug_cmds.getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
- abug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
- abug_cmds.getmem.resp_delim = " "; /* getmem.resp_delim */
- abug_cmds.getmem.term = NULL; /* getmem.term */
- abug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
- abug_cmds.setreg.cmd = "rm %s %x\r"; /* setreg.cmd (name, value) */
- abug_cmds.setreg.resp_delim = "="; /* setreg.resp_delim */
- abug_cmds.setreg.term = "? "; /* setreg.term */
- abug_cmds.setreg.term_cmd = ".\r"; /* setreg.term_cmd */
- abug_cmds.getreg.cmd = "rm %s\r"; /* getreg.cmd (name) */
- abug_cmds.getreg.resp_delim = "="; /* getreg.resp_delim */
- abug_cmds.getreg.term = "? "; /* getreg.term */
- abug_cmds.getreg.term_cmd = ".\r"; /* getreg.term_cmd */
- abug_cmds.dump_registers = "rd\r"; /* dump_registers */
- abug_cmds.register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
- abug_cmds.supply_register = abug_supply_register;
- abug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
- abug_cmds.load = "lo 0\r"; /* download command */
- abug_cmds.loadresp = "\n"; /* load response */
- abug_cmds.prompt = "135Bug>"; /* monitor command prompt */
- abug_cmds.line_term = "\r"; /* end-of-line terminator */
- abug_cmds.cmd_end = NULL; /* optional command terminator */
- abug_cmds.target = &abug_ops; /* target operations */
- abug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
- abug_cmds.regnames = NULL; /* registers names */
- abug_cmds.regname = abug_regname;
- abug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-};
-
-static void
-abug_open (char *args, int from_tty)
-{
- monitor_open (args, &abug_cmds, from_tty);
-}
-
-extern initialize_file_ftype _initialize_abug_rom; /* -Wmissing-prototypes */
-
-void
-_initialize_abug_rom (void)
-{
- init_abug_cmds ();
- init_monitor_ops (&abug_ops);
-
- abug_ops.to_shortname = "abug";
- abug_ops.to_longname = _("ABug monitor");
- abug_ops.to_doc = _("Debug via the ABug monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).");
- abug_ops.to_open = abug_open;
-
- add_target (&abug_ops);
-}
diff --git a/gdb/config/d10v/d10v.mt b/gdb/config/d10v/d10v.mt
deleted file mode 100644
index 58d3dda..0000000
--- a/gdb/config/d10v/d10v.mt
+++ /dev/null
@@ -1,4 +0,0 @@
-# OBSOLETE # Target: Renesas D10V processor
-# OBSOLETE TDEPFILES= d10v-tdep.o
-# OBSOLETE SIM_OBS= remote-sim.o
-# OBSOLETE SIM= ../sim/d10v/libsim.a
diff --git a/gdb/config/m68k/monitor.mt b/gdb/config/m68k/monitor.mt
index 0cae796..1ea8faf 100644
--- a/gdb/config/m68k/monitor.mt
+++ b/gdb/config/m68k/monitor.mt
@@ -1,3 +1,3 @@
-# Target: Motorola m68k embedded (EST emulator, rom68k and bug monitors)
-TDEPFILES= m68k-tdep.o monitor.o remote-est.o cpu32bug-rom.o rom68k-rom.o abug-rom.o dbug-rom.o dsrec.o
+# Target: Motorola m68k embedded (e.g. bug monitors)
+TDEPFILES= m68k-tdep.o monitor.o dbug-rom.o dsrec.o
DEPRECATED_TM_FILE= tm-monitor.h
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index f3ae8e8..9abf1d5 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -6,6 +6,7 @@
# gdb_target name of GDB target definition to use
case $target in
+ d10v-*-* | \
hppa*-*-hiux* | \
i[34567]86-ncr-* | \
i[34567]86-*-lynxos* | \
@@ -92,8 +93,6 @@ avr-*-*) gdb_target=avr ;;
cris*) gdb_target=cris ;;
-# OBSOLETE d10v-*-*) gdb_target=d10v ;;
-
frv-*-*) gdb_target=frv ;;
h8300-*-*) gdb_target=h8300 ;;
diff --git a/gdb/cpu32bug-rom.c b/gdb/cpu32bug-rom.c
deleted file mode 100644
index 422f8c2..0000000
--- a/gdb/cpu32bug-rom.c
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Remote debugging interface for CPU32Bug Rom monitor for GDB, the GNU debugger.
- Copyright (C) 1995, 1996, 1998, 1999, 2000, 2001, 2007
- Free Software Foundation, Inc.
-
- Written by Stu Grossman of Cygnus Support
-
- 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
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "regcache.h"
-
-#include "m68k-tdep.h"
-
-static void cpu32bug_open (char *args, int from_tty);
-
-static void
-cpu32bug_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
- int regno;
-
- if (regnamelen != 2)
- return;
-
- switch (regname[0])
- {
- case 'S':
- if (regname[1] != 'R')
- return;
- regno = PS_REGNUM;
- break;
- case 'P':
- if (regname[1] != 'C')
- return;
- regno = PC_REGNUM;
- break;
- case 'D':
- if (regname[1] < '0' || regname[1] > '7')
- return;
- regno = regname[1] - '0' + M68K_D0_REGNUM;
- break;
- case 'A':
- if (regname[1] < '0' || regname[1] > '7')
- return;
- regno = regname[1] - '0' + M68K_A0_REGNUM;
- break;
- default:
- return;
- }
-
- monitor_supply_register (regno, val);
-}
-
-/*
- * This array of registers needs to match the indexes used by GDB. The
- * whole reason this exists is because the various ROM monitors use
- * different names than GDB does, and don't support all the
- * registers either. So, typing "info reg sp" becomes an "A7".
- */
-
-static const char *
-cpu32bug_regname (int index)
-{
- static char *regnames[] =
- {
- "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
- "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
- "SR", "PC"
- };
-
- if ((index >= (sizeof (regnames) / sizeof (regnames[0])))
- || (index < 0) || (index >= NUM_REGS))
- return NULL;
- else
- return regnames[index];
-}
-
-/*
- * Define the monitor command strings. Since these are passed directly
- * through to a printf style function, we need can include formatting
- * strings. We also need a CR or LF on the end.
- */
-
-static struct target_ops cpu32bug_ops;
-
-static char *cpu32bug_inits[] =
-{"\r", NULL};
-
-static struct monitor_ops cpu32bug_cmds;
-
-static void
-init_cpu32bug_cmds (void)
-{
- cpu32bug_cmds.flags = MO_CLR_BREAK_USES_ADDR;
- cpu32bug_cmds.init = cpu32bug_inits; /* Init strings */
- cpu32bug_cmds.cont = "g\r"; /* continue command */
- cpu32bug_cmds.step = "t\r"; /* single step */
- cpu32bug_cmds.stop = NULL; /* interrupt command */
- cpu32bug_cmds.set_break = "br %x\r"; /* set a breakpoint */
- cpu32bug_cmds.clr_break = "nobr %x\r"; /* clear a breakpoint */
- cpu32bug_cmds.clr_all_break = "nobr\r"; /* clear all breakpoints */
- cpu32bug_cmds.fill = "bf %x:%x %x;b\r"; /* fill (start count val) */
- cpu32bug_cmds.setmem.cmdb = "ms %x %02x\r"; /* setmem.cmdb (addr, value) */
- cpu32bug_cmds.setmem.cmdw = "ms %x %04x\r"; /* setmem.cmdw (addr, value) */
- cpu32bug_cmds.setmem.cmdl = "ms %x %08x\r"; /* setmem.cmdl (addr, value) */
- cpu32bug_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
- cpu32bug_cmds.setmem.resp_delim = NULL; /* setreg.resp_delim */
- cpu32bug_cmds.setmem.term = NULL; /* setreg.term */
- cpu32bug_cmds.setmem.term_cmd = NULL; /* setreg.term_cmd */
- cpu32bug_cmds.getmem.cmdb = "md %x:%x;b\r"; /* getmem.cmdb (addr, len) */
- cpu32bug_cmds.getmem.cmdw = "md %x:%x;b\r"; /* getmem.cmdw (addr, len) */
- cpu32bug_cmds.getmem.cmdl = "md %x:%x;b\r"; /* getmem.cmdl (addr, len) */
- cpu32bug_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
- cpu32bug_cmds.getmem.resp_delim = " "; /* getmem.resp_delim */
- cpu32bug_cmds.getmem.term = NULL; /* getmem.term */
- cpu32bug_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
- cpu32bug_cmds.setreg.cmd = "rs %s %x\r"; /* setreg.cmd (name, value) */
- cpu32bug_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
- cpu32bug_cmds.setreg.term = NULL; /* setreg.term */
- cpu32bug_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
- cpu32bug_cmds.getreg.cmd = "rs %s\r"; /* getreg.cmd (name) */
- cpu32bug_cmds.getreg.resp_delim = "="; /* getreg.resp_delim */
- cpu32bug_cmds.getreg.term = NULL; /* getreg.term */
- cpu32bug_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
- cpu32bug_cmds.dump_registers = "rd\r"; /* dump_registers */
- cpu32bug_cmds.register_pattern = "\\(\\w+\\) +=\\([0-9a-fA-F]+\\b\\)"; /* register_pattern */
- cpu32bug_cmds.supply_register = cpu32bug_supply_register;
- cpu32bug_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
- cpu32bug_cmds.load = "lo\r"; /* download command */
- cpu32bug_cmds.loadresp = "\n"; /* load response */
- cpu32bug_cmds.prompt = "CPU32Bug>"; /* monitor command prompt */
- cpu32bug_cmds.line_term = "\r"; /* end-of-line terminator */
- cpu32bug_cmds.cmd_end = NULL; /* optional command terminator */
- cpu32bug_cmds.target = &cpu32bug_ops; /* target operations */
- cpu32bug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
- cpu32bug_cmds.regnames = NULL; /* registers names */
- cpu32bug_cmds.regname = cpu32bug_regname;
- cpu32bug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-}; /* init_cpu32bug_cmds */
-
-static void
-cpu32bug_open (char *args, int from_tty)
-{
- monitor_open (args, &cpu32bug_cmds, from_tty);
-}
-
-extern initialize_file_ftype _initialize_cpu32bug_rom; /* -Wmissing-prototypes */
-
-void
-_initialize_cpu32bug_rom (void)
-{
- init_cpu32bug_cmds ();
- init_monitor_ops (&cpu32bug_ops);
-
- cpu32bug_ops.to_shortname = "cpu32bug";
- cpu32bug_ops.to_longname = "CPU32Bug monitor";
- cpu32bug_ops.to_doc = "Debug via the CPU32Bug monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
- cpu32bug_ops.to_open = cpu32bug_open;
-
- add_target (&cpu32bug_ops);
-}
diff --git a/gdb/d10v-tdep.c b/gdb/d10v-tdep.c
deleted file mode 100644
index aadac05..0000000
--- a/gdb/d10v-tdep.c
+++ /dev/null
@@ -1,1579 +0,0 @@
-// OBSOLETE /* Target-dependent code for Renesas D10V, for GDB.
-// OBSOLETE
-// OBSOLETE Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
-// OBSOLETE Foundation, Inc.
-// OBSOLETE
-// OBSOLETE This file is part of GDB.
-// OBSOLETE
-// OBSOLETE This program is free software; you can redistribute it and/or modify
-// OBSOLETE it under the terms of the GNU General Public License as published by
-// OBSOLETE the Free Software Foundation; either version 2 of the License, or
-// OBSOLETE (at your option) any later version.
-// OBSOLETE
-// OBSOLETE This program is distributed in the hope that it will be useful,
-// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of
-// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// OBSOLETE GNU General Public License for more details.
-// OBSOLETE
-// OBSOLETE You should have received a copy of the GNU General Public License
-// OBSOLETE along with this program; if not, write to the Free Software
-// OBSOLETE Foundation, Inc., 51 Franklin Street, Fifth Floor,
-// OBSOLETE Boston, MA 02110-1301, USA. */
-// OBSOLETE
-// OBSOLETE /* Contributed by Martin Hunt, hunt@cygnus.com */
-// OBSOLETE
-// OBSOLETE #include "defs.h"
-// OBSOLETE #include "frame.h"
-// OBSOLETE #include "frame-unwind.h"
-// OBSOLETE #include "frame-base.h"
-// OBSOLETE #include "symtab.h"
-// OBSOLETE #include "gdbtypes.h"
-// OBSOLETE #include "gdbcmd.h"
-// OBSOLETE #include "gdbcore.h"
-// OBSOLETE #include "gdb_string.h"
-// OBSOLETE #include "value.h"
-// OBSOLETE #include "inferior.h"
-// OBSOLETE #include "dis-asm.h"
-// OBSOLETE #include "symfile.h"
-// OBSOLETE #include "objfiles.h"
-// OBSOLETE #include "language.h"
-// OBSOLETE #include "arch-utils.h"
-// OBSOLETE #include "regcache.h"
-// OBSOLETE #include "remote.h"
-// OBSOLETE #include "floatformat.h"
-// OBSOLETE #include "gdb/sim-d10v.h"
-// OBSOLETE #include "sim-regno.h"
-// OBSOLETE #include "disasm.h"
-// OBSOLETE #include "trad-frame.h"
-// OBSOLETE
-// OBSOLETE #include "gdb_assert.h"
-// OBSOLETE
-// OBSOLETE struct gdbarch_tdep
-// OBSOLETE {
-// OBSOLETE int a0_regnum;
-// OBSOLETE int nr_dmap_regs;
-// OBSOLETE unsigned long (*dmap_register) (void *regcache, int nr);
-// OBSOLETE unsigned long (*imap_register) (void *regcache, int nr);
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE /* These are the addresses the D10V-EVA board maps data and
-// OBSOLETE instruction memory to. */
-// OBSOLETE
-// OBSOLETE enum memspace {
-// OBSOLETE DMEM_START = 0x2000000,
-// OBSOLETE IMEM_START = 0x1000000,
-// OBSOLETE STACK_START = 0x200bffe
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE /* d10v register names. */
-// OBSOLETE
-// OBSOLETE enum
-// OBSOLETE {
-// OBSOLETE R0_REGNUM = 0,
-// OBSOLETE R3_REGNUM = 3,
-// OBSOLETE D10V_FP_REGNUM = 11,
-// OBSOLETE LR_REGNUM = 13,
-// OBSOLETE D10V_SP_REGNUM = 15,
-// OBSOLETE PSW_REGNUM = 16,
-// OBSOLETE D10V_PC_REGNUM = 18,
-// OBSOLETE NR_IMAP_REGS = 2,
-// OBSOLETE NR_A_REGS = 2,
-// OBSOLETE TS2_NUM_REGS = 37,
-// OBSOLETE TS3_NUM_REGS = 42,
-// OBSOLETE /* d10v calling convention. */
-// OBSOLETE ARG1_REGNUM = R0_REGNUM,
-// OBSOLETE ARGN_REGNUM = R3_REGNUM
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE nr_dmap_regs (struct gdbarch *gdbarch)
-// OBSOLETE {
-// OBSOLETE return gdbarch_tdep (gdbarch)->nr_dmap_regs;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE a0_regnum (struct gdbarch *gdbarch)
-// OBSOLETE {
-// OBSOLETE return gdbarch_tdep (gdbarch)->a0_regnum;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Local functions */
-// OBSOLETE
-// OBSOLETE extern void _initialize_d10v_tdep (void);
-// OBSOLETE
-// OBSOLETE static void d10v_eva_prepare_to_trace (void);
-// OBSOLETE
-// OBSOLETE static void d10v_eva_get_trace_data (void);
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_frame_align (struct gdbarch *gdbarch, CORE_ADDR sp)
-// OBSOLETE {
-// OBSOLETE /* Align to the size of an instruction (so that they can safely be
-// OBSOLETE pushed onto the stack. */
-// OBSOLETE return sp & ~3;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static const unsigned char *
-// OBSOLETE d10v_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
-// OBSOLETE {
-// OBSOLETE static unsigned char breakpoint[] =
-// OBSOLETE {0x2f, 0x90, 0x5e, 0x00};
-// OBSOLETE *lenptr = sizeof (breakpoint);
-// OBSOLETE return breakpoint;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Map the REG_NR onto an ascii name. Return NULL or an empty string
-// OBSOLETE when the reg_nr isn't valid. */
-// OBSOLETE
-// OBSOLETE enum ts2_regnums
-// OBSOLETE {
-// OBSOLETE TS2_IMAP0_REGNUM = 32,
-// OBSOLETE TS2_DMAP_REGNUM = 34,
-// OBSOLETE TS2_NR_DMAP_REGS = 1,
-// OBSOLETE TS2_A0_REGNUM = 35
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE static const char *
-// OBSOLETE d10v_ts2_register_name (int reg_nr)
-// OBSOLETE {
-// OBSOLETE static char *register_names[] =
-// OBSOLETE {
-// OBSOLETE "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
-// OBSOLETE "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
-// OBSOLETE "psw", "bpsw", "pc", "bpc", "cr4", "cr5", "cr6", "rpt_c",
-// OBSOLETE "rpt_s", "rpt_e", "mod_s", "mod_e", "cr12", "cr13", "iba", "cr15",
-// OBSOLETE "imap0", "imap1", "dmap", "a0", "a1"
-// OBSOLETE };
-// OBSOLETE if (reg_nr < 0)
-// OBSOLETE return NULL;
-// OBSOLETE if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
-// OBSOLETE return NULL;
-// OBSOLETE return register_names[reg_nr];
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE enum ts3_regnums
-// OBSOLETE {
-// OBSOLETE TS3_IMAP0_REGNUM = 36,
-// OBSOLETE TS3_DMAP0_REGNUM = 38,
-// OBSOLETE TS3_NR_DMAP_REGS = 4,
-// OBSOLETE TS3_A0_REGNUM = 32
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE static const char *
-// OBSOLETE d10v_ts3_register_name (int reg_nr)
-// OBSOLETE {
-// OBSOLETE static char *register_names[] =
-// OBSOLETE {
-// OBSOLETE "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
-// OBSOLETE "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
-// OBSOLETE "psw", "bpsw", "pc", "bpc", "cr4", "cr5", "cr6", "rpt_c",
-// OBSOLETE "rpt_s", "rpt_e", "mod_s", "mod_e", "cr12", "cr13", "iba", "cr15",
-// OBSOLETE "a0", "a1",
-// OBSOLETE "spi", "spu",
-// OBSOLETE "imap0", "imap1",
-// OBSOLETE "dmap0", "dmap1", "dmap2", "dmap3"
-// OBSOLETE };
-// OBSOLETE if (reg_nr < 0)
-// OBSOLETE return NULL;
-// OBSOLETE if (reg_nr >= (sizeof (register_names) / sizeof (*register_names)))
-// OBSOLETE return NULL;
-// OBSOLETE return register_names[reg_nr];
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Access the DMAP/IMAP registers in a target independent way.
-// OBSOLETE
-// OBSOLETE Divide the D10V's 64k data space into four 16k segments:
-// OBSOLETE 0x0000 -- 0x3fff, 0x4000 -- 0x7fff, 0x8000 -- 0xbfff, and
-// OBSOLETE 0xc000 -- 0xffff.
-// OBSOLETE
-// OBSOLETE On the TS2, the first two segments (0x0000 -- 0x3fff, 0x4000 --
-// OBSOLETE 0x7fff) always map to the on-chip data RAM, and the fourth always
-// OBSOLETE maps to I/O space. The third (0x8000 - 0xbfff) can be mapped into
-// OBSOLETE unified memory or instruction memory, under the control of the
-// OBSOLETE single DMAP register.
-// OBSOLETE
-// OBSOLETE On the TS3, there are four DMAP registers, each of which controls
-// OBSOLETE one of the segments. */
-// OBSOLETE
-// OBSOLETE static unsigned long
-// OBSOLETE d10v_ts2_dmap_register (void *regcache, int reg_nr)
-// OBSOLETE {
-// OBSOLETE switch (reg_nr)
-// OBSOLETE {
-// OBSOLETE case 0:
-// OBSOLETE case 1:
-// OBSOLETE return 0x2000;
-// OBSOLETE case 2:
-// OBSOLETE {
-// OBSOLETE ULONGEST reg;
-// OBSOLETE regcache_cooked_read_unsigned (regcache, TS2_DMAP_REGNUM, &reg);
-// OBSOLETE return reg;
-// OBSOLETE }
-// OBSOLETE default:
-// OBSOLETE return 0;
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static unsigned long
-// OBSOLETE d10v_ts3_dmap_register (void *regcache, int reg_nr)
-// OBSOLETE {
-// OBSOLETE ULONGEST reg;
-// OBSOLETE regcache_cooked_read_unsigned (regcache, TS3_DMAP0_REGNUM + reg_nr, &reg);
-// OBSOLETE return reg;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static unsigned long
-// OBSOLETE d10v_ts2_imap_register (void *regcache, int reg_nr)
-// OBSOLETE {
-// OBSOLETE ULONGEST reg;
-// OBSOLETE regcache_cooked_read_unsigned (regcache, TS2_IMAP0_REGNUM + reg_nr, &reg);
-// OBSOLETE return reg;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static unsigned long
-// OBSOLETE d10v_ts3_imap_register (void *regcache, int reg_nr)
-// OBSOLETE {
-// OBSOLETE ULONGEST reg;
-// OBSOLETE regcache_cooked_read_unsigned (regcache, TS3_IMAP0_REGNUM + reg_nr, &reg);
-// OBSOLETE return reg;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* MAP GDB's internal register numbering (determined by the layout
-// OBSOLETE from the DEPRECATED_REGISTER_BYTE array) onto the simulator's
-// OBSOLETE register numbering. */
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE d10v_ts2_register_sim_regno (int nr)
-// OBSOLETE {
-// OBSOLETE /* Only makes sense to supply raw registers. */
-// OBSOLETE gdb_assert (nr >= 0 && nr < NUM_REGS);
-// OBSOLETE if (nr >= TS2_IMAP0_REGNUM
-// OBSOLETE && nr < TS2_IMAP0_REGNUM + NR_IMAP_REGS)
-// OBSOLETE return nr - TS2_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
-// OBSOLETE if (nr == TS2_DMAP_REGNUM)
-// OBSOLETE return nr - TS2_DMAP_REGNUM + SIM_D10V_TS2_DMAP_REGNUM;
-// OBSOLETE if (nr >= TS2_A0_REGNUM
-// OBSOLETE && nr < TS2_A0_REGNUM + NR_A_REGS)
-// OBSOLETE return nr - TS2_A0_REGNUM + SIM_D10V_A0_REGNUM;
-// OBSOLETE return nr;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE d10v_ts3_register_sim_regno (int nr)
-// OBSOLETE {
-// OBSOLETE /* Only makes sense to supply raw registers. */
-// OBSOLETE gdb_assert (nr >= 0 && nr < NUM_REGS);
-// OBSOLETE if (nr >= TS3_IMAP0_REGNUM
-// OBSOLETE && nr < TS3_IMAP0_REGNUM + NR_IMAP_REGS)
-// OBSOLETE return nr - TS3_IMAP0_REGNUM + SIM_D10V_IMAP0_REGNUM;
-// OBSOLETE if (nr >= TS3_DMAP0_REGNUM
-// OBSOLETE && nr < TS3_DMAP0_REGNUM + TS3_NR_DMAP_REGS)
-// OBSOLETE return nr - TS3_DMAP0_REGNUM + SIM_D10V_DMAP0_REGNUM;
-// OBSOLETE if (nr >= TS3_A0_REGNUM
-// OBSOLETE && nr < TS3_A0_REGNUM + NR_A_REGS)
-// OBSOLETE return nr - TS3_A0_REGNUM + SIM_D10V_A0_REGNUM;
-// OBSOLETE return nr;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Return the GDB type object for the "standard" data type
-// OBSOLETE of data in register N. */
-// OBSOLETE
-// OBSOLETE static struct type *
-// OBSOLETE d10v_register_type (struct gdbarch *gdbarch, int reg_nr)
-// OBSOLETE {
-// OBSOLETE if (reg_nr == D10V_PC_REGNUM)
-// OBSOLETE return builtin_type (gdbarch)->builtin_func_ptr;
-// OBSOLETE if (reg_nr == D10V_SP_REGNUM || reg_nr == D10V_FP_REGNUM)
-// OBSOLETE return builtin_type (gdbarch)->builtin_data_ptr;
-// OBSOLETE else if (reg_nr >= a0_regnum (gdbarch)
-// OBSOLETE && reg_nr < (a0_regnum (gdbarch) + NR_A_REGS))
-// OBSOLETE return builtin_type_int64;
-// OBSOLETE else
-// OBSOLETE return builtin_type_int16;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE d10v_iaddr_p (CORE_ADDR x)
-// OBSOLETE {
-// OBSOLETE return (((x) & 0x3000000) == IMEM_START);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_make_daddr (CORE_ADDR x)
-// OBSOLETE {
-// OBSOLETE return ((x) | DMEM_START);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_make_iaddr (CORE_ADDR x)
-// OBSOLETE {
-// OBSOLETE if (d10v_iaddr_p (x))
-// OBSOLETE return x; /* Idempotency -- x is already in the IMEM space. */
-// OBSOLETE else
-// OBSOLETE return (((x) << 2) | IMEM_START);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_convert_iaddr_to_raw (CORE_ADDR x)
-// OBSOLETE {
-// OBSOLETE return (((x) >> 2) & 0xffff);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_convert_daddr_to_raw (CORE_ADDR x)
-// OBSOLETE {
-// OBSOLETE return ((x) & 0xffff);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_address_to_pointer (struct type *type, void *buf, CORE_ADDR addr)
-// OBSOLETE {
-// OBSOLETE /* Is it a code address? */
-// OBSOLETE if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
-// OBSOLETE || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD)
-// OBSOLETE {
-// OBSOLETE store_unsigned_integer (buf, TYPE_LENGTH (type),
-// OBSOLETE d10v_convert_iaddr_to_raw (addr));
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE /* Strip off any upper segment bits. */
-// OBSOLETE store_unsigned_integer (buf, TYPE_LENGTH (type),
-// OBSOLETE d10v_convert_daddr_to_raw (addr));
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_pointer_to_address (struct type *type, const void *buf)
-// OBSOLETE {
-// OBSOLETE CORE_ADDR addr = extract_unsigned_integer (buf, TYPE_LENGTH (type));
-// OBSOLETE /* Is it a code address? */
-// OBSOLETE if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_FUNC
-// OBSOLETE || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_METHOD
-// OBSOLETE || TYPE_CODE_SPACE (TYPE_TARGET_TYPE (type)))
-// OBSOLETE return d10v_make_iaddr (addr);
-// OBSOLETE else
-// OBSOLETE return d10v_make_daddr (addr);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Don't do anything if we have an integer, this way users can type 'x
-// OBSOLETE <addr>' w/o having gdb outsmart them. The internal gdb conversions
-// OBSOLETE to the correct space are taken care of in the pointer_to_address
-// OBSOLETE function. If we don't do this, 'x $fp' wouldn't work. */
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_integer_to_address (struct type *type, void *buf)
-// OBSOLETE {
-// OBSOLETE LONGEST val;
-// OBSOLETE val = unpack_long (type, buf);
-// OBSOLETE return val;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Handle the d10v's return_value convention. */
-// OBSOLETE
-// OBSOLETE static enum return_value_convention
-// OBSOLETE d10v_return_value (struct gdbarch *gdbarch, struct type *valtype,
-// OBSOLETE struct regcache *regcache, void *readbuf,
-// OBSOLETE const void *writebuf)
-// OBSOLETE {
-// OBSOLETE if (TYPE_LENGTH (valtype) > 8)
-// OBSOLETE /* Anything larger than 8 bytes (4 registers) goes on the stack. */
-// OBSOLETE return RETURN_VALUE_STRUCT_CONVENTION;
-// OBSOLETE if (TYPE_LENGTH (valtype) == 5
-// OBSOLETE || TYPE_LENGTH (valtype) == 6)
-// OBSOLETE /* Anything 5 or 6 bytes in size goes in memory. Contents don't
-// OBSOLETE appear to matter. Note that 7 and 8 byte objects do end up in
-// OBSOLETE registers! */
-// OBSOLETE return RETURN_VALUE_STRUCT_CONVENTION;
-// OBSOLETE if (TYPE_LENGTH (valtype) == 1)
-// OBSOLETE {
-// OBSOLETE /* All single byte values go in a register stored right-aligned.
-// OBSOLETE Note: 2 byte integer values are handled further down. */
-// OBSOLETE if (readbuf)
-// OBSOLETE {
-// OBSOLETE /* Since TYPE is smaller than the register, there isn't a
-// OBSOLETE sign extension problem. Let the extraction truncate the
-// OBSOLETE register value. */
-// OBSOLETE ULONGEST regval;
-// OBSOLETE regcache_cooked_read_unsigned (regcache, R0_REGNUM,
-// OBSOLETE &regval);
-// OBSOLETE store_unsigned_integer (readbuf, TYPE_LENGTH (valtype), regval);
-// OBSOLETE
-// OBSOLETE }
-// OBSOLETE if (writebuf)
-// OBSOLETE {
-// OBSOLETE ULONGEST regval;
-// OBSOLETE if (TYPE_CODE (valtype) == TYPE_CODE_INT)
-// OBSOLETE /* Some sort of integer value stored in R0. Use
-// OBSOLETE unpack_long since that should handle any required sign
-// OBSOLETE extension. */
-// OBSOLETE regval = unpack_long (valtype, writebuf);
-// OBSOLETE else
-// OBSOLETE /* Some other type. Don't sign-extend the value when
-// OBSOLETE storing it in the register. */
-// OBSOLETE regval = extract_unsigned_integer (writebuf, 1);
-// OBSOLETE regcache_cooked_write_unsigned (regcache, R0_REGNUM, regval);
-// OBSOLETE }
-// OBSOLETE return RETURN_VALUE_REGISTER_CONVENTION;
-// OBSOLETE }
-// OBSOLETE if ((TYPE_CODE (valtype) == TYPE_CODE_STRUCT
-// OBSOLETE || TYPE_CODE (valtype) == TYPE_CODE_UNION)
-// OBSOLETE && TYPE_NFIELDS (valtype) > 1
-// OBSOLETE && TYPE_FIELD_BITPOS (valtype, 1) == 8)
-// OBSOLETE /* If a composite is 8 bit aligned (determined by looking at the
-// OBSOLETE start address of the second field), put it in memory. */
-// OBSOLETE return RETURN_VALUE_STRUCT_CONVENTION;
-// OBSOLETE /* Assume it is in registers. */
-// OBSOLETE if (writebuf || readbuf)
-// OBSOLETE {
-// OBSOLETE int reg;
-// OBSOLETE /* Per above, the value is never more than 8 bytes long. */
-// OBSOLETE gdb_assert (TYPE_LENGTH (valtype) <= 8);
-// OBSOLETE /* Xfer 2 bytes at a time. */
-// OBSOLETE for (reg = 0; (reg * 2) + 1 < TYPE_LENGTH (valtype); reg++)
-// OBSOLETE {
-// OBSOLETE if (readbuf)
-// OBSOLETE regcache_cooked_read (regcache, R0_REGNUM + reg,
-// OBSOLETE (bfd_byte *) readbuf + reg * 2);
-// OBSOLETE if (writebuf)
-// OBSOLETE regcache_cooked_write (regcache, R0_REGNUM + reg,
-// OBSOLETE (bfd_byte *) writebuf + reg * 2);
-// OBSOLETE }
-// OBSOLETE /* Any trailing byte ends up _left_ aligned. */
-// OBSOLETE if ((reg * 2) < TYPE_LENGTH (valtype))
-// OBSOLETE {
-// OBSOLETE if (readbuf)
-// OBSOLETE regcache_cooked_read_part (regcache, R0_REGNUM + reg,
-// OBSOLETE 0, 1, (bfd_byte *) readbuf + reg * 2);
-// OBSOLETE if (writebuf)
-// OBSOLETE regcache_cooked_write_part (regcache, R0_REGNUM + reg,
-// OBSOLETE 0, 1, (bfd_byte *) writebuf + reg * 2);
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE return RETURN_VALUE_REGISTER_CONVENTION;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE check_prologue (unsigned short op)
-// OBSOLETE {
-// OBSOLETE /* st rn, @-sp */
-// OBSOLETE if ((op & 0x7E1F) == 0x6C1F)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* st2w rn, @-sp */
-// OBSOLETE if ((op & 0x7E3F) == 0x6E1F)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* subi sp, n */
-// OBSOLETE if ((op & 0x7FE1) == 0x01E1)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* mv r11, sp */
-// OBSOLETE if (op == 0x417E)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* nop */
-// OBSOLETE if (op == 0x5E00)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* st rn, @sp */
-// OBSOLETE if ((op & 0x7E1F) == 0x681E)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* st2w rn, @sp */
-// OBSOLETE if ((op & 0x7E3F) == 0x3A1E)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE return 0;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_skip_prologue (CORE_ADDR pc)
-// OBSOLETE {
-// OBSOLETE unsigned long op;
-// OBSOLETE unsigned short op1, op2;
-// OBSOLETE CORE_ADDR func_addr, func_end;
-// OBSOLETE struct symtab_and_line sal;
-// OBSOLETE
-// OBSOLETE /* If we have line debugging information, then the end of the prologue
-// OBSOLETE should be the first assembly instruction of the first source line. */
-// OBSOLETE if (find_pc_partial_function (pc, NULL, &func_addr, &func_end))
-// OBSOLETE {
-// OBSOLETE sal = find_pc_line (func_addr, 0);
-// OBSOLETE if (sal.end && sal.end < func_end)
-// OBSOLETE return sal.end;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE if (target_read_memory (pc, (char *) &op, 4))
-// OBSOLETE return pc; /* Can't access it -- assume no prologue. */
-// OBSOLETE
-// OBSOLETE while (1)
-// OBSOLETE {
-// OBSOLETE op = (unsigned long) read_memory_integer (pc, 4);
-// OBSOLETE if ((op & 0xC0000000) == 0xC0000000)
-// OBSOLETE {
-// OBSOLETE /* long instruction */
-// OBSOLETE if (((op & 0x3FFF0000) != 0x01FF0000) && /* add3 sp,sp,n */
-// OBSOLETE ((op & 0x3F0F0000) != 0x340F0000) && /* st rn, @(offset,sp) */
-// OBSOLETE ((op & 0x3F1F0000) != 0x350F0000)) /* st2w rn, @(offset,sp) */
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE /* short instructions */
-// OBSOLETE if ((op & 0xC0000000) == 0x80000000)
-// OBSOLETE {
-// OBSOLETE op2 = (op & 0x3FFF8000) >> 15;
-// OBSOLETE op1 = op & 0x7FFF;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE op1 = (op & 0x3FFF8000) >> 15;
-// OBSOLETE op2 = op & 0x7FFF;
-// OBSOLETE }
-// OBSOLETE if (check_prologue (op1))
-// OBSOLETE {
-// OBSOLETE if (!check_prologue (op2))
-// OBSOLETE {
-// OBSOLETE /* If the previous opcode was really part of the
-// OBSOLETE prologue and not just a NOP, then we want to
-// OBSOLETE break after both instructions. */
-// OBSOLETE if (op1 != 0x5E00)
-// OBSOLETE pc += 4;
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE pc += 4;
-// OBSOLETE }
-// OBSOLETE return pc;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE struct d10v_unwind_cache
-// OBSOLETE {
-// OBSOLETE /* The previous frame's inner most stack address. Used as this
-// OBSOLETE frame ID's stack_addr. */
-// OBSOLETE CORE_ADDR prev_sp;
-// OBSOLETE /* The frame's base, optionally used by the high-level debug info. */
-// OBSOLETE CORE_ADDR base;
-// OBSOLETE int size;
-// OBSOLETE /* How far the SP and r11 (FP) have been offset from the start of
-// OBSOLETE the stack frame (as defined by the previous frame's stack
-// OBSOLETE pointer). */
-// OBSOLETE LONGEST sp_offset;
-// OBSOLETE LONGEST r11_offset;
-// OBSOLETE int uses_frame;
-// OBSOLETE /* Table indicating the location of each and every register. */
-// OBSOLETE struct trad_frame_saved_reg *saved_regs;
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE static int
-// OBSOLETE prologue_find_regs (struct d10v_unwind_cache *info, unsigned short op,
-// OBSOLETE CORE_ADDR addr)
-// OBSOLETE {
-// OBSOLETE int n;
-// OBSOLETE
-// OBSOLETE /* st rn, @-sp */
-// OBSOLETE if ((op & 0x7E1F) == 0x6C1F)
-// OBSOLETE {
-// OBSOLETE n = (op & 0x1E0) >> 5;
-// OBSOLETE info->sp_offset -= 2;
-// OBSOLETE info->saved_regs[n].addr = info->sp_offset;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* st2w rn, @-sp */
-// OBSOLETE else if ((op & 0x7E3F) == 0x6E1F)
-// OBSOLETE {
-// OBSOLETE n = (op & 0x1E0) >> 5;
-// OBSOLETE info->sp_offset -= 4;
-// OBSOLETE info->saved_regs[n + 0].addr = info->sp_offset + 0;
-// OBSOLETE info->saved_regs[n + 1].addr = info->sp_offset + 2;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* subi sp, n */
-// OBSOLETE if ((op & 0x7FE1) == 0x01E1)
-// OBSOLETE {
-// OBSOLETE n = (op & 0x1E) >> 1;
-// OBSOLETE if (n == 0)
-// OBSOLETE n = 16;
-// OBSOLETE info->sp_offset -= n;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* mv r11, sp */
-// OBSOLETE if (op == 0x417E)
-// OBSOLETE {
-// OBSOLETE info->uses_frame = 1;
-// OBSOLETE info->r11_offset = info->sp_offset;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* st rn, @r11 */
-// OBSOLETE if ((op & 0x7E1F) == 0x6816)
-// OBSOLETE {
-// OBSOLETE n = (op & 0x1E0) >> 5;
-// OBSOLETE info->saved_regs[n].addr = info->r11_offset;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* nop */
-// OBSOLETE if (op == 0x5E00)
-// OBSOLETE return 1;
-// OBSOLETE
-// OBSOLETE /* st rn, @sp */
-// OBSOLETE if ((op & 0x7E1F) == 0x681E)
-// OBSOLETE {
-// OBSOLETE n = (op & 0x1E0) >> 5;
-// OBSOLETE info->saved_regs[n].addr = info->sp_offset;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* st2w rn, @sp */
-// OBSOLETE if ((op & 0x7E3F) == 0x3A1E)
-// OBSOLETE {
-// OBSOLETE n = (op & 0x1E0) >> 5;
-// OBSOLETE info->saved_regs[n + 0].addr = info->sp_offset + 0;
-// OBSOLETE info->saved_regs[n + 1].addr = info->sp_offset + 2;
-// OBSOLETE return 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE return 0;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Put here the code to store, into fi->saved_regs, the addresses of
-// OBSOLETE the saved registers of frame described by FRAME_INFO. This
-// OBSOLETE includes special registers such as pc and fp saved in special ways
-// OBSOLETE in the stack frame. sp is even more special: the address we return
-// OBSOLETE for it IS the sp for the next frame. */
-// OBSOLETE
-// OBSOLETE static struct d10v_unwind_cache *
-// OBSOLETE d10v_frame_unwind_cache (struct frame_info *next_frame,
-// OBSOLETE void **this_prologue_cache)
-// OBSOLETE {
-// OBSOLETE struct gdbarch *gdbarch = get_frame_arch (next_frame);
-// OBSOLETE CORE_ADDR pc;
-// OBSOLETE ULONGEST prev_sp;
-// OBSOLETE ULONGEST this_base;
-// OBSOLETE unsigned long op;
-// OBSOLETE unsigned short op1, op2;
-// OBSOLETE int i;
-// OBSOLETE struct d10v_unwind_cache *info;
-// OBSOLETE
-// OBSOLETE if ((*this_prologue_cache))
-// OBSOLETE return (*this_prologue_cache);
-// OBSOLETE
-// OBSOLETE info = FRAME_OBSTACK_ZALLOC (struct d10v_unwind_cache);
-// OBSOLETE (*this_prologue_cache) = info;
-// OBSOLETE info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
-// OBSOLETE
-// OBSOLETE info->size = 0;
-// OBSOLETE info->sp_offset = 0;
-// OBSOLETE
-// OBSOLETE info->uses_frame = 0;
-// OBSOLETE for (pc = frame_func_unwind (next_frame);
-// OBSOLETE pc > 0 && pc < frame_pc_unwind (next_frame);
-// OBSOLETE pc += 4)
-// OBSOLETE {
-// OBSOLETE op = get_frame_memory_unsigned (next_frame, pc, 4);
-// OBSOLETE if ((op & 0xC0000000) == 0xC0000000)
-// OBSOLETE {
-// OBSOLETE /* long instruction */
-// OBSOLETE if ((op & 0x3FFF0000) == 0x01FF0000)
-// OBSOLETE {
-// OBSOLETE /* add3 sp,sp,n */
-// OBSOLETE short n = op & 0xFFFF;
-// OBSOLETE info->sp_offset += n;
-// OBSOLETE }
-// OBSOLETE else if ((op & 0x3F0F0000) == 0x340F0000)
-// OBSOLETE {
-// OBSOLETE /* st rn, @(offset,sp) */
-// OBSOLETE short offset = op & 0xFFFF;
-// OBSOLETE short n = (op >> 20) & 0xF;
-// OBSOLETE info->saved_regs[n].addr = info->sp_offset + offset;
-// OBSOLETE }
-// OBSOLETE else if ((op & 0x3F1F0000) == 0x350F0000)
-// OBSOLETE {
-// OBSOLETE /* st2w rn, @(offset,sp) */
-// OBSOLETE short offset = op & 0xFFFF;
-// OBSOLETE short n = (op >> 20) & 0xF;
-// OBSOLETE info->saved_regs[n + 0].addr = info->sp_offset + offset + 0;
-// OBSOLETE info->saved_regs[n + 1].addr = info->sp_offset + offset + 2;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE /* short instructions */
-// OBSOLETE if ((op & 0xC0000000) == 0x80000000)
-// OBSOLETE {
-// OBSOLETE op2 = (op & 0x3FFF8000) >> 15;
-// OBSOLETE op1 = op & 0x7FFF;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE op1 = (op & 0x3FFF8000) >> 15;
-// OBSOLETE op2 = op & 0x7FFF;
-// OBSOLETE }
-// OBSOLETE if (!prologue_find_regs (info, op1, pc)
-// OBSOLETE || !prologue_find_regs (info, op2, pc))
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE info->size = -info->sp_offset;
-// OBSOLETE
-// OBSOLETE /* Compute the previous frame's stack pointer (which is also the
-// OBSOLETE frame's ID's stack address), and this frame's base pointer. */
-// OBSOLETE if (info->uses_frame)
-// OBSOLETE {
-// OBSOLETE /* The SP was moved to the FP. This indicates that a new frame
-// OBSOLETE was created. Get THIS frame's FP value by unwinding it from
-// OBSOLETE the next frame. */
-// OBSOLETE frame_unwind_unsigned_register (next_frame, D10V_FP_REGNUM, &this_base);
-// OBSOLETE /* The FP points at the last saved register. Adjust the FP back
-// OBSOLETE to before the first saved register giving the SP. */
-// OBSOLETE prev_sp = this_base + info->size;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE /* Assume that the FP is this frame's SP but with that pushed
-// OBSOLETE stack space added back. */
-// OBSOLETE frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &this_base);
-// OBSOLETE prev_sp = this_base + info->size;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Convert that SP/BASE into real addresses. */
-// OBSOLETE info->prev_sp = d10v_make_daddr (prev_sp);
-// OBSOLETE info->base = d10v_make_daddr (this_base);
-// OBSOLETE
-// OBSOLETE /* Adjust all the saved registers so that they contain addresses and
-// OBSOLETE not offsets. */
-// OBSOLETE for (i = 0; i < NUM_REGS - 1; i++)
-// OBSOLETE if (trad_frame_addr_p (info->saved_regs, i))
-// OBSOLETE {
-// OBSOLETE info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* The call instruction moves the caller's PC in the callee's LR.
-// OBSOLETE Since this is an unwind, do the reverse. Copy the location of LR
-// OBSOLETE into PC (the address / regnum) so that a request for PC will be
-// OBSOLETE converted into a request for the LR. */
-// OBSOLETE info->saved_regs[D10V_PC_REGNUM] = info->saved_regs[LR_REGNUM];
-// OBSOLETE
-// OBSOLETE /* The previous frame's SP needed to be computed. Save the computed
-// OBSOLETE value. */
-// OBSOLETE trad_frame_set_value (info->saved_regs, D10V_SP_REGNUM,
-// OBSOLETE d10v_make_daddr (prev_sp));
-// OBSOLETE
-// OBSOLETE return info;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
-// OBSOLETE struct frame_info *frame, int regnum, int all)
-// OBSOLETE {
-// OBSOLETE struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-// OBSOLETE if (regnum >= 0)
-// OBSOLETE {
-// OBSOLETE default_print_registers_info (gdbarch, file, frame, regnum, all);
-// OBSOLETE return;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE {
-// OBSOLETE ULONGEST pc, psw, rpt_s, rpt_e, rpt_c;
-// OBSOLETE pc = get_frame_register_unsigned (frame, D10V_PC_REGNUM);
-// OBSOLETE psw = get_frame_register_unsigned (frame, PSW_REGNUM);
-// OBSOLETE rpt_s = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_s", -1));
-// OBSOLETE rpt_e = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_e", -1));
-// OBSOLETE rpt_c = get_frame_register_unsigned (frame, frame_map_name_to_regnum (frame, "rpt_c", -1));
-// OBSOLETE fprintf_filtered (file, "PC=%04lx (0x%lx) PSW=%04lx RPT_S=%04lx RPT_E=%04lx RPT_C=%04lx\n",
-// OBSOLETE (long) pc, (long) d10v_make_iaddr (pc), (long) psw,
-// OBSOLETE (long) rpt_s, (long) rpt_e, (long) rpt_c);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE {
-// OBSOLETE int group;
-// OBSOLETE for (group = 0; group < 16; group += 8)
-// OBSOLETE {
-// OBSOLETE int r;
-// OBSOLETE fprintf_filtered (file, "R%d-R%-2d", group, group + 7);
-// OBSOLETE for (r = group; r < group + 8; r++)
-// OBSOLETE {
-// OBSOLETE ULONGEST tmp;
-// OBSOLETE tmp = get_frame_register_unsigned (frame, r);
-// OBSOLETE fprintf_filtered (file, " %04lx", (long) tmp);
-// OBSOLETE }
-// OBSOLETE fprintf_filtered (file, "\n");
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Note: The IMAP/DMAP registers don't participate in function
-// OBSOLETE calls. Don't bother trying to unwind them. */
-// OBSOLETE
-// OBSOLETE {
-// OBSOLETE int a;
-// OBSOLETE for (a = 0; a < NR_IMAP_REGS; a++)
-// OBSOLETE {
-// OBSOLETE if (a > 0)
-// OBSOLETE fprintf_filtered (file, " ");
-// OBSOLETE fprintf_filtered (file, "IMAP%d %04lx", a,
-// OBSOLETE tdep->imap_register (current_regcache, a));
-// OBSOLETE }
-// OBSOLETE if (nr_dmap_regs (gdbarch) == 1)
-// OBSOLETE /* Registers DMAP0 and DMAP1 are constant. Just return dmap2. */
-// OBSOLETE fprintf_filtered (file, " DMAP %04lx\n",
-// OBSOLETE tdep->dmap_register (current_regcache, 2));
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE for (a = 0; a < nr_dmap_regs (gdbarch); a++)
-// OBSOLETE {
-// OBSOLETE fprintf_filtered (file, " DMAP%d %04lx", a,
-// OBSOLETE tdep->dmap_register (current_regcache, a));
-// OBSOLETE }
-// OBSOLETE fprintf_filtered (file, "\n");
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE {
-// OBSOLETE char num[MAX_REGISTER_SIZE];
-// OBSOLETE int a;
-// OBSOLETE fprintf_filtered (file, "A0-A%d", NR_A_REGS - 1);
-// OBSOLETE for (a = a0_regnum (gdbarch); a < a0_regnum (gdbarch) + NR_A_REGS; a++)
-// OBSOLETE {
-// OBSOLETE int i;
-// OBSOLETE fprintf_filtered (file, " ");
-// OBSOLETE get_frame_register (frame, a, num);
-// OBSOLETE for (i = 0; i < register_size (gdbarch, a); i++)
-// OBSOLETE {
-// OBSOLETE fprintf_filtered (file, "%02x", (num[i] & 0xff));
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE fprintf_filtered (file, "\n");
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE show_regs (char *args, int from_tty)
-// OBSOLETE {
-// OBSOLETE d10v_print_registers_info (current_gdbarch, gdb_stdout,
-// OBSOLETE get_current_frame (), -1, 1);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_read_pc (ptid_t ptid)
-// OBSOLETE {
-// OBSOLETE ptid_t save_ptid;
-// OBSOLETE CORE_ADDR pc;
-// OBSOLETE CORE_ADDR retval;
-// OBSOLETE
-// OBSOLETE save_ptid = inferior_ptid;
-// OBSOLETE inferior_ptid = ptid;
-// OBSOLETE pc = (int) read_register (D10V_PC_REGNUM);
-// OBSOLETE inferior_ptid = save_ptid;
-// OBSOLETE retval = d10v_make_iaddr (pc);
-// OBSOLETE return retval;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_write_pc (CORE_ADDR val, ptid_t ptid)
-// OBSOLETE {
-// OBSOLETE ptid_t save_ptid;
-// OBSOLETE
-// OBSOLETE save_ptid = inferior_ptid;
-// OBSOLETE inferior_ptid = ptid;
-// OBSOLETE write_register (D10V_PC_REGNUM, d10v_convert_iaddr_to_raw (val));
-// OBSOLETE inferior_ptid = save_ptid;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
-// OBSOLETE {
-// OBSOLETE ULONGEST sp;
-// OBSOLETE frame_unwind_unsigned_register (next_frame, D10V_SP_REGNUM, &sp);
-// OBSOLETE return d10v_make_daddr (sp);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* When arguments must be pushed onto the stack, they go on in reverse
-// OBSOLETE order. The below implements a FILO (stack) to do this. */
-// OBSOLETE
-// OBSOLETE struct stack_item
-// OBSOLETE {
-// OBSOLETE int len;
-// OBSOLETE struct stack_item *prev;
-// OBSOLETE void *data;
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE static struct stack_item *push_stack_item (struct stack_item *prev,
-// OBSOLETE void *contents, int len);
-// OBSOLETE static struct stack_item *
-// OBSOLETE push_stack_item (struct stack_item *prev, void *contents, int len)
-// OBSOLETE {
-// OBSOLETE struct stack_item *si;
-// OBSOLETE si = xmalloc (sizeof (struct stack_item));
-// OBSOLETE si->data = xmalloc (len);
-// OBSOLETE si->len = len;
-// OBSOLETE si->prev = prev;
-// OBSOLETE memcpy (si->data, contents, len);
-// OBSOLETE return si;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static struct stack_item *pop_stack_item (struct stack_item *si);
-// OBSOLETE static struct stack_item *
-// OBSOLETE pop_stack_item (struct stack_item *si)
-// OBSOLETE {
-// OBSOLETE struct stack_item *dead = si;
-// OBSOLETE si = si->prev;
-// OBSOLETE xfree (dead->data);
-// OBSOLETE xfree (dead);
-// OBSOLETE return si;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_push_dummy_code (struct gdbarch *gdbarch,
-// OBSOLETE CORE_ADDR sp, CORE_ADDR funaddr, int using_gcc,
-// OBSOLETE struct value **args, int nargs,
-// OBSOLETE struct type *value_type,
-// OBSOLETE CORE_ADDR *real_pc, CORE_ADDR *bp_addr)
-// OBSOLETE {
-// OBSOLETE /* Allocate space sufficient for a breakpoint. */
-// OBSOLETE sp = (sp - 4) & ~3;
-// OBSOLETE /* Store the address of that breakpoint taking care to first convert
-// OBSOLETE it into a code (IADDR) address from a stack (DADDR) address.
-// OBSOLETE This of course assumes that the two virtual addresses map onto
-// OBSOLETE the same real address. */
-// OBSOLETE (*bp_addr) = d10v_make_iaddr (d10v_convert_iaddr_to_raw (sp));
-// OBSOLETE /* d10v always starts the call at the callee's entry point. */
-// OBSOLETE (*real_pc) = funaddr;
-// OBSOLETE return sp;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
-// OBSOLETE struct regcache *regcache, CORE_ADDR bp_addr,
-// OBSOLETE int nargs, struct value **args, CORE_ADDR sp,
-// OBSOLETE int struct_return, CORE_ADDR struct_addr)
-// OBSOLETE {
-// OBSOLETE int i;
-// OBSOLETE int regnum = ARG1_REGNUM;
-// OBSOLETE struct stack_item *si = NULL;
-// OBSOLETE long val;
-// OBSOLETE
-// OBSOLETE /* Set the return address. For the d10v, the return breakpoint is
-// OBSOLETE always at BP_ADDR. */
-// OBSOLETE regcache_cooked_write_unsigned (regcache, LR_REGNUM,
-// OBSOLETE d10v_convert_iaddr_to_raw (bp_addr));
-// OBSOLETE
-// OBSOLETE /* If STRUCT_RETURN is true, then the struct return address (in
-// OBSOLETE STRUCT_ADDR) will consume the first argument-passing register.
-// OBSOLETE Both adjust the register count and store that value. */
-// OBSOLETE if (struct_return)
-// OBSOLETE {
-// OBSOLETE regcache_cooked_write_unsigned (regcache, regnum, struct_addr);
-// OBSOLETE regnum++;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Fill in registers and arg lists */
-// OBSOLETE for (i = 0; i < nargs; i++)
-// OBSOLETE {
-// OBSOLETE struct value *arg = args[i];
-// OBSOLETE struct type *type = check_typedef (VALUE_TYPE (arg));
-// OBSOLETE char *contents = VALUE_CONTENTS (arg);
-// OBSOLETE int len = TYPE_LENGTH (type);
-// OBSOLETE int aligned_regnum = (regnum + 1) & ~1;
-// OBSOLETE
-// OBSOLETE /* printf ("push: type=%d len=%d\n", TYPE_CODE (type), len); */
-// OBSOLETE if (len <= 2 && regnum <= ARGN_REGNUM)
-// OBSOLETE /* fits in a single register, do not align */
-// OBSOLETE {
-// OBSOLETE val = extract_unsigned_integer (contents, len);
-// OBSOLETE regcache_cooked_write_unsigned (regcache, regnum++, val);
-// OBSOLETE }
-// OBSOLETE else if (len <= (ARGN_REGNUM - aligned_regnum + 1) * 2)
-// OBSOLETE /* value fits in remaining registers, store keeping left
-// OBSOLETE aligned */
-// OBSOLETE {
-// OBSOLETE int b;
-// OBSOLETE regnum = aligned_regnum;
-// OBSOLETE for (b = 0; b < (len & ~1); b += 2)
-// OBSOLETE {
-// OBSOLETE val = extract_unsigned_integer (&contents[b], 2);
-// OBSOLETE regcache_cooked_write_unsigned (regcache, regnum++, val);
-// OBSOLETE }
-// OBSOLETE if (b < len)
-// OBSOLETE {
-// OBSOLETE val = extract_unsigned_integer (&contents[b], 1);
-// OBSOLETE regcache_cooked_write_unsigned (regcache, regnum++, (val << 8));
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE /* arg will go onto stack */
-// OBSOLETE regnum = ARGN_REGNUM + 1;
-// OBSOLETE si = push_stack_item (si, contents, len);
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE while (si)
-// OBSOLETE {
-// OBSOLETE sp = (sp - si->len) & ~1;
-// OBSOLETE write_memory (sp, si->data, si->len);
-// OBSOLETE si = pop_stack_item (si);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Finally, update the SP register. */
-// OBSOLETE regcache_cooked_write_unsigned (regcache, D10V_SP_REGNUM,
-// OBSOLETE d10v_convert_daddr_to_raw (sp));
-// OBSOLETE
-// OBSOLETE return sp;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Translate a GDB virtual ADDR/LEN into a format the remote target
-// OBSOLETE understands. Returns number of bytes that can be transfered
-// OBSOLETE starting at TARG_ADDR. Return ZERO if no bytes can be transfered
-// OBSOLETE (segmentation fault). Since the simulator knows all about how the
-// OBSOLETE VM system works, we just call that to do the translation. */
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE remote_d10v_translate_xfer_address (struct gdbarch *gdbarch,
-// OBSOLETE struct regcache *regcache,
-// OBSOLETE CORE_ADDR memaddr, int nr_bytes,
-// OBSOLETE CORE_ADDR *targ_addr, int *targ_len)
-// OBSOLETE {
-// OBSOLETE struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-// OBSOLETE long out_addr;
-// OBSOLETE long out_len;
-// OBSOLETE out_len = sim_d10v_translate_addr (memaddr, nr_bytes, &out_addr, regcache,
-// OBSOLETE tdep->dmap_register, tdep->imap_register);
-// OBSOLETE *targ_addr = out_addr;
-// OBSOLETE *targ_len = out_len;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE
-// OBSOLETE /* The following code implements access to, and display of, the D10V's
-// OBSOLETE instruction trace buffer. The buffer consists of 64K or more
-// OBSOLETE 4-byte words of data, of which each words includes an 8-bit count,
-// OBSOLETE an 8-bit segment number, and a 16-bit instruction address.
-// OBSOLETE
-// OBSOLETE In theory, the trace buffer is continuously capturing instruction
-// OBSOLETE data that the CPU presents on its "debug bus", but in practice, the
-// OBSOLETE ROMified GDB stub only enables tracing when it continues or steps
-// OBSOLETE the program, and stops tracing when the program stops; so it
-// OBSOLETE actually works for GDB to read the buffer counter out of memory and
-// OBSOLETE then read each trace word. The counter records where the tracing
-// OBSOLETE stops, but there is no record of where it started, so we remember
-// OBSOLETE the PC when we resumed and then search backwards in the trace
-// OBSOLETE buffer for a word that includes that address. This is not perfect,
-// OBSOLETE because you will miss trace data if the resumption PC is the target
-// OBSOLETE of a branch. (The value of the buffer counter is semi-random, any
-// OBSOLETE trace data from a previous program stop is gone.) */
-// OBSOLETE
-// OBSOLETE /* The address of the last word recorded in the trace buffer. */
-// OBSOLETE
-// OBSOLETE #define DBBC_ADDR (0xd80000)
-// OBSOLETE
-// OBSOLETE /* The base of the trace buffer, at least for the "Board_0". */
-// OBSOLETE
-// OBSOLETE #define TRACE_BUFFER_BASE (0xf40000)
-// OBSOLETE
-// OBSOLETE static void trace_command (char *, int);
-// OBSOLETE
-// OBSOLETE static void untrace_command (char *, int);
-// OBSOLETE
-// OBSOLETE static void trace_info (char *, int);
-// OBSOLETE
-// OBSOLETE static void tdisassemble_command (char *, int);
-// OBSOLETE
-// OBSOLETE static void display_trace (int, int);
-// OBSOLETE
-// OBSOLETE /* True when instruction traces are being collected. */
-// OBSOLETE
-// OBSOLETE static int tracing;
-// OBSOLETE
-// OBSOLETE /* Remembered PC. */
-// OBSOLETE
-// OBSOLETE static CORE_ADDR last_pc;
-// OBSOLETE
-// OBSOLETE /* True when trace output should be displayed whenever program stops. */
-// OBSOLETE
-// OBSOLETE static int trace_display;
-// OBSOLETE
-// OBSOLETE /* True when trace listing should include source lines. */
-// OBSOLETE
-// OBSOLETE static int default_trace_show_source = 1;
-// OBSOLETE
-// OBSOLETE struct trace_buffer
-// OBSOLETE {
-// OBSOLETE int size;
-// OBSOLETE short *counts;
-// OBSOLETE CORE_ADDR *addrs;
-// OBSOLETE }
-// OBSOLETE trace_data;
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE trace_command (char *args, int from_tty)
-// OBSOLETE {
-// OBSOLETE /* Clear the host-side trace buffer, allocating space if needed. */
-// OBSOLETE trace_data.size = 0;
-// OBSOLETE if (trace_data.counts == NULL)
-// OBSOLETE trace_data.counts = XCALLOC (65536, short);
-// OBSOLETE if (trace_data.addrs == NULL)
-// OBSOLETE trace_data.addrs = XCALLOC (65536, CORE_ADDR);
-// OBSOLETE
-// OBSOLETE tracing = 1;
-// OBSOLETE
-// OBSOLETE printf_filtered ("Tracing is now on.\n");
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE untrace_command (char *args, int from_tty)
-// OBSOLETE {
-// OBSOLETE tracing = 0;
-// OBSOLETE
-// OBSOLETE printf_filtered ("Tracing is now off.\n");
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE trace_info (char *args, int from_tty)
-// OBSOLETE {
-// OBSOLETE int i;
-// OBSOLETE
-// OBSOLETE if (trace_data.size)
-// OBSOLETE {
-// OBSOLETE printf_filtered ("%d entries in trace buffer:\n", trace_data.size);
-// OBSOLETE
-// OBSOLETE for (i = 0; i < trace_data.size; ++i)
-// OBSOLETE {
-// OBSOLETE printf_filtered ("%d: %d instruction%s at 0x%s\n",
-// OBSOLETE i,
-// OBSOLETE trace_data.counts[i],
-// OBSOLETE (trace_data.counts[i] == 1 ? "" : "s"),
-// OBSOLETE paddr_nz (trace_data.addrs[i]));
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE printf_filtered ("No entries in trace buffer.\n");
-// OBSOLETE
-// OBSOLETE printf_filtered ("Tracing is currently %s.\n", (tracing ? "on" : "off"));
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_eva_prepare_to_trace (void)
-// OBSOLETE {
-// OBSOLETE if (!tracing)
-// OBSOLETE return;
-// OBSOLETE
-// OBSOLETE last_pc = read_register (D10V_PC_REGNUM);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Collect trace data from the target board and format it into a form
-// OBSOLETE more useful for display. */
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_eva_get_trace_data (void)
-// OBSOLETE {
-// OBSOLETE int count, i, j, oldsize;
-// OBSOLETE int trace_addr, trace_seg, trace_cnt, next_cnt;
-// OBSOLETE unsigned int last_trace, trace_word, next_word;
-// OBSOLETE unsigned int *tmpspace;
-// OBSOLETE
-// OBSOLETE if (!tracing)
-// OBSOLETE return;
-// OBSOLETE
-// OBSOLETE tmpspace = xmalloc (65536 * sizeof (unsigned int));
-// OBSOLETE
-// OBSOLETE last_trace = read_memory_unsigned_integer (DBBC_ADDR, 2) << 2;
-// OBSOLETE
-// OBSOLETE /* Collect buffer contents from the target, stopping when we reach
-// OBSOLETE the word recorded when execution resumed. */
-// OBSOLETE
-// OBSOLETE count = 0;
-// OBSOLETE while (last_trace > 0)
-// OBSOLETE {
-// OBSOLETE QUIT;
-// OBSOLETE trace_word =
-// OBSOLETE read_memory_unsigned_integer (TRACE_BUFFER_BASE + last_trace, 4);
-// OBSOLETE trace_addr = trace_word & 0xffff;
-// OBSOLETE last_trace -= 4;
-// OBSOLETE /* Ignore an apparently nonsensical entry. */
-// OBSOLETE if (trace_addr == 0xffd5)
-// OBSOLETE continue;
-// OBSOLETE tmpspace[count++] = trace_word;
-// OBSOLETE if (trace_addr == last_pc)
-// OBSOLETE break;
-// OBSOLETE if (count > 65535)
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Move the data to the host-side trace buffer, adjusting counts to
-// OBSOLETE include the last instruction executed and transforming the address
-// OBSOLETE into something that GDB likes. */
-// OBSOLETE
-// OBSOLETE for (i = 0; i < count; ++i)
-// OBSOLETE {
-// OBSOLETE trace_word = tmpspace[i];
-// OBSOLETE next_word = ((i == 0) ? 0 : tmpspace[i - 1]);
-// OBSOLETE trace_addr = trace_word & 0xffff;
-// OBSOLETE next_cnt = (next_word >> 24) & 0xff;
-// OBSOLETE j = trace_data.size + count - i - 1;
-// OBSOLETE trace_data.addrs[j] = (trace_addr << 2) + 0x1000000;
-// OBSOLETE trace_data.counts[j] = next_cnt + 1;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE oldsize = trace_data.size;
-// OBSOLETE trace_data.size += count;
-// OBSOLETE
-// OBSOLETE xfree (tmpspace);
-// OBSOLETE
-// OBSOLETE if (trace_display)
-// OBSOLETE display_trace (oldsize, trace_data.size);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE tdisassemble_command (char *arg, int from_tty)
-// OBSOLETE {
-// OBSOLETE int i, count;
-// OBSOLETE CORE_ADDR low, high;
-// OBSOLETE
-// OBSOLETE if (!arg)
-// OBSOLETE {
-// OBSOLETE low = 0;
-// OBSOLETE high = trace_data.size;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE char *space_index = strchr (arg, ' ');
-// OBSOLETE if (space_index == NULL)
-// OBSOLETE {
-// OBSOLETE low = parse_and_eval_address (arg);
-// OBSOLETE high = low + 5;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE /* Two arguments. */
-// OBSOLETE *space_index = '\0';
-// OBSOLETE low = parse_and_eval_address (arg);
-// OBSOLETE high = parse_and_eval_address (space_index + 1);
-// OBSOLETE if (high < low)
-// OBSOLETE high = low;
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE printf_filtered ("Dump of trace from %s to %s:\n",
-// OBSOLETE paddr_u (low), paddr_u (high));
-// OBSOLETE
-// OBSOLETE display_trace (low, high);
-// OBSOLETE
-// OBSOLETE printf_filtered ("End of trace dump.\n");
-// OBSOLETE gdb_flush (gdb_stdout);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE display_trace (int low, int high)
-// OBSOLETE {
-// OBSOLETE int i, count, trace_show_source, first, suppress;
-// OBSOLETE CORE_ADDR next_address;
-// OBSOLETE
-// OBSOLETE trace_show_source = default_trace_show_source;
-// OBSOLETE if (!have_full_symbols () && !have_partial_symbols ())
-// OBSOLETE {
-// OBSOLETE trace_show_source = 0;
-// OBSOLETE printf_filtered ("No symbol table is loaded. Use the \"file\" command.\n");
-// OBSOLETE printf_filtered ("Trace will not display any source.\n");
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE first = 1;
-// OBSOLETE suppress = 0;
-// OBSOLETE for (i = low; i < high; ++i)
-// OBSOLETE {
-// OBSOLETE next_address = trace_data.addrs[i];
-// OBSOLETE count = trace_data.counts[i];
-// OBSOLETE while (count-- > 0)
-// OBSOLETE {
-// OBSOLETE QUIT;
-// OBSOLETE if (trace_show_source)
-// OBSOLETE {
-// OBSOLETE struct symtab_and_line sal, sal_prev;
-// OBSOLETE
-// OBSOLETE sal_prev = find_pc_line (next_address - 4, 0);
-// OBSOLETE sal = find_pc_line (next_address, 0);
-// OBSOLETE
-// OBSOLETE if (sal.symtab)
-// OBSOLETE {
-// OBSOLETE if (first || sal.line != sal_prev.line)
-// OBSOLETE print_source_lines (sal.symtab, sal.line, sal.line + 1, 0);
-// OBSOLETE suppress = 0;
-// OBSOLETE }
-// OBSOLETE else
-// OBSOLETE {
-// OBSOLETE if (!suppress)
-// OBSOLETE /* FIXME-32x64--assumes sal.pc fits in long. */
-// OBSOLETE printf_filtered ("No source file for address %s.\n",
-// OBSOLETE hex_string ((unsigned long) sal.pc));
-// OBSOLETE suppress = 1;
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE first = 0;
-// OBSOLETE print_address (next_address, gdb_stdout);
-// OBSOLETE printf_filtered (":");
-// OBSOLETE printf_filtered ("\t");
-// OBSOLETE wrap_here (" ");
-// OBSOLETE next_address += gdb_print_insn (next_address, gdb_stdout);
-// OBSOLETE printf_filtered ("\n");
-// OBSOLETE gdb_flush (gdb_stdout);
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
-// OBSOLETE {
-// OBSOLETE ULONGEST pc;
-// OBSOLETE frame_unwind_unsigned_register (next_frame, D10V_PC_REGNUM, &pc);
-// OBSOLETE return d10v_make_iaddr (pc);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE /* Given a GDB frame, determine the address of the calling function's
-// OBSOLETE frame. This will be used to create a new GDB frame struct. */
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_frame_this_id (struct frame_info *next_frame,
-// OBSOLETE void **this_prologue_cache,
-// OBSOLETE struct frame_id *this_id)
-// OBSOLETE {
-// OBSOLETE struct d10v_unwind_cache *info
-// OBSOLETE = d10v_frame_unwind_cache (next_frame, this_prologue_cache);
-// OBSOLETE CORE_ADDR base;
-// OBSOLETE CORE_ADDR func;
-// OBSOLETE struct frame_id id;
-// OBSOLETE
-// OBSOLETE /* The FUNC is easy. */
-// OBSOLETE func = frame_func_unwind (next_frame);
-// OBSOLETE
-// OBSOLETE /* Hopefully the prologue analysis either correctly determined the
-// OBSOLETE frame's base (which is the SP from the previous frame), or set
-// OBSOLETE that base to "NULL". */
-// OBSOLETE base = info->prev_sp;
-// OBSOLETE if (base == STACK_START || base == 0)
-// OBSOLETE return;
-// OBSOLETE
-// OBSOLETE id = frame_id_build (base, func);
-// OBSOLETE
-// OBSOLETE (*this_id) = id;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static void
-// OBSOLETE d10v_frame_prev_register (struct frame_info *next_frame,
-// OBSOLETE void **this_prologue_cache,
-// OBSOLETE int regnum, int *optimizedp,
-// OBSOLETE enum lval_type *lvalp, CORE_ADDR *addrp,
-// OBSOLETE int *realnump, void *bufferp)
-// OBSOLETE {
-// OBSOLETE struct d10v_unwind_cache *info
-// OBSOLETE = d10v_frame_unwind_cache (next_frame, this_prologue_cache);
-// OBSOLETE trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
-// OBSOLETE optimizedp, lvalp, addrp, realnump, bufferp);
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static const struct frame_unwind d10v_frame_unwind = {
-// OBSOLETE NORMAL_FRAME,
-// OBSOLETE d10v_frame_this_id,
-// OBSOLETE d10v_frame_prev_register
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE static const struct frame_unwind *
-// OBSOLETE d10v_frame_sniffer (struct frame_info *next_frame)
-// OBSOLETE {
-// OBSOLETE return &d10v_frame_unwind;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static CORE_ADDR
-// OBSOLETE d10v_frame_base_address (struct frame_info *next_frame, void **this_cache)
-// OBSOLETE {
-// OBSOLETE struct d10v_unwind_cache *info
-// OBSOLETE = d10v_frame_unwind_cache (next_frame, this_cache);
-// OBSOLETE return info->base;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static const struct frame_base d10v_frame_base = {
-// OBSOLETE &d10v_frame_unwind,
-// OBSOLETE d10v_frame_base_address,
-// OBSOLETE d10v_frame_base_address,
-// OBSOLETE d10v_frame_base_address
-// OBSOLETE };
-// OBSOLETE
-// OBSOLETE /* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
-// OBSOLETE dummy frame. The frame ID's base needs to match the TOS value
-// OBSOLETE saved by save_dummy_frame_tos(), and the PC match the dummy frame's
-// OBSOLETE breakpoint. */
-// OBSOLETE
-// OBSOLETE static struct frame_id
-// OBSOLETE d10v_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
-// OBSOLETE {
-// OBSOLETE return frame_id_build (d10v_unwind_sp (gdbarch, next_frame),
-// OBSOLETE frame_pc_unwind (next_frame));
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE static gdbarch_init_ftype d10v_gdbarch_init;
-// OBSOLETE
-// OBSOLETE static struct gdbarch *
-// OBSOLETE d10v_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
-// OBSOLETE {
-// OBSOLETE struct gdbarch *gdbarch;
-// OBSOLETE int d10v_num_regs;
-// OBSOLETE struct gdbarch_tdep *tdep;
-// OBSOLETE gdbarch_register_name_ftype *d10v_register_name;
-// OBSOLETE gdbarch_register_sim_regno_ftype *d10v_register_sim_regno;
-// OBSOLETE
-// OBSOLETE /* Find a candidate among the list of pre-declared architectures. */
-// OBSOLETE arches = gdbarch_list_lookup_by_info (arches, &info);
-// OBSOLETE if (arches != NULL)
-// OBSOLETE return arches->gdbarch;
-// OBSOLETE
-// OBSOLETE /* None found, create a new architecture from the information
-// OBSOLETE provided. */
-// OBSOLETE tdep = XMALLOC (struct gdbarch_tdep);
-// OBSOLETE gdbarch = gdbarch_alloc (&info, tdep);
-// OBSOLETE
-// OBSOLETE switch (info.bfd_arch_info->mach)
-// OBSOLETE {
-// OBSOLETE case bfd_mach_d10v_ts2:
-// OBSOLETE d10v_num_regs = 37;
-// OBSOLETE d10v_register_name = d10v_ts2_register_name;
-// OBSOLETE d10v_register_sim_regno = d10v_ts2_register_sim_regno;
-// OBSOLETE tdep->a0_regnum = TS2_A0_REGNUM;
-// OBSOLETE tdep->nr_dmap_regs = TS2_NR_DMAP_REGS;
-// OBSOLETE tdep->dmap_register = d10v_ts2_dmap_register;
-// OBSOLETE tdep->imap_register = d10v_ts2_imap_register;
-// OBSOLETE break;
-// OBSOLETE default:
-// OBSOLETE case bfd_mach_d10v_ts3:
-// OBSOLETE d10v_num_regs = 42;
-// OBSOLETE d10v_register_name = d10v_ts3_register_name;
-// OBSOLETE d10v_register_sim_regno = d10v_ts3_register_sim_regno;
-// OBSOLETE tdep->a0_regnum = TS3_A0_REGNUM;
-// OBSOLETE tdep->nr_dmap_regs = TS3_NR_DMAP_REGS;
-// OBSOLETE tdep->dmap_register = d10v_ts3_dmap_register;
-// OBSOLETE tdep->imap_register = d10v_ts3_imap_register;
-// OBSOLETE break;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE set_gdbarch_read_pc (gdbarch, d10v_read_pc);
-// OBSOLETE set_gdbarch_write_pc (gdbarch, d10v_write_pc);
-// OBSOLETE set_gdbarch_unwind_sp (gdbarch, d10v_unwind_sp);
-// OBSOLETE
-// OBSOLETE set_gdbarch_num_regs (gdbarch, d10v_num_regs);
-// OBSOLETE set_gdbarch_sp_regnum (gdbarch, D10V_SP_REGNUM);
-// OBSOLETE set_gdbarch_register_name (gdbarch, d10v_register_name);
-// OBSOLETE set_gdbarch_register_type (gdbarch, d10v_register_type);
-// OBSOLETE
-// OBSOLETE set_gdbarch_ptr_bit (gdbarch, 2 * TARGET_CHAR_BIT);
-// OBSOLETE set_gdbarch_addr_bit (gdbarch, 32);
-// OBSOLETE set_gdbarch_address_to_pointer (gdbarch, d10v_address_to_pointer);
-// OBSOLETE set_gdbarch_pointer_to_address (gdbarch, d10v_pointer_to_address);
-// OBSOLETE set_gdbarch_integer_to_address (gdbarch, d10v_integer_to_address);
-// OBSOLETE set_gdbarch_short_bit (gdbarch, 2 * TARGET_CHAR_BIT);
-// OBSOLETE set_gdbarch_int_bit (gdbarch, 2 * TARGET_CHAR_BIT);
-// OBSOLETE set_gdbarch_long_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-// OBSOLETE set_gdbarch_long_long_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-// OBSOLETE /* NOTE: The d10v as a 32 bit ``float'' and ``double''. ``long
-// OBSOLETE double'' is 64 bits. */
-// OBSOLETE set_gdbarch_float_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-// OBSOLETE set_gdbarch_double_bit (gdbarch, 4 * TARGET_CHAR_BIT);
-// OBSOLETE set_gdbarch_long_double_bit (gdbarch, 8 * TARGET_CHAR_BIT);
-// OBSOLETE switch (info.byte_order)
-// OBSOLETE {
-// OBSOLETE case BFD_ENDIAN_BIG:
-// OBSOLETE set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_big);
-// OBSOLETE set_gdbarch_double_format (gdbarch, &floatformat_ieee_single_big);
-// OBSOLETE set_gdbarch_long_double_format (gdbarch, &floatformat_ieee_double_big);
-// OBSOLETE break;
-// OBSOLETE case BFD_ENDIAN_LITTLE:
-// OBSOLETE set_gdbarch_float_format (gdbarch, &floatformat_ieee_single_little);
-// OBSOLETE set_gdbarch_double_format (gdbarch, &floatformat_ieee_single_little);
-// OBSOLETE set_gdbarch_long_double_format (gdbarch,
-// OBSOLETE &floatformat_ieee_double_little);
-// OBSOLETE break;
-// OBSOLETE default:
-// OBSOLETE internal_error (__FILE__, __LINE__,
-// OBSOLETE "d10v_gdbarch_init: bad byte order for float format");
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE set_gdbarch_return_value (gdbarch, d10v_return_value);
-// OBSOLETE set_gdbarch_push_dummy_code (gdbarch, d10v_push_dummy_code);
-// OBSOLETE set_gdbarch_push_dummy_call (gdbarch, d10v_push_dummy_call);
-// OBSOLETE
-// OBSOLETE set_gdbarch_skip_prologue (gdbarch, d10v_skip_prologue);
-// OBSOLETE set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
-// OBSOLETE set_gdbarch_decr_pc_after_break (gdbarch, 4);
-// OBSOLETE set_gdbarch_breakpoint_from_pc (gdbarch, d10v_breakpoint_from_pc);
-// OBSOLETE
-// OBSOLETE set_gdbarch_remote_translate_xfer_address (gdbarch,
-// OBSOLETE remote_d10v_translate_xfer_address);
-// OBSOLETE
-// OBSOLETE set_gdbarch_frame_align (gdbarch, d10v_frame_align);
-// OBSOLETE
-// OBSOLETE set_gdbarch_register_sim_regno (gdbarch, d10v_register_sim_regno);
-// OBSOLETE
-// OBSOLETE set_gdbarch_print_registers_info (gdbarch, d10v_print_registers_info);
-// OBSOLETE
-// OBSOLETE frame_unwind_append_sniffer (gdbarch, d10v_frame_sniffer);
-// OBSOLETE frame_base_set_default (gdbarch, &d10v_frame_base);
-// OBSOLETE
-// OBSOLETE /* Methods for saving / extracting a dummy frame's ID. The ID's
-// OBSOLETE stack address must match the SP value returned by
-// OBSOLETE PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
-// OBSOLETE set_gdbarch_unwind_dummy_id (gdbarch, d10v_unwind_dummy_id);
-// OBSOLETE
-// OBSOLETE /* Return the unwound PC value. */
-// OBSOLETE set_gdbarch_unwind_pc (gdbarch, d10v_unwind_pc);
-// OBSOLETE
-// OBSOLETE set_gdbarch_print_insn (gdbarch, print_insn_d10v);
-// OBSOLETE
-// OBSOLETE return gdbarch;
-// OBSOLETE }
-// OBSOLETE
-// OBSOLETE void
-// OBSOLETE _initialize_d10v_tdep (void)
-// OBSOLETE {
-// OBSOLETE register_gdbarch_init (bfd_arch_d10v, d10v_gdbarch_init);
-// OBSOLETE
-// OBSOLETE deprecated_target_resume_hook = d10v_eva_prepare_to_trace;
-// OBSOLETE deprecated_target_wait_loop_hook = d10v_eva_get_trace_data;
-// OBSOLETE
-// OBSOLETE deprecate_cmd (add_com ("regs", class_vars, show_regs,
-// OBSOLETE "Print all registers"),
-// OBSOLETE "info registers");
-// OBSOLETE
-// OBSOLETE add_com ("itrace", class_support, trace_command,
-// OBSOLETE "Enable tracing of instruction execution.");
-// OBSOLETE
-// OBSOLETE add_com ("iuntrace", class_support, untrace_command,
-// OBSOLETE "Disable tracing of instruction execution.");
-// OBSOLETE
-// OBSOLETE add_com ("itdisassemble", class_vars, tdisassemble_command,
-// OBSOLETE "Disassemble the trace buffer.\n\
-// OBSOLETE Two optional arguments specify a range of trace buffer entries\n\
-// OBSOLETE as reported by info trace (NOT addresses!).");
-// OBSOLETE
-// OBSOLETE add_info ("itrace", trace_info,
-// OBSOLETE "Display info about the trace data buffer.");
-// OBSOLETE
-// OBSOLETE add_setshow_boolean_cmd ("itracedisplay", no_class, &trace_display, "\
-// OBSOLETE Set automatic display of trace.", "\
-// OBSOLETE Show automatic display of trace.", "\
-// OBSOLETE Controls the display of d10v specific instruction trace information.", "\
-// OBSOLETE Automatic display of trace is %s.",
-// OBSOLETE NULL, NULL, &setlist, &showlist);
-// OBSOLETE add_setshow_boolean_cmd ("itracesource", no_class,
-// OBSOLETE &default_trace_show_source, "\
-// OBSOLETE Set display of source code with trace.", "\
-// OBSOLETE Show display of source code with trace.", "\
-// OBSOLETE When on source code is included in the d10v instruction trace display.", "\
-// OBSOLETE Display of source code with trace is %s.",
-// OBSOLETE NULL, NULL, &setlist, &showlist);
-// OBSOLETE }
diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog
index 9242433..be2b2d5 100644
--- a/gdb/doc/ChangeLog
+++ b/gdb/doc/ChangeLog
@@ -1,5 +1,11 @@
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+ * gdb.texinfo (M68K): Remove obsolete ROM monitors.
+ * gdbint.texinfo (DWARF 1): Delete section and other dwarfread.c
+ references.
+
+2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+
* gdb.texinfo (Startup): Delete references to some alternate
names for .gdbinit.
(Thread): Remove LynxOS reference.
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 0eee55e..cc4c5a0 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14743,39 +14743,15 @@ Instructs the remote to set breakpoints by DBT.
@node M68K
@subsection M68k
-The Motorola m68k configuration includes ColdFire support, and
-target command for the following ROM monitors.
+The Motorola m68k configuration includes ColdFire support, and a
+target command for the following ROM monitor.
@table @code
-@kindex target abug
-@item target abug @var{dev}
-ABug ROM monitor for M68K.
-
-@kindex target cpu32bug
-@item target cpu32bug @var{dev}
-CPU32BUG monitor, running on a CPU32 (M68K) board.
-
@kindex target dbug
@item target dbug @var{dev}
dBUG ROM monitor for Motorola ColdFire.
-@kindex target est
-@item target est @var{dev}
-EST-300 ICE monitor, running on a CPU32 (M68K) board.
-
-@kindex target rom68k
-@item target rom68k @var{dev}
-ROM 68K monitor, running on an M68K IDP board.
-
-@end table
-
-@table @code
-
-@kindex target rombug
-@item target rombug @var{dev}
-ROMBUG ROM monitor for OS/9000.
-
@end table
@node MIPS Embedded
diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo
index 97fca00..e6a2b70 100644
--- a/gdb/doc/gdbint.texinfo
+++ b/gdb/doc/gdbint.texinfo
@@ -219,7 +219,7 @@ have to include all three kinds of information.
The @value{GDBN} source directory has a mostly flat structure---there
are only a few subdirectories. A file's name usually gives a hint as
to what it does; for example, @file{stabsread.c} reads stabs,
-@file{dwarfread.c} reads DWARF, etc.
+@file{dwarf2read.c} reads @sc{DWARF 2}, etc.
Files that are related to some common task have names that share
common substrings. For example, @file{*-thread.c} files deal with
@@ -2143,20 +2143,6 @@ ECOFF includes a definition of a special debug format.
The file @file{mdebugread.c} implements reading for this format.
-@subsection DWARF 1
-
-@cindex DWARF 1 debugging info
-DWARF 1 is a debugging format that was originally designed to be
-used with ELF in SVR4 systems.
-
-@c GCC_PRODUCER
-@c GPLUS_PRODUCER
-@c LCC_PRODUCER
-@c If defined, these are the producer strings in a DWARF 1 file. All of
-@c these have reasonable defaults already.
-
-The DWARF 1 reader is in @file{dwarfread.c}.
-
@subsection DWARF 2
@cindex DWARF 2 debugging info
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 4d62926..0fb3500 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -8,7 +8,7 @@
with the Ada Joint Program Office), and Silicon Graphics, Inc.
Initial contribution by Brent Benson, Harris Computer Systems, Inc.,
based on Fred Fish's (Cygnus Support) implementation of DWARF 1
- support in dwarfread.c
+ support.
This file is part of GDB.
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
deleted file mode 100644
index b7000e5..0000000
--- a/gdb/dwarfread.c
+++ /dev/null
@@ -1,3820 +0,0 @@
-/* DWARF debugging format support for GDB.
-
- Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
- 2001, 2002, 2003, 2004, 2007 Free Software Foundation, Inc.
-
- Written by Fred Fish at Cygnus Support. Portions based on dbxread.c,
- 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
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-/*
- If you are looking for DWARF-2 support, you are in the wrong file.
- Go look in dwarf2read.c. This file is for the original DWARF,
- also known as DWARF-1.
-
- DWARF-1 is slowly headed for obsoletion.
-
- In gcc 3.4.0, support for dwarf-1 has been removed.
-
- In gcc 3.3.2, these targets prefer dwarf-1:
-
- i[34567]86-sequent-ptx4*
- i[34567]86-sequent-sysv4*
- mips-sni-sysv4
- sparc-hal-solaris2*
-
- In gcc 3.2.2, these targets prefer dwarf-1:
-
- i[34567]86-dg-dgux*
- i[34567]86-sequent-ptx4*
- i[34567]86-sequent-sysv4*
- m88k-dg-dgux*
- mips-sni-sysv4
- sparc-hal-solaris2*
-
- In gcc 2.95.3, these targets prefer dwarf-1:
-
- i[34567]86-dg-dgux*
- i[34567]86-ncr-sysv4*
- i[34567]86-sequent-ptx4*
- i[34567]86-sequent-sysv4*
- i[34567]86-*-osf1*
- i[34567]86-*-sco3.2v5*
- i[34567]86-*-sysv4*
- i860-alliant-*
- i860-*-sysv4*
- m68k-atari-sysv4*
- m68k-cbm-sysv4*
- m68k-*-sysv4*
- m88k-dg-dgux*
- m88k-*-sysv4*
- mips-sni-sysv4
- mips-*-gnu*
- sh-*-elf*
- sh-*-rtemself*
- sparc-hal-solaris2*
- sparc-*-sysv4*
-
- Some non-gcc compilers produce dwarf-1:
-
- PR gdb/1179 was from a user with Diab C++ 4.3.
- On 2003-07-25 the gdb list received a report from a user
- with Diab Compiler 4.4b.
- Other users have also reported using Diab compilers with dwarf-1.
-
- Diab Compiler Suite 5.0.1 supports dwarf-2/dwarf-3 for C and C++.
- (Diab(tm) Compiler Suite 5.0.1 Release Notes, DOC-14691-ZD-00,
- Wind River Systems, 2002-07-31).
-
- On 2003-06-09 the gdb list received a report from a user
- with Absoft ProFortran f77 which is dwarf-1.
-
- Absoft ProFortran Linux[sic] Fortran User Guide (no version,
- but copyright dates are 1991-2001) says that Absoft ProFortran
- supports -gdwarf1 and -gdwarf2.
-
- -- chastain 2004-04-24
-*/
-
-/*
-
- FIXME: Do we need to generate dependencies in partial symtabs?
- (Perhaps we don't need to).
-
- 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. :-)
-
- */
-
-#include "defs.h"
-#include "symtab.h"
-#include "gdbtypes.h"
-#include "objfiles.h"
-#include "elf/dwarf.h"
-#include "buildsym.h"
-#include "demangle.h"
-#include "expression.h" /* Needed for enum exp_opcode in language.h, sigh... */
-#include "language.h"
-#include "complaints.h"
-
-#include <fcntl.h>
-#include "gdb_string.h"
-
-/* 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. */
-
-static void
-bad_die_ref_complaint (int arg1, const char *arg2, int arg3)
-{
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", reference to DIE (0x%x) outside compilation unit"),
- arg1, arg2, arg3);
-}
-
-static void
-unknown_attribute_form_complaint (int arg1, const char *arg2, int arg3)
-{
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", unknown attribute form (0x%x)"), arg1, arg2,
- arg3);
-}
-
-static void
-dup_user_type_definition_complaint (int arg1, const char *arg2)
-{
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", internal error: duplicate user type definition"),
- arg1, arg2);
-}
-
-static void
-bad_array_element_type_complaint (int arg1, const char *arg2, int arg3)
-{
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", bad array element type attribute 0x%x"), arg1,
- arg2, arg3);
-}
-
-typedef unsigned int DIE_REF; /* Reference to a DIE */
-
-#ifndef GCC_PRODUCER
-#define GCC_PRODUCER "GNU C "
-#endif
-
-#ifndef GPLUS_PRODUCER
-#define GPLUS_PRODUCER "GNU C++ "
-#endif
-
-#ifndef LCC_PRODUCER
-#define LCC_PRODUCER "NCR C/C++"
-#endif
-
-/* 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.
-
- 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)
-
-/* 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)
-
-/* 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
- of the current DIE, which are specifically unordered within the DIE,
- 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,
- such as AT_low_pc, without restricting the values of the field,
- we need someway to note that we found such an attribute.
-
- */
-
-typedef char BLOCK;
-
-struct dieinfo
- {
- 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;
- CORE_ADDR at_low_pc;
- CORE_ADDR at_high_pc;
- 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;
- unsigned int has_at_byte_size:1;
- unsigned int short_element_list:1;
-
- /* Kludge to identify register variables */
-
- unsigned int isreg;
-
- /* Kludge to identify optimized out variables */
-
- unsigned int optimized_out;
-
- /* Kludge to identify basereg references.
- Nonzero if we have an offset relative to a basereg. */
-
- unsigned int offreg;
-
- /* Kludge to identify which base register is it relative to. */
-
- unsigned int basereg;
- };
-
-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 */
-static int dbsize; /* Size of dwarf info in bytes */
-static int dbroff; /* Relative offset from start of .debug section */
-static char *lnbase; /* Base pointer to line section */
-
-/* This value is added to each symbol value. FIXME: Generalize to
- the section_offsets structure used by dbxread (once this is done,
- pass the appropriate section number to end_symtab). */
-static CORE_ADDR baseaddr; /* Add to each symbol value */
-
-/* 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;
-
-/* We put a pointer to this structure in the read_symtab_private field
- of the psymtab. */
-
-struct dwfinfo
- {
- /* 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;
- };
-
-#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)
-
-/* 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.
-
- 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 */
-
-struct pending **list_in_scope = &file_symbols;
-
-/* 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
- 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. */
-
-static struct type **utypes; /* Pointer to array of user type pointers */
-static int numutypes; /* Max number of user type pointers */
-
-/* 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 */
-
-/* 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
- 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. */
-
-static enum language cu_language;
-static const struct language_defn *cu_language_defn;
-
-/* Forward declarations of static functions so we don't have to worry
- about ordering within this file. */
-
-static void free_utypes (void *);
-
-static int attribute_size (unsigned int);
-
-static CORE_ADDR target_to_host (char *, int, int, struct objfile *);
-
-static void add_enum_psymbol (struct dieinfo *, struct objfile *);
-
-static void handle_producer (char *);
-
-static void read_file_scope (struct dieinfo *, char *, char *,
- struct objfile *);
-
-static void read_func_scope (struct dieinfo *, char *, char *,
- struct objfile *);
-
-static void read_lexical_block_scope (struct dieinfo *, char *, char *,
- struct objfile *);
-
-static void scan_partial_symbols (char *, char *, struct objfile *);
-
-static void scan_compilation_units (char *, char *, file_ptr, file_ptr,
- struct objfile *);
-
-static void add_partial_symbol (struct dieinfo *, struct objfile *);
-
-static void basicdieinfo (struct dieinfo *, char *, struct objfile *);
-
-static void completedieinfo (struct dieinfo *, struct objfile *);
-
-static void dwarf_psymtab_to_symtab (struct partial_symtab *);
-
-static void psymtab_to_symtab_1 (struct partial_symtab *);
-
-static void read_ofile_symtab (struct partial_symtab *);
-
-static void process_dies (char *, char *, struct objfile *);
-
-static void read_structure_scope (struct dieinfo *, char *, char *,
- struct objfile *);
-
-static struct type *decode_array_element_type (char *);
-
-static struct type *decode_subscript_data_item (char *, char *);
-
-static void dwarf_read_array_type (struct dieinfo *);
-
-static void read_tag_pointer_type (struct dieinfo *dip);
-
-static void read_tag_string_type (struct dieinfo *dip);
-
-static void read_subroutine_type (struct dieinfo *, char *, char *);
-
-static void read_enumeration (struct dieinfo *, char *, char *,
- struct objfile *);
-
-static struct type *struct_type (struct dieinfo *, char *, char *,
- struct objfile *);
-
-static struct type *enum_type (struct dieinfo *, struct objfile *);
-
-static void decode_line_numbers (char *);
-
-static struct type *decode_die_type (struct dieinfo *);
-
-static struct type *decode_mod_fund_type (char *);
-
-static struct type *decode_mod_u_d_type (char *);
-
-static struct type *decode_modified_type (char *, unsigned int, int);
-
-static struct type *decode_fund_type (unsigned int);
-
-static char *create_name (char *, struct obstack *);
-
-static struct type *lookup_utype (DIE_REF);
-
-static struct type *alloc_utype (DIE_REF, struct type *);
-
-static struct symbol *new_symbol (struct dieinfo *, struct objfile *);
-
-static void synthesize_typedef (struct dieinfo *, struct objfile *,
- struct type *);
-
-static int locval (struct dieinfo *);
-
-static void set_cu_language (struct dieinfo *);
-
-static struct type *dwarf_fundamental_type (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 (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]);
-}
-
-/*
-
- 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 (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;
- case LANG_MODULA2:
- cu_language = language_m2;
- break;
- case LANG_FORTRAN77:
- case LANG_FORTRAN90:
- cu_language = language_fortran;
- break;
- case LANG_PASCAL83:
- cu_language = language_pascal;
- break;
- case LANG_ADA83:
- case LANG_COBOL74:
- case LANG_COBOL85:
- /* We don't know anything special about these yet. */
- cu_language = language_unknown;
- break;
- default:
- /* If no at_language, try to deduce one from the filename */
- cu_language = deduce_language_from_filename (dip->at_name);
- break;
- }
- cu_language_defn = language_def (cu_language);
-}
-
-/*
-
- GLOBAL FUNCTION
-
- dwarf_build_psymtabs -- build partial symtabs from DWARF debug info
-
- SYNOPSIS
-
- void dwarf_build_psymtabs (struct objfile *objfile,
- int mainline, file_ptr dbfoff, unsigned int dbfsize,
- file_ptr lnoffset, unsigned int lnsize)
-
- DESCRIPTION
-
- This function is called upon to build partial symtabs from files
- containing DIE's (Dwarf Information Entries) and DWARF line numbers.
-
- It is passed a bfd* containing the DIES
- 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
-dwarf_build_psymtabs (struct objfile *objfile, int mainline, file_ptr dbfoff,
- unsigned int dbfsize, file_ptr lnoffset,
- unsigned int lnsize)
-{
- bfd *abfd = objfile->obfd;
- struct cleanup *back_to;
-
- current_objfile = objfile;
- dbsize = dbfsize;
- dbbase = xmalloc (dbsize);
- dbroff = 0;
- if ((bfd_seek (abfd, dbfoff, SEEK_SET) != 0) ||
- (bfd_bread (dbbase, dbsize, abfd) != dbsize))
- {
- xfree (dbbase);
- error (_("can't read DWARF data from '%s'"), bfd_get_filename (abfd));
- }
- back_to = make_cleanup (xfree, 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. */
-
- if (mainline
- || (objfile->global_psymbols.size == 0
- && objfile->static_psymbols.size == 0))
- {
- init_psymbol_list (objfile, 1024);
- }
-
- /* Save the relocation factor where everybody can see it. */
-
- base_section_offsets = objfile->section_offsets;
- baseaddr = ANOFFSET (objfile->section_offsets, 0);
-
- /* 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. */
-
- scan_compilation_units (dbbase, dbbase + dbsize, dbfoff, lnoffset, objfile);
-
- do_cleanups (back_to);
- current_objfile = NULL;
-}
-
-/*
-
- 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
-read_lexical_block_scope (struct dieinfo *dip, char *thisdie, char *enddie,
- struct objfile *objfile)
-{
- struct context_stack *new;
-
- push_context (0, dip->at_low_pc);
- process_dies (thisdie + dip->die_length, enddie, objfile);
- new = pop_context ();
- if (local_symbols != NULL)
- {
- finish_block (0, &local_symbols, new->old_blocks, new->start_addr,
- dip->at_high_pc, objfile);
- }
- local_symbols = new->locals;
-}
-
-/*
-
- LOCAL FUNCTION
-
- lookup_utype -- look up a user defined type from die reference
-
- SYNOPSIS
-
- static type *lookup_utype (DIE_REF die_ref)
-
- 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 *
-lookup_utype (DIE_REF die_ref)
-{
- struct type *type = NULL;
- int utypeidx;
-
- utypeidx = (die_ref - dbroff) / 4;
- if ((utypeidx < 0) || (utypeidx >= numutypes))
- {
- bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref);
- }
- else
- {
- type = *(utypes + utypeidx);
- }
- return (type);
-}
-
-
-/*
-
- LOCAL FUNCTION
-
- alloc_utype -- add a user defined type for die reference
-
- SYNOPSIS
-
- static type *alloc_utype (DIE_REF die_ref, struct type *utypep)
-
- DESCRIPTION
-
- Given a die reference DIE_REF, and a possible pointer to a user
- 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
- there is not currently a type registered for DIE_REF.
- */
-
-static struct type *
-alloc_utype (DIE_REF die_ref, struct type *utypep)
-{
- struct type **typep;
- int utypeidx;
-
- utypeidx = (die_ref - dbroff) / 4;
- typep = utypes + utypeidx;
- if ((utypeidx < 0) || (utypeidx >= numutypes))
- {
- utypep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- bad_die_ref_complaint (DIE_ID, DIE_NAME, die_ref);
- }
- else if (*typep != NULL)
- {
- utypep = *typep;
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", internal error: duplicate user type allocation"),
- DIE_ID, DIE_NAME);
- }
- else
- {
- if (utypep == NULL)
- {
- utypep = alloc_type (current_objfile);
- }
- *typep = utypep;
- }
- return (utypep);
-}
-
-/*
-
- LOCAL FUNCTION
-
- free_utypes -- free the utypes array and reset pointer & count
-
- SYNOPSIS
-
- static void free_utypes (void *dummy)
-
- DESCRIPTION
-
- Called via do_cleanups to free the utypes array, reset the pointer to NULL,
- and set numutypes back to zero. This ensures that the utypes does not get
- referenced after being freed.
- */
-
-static void
-free_utypes (void *dummy)
-{
- xfree (utypes);
- utypes = NULL;
- numutypes = 0;
-}
-
-
-/*
-
- 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 *
-decode_die_type (struct dieinfo *dip)
-{
- 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)
- {
- type = lookup_utype (dip->at_user_def_type);
- if (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
- {
- type = dwarf_fundamental_type (current_objfile, FT_VOID);
- }
- 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,
- char *enddie, struct objfile *objfile)
-
- DESCRIPTION
-
- Given pointer to a die information structure for a die which
- 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.
- */
-
-static struct type *
-struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
- struct objfile *objfile)
-{
- 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;
- char *nextdie;
- int anonymous_size;
-
- type = lookup_utype (dip->die_ref);
- if (type == NULL)
- {
- /* No forward references created an empty type, so install one now */
- type = alloc_utype (dip->die_ref, NULL);
- }
- INIT_CPLUS_SPECIFIC (type);
- switch (dip->die_tag)
- {
- case TAG_class_type:
- TYPE_CODE (type) = TYPE_CODE_CLASS;
- break;
- case TAG_structure_type:
- TYPE_CODE (type) = TYPE_CODE_STRUCT;
- break;
- case TAG_union_type:
- TYPE_CODE (type) = TYPE_CODE_UNION;
- break;
- default:
- /* Should never happen */
- TYPE_CODE (type) = TYPE_CODE_UNDEF;
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", missing class, structure, or union tag"),
- DIE_ID, DIE_NAME);
- break;
- }
- /* Some compilers try to be helpful by inventing "fake" names for
- anonymous enums, structures, and unions, like "~0fake" or ".0fake".
- Thanks, but no thanks... */
- if (dip->at_name != NULL
- && *dip->at_name != '~'
- && *dip->at_name != '.')
- {
- TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack,
- "", "", dip->at_name);
- }
- /* 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;
- thisdie += dip->die_length;
- while (thisdie < enddie)
- {
- basicdieinfo (&mbr, thisdie, objfile);
- completedieinfo (&mbr, objfile);
- if (mbr.die_length <= SIZEOF_DIE_LENGTH)
- {
- break;
- }
- else if (mbr.at_sibling != 0)
- {
- nextdie = dbbase + mbr.at_sibling - dbroff;
- }
- else
- {
- nextdie = thisdie + mbr.die_length;
- }
- switch (mbr.die_tag)
- {
- case TAG_member:
- /* Static fields can be either TAG_global_variable (GCC) or else
- TAG_member with no location (Diab). We could treat the latter like
- the former... but since we don't support the former, just avoid
- crashing on the latter for now. */
- if (mbr.at_location == NULL)
- break;
-
- /* Get space to record the next field's data. */
- new = (struct nextfield *) alloca (sizeof (struct nextfield));
- new->next = list;
- list = new;
- /* Save the data. */
- list->field.name =
- obsavestring (mbr.at_name, strlen (mbr.at_name),
- &objfile->objfile_obstack);
- FIELD_TYPE (list->field) = decode_die_type (&mbr);
- FIELD_BITPOS (list->field) = 8 * locval (&mbr);
- FIELD_STATIC_KIND (list->field) = 0;
- /* Handle bit fields. */
- FIELD_BITSIZE (list->field) = mbr.at_bit_size;
- if (BITS_BIG_ENDIAN)
- {
- /* 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. */
- FIELD_BITPOS (list->field) += 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)
- {
- 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);
- }
- FIELD_BITPOS (list->field) +=
- anonymous_size * 8 - mbr.at_bit_offset - mbr.at_bit_size;
- }
- }
- nfields++;
- break;
- default:
- process_dies (thisdie, nextdie, objfile);
- break;
- }
- thisdie = nextdie;
- }
- /* 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)
- {
- TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
- }
- else
- {
- TYPE_NFIELDS (type) = nfields;
- TYPE_FIELDS (type) = (struct field *)
- TYPE_ALLOC (type, sizeof (struct field) * nfields);
- /* Copy the saved-up fields into the field vector. */
- for (n = nfields; list; list = list->next)
- {
- TYPE_FIELD (type, --n) = list->field;
- }
- }
- return (type);
-}
-
-/*
-
- LOCAL FUNCTION
-
- read_structure_scope -- process all dies within struct or union
-
- SYNOPSIS
-
- static void read_structure_scope (struct dieinfo *dip,
- char *thisdie, char *enddie, struct objfile *objfile)
-
- 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
- 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).
-
- */
-
-static void
-read_structure_scope (struct dieinfo *dip, char *thisdie, char *enddie,
- struct objfile *objfile)
-{
- struct type *type;
- struct symbol *sym;
-
- type = struct_type (dip, thisdie, enddie, objfile);
- if (!TYPE_STUB (type))
- {
- sym = new_symbol (dip, objfile);
- if (sym != NULL)
- {
- SYMBOL_TYPE (sym) = type;
- if (cu_language == language_cplus)
- {
- synthesize_typedef (dip, objfile, type);
- }
- }
- }
-}
-
-/*
-
- 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 *
-decode_array_element_type (char *scan)
-{
- struct type *typep;
- DIE_REF die_ref;
- unsigned short attribute;
- unsigned short fundtype;
- int nbytes;
-
- attribute = target_to_host (scan, SIZEOF_ATTRIBUTE, GET_UNSIGNED,
- current_objfile);
- scan += SIZEOF_ATTRIBUTE;
- nbytes = attribute_size (attribute);
- if (nbytes == -1)
- {
- bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
- typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- }
- 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);
- typep = lookup_utype (die_ref);
- if (typep == NULL)
- {
- typep = alloc_utype (die_ref, NULL);
- }
- break;
- case AT_mod_u_d_type:
- typep = decode_mod_u_d_type (scan);
- break;
- default:
- bad_array_element_type_complaint (DIE_ID, DIE_NAME, attribute);
- typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- break;
- }
- }
- return (typep);
-}
-
-/*
-
- LOCAL FUNCTION
-
- decode_subscript_data_item -- decode array subscript item
-
- SYNOPSIS
-
- static struct type *
- decode_subscript_data_item (char *scan, char *end)
-
- 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).
-
- 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.
-
- We are passed a pointer to the start of the block of bytes
- 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".
-
- 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 *
-decode_subscript_data_item (char *scan, char *end)
-{
- 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 */
- struct type *rangetype;
- unsigned int format;
- unsigned short fundtype;
- unsigned long lowbound;
- unsigned long highbound;
- int nbytes;
-
- format = target_to_host (scan, SIZEOF_FORMAT_SPECIFIER, GET_UNSIGNED,
- current_objfile);
- scan += SIZEOF_FORMAT_SPECIFIER;
- switch (format)
- {
- case FMT_ET:
- typep = decode_array_element_type (scan);
- break;
- case FMT_FT_C_C:
- fundtype = target_to_host (scan, SIZEOF_FMT_FT, GET_UNSIGNED,
- current_objfile);
- indextype = decode_fund_type (fundtype);
- scan += SIZEOF_FMT_FT;
- 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;
- nexttype = decode_subscript_data_item (scan, end);
- if (nexttype == NULL)
- {
- /* Munged subscript data or other problem, fake it. */
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", can't decode subscript data items"),
- DIE_ID, DIE_NAME);
- nexttype = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- }
- rangetype = create_range_type ((struct type *) NULL, indextype,
- lowbound, highbound);
- typep = create_array_type ((struct type *) NULL, nexttype, rangetype);
- 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:
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", array subscript format 0x%x not handled yet"),
- DIE_ID, DIE_NAME, format);
- 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);
- break;
- default:
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", unknown array subscript format %x"), DIE_ID,
- DIE_NAME, format);
- 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);
- break;
- }
- return (typep);
-}
-
-/*
-
- LOCAL FUNCTION
-
- dwarf_read_array_type -- read TAG_array_type DIE
-
- SYNOPSIS
-
- static void dwarf_read_array_type (struct dieinfo *dip)
-
- DESCRIPTION
-
- Extract all information from a TAG_array_type DIE and add to
- the user defined type vector.
- */
-
-static void
-dwarf_read_array_type (struct dieinfo *dip)
-{
- struct type *type;
- struct type *utype;
- char *sub;
- char *subend;
- unsigned short blocksz;
- int nbytes;
-
- if (dip->at_ordering != ORD_row_major)
- {
- /* FIXME: Can gdb even handle column major arrays? */
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", array not row major; not handled correctly"),
- DIE_ID, DIE_NAME);
- }
- sub = dip->at_subscr_data;
- if (sub != NULL)
- {
- nbytes = attribute_size (AT_subscr_data);
- blocksz = target_to_host (sub, nbytes, GET_UNSIGNED, current_objfile);
- subend = sub + nbytes + blocksz;
- sub += nbytes;
- type = decode_subscript_data_item (sub, subend);
- utype = lookup_utype (dip->die_ref);
- if (utype == NULL)
- {
- /* 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;
- }
- else
- {
- /* Double ick! Not only is a type already in our slot, but
- someone has decorated it. Complain and leave it alone. */
- dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
- }
- }
-}
-
-/*
-
- 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
-read_tag_pointer_type (struct dieinfo *dip)
-{
- struct type *type;
- struct type *utype;
-
- type = decode_die_type (dip);
- utype = lookup_utype (dip->die_ref);
- if (utype == NULL)
- {
- utype = lookup_pointer_type (type);
- alloc_utype (dip->die_ref, utype);
- }
- else
- {
- TYPE_TARGET_TYPE (utype) = type;
- TYPE_POINTER_TYPE (type) = utype;
-
- /* We assume the machine has only one representation for pointers! */
- /* FIXME: Possably a poor assumption */
- TYPE_LENGTH (utype) = TARGET_PTR_BIT / TARGET_CHAR_BIT;
- TYPE_CODE (utype) = TYPE_CODE_PTR;
- }
-}
-
-/*
-
- 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 (struct dieinfo *dip)
-{
- struct type *utype;
- struct type *indextype;
- struct type *rangetype;
- unsigned long lowbound = 0;
- unsigned long highbound;
-
- if (dip->has_at_byte_size)
- {
- /* A fixed bounds string */
- highbound = dip->at_byte_size - 1;
- }
- else
- {
- /* 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)
- {
- dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
- return;
- }
- }
-
- /* Create the string type using the blank type we either found or created. */
- utype = create_string_type (utype, rangetype);
-}
-
-/*
-
- 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
-read_subroutine_type (struct dieinfo *dip, char *thisdie, char *enddie)
-{
- struct type *type; /* Type that this function returns */
- struct type *ftype; /* Function that returns above type */
-
- /* Decode the type that this subroutine returns */
-
- type = decode_die_type (dip);
-
- /* Check to see if we already have a partially constructed user
- defined type for this DIE, from a forward reference. */
-
- ftype = lookup_utype (dip->die_ref);
- if (ftype == NULL)
- {
- /* 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);
- alloc_utype (dip->die_ref, ftype);
- }
- else if (TYPE_CODE (ftype) == TYPE_CODE_UNDEF)
- {
- /* 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;
- }
- else
- {
- dup_user_type_definition_complaint (DIE_ID, DIE_NAME);
- }
-}
-
-/*
-
- LOCAL FUNCTION
-
- read_enumeration -- process dies which define an enumeration
-
- SYNOPSIS
-
- static void read_enumeration (struct dieinfo *dip, char *thisdie,
- char *enddie, struct objfile *objfile)
-
- 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
-read_enumeration (struct dieinfo *dip, char *thisdie, char *enddie,
- struct objfile *objfile)
-{
- struct type *type;
- struct symbol *sym;
-
- type = enum_type (dip, objfile);
- sym = new_symbol (dip, objfile);
- if (sym != NULL)
- {
- SYMBOL_TYPE (sym) = type;
- if (cu_language == language_cplus)
- {
- synthesize_typedef (dip, objfile, type);
- }
- }
-}
-
-/*
-
- LOCAL FUNCTION
-
- enum_type -- decode and return a type for an enumeration
-
- SYNOPSIS
-
- static type *enum_type (struct dieinfo *dip, struct objfile *objfile)
-
- 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.
-
- At the same time, for each member of the enumeration, create a
- symbol for it with domain VAR_DOMAIN and class LOC_CONST,
- and give it the type of the enumeration itself.
-
- NOTES
-
- 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
- compilers to generate. (Draft 6, sec 3.8.5, Enumeration type
- Entries). Because gdb wants to see the enum members in program
- source order, we have to ensure that the order gets reversed while
- we are processing them.
- */
-
-static struct type *
-enum_type (struct dieinfo *dip, struct objfile *objfile)
-{
- 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;
- unsigned short blocksz;
- struct symbol *sym;
- int nbytes;
- int unsigned_enum = 1;
-
- type = lookup_utype (dip->die_ref);
- if (type == NULL)
- {
- /* No forward references created an empty type, so install one now */
- type = alloc_utype (dip->die_ref, NULL);
- }
- TYPE_CODE (type) = TYPE_CODE_ENUM;
- /* Some compilers try to be helpful by inventing "fake" names for
- anonymous enums, structures, and unions, like "~0fake" or ".0fake".
- Thanks, but no thanks... */
- if (dip->at_name != NULL
- && *dip->at_name != '~'
- && *dip->at_name != '.')
- {
- TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack,
- "", "", dip->at_name);
- }
- if (dip->at_byte_size != 0)
- {
- TYPE_LENGTH (type) = dip->at_byte_size;
- }
- scan = dip->at_element_list;
- if (scan != NULL)
- {
- if (dip->short_element_list)
- {
- nbytes = attribute_size (AT_short_element_list);
- }
- else
- {
- nbytes = attribute_size (AT_element_list);
- }
- blocksz = target_to_host (scan, nbytes, GET_UNSIGNED, objfile);
- listend = scan + nbytes + blocksz;
- scan += nbytes;
- while (scan < listend)
- {
- new = (struct nextfield *) alloca (sizeof (struct nextfield));
- new->next = list;
- list = new;
- FIELD_TYPE (list->field) = NULL;
- FIELD_BITSIZE (list->field) = 0;
- FIELD_STATIC_KIND (list->field) = 0;
- FIELD_BITPOS (list->field) =
- target_to_host (scan, TARGET_FT_LONG_SIZE (objfile), GET_SIGNED,
- objfile);
- scan += TARGET_FT_LONG_SIZE (objfile);
- list->field.name = obsavestring (scan, strlen (scan),
- &objfile->objfile_obstack);
- scan += strlen (scan) + 1;
- nfields++;
- /* Handcraft a new symbol for this enum member. */
- sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct symbol));
- memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = create_name (list->field.name,
- &objfile->objfile_obstack);
- SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
- SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_CONST;
- SYMBOL_TYPE (sym) = type;
- SYMBOL_VALUE (sym) = FIELD_BITPOS (list->field);
- if (SYMBOL_VALUE (sym) < 0)
- unsigned_enum = 0;
- add_symbol_to_list (sym, list_in_scope);
- }
- /* Now create the vector of fields, and record how big it is. This is
- where we reverse the order, by pulling the members off the list in
- 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)
- {
- if (unsigned_enum)
- TYPE_FLAGS (type) |= TYPE_FLAG_UNSIGNED;
- TYPE_NFIELDS (type) = nfields;
- TYPE_FIELDS (type) = (struct field *)
- obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nfields);
- /* 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;
- }
- }
- }
- 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
-read_func_scope (struct dieinfo *dip, char *thisdie, char *enddie,
- struct objfile *objfile)
-{
- struct context_stack *new;
-
- /* AT_name is absent if the function is described with an
- AT_abstract_origin tag.
- Ignore the function description for now to avoid GDB core dumps.
- FIXME: Add code to handle AT_abstract_origin tags properly. */
- if (dip->at_name == NULL)
- {
- complaint (&symfile_complaints, _("DIE @ 0x%x, AT_name tag missing"),
- DIE_ID);
- return;
- }
-
- new = push_context (0, dip->at_low_pc);
- new->name = new_symbol (dip, objfile);
- list_in_scope = &local_symbols;
- process_dies (thisdie + dip->die_length, enddie, objfile);
- new = pop_context ();
- /* Make a block for the local symbols within. */
- finish_block (new->name, &local_symbols, new->old_blocks,
- new->start_addr, dip->at_high_pc, objfile);
- list_in_scope = &file_symbols;
-}
-
-
-/*
-
- 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 (char *producer)
-{
-
- /* If this compilation unit was compiled with g++ or gcc, then set the
- processing_gcc_compilation flag. */
-
- if (DEPRECATED_STREQN (producer, GCC_PRODUCER, strlen (GCC_PRODUCER)))
- {
- char version = producer[strlen (GCC_PRODUCER)];
- processing_gcc_compilation = (version == '2' ? 2 : 1);
- }
- else
- {
- processing_gcc_compilation =
- strncmp (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)) == 0;
- }
-
- /* 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. */
-
- if (AUTO_DEMANGLING)
- {
- if (DEPRECATED_STREQN (producer, GPLUS_PRODUCER, strlen (GPLUS_PRODUCER)))
- {
-#if 0
- /* For now, stay with AUTO_DEMANGLING for g++ output, as we don't
- know whether it will use the old style or v3 mangling. */
- set_demangling_style (GNU_DEMANGLING_STYLE_STRING);
-#endif
- }
- else if (DEPRECATED_STREQN (producer, LCC_PRODUCER, strlen (LCC_PRODUCER)))
- {
- set_demangling_style (LUCID_DEMANGLING_STYLE_STRING);
- }
- }
-}
-
-
-/*
-
- 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
-read_file_scope (struct dieinfo *dip, char *thisdie, char *enddie,
- struct objfile *objfile)
-{
- struct cleanup *back_to;
- struct symtab *symtab;
-
- set_cu_language (dip);
- if (dip->at_producer != NULL)
- {
- handle_producer (dip->at_producer);
- }
- numutypes = (enddie - thisdie) / 4;
- utypes = (struct type **) xmalloc (numutypes * sizeof (struct type *));
- back_to = make_cleanup (free_utypes, NULL);
- memset (utypes, 0, numutypes * sizeof (struct type *));
- memset (ftypes, 0, FT_NUM_MEMBERS * sizeof (struct type *));
- start_symtab (dip->at_name, dip->at_comp_dir, dip->at_low_pc);
- record_debugformat ("DWARF 1");
- decode_line_numbers (lnbase);
- process_dies (thisdie + dip->die_length, enddie, objfile);
-
- symtab = end_symtab (dip->at_high_pc, objfile, 0);
- if (symtab != NULL)
- {
- symtab->language = cu_language;
- }
- do_cleanups (back_to);
-}
-
-/*
-
- LOCAL FUNCTION
-
- process_dies -- process a range of DWARF Information Entries
-
- SYNOPSIS
-
- static void process_dies (char *thisdie, char *enddie,
- struct objfile *objfile)
-
- DESCRIPTION
-
- Process all DIE's in a specified range. May be (and almost
- certainly will be) called recursively.
- */
-
-static void
-process_dies (char *thisdie, char *enddie, struct objfile *objfile)
-{
- char *nextdie;
- struct dieinfo di;
-
- while (thisdie < enddie)
- {
- basicdieinfo (&di, thisdie, objfile);
- if (di.die_length < SIZEOF_DIE_LENGTH)
- {
- break;
- }
- else if (di.die_tag == TAG_padding)
- {
- nextdie = thisdie + di.die_length;
- }
- else
- {
- completedieinfo (&di, objfile);
- if (di.at_sibling != 0)
- {
- nextdie = dbbase + di.at_sibling - dbroff;
- }
- else
- {
- nextdie = thisdie + di.die_length;
- }
- /* I think that these are always text, not data, addresses. */
- di.at_low_pc = SMASH_TEXT_ADDRESS (di.at_low_pc);
- di.at_high_pc = SMASH_TEXT_ADDRESS (di.at_high_pc);
- switch (di.die_tag)
- {
- case TAG_compile_unit:
- /* 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;
- break;
- case TAG_global_subroutine:
- case TAG_subroutine:
- if (di.has_at_low_pc)
- {
- read_func_scope (&di, thisdie, nextdie, objfile);
- }
- break;
- case TAG_lexical_block:
- read_lexical_block_scope (&di, thisdie, nextdie, objfile);
- break;
- case TAG_class_type:
- case TAG_structure_type:
- case TAG_union_type:
- read_structure_scope (&di, thisdie, nextdie, objfile);
- break;
- case TAG_enumeration_type:
- read_enumeration (&di, thisdie, nextdie, objfile);
- break;
- case TAG_subroutine_type:
- read_subroutine_type (&di, thisdie, nextdie);
- break;
- case TAG_array_type:
- dwarf_read_array_type (&di);
- break;
- case TAG_pointer_type:
- read_tag_pointer_type (&di);
- break;
- case TAG_string_type:
- read_tag_string_type (&di);
- break;
- default:
- new_symbol (&di, objfile);
- 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
-decode_line_numbers (char *linetable)
-{
- char *tblscan;
- char *tblend;
- unsigned long length;
- unsigned long base;
- unsigned long line;
- unsigned long pc;
-
- if (linetable != NULL)
- {
- tblscan = tblend = linetable;
- length = target_to_host (tblscan, SIZEOF_LINETBL_LENGTH, GET_UNSIGNED,
- current_objfile);
- tblscan += SIZEOF_LINETBL_LENGTH;
- tblend += length;
- base = target_to_host (tblscan, TARGET_FT_POINTER_SIZE (objfile),
- GET_UNSIGNED, current_objfile);
- tblscan += TARGET_FT_POINTER_SIZE (objfile);
- base += baseaddr;
- while (tblscan < tblend)
- {
- 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;
- pc += base;
- if (line != 0)
- {
- record_line (current_subfile, line, pc);
- }
- }
- }
-}
-
-/*
-
- LOCAL FUNCTION
-
- locval -- compute the value of a location attribute
-
- SYNOPSIS
-
- static int locval (struct dieinfo *dip)
-
- DESCRIPTION
-
- Given pointer to a string of bytes that define a location, compute
- the location and return the value.
- A location description containing no atoms indicates that the
- object is optimized out. The optimized_out flag is set for those,
- the return value is meaningless.
-
- 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 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
-locval (struct dieinfo *dip)
-{
- unsigned short nbytes;
- unsigned short locsize;
- auto long stack[64];
- int stacki;
- char *loc;
- char *end;
- int loc_atom_code;
- int loc_value_size;
-
- loc = dip->at_location;
- nbytes = attribute_size (AT_location);
- locsize = target_to_host (loc, nbytes, GET_UNSIGNED, current_objfile);
- loc += nbytes;
- end = loc + locsize;
- stacki = 0;
- stack[stacki] = 0;
- dip->isreg = 0;
- dip->offreg = 0;
- dip->optimized_out = 1;
- loc_value_size = TARGET_FT_LONG_SIZE (current_objfile);
- while (loc < end)
- {
- dip->optimized_out = 0;
- 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) */
- stack[++stacki]
- = DWARF_REG_TO_REGNUM (target_to_host (loc, loc_value_size,
- GET_UNSIGNED,
- current_objfile));
- loc += loc_value_size;
- dip->isreg = 1;
- break;
- case OP_BASEREG:
- /* push value of register (number) */
- /* Actually, we compute the value as if register has 0, so the
- value ends up being the offset from that register. */
- dip->offreg = 1;
- dip->basereg = target_to_host (loc, loc_value_size, GET_UNSIGNED,
- current_objfile);
- loc += loc_value_size;
- stack[++stacki] = 0;
- 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) */
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", OP_DEREF2 address 0x%lx not handled"),
- DIE_ID, DIE_NAME, stack[stacki]);
- break;
- case OP_DEREF4: /* pop, deref and push 4 bytes (as a long) */
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", OP_DEREF4 address 0x%lx not handled"),
- DIE_ID, DIE_NAME, stack[stacki]);
- break;
- case OP_ADD: /* pop top 2 items, add, push result */
- stack[stacki - 1] += stack[stacki];
- stacki--;
- break;
- }
- }
- return (stack[stacki]);
-}
-
-/*
-
- LOCAL FUNCTION
-
- read_ofile_symtab -- build a full symtab entry from chunk of DIE's
-
- SYNOPSIS
-
- static void read_ofile_symtab (struct partial_symtab *pst)
-
- DESCRIPTION
-
- 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
- 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.
- */
-
-static void
-read_ofile_symtab (struct partial_symtab *pst)
-{
- struct cleanup *back_to;
- unsigned long lnsize;
- file_ptr foffset;
- bfd *abfd;
- char lnsizedata[SIZEOF_LINETBL_LENGTH];
-
- abfd = pst->objfile->obfd;
- current_objfile = pst->objfile;
-
- /* 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;
- dbsize = DBLENGTH (pst);
- dbbase = xmalloc (dbsize);
- dbroff = DBROFF (pst);
- foffset = DBFOFF (pst) + dbroff;
- base_section_offsets = pst->section_offsets;
- baseaddr = ANOFFSET (pst->section_offsets, 0);
- if (bfd_seek (abfd, foffset, SEEK_SET) ||
- (bfd_bread (dbbase, dbsize, abfd) != dbsize))
- {
- xfree (dbbase);
- error (_("can't read DWARF data"));
- }
- back_to = make_cleanup (xfree, dbbase);
-
- /* If there is a line number table associated with this compilation unit
- 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
- processing. */
-
- lnbase = NULL;
- if (LNFOFF (pst))
- {
- if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
- (bfd_bread (lnsizedata, sizeof (lnsizedata), abfd)
- != sizeof (lnsizedata)))
- {
- error (_("can't read DWARF line number table size"));
- }
- lnsize = target_to_host (lnsizedata, SIZEOF_LINETBL_LENGTH,
- GET_UNSIGNED, pst->objfile);
- lnbase = xmalloc (lnsize);
- if (bfd_seek (abfd, LNFOFF (pst), SEEK_SET) ||
- (bfd_bread (lnbase, lnsize, abfd) != lnsize))
- {
- xfree (lnbase);
- error (_("can't read DWARF line numbers"));
- }
- make_cleanup (xfree, lnbase);
- }
-
- process_dies (dbbase, dbbase + dbsize, pst->objfile);
- do_cleanups (back_to);
- current_objfile = NULL;
- pst->symtab = pst->objfile->symtabs;
-}
-
-/*
-
- LOCAL FUNCTION
-
- psymtab_to_symtab_1 -- do grunt work for building a full symtab entry
-
- SYNOPSIS
-
- static void psymtab_to_symtab_1 (struct partial_symtab *pst)
-
- DESCRIPTION
-
- Called once for each partial symbol table entry that needs to be
- expanded into a full symbol table entry.
-
- */
-
-static void
-psymtab_to_symtab_1 (struct partial_symtab *pst)
-{
- int i;
- struct cleanup *old_chain;
-
- if (pst != NULL)
- {
- if (pst->readin)
- {
- warning (_("psymtab for %s already read in. Shouldn't happen."),
- 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)
- {
- /* FIXME: i18n: Need to make this a single
- string. */
- fputs_filtered (" ", gdb_stdout);
- wrap_here ("");
- fputs_filtered ("and ", gdb_stdout);
- wrap_here ("");
- printf_filtered ("%s...",
- pst->dependencies[i]->filename);
- wrap_here ("");
- gdb_flush (gdb_stdout); /* Flush output */
- }
- psymtab_to_symtab_1 (pst->dependencies[i]);
- }
- }
- if (DBLENGTH (pst)) /* Otherwise it's a dummy */
- {
- buildsym_init ();
- old_chain = make_cleanup (really_free_pendings, 0);
- read_ofile_symtab (pst);
- if (info_verbose)
- {
- printf_filtered (_("%d DIE's, sorting..."), diecount);
- wrap_here ("");
- gdb_flush (gdb_stdout);
- }
- do_cleanups (old_chain);
- }
- pst->readin = 1;
- }
- }
-}
-
-/*
-
- 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
-dwarf_psymtab_to_symtab (struct partial_symtab *pst)
-{
-
- if (pst != NULL)
- {
- if (pst->readin)
- {
- warning (_("psymtab for %s already read in. Shouldn't happen."),
- pst->filename);
- }
- else
- {
- 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);
- gdb_flush (gdb_stdout);
- }
-
- 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"));
- gdb_flush (gdb_stdout);
- }
- }
- }
- }
-}
-
-/*
-
- 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
-add_enum_psymbol (struct dieinfo *dip, struct objfile *objfile)
-{
- char *scan;
- char *listend;
- unsigned short blocksz;
- int nbytes;
-
- scan = dip->at_element_list;
- if (scan != NULL)
- {
- if (dip->short_element_list)
- {
- nbytes = attribute_size (AT_short_element_list);
- }
- else
- {
- nbytes = attribute_size (AT_element_list);
- }
- blocksz = target_to_host (scan, nbytes, GET_UNSIGNED, objfile);
- scan += nbytes;
- listend = scan + blocksz;
- while (scan < listend)
- {
- scan += TARGET_FT_LONG_SIZE (objfile);
- add_psymbol_to_list (scan, strlen (scan), VAR_DOMAIN, LOC_CONST,
- &objfile->static_psymbols, 0, 0, cu_language,
- objfile);
- scan += strlen (scan) + 1;
- }
- }
-}
-
-/*
-
- 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.
-
- NOTES
-
- The caller must ensure that the DIE has a valid name attribute.
- */
-
-static void
-add_partial_symbol (struct dieinfo *dip, struct objfile *objfile)
-{
- switch (dip->die_tag)
- {
- case TAG_global_subroutine:
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- VAR_DOMAIN, LOC_BLOCK,
- &objfile->global_psymbols,
- 0, dip->at_low_pc, cu_language, objfile);
- break;
- case TAG_global_variable:
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- VAR_DOMAIN, LOC_STATIC,
- &objfile->global_psymbols,
- 0, 0, cu_language, objfile);
- break;
- case TAG_subroutine:
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- VAR_DOMAIN, LOC_BLOCK,
- &objfile->static_psymbols,
- 0, dip->at_low_pc, cu_language, objfile);
- break;
- case TAG_local_variable:
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- VAR_DOMAIN, LOC_STATIC,
- &objfile->static_psymbols,
- 0, 0, cu_language, objfile);
- break;
- case TAG_typedef:
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- VAR_DOMAIN, LOC_TYPEDEF,
- &objfile->static_psymbols,
- 0, 0, cu_language, objfile);
- break;
- case TAG_class_type:
- case TAG_structure_type:
- case TAG_union_type:
- case TAG_enumeration_type:
- /* Do not add opaque aggregate definitions to the psymtab. */
- if (!dip->has_at_byte_size)
- break;
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- STRUCT_DOMAIN, LOC_TYPEDEF,
- &objfile->static_psymbols,
- 0, 0, cu_language, objfile);
- if (cu_language == language_cplus)
- {
- /* For C++, these implicitly act as typedefs as well. */
- add_psymbol_to_list (dip->at_name, strlen (dip->at_name),
- VAR_DOMAIN, LOC_TYPEDEF,
- &objfile->static_psymbols,
- 0, 0, cu_language, objfile);
- }
- break;
- }
-}
-/* *INDENT-OFF* */
-/*
-
-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
- for this compilation unit.
-
-NOTES
-
- 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.
-
- 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).
-
- Also, for variables and subroutines, check that this is the place
- where the actual definition occurs, rather than just a reference
- to an external.
- */
-/* *INDENT-ON* */
-
-
-
-static void
-scan_partial_symbols (char *thisdie, char *enddie, struct objfile *objfile)
-{
- char *nextdie;
- char *temp;
- struct dieinfo di;
-
- while (thisdie < enddie)
- {
- basicdieinfo (&di, thisdie, objfile);
- if (di.die_length < SIZEOF_DIE_LENGTH)
- {
- break;
- }
- else
- {
- nextdie = thisdie + di.die_length;
- /* To avoid getting complete die information for every die, we
- only do it (below) for the cases we are interested in. */
- switch (di.die_tag)
- {
- case TAG_global_subroutine:
- case TAG_subroutine:
- 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))
- {
- bad_die_ref_complaint (DIE_ID, DIE_NAME,
- di.at_sibling);
- }
- else
- {
- nextdie = temp;
- }
- }
- }
- break;
- case TAG_global_variable:
- case TAG_local_variable:
- completedieinfo (&di, objfile);
- if (di.at_name && (di.has_at_low_pc || di.at_location))
- {
- add_partial_symbol (&di, objfile);
- }
- break;
- case TAG_typedef:
- case TAG_class_type:
- case TAG_structure_type:
- case TAG_union_type:
- completedieinfo (&di, objfile);
- if (di.at_name)
- {
- add_partial_symbol (&di, objfile);
- }
- break;
- case TAG_enumeration_type:
- completedieinfo (&di, objfile);
- if (di.at_name)
- {
- add_partial_symbol (&di, objfile);
- }
- add_enum_psymbol (&di, objfile);
- break;
- }
- }
- 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
-scan_compilation_units (char *thisdie, char *enddie, file_ptr dbfoff,
- file_ptr lnoffset, struct objfile *objfile)
-{
- char *nextdie;
- struct dieinfo di;
- struct partial_symtab *pst;
- int culength;
- int curoff;
- file_ptr curlnoffset;
-
- while (thisdie < enddie)
- {
- basicdieinfo (&di, thisdie, objfile);
- if (di.die_length < SIZEOF_DIE_LENGTH)
- {
- break;
- }
- else if (di.die_tag != TAG_compile_unit)
- {
- nextdie = thisdie + di.die_length;
- }
- else
- {
- completedieinfo (&di, objfile);
- set_cu_language (&di);
- if (di.at_sibling != 0)
- {
- nextdie = dbbase + di.at_sibling - dbroff;
- }
- else
- {
- nextdie = thisdie + di.die_length;
- }
- curoff = thisdie - dbbase;
- culength = nextdie - thisdie;
- curlnoffset = di.has_at_stmt_list ? lnoffset + di.at_stmt_list : 0;
-
- /* First allocate a new partial symbol table structure */
-
- pst = start_psymtab_common (objfile, base_section_offsets,
- di.at_name, di.at_low_pc,
- objfile->global_psymbols.next,
- objfile->static_psymbols.next);
-
- pst->texthigh = di.at_high_pc;
- pst->read_symtab_private = (char *)
- obstack_alloc (&objfile->objfile_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 */
-
- scan_partial_symbols (thisdie + di.die_length, nextdie, objfile);
-
- 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);
- /* 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
-
- static struct symbol *new_symbol (struct dieinfo *dip,
- struct objfile *objfile)
-
- 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 *
-new_symbol (struct dieinfo *dip, struct objfile *objfile)
-{
- struct symbol *sym = NULL;
-
- if (dip->at_name != NULL)
- {
- sym = (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
- sizeof (struct symbol));
- OBJSTAT (objfile, n_syms++);
- memset (sym, 0, sizeof (struct symbol));
- /* default assumptions */
- SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_STATIC;
- SYMBOL_TYPE (sym) = decode_die_type (dip);
-
- /* 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;
- SYMBOL_SET_NAMES (sym, dip->at_name, strlen (dip->at_name), objfile);
- switch (dip->die_tag)
- {
- case TAG_label:
- SYMBOL_VALUE_ADDRESS (sym) = dip->at_low_pc;
- SYMBOL_CLASS (sym) = LOC_LABEL;
- break;
- case TAG_global_subroutine:
- case TAG_subroutine:
- SYMBOL_VALUE_ADDRESS (sym) = dip->at_low_pc;
- SYMBOL_TYPE (sym) = lookup_function_type (SYMBOL_TYPE (sym));
- if (dip->at_prototyped)
- TYPE_FLAGS (SYMBOL_TYPE (sym)) |= TYPE_FLAG_PROTOTYPED;
- SYMBOL_CLASS (sym) = LOC_BLOCK;
- if (dip->die_tag == TAG_global_subroutine)
- {
- add_symbol_to_list (sym, &global_symbols);
- }
- else
- {
- add_symbol_to_list (sym, list_in_scope);
- }
- break;
- case TAG_global_variable:
- if (dip->at_location != NULL)
- {
- SYMBOL_VALUE_ADDRESS (sym) = locval (dip);
- add_symbol_to_list (sym, &global_symbols);
- SYMBOL_CLASS (sym) = LOC_STATIC;
- SYMBOL_VALUE (sym) += baseaddr;
- }
- break;
- case TAG_local_variable:
- if (dip->at_location != NULL)
- {
- int loc = locval (dip);
- if (dip->optimized_out)
- {
- SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
- }
- else if (dip->isreg)
- {
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- }
- else if (dip->offreg)
- {
- SYMBOL_CLASS (sym) = LOC_BASEREG;
- SYMBOL_BASEREG (sym) = dip->basereg;
- }
- else
- {
- SYMBOL_CLASS (sym) = LOC_STATIC;
- SYMBOL_VALUE (sym) += baseaddr;
- }
- if (SYMBOL_CLASS (sym) == LOC_STATIC)
- {
- /* LOC_STATIC address class MUST use SYMBOL_VALUE_ADDRESS,
- which may store to a bigger location than SYMBOL_VALUE. */
- SYMBOL_VALUE_ADDRESS (sym) = loc;
- }
- else
- {
- SYMBOL_VALUE (sym) = loc;
- }
- add_symbol_to_list (sym, list_in_scope);
- }
- break;
- case TAG_formal_parameter:
- if (dip->at_location != NULL)
- {
- SYMBOL_VALUE (sym) = locval (dip);
- }
- add_symbol_to_list (sym, list_in_scope);
- if (dip->isreg)
- {
- SYMBOL_CLASS (sym) = LOC_REGPARM;
- }
- else if (dip->offreg)
- {
- SYMBOL_CLASS (sym) = LOC_BASEREG_ARG;
- SYMBOL_BASEREG (sym) = dip->basereg;
- }
- 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;
- case TAG_class_type:
- case TAG_structure_type:
- case TAG_union_type:
- case TAG_enumeration_type:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
- SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
- add_symbol_to_list (sym, list_in_scope);
- break;
- case TAG_typedef:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
- SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, list_in_scope);
- 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);
-}
-
-/*
-
- 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 (struct dieinfo *dip, struct objfile *objfile,
- struct type *type)
-{
- struct symbol *sym = NULL;
-
- if (dip->at_name != NULL)
- {
- sym = (struct symbol *)
- obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
- OBJSTAT (objfile, n_syms++);
- memset (sym, 0, sizeof (struct symbol));
- DEPRECATED_SYMBOL_NAME (sym) = create_name (dip->at_name,
- &objfile->objfile_obstack);
- SYMBOL_INIT_LANGUAGE_SPECIFIC (sym, cu_language);
- SYMBOL_TYPE (sym) = type;
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
- SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- add_symbol_to_list (sym, list_in_scope);
- }
-}
-
-/*
-
- 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,
- 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
- 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 *
-decode_mod_fund_type (char *typedata)
-{
- struct type *typep = NULL;
- unsigned short modcount;
- int nbytes;
-
- /* Get the total size of the block, exclusive of the size itself */
-
- nbytes = attribute_size (AT_mod_fund_type);
- modcount = target_to_host (typedata, nbytes, GET_UNSIGNED, current_objfile);
- typedata += nbytes;
-
- /* Deduct the size of the fundamental type bytes at the end of the block. */
-
- modcount -= attribute_size (AT_fund_type);
-
- /* Now do the actual decoding */
-
- typep = decode_modified_type (typedata, modcount, AT_mod_fund_type);
- 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 *
-decode_mod_u_d_type (char *typedata)
-{
- struct type *typep = NULL;
- unsigned short modcount;
- int nbytes;
-
- /* Get the total size of the block, exclusive of the size itself */
-
- nbytes = attribute_size (AT_mod_u_d_type);
- modcount = target_to_host (typedata, nbytes, GET_UNSIGNED, current_objfile);
- typedata += nbytes;
-
- /* Deduct the size of the reference type bytes at the end of the block. */
-
- modcount -= attribute_size (AT_user_def_type);
-
- /* Now do the actual decoding */
-
- typep = decode_modified_type (typedata, modcount, AT_mod_u_d_type);
- return (typep);
-}
-
-/*
-
- LOCAL FUNCTION
-
- decode_modified_type -- decode modified user or fundamental type
-
- SYNOPSIS
-
- static struct type *decode_modified_type (char *modifiers,
- 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 *
-decode_modified_type (char *modifiers, unsigned int modcount, int mtype)
-{
- struct type *typep = NULL;
- unsigned short fundtype;
- DIE_REF die_ref;
- char modifier;
- int nbytes;
-
- if (modcount == 0)
- {
- switch (mtype)
- {
- case AT_mod_fund_type:
- nbytes = attribute_size (AT_fund_type);
- fundtype = target_to_host (modifiers, nbytes, GET_UNSIGNED,
- current_objfile);
- typep = decode_fund_type (fundtype);
- break;
- case AT_mod_u_d_type:
- nbytes = attribute_size (AT_user_def_type);
- die_ref = target_to_host (modifiers, nbytes, GET_UNSIGNED,
- current_objfile);
- typep = lookup_utype (die_ref);
- if (typep == NULL)
- {
- typep = alloc_utype (die_ref, NULL);
- }
- break;
- default:
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", botched modified type decoding (mtype 0x%x)"),
- DIE_ID, DIE_NAME, mtype);
- typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- break;
- }
- }
- else
- {
- modifier = *modifiers++;
- typep = decode_modified_type (modifiers, --modcount, mtype);
- switch (modifier)
- {
- case MOD_pointer_to:
- typep = lookup_pointer_type (typep);
- break;
- case MOD_reference_to:
- typep = lookup_reference_type (typep);
- break;
- case MOD_const:
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", type modifier 'const' ignored"), DIE_ID,
- DIE_NAME); /* FIXME */
- break;
- case MOD_volatile:
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", type modifier 'volatile' ignored"),
- DIE_ID, DIE_NAME); /* FIXME */
- break;
- default:
- if (!(MOD_lo_user <= (unsigned char) modifier))
-#if 0
-/* This part of the test would always be true, and it triggers a compiler
- warning. */
- && (unsigned char) modifier <= MOD_hi_user))
-#endif
- {
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", unknown type modifier %u"), DIE_ID,
- DIE_NAME, modifier);
- }
- break;
- }
- }
- 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
-
- 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.
- */
-
-static struct type *
-decode_fund_type (unsigned int fundtype)
-{
- struct type *typep = NULL;
-
- switch (fundtype)
- {
-
- case FT_void:
- typep = dwarf_fundamental_type (current_objfile, FT_VOID);
- break;
-
- case FT_boolean: /* Was FT_set in AT&T version */
- typep = dwarf_fundamental_type (current_objfile, FT_BOOLEAN);
- break;
-
- case FT_pointer: /* (void *) */
- typep = dwarf_fundamental_type (current_objfile, FT_VOID);
- typep = lookup_pointer_type (typep);
- break;
-
- case FT_char:
- typep = dwarf_fundamental_type (current_objfile, FT_CHAR);
- break;
-
- case FT_signed_char:
- typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_CHAR);
- break;
-
- case FT_unsigned_char:
- typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_CHAR);
- break;
-
- case FT_short:
- typep = dwarf_fundamental_type (current_objfile, FT_SHORT);
- break;
-
- case FT_signed_short:
- typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_SHORT);
- break;
-
- case FT_unsigned_short:
- typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_SHORT);
- break;
-
- case FT_integer:
- typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- break;
-
- case FT_signed_integer:
- typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_INTEGER);
- break;
-
- case FT_unsigned_integer:
- typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_INTEGER);
- break;
-
- case FT_long:
- typep = dwarf_fundamental_type (current_objfile, FT_LONG);
- break;
-
- case FT_signed_long:
- typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_LONG);
- break;
-
- case FT_unsigned_long:
- typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_LONG);
- break;
-
- case FT_long_long:
- typep = dwarf_fundamental_type (current_objfile, FT_LONG_LONG);
- break;
-
- case FT_signed_long_long:
- typep = dwarf_fundamental_type (current_objfile, FT_SIGNED_LONG_LONG);
- break;
-
- case FT_unsigned_long_long:
- typep = dwarf_fundamental_type (current_objfile, FT_UNSIGNED_LONG_LONG);
- break;
-
- case FT_float:
- typep = dwarf_fundamental_type (current_objfile, FT_FLOAT);
- break;
-
- case FT_dbl_prec_float:
- typep = dwarf_fundamental_type (current_objfile, FT_DBL_PREC_FLOAT);
- break;
-
- case FT_ext_prec_float:
- typep = dwarf_fundamental_type (current_objfile, FT_EXT_PREC_FLOAT);
- break;
-
- case FT_complex:
- typep = dwarf_fundamental_type (current_objfile, FT_COMPLEX);
- break;
-
- case FT_dbl_prec_complex:
- typep = dwarf_fundamental_type (current_objfile, FT_DBL_PREC_COMPLEX);
- break;
-
- case FT_ext_prec_complex:
- typep = dwarf_fundamental_type (current_objfile, FT_EXT_PREC_COMPLEX);
- break;
-
- }
-
- if (typep == NULL)
- {
- typep = dwarf_fundamental_type (current_objfile, FT_INTEGER);
- if (!(FT_lo_user <= fundtype && fundtype <= FT_hi_user))
- {
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", unexpected fundamental type 0x%x"),
- DIE_ID, DIE_NAME, fundtype);
- }
- }
-
- 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 *
-create_name (char *name, struct obstack *obstackp)
-{
- int length;
- char *newname;
-
- length = strlen (name) + 1;
- newname = (char *) obstack_alloc (obstackp, length);
- strcpy (newname, name);
- return (newname);
-}
-
-/*
-
- LOCAL FUNCTION
-
- basicdieinfo -- extract the minimal die info from raw die data
-
- SYNOPSIS
-
- void basicdieinfo (char *diep, struct dieinfo *dip,
- struct objfile *objfile)
-
- 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
- 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.
-
- 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
- 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
- are forced to be TAG_padding DIES.
-
- 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.
-
- 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.
- */
-
-static void
-basicdieinfo (struct dieinfo *dip, char *diep, struct objfile *objfile)
-{
- curdie = dip;
- memset (dip, 0, sizeof (struct dieinfo));
- dip->die = diep;
- dip->die_ref = dbroff + (diep - dbbase);
- dip->die_length = target_to_host (diep, SIZEOF_DIE_LENGTH, GET_UNSIGNED,
- objfile);
- if ((dip->die_length < SIZEOF_DIE_LENGTH) ||
- ((diep + dip->die_length) > (dbbase + dbsize)))
- {
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", malformed DIE, bad length (%ld bytes)"),
- DIE_ID, DIE_NAME, dip->die_length);
- dip->die_length = 0;
- }
- else if (dip->die_length < (SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG))
- {
- dip->die_tag = TAG_padding;
- }
- else
- {
- diep += SIZEOF_DIE_LENGTH;
- dip->die_tag = target_to_host (diep, SIZEOF_DIE_TAG, GET_UNSIGNED,
- objfile);
- }
-}
-
-/*
-
- LOCAL FUNCTION
-
- completedieinfo -- finish reading the information for a given DIE
-
- SYNOPSIS
-
- void completedieinfo (struct dieinfo *dip, struct objfile *objfile)
-
- 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
- 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.
-
- 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
-completedieinfo (struct dieinfo *dip, struct objfile *objfile)
-{
- 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 */
- int nbytes; /* Size of next field to read */
-
- diecount++;
- diep = dip->die;
- end = diep + dip->die_length;
- diep += SIZEOF_DIE_LENGTH + SIZEOF_DIE_TAG;
- while (diep < end)
- {
- attr = target_to_host (diep, SIZEOF_ATTRIBUTE, GET_UNSIGNED, objfile);
- diep += SIZEOF_ATTRIBUTE;
- nbytes = attribute_size (attr);
- if (nbytes == -1)
- {
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", unknown attribute length, skipped remaining attributes"),
- DIE_ID, DIE_NAME);
- diep = end;
- continue;
- }
- switch (attr)
- {
- case AT_fund_type:
- dip->at_fund_type = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_ordering:
- dip->at_ordering = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_bit_offset:
- dip->at_bit_offset = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_sibling:
- dip->at_sibling = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_stmt_list:
- dip->at_stmt_list = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- dip->has_at_stmt_list = 1;
- break;
- case AT_low_pc:
- dip->at_low_pc = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- dip->at_low_pc += baseaddr;
- dip->has_at_low_pc = 1;
- break;
- case AT_high_pc:
- dip->at_high_pc = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- dip->at_high_pc += baseaddr;
- break;
- case AT_language:
- dip->at_language = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_user_def_type:
- dip->at_user_def_type = target_to_host (diep, nbytes,
- GET_UNSIGNED, objfile);
- break;
- case AT_byte_size:
- dip->at_byte_size = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- dip->has_at_byte_size = 1;
- break;
- case AT_bit_size:
- dip->at_bit_size = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_member:
- dip->at_member = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_discr:
- dip->at_discr = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- 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;
- dip->short_element_list = 0;
- break;
- case AT_short_element_list:
- dip->at_element_list = diep;
- dip->short_element_list = 1;
- 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:
- /* 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;
- }
- break;
- case AT_producer:
- dip->at_producer = diep;
- break;
- case AT_start_scope:
- dip->at_start_scope = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_stride_size:
- dip->at_stride_size = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_src_info:
- dip->at_src_info = target_to_host (diep, nbytes, GET_UNSIGNED,
- objfile);
- break;
- case AT_prototyped:
- dip->at_prototyped = diep;
- 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;
- }
- form = FORM_FROM_ATTR (attr);
- switch (form)
- {
- case FORM_DATA2:
- diep += 2;
- break;
- case FORM_DATA4:
- case FORM_REF:
- diep += 4;
- break;
- case FORM_DATA8:
- diep += 8;
- break;
- case FORM_ADDR:
- diep += TARGET_FT_POINTER_SIZE (objfile);
- break;
- case FORM_BLOCK2:
- diep += 2 + target_to_host (diep, nbytes, GET_UNSIGNED, objfile);
- break;
- case FORM_BLOCK4:
- diep += 4 + target_to_host (diep, nbytes, GET_UNSIGNED, objfile);
- break;
- case FORM_STRING:
- diep += strlen (diep) + 1;
- break;
- default:
- unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form);
- diep = end;
- break;
- }
- }
-}
-
-/*
-
- 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.
-
- FIXME: Would a 32 bit target ever need an 8 byte result?
-
- */
-
-static CORE_ADDR
-target_to_host (char *from, int nbytes, int signextend, /* FIXME: Unused */
- struct objfile *objfile)
-{
- CORE_ADDR rtnval;
-
- switch (nbytes)
- {
- case 8:
- rtnval = bfd_get_64 (objfile->obfd, (bfd_byte *) from);
- break;
- case 4:
- rtnval = bfd_get_32 (objfile->obfd, (bfd_byte *) from);
- break;
- case 2:
- rtnval = bfd_get_16 (objfile->obfd, (bfd_byte *) from);
- break;
- case 1:
- rtnval = bfd_get_8 (objfile->obfd, (bfd_byte *) from);
- break;
- default:
- complaint (&symfile_complaints,
- _("DIE @ 0x%x \"%s\", no bfd support for %d byte data object"),
- DIE_ID, DIE_NAME, nbytes);
- rtnval = 0;
- break;
- }
- return (rtnval);
-}
-
-/*
-
- 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 (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:
- unknown_attribute_form_complaint (DIE_ID, DIE_NAME, form);
- nbytes = -1;
- break;
- }
- return (nbytes);
-}
diff --git a/gdb/elfread.c b/gdb/elfread.c
index 646b314..a80b8f0 100644
--- a/gdb/elfread.c
+++ b/gdb/elfread.c
@@ -44,10 +44,6 @@ extern void _initialize_elfread (void);
struct elfinfo
{
- file_ptr dboffset; /* Offset to dwarf debug section */
- unsigned int dbsize; /* Size of dwarf debug section */
- file_ptr lnoffset; /* Offset to dwarf line number section */
- unsigned int lnsize; /* Size of dwarf line number section */
asection *stabsect; /* Section pointer for .stab section */
asection *stabindexsect; /* Section pointer for .stab.index section */
asection *mdebugsect; /* Section pointer for .mdebug section */
@@ -80,17 +76,7 @@ elf_locate_sections (bfd *ignore_abfd, asection *sectp, void *eip)
struct elfinfo *ei;
ei = (struct elfinfo *) eip;
- if (strcmp (sectp->name, ".debug") == 0)
- {
- ei->dboffset = sectp->filepos;
- ei->dbsize = bfd_get_section_size (sectp);
- }
- else if (strcmp (sectp->name, ".line") == 0)
- {
- ei->lnoffset = sectp->filepos;
- ei->lnsize = bfd_get_section_size (sectp);
- }
- else if (strcmp (sectp->name, ".stab") == 0)
+ if (strcmp (sectp->name, ".stab") == 0)
{
ei->stabsect = sectp;
}
@@ -451,7 +437,6 @@ elf_symtab_read (struct objfile *objfile, int dynamic,
We look for sections with specific names, to tell us what debug
format to look for: FIXME!!!
- dwarf_build_psymtabs() builds psymtabs for DWARF symbols;
elfstab_build_psymtabs() handles STABS symbols;
mdebug_build_psymtabs() handles ECOFF debugging information.
@@ -608,14 +593,6 @@ elf_symfile_read (struct objfile *objfile, int mainline)
/* DWARF 2 sections */
dwarf2_build_psymtabs (objfile, mainline);
}
- else if (ei.dboffset && ei.lnoffset)
- {
- /* DWARF sections */
- dwarf_build_psymtabs (objfile,
- mainline,
- ei.dboffset, ei.dbsize,
- ei.lnoffset, ei.lnsize);
- }
/* FIXME: kettenis/20030504: This still needs to be integrated with
dwarf2read.c in a better way. */
diff --git a/gdb/remote-est.c b/gdb/remote-est.c
deleted file mode 100644
index 13b0e1d..0000000
--- a/gdb/remote-est.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* Remote debugging interface for EST-300 ICE, for GDB
- Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2007
- Free Software Foundation, Inc.
- Contributed by Cygnus Support.
-
- Written by Steve Chamberlain for Cygnus Support.
- Re-written by Stu Grossman of Cygnus Support
-
- 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
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "regcache.h"
-
-#include "m68k-tdep.h"
-
-static void est_open (char *args, int from_tty);
-
-static void
-est_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
- int regno;
-
- if (regnamelen != 2)
- return;
-
- switch (regname[0])
- {
- case 'S':
- if (regname[1] != 'R')
- return;
- regno = PS_REGNUM;
- break;
- case 'P':
- if (regname[1] != 'C')
- return;
- regno = PC_REGNUM;
- break;
- case 'D':
- if (regname[1] < '0' || regname[1] > '7')
- return;
- regno = regname[1] - '0' + M68K_D0_REGNUM;
- break;
- case 'A':
- if (regname[1] < '0' || regname[1] > '7')
- return;
- regno = regname[1] - '0' + M68K_A0_REGNUM;
- break;
- default:
- return;
- }
-
- monitor_supply_register (regno, val);
-}
-
-/*
- * This array of registers needs to match the indexes used by GDB. The
- * whole reason this exists is because the various ROM monitors use
- * different names than GDB does, and don't support all the
- * registers either. So, typing "info reg sp" becomes a "r30".
- */
-
-static const char *
-est_regname (int index)
-{
-
- static char *regnames[] =
- {
- "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
- "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7",
- "SR", "PC",
- };
-
-
- if ((index >= (sizeof (regnames) / sizeof (regnames[0])))
- || (index < 0) || (index >= NUM_REGS))
- return NULL;
- else
- return regnames[index];
-}
-
-/*
- * Define the monitor command strings. Since these are passed directly
- * through to a printf style function, we need can include formatting
- * strings. We also need a CR or LF on the end.
- */
-
-static struct target_ops est_ops;
-
-static char *est_inits[] =
-{"he\r", /* Resets the prompt, and clears repeated cmds */
- NULL};
-
-static struct monitor_ops est_cmds;
-
-static void
-init_est_cmds (void)
-{
- est_cmds.flags = MO_CLR_BREAK_USES_ADDR | MO_FILL_USES_ADDR | MO_NEED_REGDUMP_AFTER_CONT |
- MO_SREC_ACK | MO_SREC_ACK_PLUS;
- est_cmds.init = est_inits; /* Init strings */
- est_cmds.cont = "go\r"; /* continue command */
- est_cmds.step = "sidr\r"; /* single step */
- est_cmds.stop = "\003"; /* ^C interrupts the program */
- est_cmds.set_break = "sb %x\r"; /* set a breakpoint */
- est_cmds.clr_break = "rb %x\r"; /* clear a breakpoint */
- est_cmds.clr_all_break = "rb\r"; /* clear all breakpoints */
- est_cmds.fill = "bfb %x %x %x\r"; /* fill (start end val) */
- est_cmds.setmem.cmdb = "smb %x %x\r"; /* setmem.cmdb (addr, value) */
- est_cmds.setmem.cmdw = "smw %x %x\r"; /* setmem.cmdw (addr, value) */
- est_cmds.setmem.cmdl = "sml %x %x\r"; /* setmem.cmdl (addr, value) */
- est_cmds.setmem.cmdll = NULL; /* setmem.cmdll (addr, value) */
- est_cmds.setmem.resp_delim = NULL; /* setreg.resp_delim */
- est_cmds.setmem.term = NULL; /* setreg.term */
- est_cmds.setmem.term_cmd = NULL; /* setreg.term_cmd */
- est_cmds.getmem.cmdb = "dmb %x %x\r"; /* getmem.cmdb (addr, len) */
- est_cmds.getmem.cmdw = "dmw %x %x\r"; /* getmem.cmdw (addr, len) */
- est_cmds.getmem.cmdl = "dml %x %x\r"; /* getmem.cmdl (addr, len) */
- est_cmds.getmem.cmdll = NULL; /* getmem.cmdll (addr, len) */
- est_cmds.getmem.resp_delim = ": "; /* getmem.resp_delim */
- est_cmds.getmem.term = NULL; /* getmem.term */
- est_cmds.getmem.term_cmd = NULL; /* getmem.term_cmd */
- est_cmds.setreg.cmd = "sr %s %x\r"; /* setreg.cmd (name, value) */
- est_cmds.setreg.resp_delim = NULL; /* setreg.resp_delim */
- est_cmds.setreg.term = NULL; /* setreg.term */
- est_cmds.setreg.term_cmd = NULL; /* setreg.term_cmd */
- est_cmds.getreg.cmd = "dr %s\r"; /* getreg.cmd (name) */
- est_cmds.getreg.resp_delim = " = "; /* getreg.resp_delim */
- est_cmds.getreg.term = NULL; /* getreg.term */
- est_cmds.getreg.term_cmd = NULL; /* getreg.term_cmd */
- est_cmds.dump_registers = "dr\r"; /* dump_registers */
- est_cmds.register_pattern = "\\(\\w+\\) = \\([0-9a-fA-F]+\\)"; /* register_pattern */
- est_cmds.supply_register = est_supply_register;
- est_cmds.load_routine = NULL; /* load_routine (defaults to SRECs) */
- est_cmds.load = "dl\r"; /* download command */
- est_cmds.loadresp = "+"; /* load response */
- est_cmds.prompt = ">BKM>"; /* monitor command prompt */
- est_cmds.line_term = "\r"; /* end-of-line terminator */
- est_cmds.cmd_end = NULL; /* optional command terminator */
- est_cmds.target = &est_ops; /* target operations */
- est_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
- est_cmds.regnames = NULL;
- est_cmds.regname = est_regname; /*register names*/
- est_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
-} /* init_est_cmds */
-
-static void
-est_open (char *args, int from_tty)
-{
- monitor_open (args, &est_cmds, from_tty);
-}
-
-extern initialize_file_ftype _initialize_est; /* -Wmissing-prototypes */
-
-void
-_initialize_est (void)
-{
- init_est_cmds ();
- init_monitor_ops (&est_ops);
-
- est_ops.to_shortname = "est";
- est_ops.to_longname = "EST background debug monitor";
- est_ops.to_doc = "Debug via the EST BDM.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
- est_ops.to_open = est_open;
-
- add_target (&est_ops);
-}
diff --git a/gdb/rom68k-rom.c b/gdb/rom68k-rom.c
deleted file mode 100644
index 2b729e6..0000000
--- a/gdb/rom68k-rom.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/* Remote target glue for the ROM68K ROM monitor.
- Copyright (C) 1988, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001,
- 2007 Free Software Foundation, Inc.
-
- 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
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
-
-#include "defs.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "monitor.h"
-#include "serial.h"
-#include "regcache.h"
-#include "value.h"
-
-#include "m68k-tdep.h"
-
-static void rom68k_open (char *args, int from_tty);
-
-/* Return true if C is a hex digit.
- We can't use isxdigit here: that is affected by the current locale;
- ROM68K is not. */
-static int
-is_hex_digit (int c)
-{
- return (('0' <= c && c <= '9')
- || ('a' <= c && c <= 'f')
- || ('A' <= c && c <= 'F'));
-}
-
-
-/* Convert hex digit A to a number. */
-static int
-hex_digit_value (int a)
-{
- if (a >= '0' && a <= '9')
- return a - '0';
- else if (a >= 'a' && a <= 'f')
- return a - 'a' + 10;
- else if (a >= 'A' && a <= 'F')
- return a - 'A' + 10;
- else
- error (_("Invalid hex digit %d"), a);
-}
-
-
-/* Return true iff C is a whitespace character.
- We can't use isspace here: that is affected by the current locale;
- ROM68K is not. */
-static int
-is_whitespace (int c)
-{
- return (c == ' '
- || c == '\r'
- || c == '\n'
- || c == '\t'
- || c == '\f');
-}
-
-
-/* Parse a string of hex digits starting at HEX, supply them as the
- value of register REGNO, skip any whitespace, and return a pointer
- to the next character.
-
- There is a function in monitor.c, monitor_supply_register, which is
- supposed to do this job. However, there is some rather odd stuff
- in there (whitespace characters don't terminate numbers, for
- example) that is incorrect for ROM68k. It's basically impossible
- to safely tweak monitor_supply_register --- it's used by a zillion
- other monitors; who knows what behaviors they're depending on. So
- instead, we'll just use our own function, which can behave exactly
- the way we want it to. */
-static char *
-rom68k_supply_one_register (int regno, unsigned char *hex)
-{
- ULONGEST value;
- unsigned char regbuf[MAX_REGISTER_SIZE];
-
- value = 0;
- while (*hex != '\0')
- if (is_hex_digit (*hex))
- value = (value * 16) + hex_digit_value (*hex++);
- else
- break;
-
- /* Skip any whitespace. */
- while (is_whitespace (*hex))
- hex++;
-
- store_unsigned_integer (regbuf, register_size (current_gdbarch, regno), value);
- regcache_raw_supply (current_regcache, regno, regbuf);
-
- return hex;
-}
-
-
-static void
-rom68k_supply_register (char *regname, int regnamelen, char *val, int vallen)
-{
- int numregs;
- int regno;
-
- numregs = 1;
- regno = -1;
-
- if (regnamelen == 2)
- switch (regname[0])
- {
- case 'S':
- if (regname[1] == 'R')
- regno = PS_REGNUM;
- break;
- case 'P':
- if (regname[1] == 'C')
- regno = PC_REGNUM;
- break;
- case 'D':
- if (regname[1] != 'R')
- break;
- regno = M68K_D0_REGNUM;
- numregs = 8;
- break;
- case 'A':
- if (regname[1] != 'R')
- break;
- regno = M68K_A0_REGNUM;
- numregs = 7;
- break;
- }
- else if (regnamelen == 3)
- switch (regname[0])
- {
- case 'I':
- if (regname[1] == 'S' && regname[2] == 'P')
- regno = SP_REGNUM;
- }
-
- if (regno >= 0)
- while (numregs-- > 0)
- val = rom68k_supply_one_register (regno++, val);
-}
-
-/* This array of registers need to match the indexes used by GDB.
- This exists because the various ROM monitors use different strings
- than does GDB, and don't necessarily support all the registers
- either. So, typing "info reg sp" becomes a "r30". */
-
-static const char *
-rom68k_regname (int index)
-{
-
- static char *regnames[] =
- {
- "D0", "D1", "D2", "D3", "D4", "D5", "D6", "D7",
- "A0", "A1", "A2", "A3", "A4", "A5", "A6", "ISP",
- "SR", "PC"
- };
-
- if ((index >= (sizeof (regnames) / sizeof(regnames[0])))
- || (index < 0) || (index >= NUM_REGS))
- return NULL;
- else
- return regnames[index];
-
-}
-
-/* Define the monitor command strings. Since these are passed directly
- through to a printf style function, we may include formatting
- strings. We also need a CR or LF on the end. */
-
-static struct target_ops rom68k_ops;
-
-static char *rom68k_inits[] =
-{".\r\r", NULL}; /* Exits pm/pr & download cmds */
-
-static struct monitor_ops rom68k_cmds;
-
-static void
-init_rom68k_cmds (void)
-{
- rom68k_cmds.flags = MO_PRINT_PROGRAM_OUTPUT;
- rom68k_cmds.init = rom68k_inits; /* monitor init string */
- rom68k_cmds.cont = "go\r";
- rom68k_cmds.step = "st\r";
- rom68k_cmds.stop = NULL;
- rom68k_cmds.set_break = "db %x\r";
- rom68k_cmds.clr_break = "cb %x\r";
- rom68k_cmds.clr_all_break = "cb *\r";
- rom68k_cmds.fill = "fm %x %x %x\r";
- rom68k_cmds.setmem.cmdb = "pm %x %x\r";
- rom68k_cmds.setmem.cmdw = "pm.w %x %x\r";
- rom68k_cmds.setmem.cmdl = "pm.l %x %x\r";
- rom68k_cmds.setmem.cmdll = NULL;
- rom68k_cmds.setmem.resp_delim = NULL;
- rom68k_cmds.setmem.term = NULL;
- rom68k_cmds.setmem.term_cmd = NULL;
- rom68k_cmds.getmem.cmdb = "dm %x %x\r";
- rom68k_cmds.getmem.cmdw = "dm.w %x %x\r";
- rom68k_cmds.getmem.cmdl = "dm.l %x %x\r";
- rom68k_cmds.getmem.cmdll = NULL;
- rom68k_cmds.getmem.resp_delim = " ";
- rom68k_cmds.getmem.term = NULL;
- rom68k_cmds.getmem.term_cmd = NULL;
- rom68k_cmds.setreg.cmd = "pr %s %x\r";
- rom68k_cmds.setreg.resp_delim = NULL;
- rom68k_cmds.setreg.term = NULL;
- rom68k_cmds.setreg.term_cmd = NULL;
- rom68k_cmds.getreg.cmd = "pr %s\r";
- rom68k_cmds.getreg.resp_delim = ": ";
- rom68k_cmds.getreg.term = "= ";
- rom68k_cmds.getreg.term_cmd = ".\r";
- rom68k_cmds.dump_registers = "dr\r";
- rom68k_cmds.register_pattern =
- "\\(\\w+\\)=\\([0-9a-fA-F]+\\( +[0-9a-fA-F]+\\b\\)*\\)";
- rom68k_cmds.supply_register = rom68k_supply_register;
- rom68k_cmds.load_routine = NULL;
- rom68k_cmds.load = "dc\r";
- rom68k_cmds.loadresp = "Waiting for S-records from host... ";
- rom68k_cmds.prompt = "ROM68K :-> ";
- rom68k_cmds.line_term = "\r";
- rom68k_cmds.cmd_end = ".\r";
- rom68k_cmds.target = &rom68k_ops;
- rom68k_cmds.stopbits = SERIAL_1_STOPBITS;
- rom68k_cmds.regnames = NULL;
- rom68k_cmds.regname = rom68k_regname;
- rom68k_cmds.magic = MONITOR_OPS_MAGIC;
-} /* init_rom68k_cmds */
-
-static void
-rom68k_open (char *args, int from_tty)
-{
- monitor_open (args, &rom68k_cmds, from_tty);
-}
-
-extern initialize_file_ftype _initialize_rom68k; /* -Wmissing-prototypes */
-
-void
-_initialize_rom68k (void)
-{
- init_rom68k_cmds ();
- init_monitor_ops (&rom68k_ops);
-
- rom68k_ops.to_shortname = "rom68k";
- rom68k_ops.to_longname = "Rom68k debug monitor for the IDP Eval board";
- rom68k_ops.to_doc = "Debug on a Motorola IDP eval board running the ROM68K monitor.\n\
-Specify the serial device it is connected to (e.g. /dev/ttya).";
- rom68k_ops.to_open = rom68k_open;
-
- add_target (&rom68k_ops);
-}
diff --git a/gdb/symfile.h b/gdb/symfile.h
index 2737191..baf61be 100644
--- a/gdb/symfile.h
+++ b/gdb/symfile.h
@@ -318,11 +318,6 @@ extern void symbol_file_clear (int from_tty);
extern bfd_byte *symfile_relocate_debug_section (bfd *abfd, asection *sectp,
bfd_byte * buf);
-/* From dwarfread.c */
-
-extern void dwarf_build_psymtabs (struct objfile *, int, file_ptr,
- unsigned int, file_ptr, unsigned int);
-
/* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 74d754d..d8fa977 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+ * gdb.asm/asm-source.exp: Remove d10v case.
+ * lib/gdb.exp (skip_cplus_tests): Likewise.
+ * gdb.asm/d10v.inc: Deleted.
+
+2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
+
* gdb.base/infnan.c, gdb.base/infnan.exp: New files.
2007-03-30 Daniel Jacobowitz <dan@codesourcery.com>
diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp
index 4c6319c..85d8234 100644
--- a/gdb/testsuite/gdb.asm/asm-source.exp
+++ b/gdb/testsuite/gdb.asm/asm-source.exp
@@ -52,9 +52,6 @@ switch -glob -- [istarget] {
"xscale-*-*" {
set asm-arch arm
}
- "d10v-*-*" {
- set asm-arch d10v
- }
"frv-*-*" {
set asm-arch frv
}
diff --git a/gdb/testsuite/gdb.asm/d10v.inc b/gdb/testsuite/gdb.asm/d10v.inc
deleted file mode 100644
index bd9463f..0000000
--- a/gdb/testsuite/gdb.asm/d10v.inc
+++ /dev/null
@@ -1,55 +0,0 @@
- comment "subroutine prologue"
- .macro gdbasm_enter
- st r11,@-sp
- st r13,@-sp
- mv r11,sp
- .endm
-
- comment "subroutine epilogue"
- .macro gdbasm_leave
- add3 sp,r11,0
- ld r13,@sp+
- ld r11,@sp+
- jmp r13
- .endm
-
- .macro gdbasm_call subr
- bl \subr
- .endm
-
- .macro gdbasm_several_nops
- nop
- nop
- nop
- nop
- .endm
-
- comment "exit (0)"
- .macro gdbasm_exit0
- ldi r4, 1
- ldi r0, 0
- trap 15
- .endm
-
- comment "crt0 startup"
- .macro gdbasm_startup
-; R14 always contains memory base address (0)
-
- ldi r14,0
-
-; Set the USER and SYSTEM stack pointers.
-
- ldi r0, 0 ; zero arguments
- ldi r1, 0
- mvtc r0, psw ; select SPI and set it
- ldi sp, _stack
- ldi r10, 0x8000 ; select SPU/FP and set it
- mvtc r10, psw || ldi r11, 0; clear stack frame
- ldi sp, _stack - 0x200
- ldi r13, 0
-
- st r11, @-sp
- st r13, @-sp
-; mv r11, sp
-
- .endm
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 4cf763d..5493a5c 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -1191,9 +1191,6 @@ proc default_gdb_start { } {
# test C++.
proc skip_cplus_tests {} {
- if { [istarget "d10v-*-*"] } {
- return 1
- }
if { [istarget "h8300-*-*"] } {
return 1
}