2004-11-13 Andrew Cagney <cagney@gnu.org>
* NEWS: List h8300*-*-*, mcore-*-*, mn10300-*-*, ns32k-*-*, and v850-*-* under removed. * configure.host: Delete ns32k-*-netbsd*. * configure.tgt: Delete h8300-*-*, mcore*-*-*, mn10300-*-*, ns32k-*-netbsd*, and v850*-*-*. * MAINTAINERS: Mark h8300, mcore, mn10300, ns32k, v850 as "Deleted" * config/h8300/tm-h8300.h, config/h8300/h8300.mt: Delete. * h8300-tdep.c, config/mcore/mcore.mt, mcore-rom.c: Delete. * mcore-tdep.c, config/mn10300/mn10300.mt: Delete. * mn10300-tdep.c, config/ns32k/nbsdaout.mh: Delete. * config/ns32k/nbsdaout.mt, config/ns32k/nm-nbsd.h: Delete. * config/ns32k/nm-nbsdaout.h, config/ns32k/tm-ns32k.h: Delete. * ns32knbsd-nat.c, ns32knbsd-tdep.c, ns32k-tdep.c: Delete. * ns32k-tdep.h, config/v850/v850.mt, v850ice.c: Delete. * v850-tdep.c: Delete.
This commit is contained in:
parent
e3ab723477
commit
9445aa303f
|
@ -1,3 +1,22 @@
|
||||||
|
2004-11-13 Andrew Cagney <cagney@gnu.org>
|
||||||
|
|
||||||
|
* NEWS: List h8300*-*-*, mcore-*-*, mn10300-*-*, ns32k-*-*, and
|
||||||
|
v850-*-* under removed.
|
||||||
|
* configure.host: Delete ns32k-*-netbsd*.
|
||||||
|
* configure.tgt: Delete h8300-*-*, mcore*-*-*, mn10300-*-*,
|
||||||
|
ns32k-*-netbsd*, and v850*-*-*.
|
||||||
|
* MAINTAINERS: Mark h8300, mcore, mn10300, ns32k, v850 as
|
||||||
|
"Deleted"
|
||||||
|
* config/h8300/tm-h8300.h, config/h8300/h8300.mt: Delete.
|
||||||
|
* h8300-tdep.c, config/mcore/mcore.mt, mcore-rom.c: Delete.
|
||||||
|
* mcore-tdep.c, config/mn10300/mn10300.mt: Delete.
|
||||||
|
* mn10300-tdep.c, config/ns32k/nbsdaout.mh: Delete.
|
||||||
|
* config/ns32k/nbsdaout.mt, config/ns32k/nm-nbsd.h: Delete.
|
||||||
|
* config/ns32k/nm-nbsdaout.h, config/ns32k/tm-ns32k.h: Delete.
|
||||||
|
* ns32knbsd-nat.c, ns32knbsd-tdep.c, ns32k-tdep.c: Delete.
|
||||||
|
* ns32k-tdep.h, config/v850/v850.mt, v850ice.c: Delete.
|
||||||
|
* v850-tdep.c: Delete.
|
||||||
|
|
||||||
2004-11-13 Joel Brobecker <brobecker@gnat.com>
|
2004-11-13 Joel Brobecker <brobecker@gnat.com>
|
||||||
|
|
||||||
* irix5-nat.c (fetch_core_registers): Replace use of
|
* irix5-nat.c (fetch_core_registers): Replace use of
|
||||||
|
|
|
@ -73,8 +73,7 @@ maintainer works with the native maintainer when resolving API issues.
|
||||||
frv --target=frv-elf ,-Werror
|
frv --target=frv-elf ,-Werror
|
||||||
Maintenance only
|
Maintenance only
|
||||||
|
|
||||||
h8300 --target=h8300hms broken
|
h8300 Deleted
|
||||||
Maintenance only
|
|
||||||
|
|
||||||
i386 --target=i386-elf ,-Werror
|
i386 --target=i386-elf ,-Werror
|
||||||
Mark Kettenis kettenis@gnu.org
|
Mark Kettenis kettenis@gnu.org
|
||||||
|
@ -94,17 +93,14 @@ maintainer works with the native maintainer when resolving API issues.
|
||||||
m88k --target=m88k-openbsd ,-Werror
|
m88k --target=m88k-openbsd ,-Werror
|
||||||
Mark Kettenis kettenis@gnu.org
|
Mark Kettenis kettenis@gnu.org
|
||||||
|
|
||||||
mcore --target=mcore-elf broken
|
mcore Deleted
|
||||||
Maintenance only
|
|
||||||
|
|
||||||
mips --target=mips-elf ,-Werror
|
mips --target=mips-elf ,-Werror
|
||||||
Andrew Cagney cagney@redhat.com
|
Andrew Cagney cagney@redhat.com
|
||||||
|
|
||||||
mn10300 --target=mn10300-elf broken
|
mn10300 Deleted
|
||||||
Maintenance only
|
|
||||||
|
|
||||||
ns32k --target=ns32k-netbsd broken
|
ns32k Deleted
|
||||||
Maintenance only
|
|
||||||
|
|
||||||
pa --target=hppa-elf ,-Werror
|
pa --target=hppa-elf ,-Werror
|
||||||
Maintenance only
|
Maintenance only
|
||||||
|
@ -122,8 +118,7 @@ maintainer works with the native maintainer when resolving API issues.
|
||||||
sparc --target=sparc-elf ,-Werror
|
sparc --target=sparc-elf ,-Werror
|
||||||
Maintenance only
|
Maintenance only
|
||||||
|
|
||||||
v850 --target=v850-elf broken
|
v850 Deleted
|
||||||
Maintenance only
|
|
||||||
|
|
||||||
vax --target=vax-netbsd ,-Werror
|
vax --target=vax-netbsd ,-Werror
|
||||||
Maintenance only
|
Maintenance only
|
||||||
|
|
5
gdb/NEWS
5
gdb/NEWS
|
@ -6,6 +6,11 @@
|
||||||
* REMOVED configurations and files
|
* REMOVED configurations and files
|
||||||
|
|
||||||
VxWorks and the XDR protocol *-*-vxworks
|
VxWorks and the XDR protocol *-*-vxworks
|
||||||
|
Renesas H8/300S h8300*-*-*
|
||||||
|
Motorola MCORE mcore-*-*
|
||||||
|
Matsushita MN10300 w/simulator mn10300-*-*
|
||||||
|
National Semiconductor NS32000 ns32k-*-*
|
||||||
|
NEC V850 v850-*-*
|
||||||
|
|
||||||
*** Changes in GDB 6.3:
|
*** Changes in GDB 6.3:
|
||||||
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
# Target: H8300 with HMS monitor, E7000 ICE and H8 simulator
|
|
||||||
TDEPFILES= h8300-tdep.o remote-e7000.o ser-e7kpc.o monitor.o remote-hms.o dsrec.o
|
|
||||||
DEPRECATED_TM_FILE= tm-h8300.h
|
|
||||||
|
|
||||||
SIM_OBS = remote-sim.o
|
|
||||||
SIM = ../sim/h8300/libsim.a
|
|
|
@ -1,32 +0,0 @@
|
||||||
/* Parameters for execution on a H8/300 series machine.
|
|
||||||
Copyright 1992, 1993, 1994, 1996, 1998, 1999, 2000
|
|
||||||
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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
/* Contributed by Steve Chamberlain sac@cygnus.com */
|
|
||||||
|
|
||||||
/* Needed for remote.c */
|
|
||||||
#define DEPRECATED_REMOTE_BREAKPOINT { 0x57, 0x30} /* trapa #3 */
|
|
||||||
/* Needed for remote-hms.c */
|
|
||||||
#define CCR_REGNUM 8
|
|
||||||
/* Needed for remote-e7000.c */
|
|
||||||
#define NUM_REALREGS ((TARGET_ARCHITECTURE->mach == bfd_mach_h8300s || \
|
|
||||||
TARGET_ARCHITECTURE->mach == bfd_mach_h8300sn || \
|
|
||||||
TARGET_ARCHITECTURE->mach == bfd_mach_h8300sx || \
|
|
||||||
TARGET_ARCHITECTURE->mach == bfd_mach_h8300sxn) ? 11 : 10)
|
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Target: Motorola MCore processor
|
|
||||||
TDEPFILES= mcore-tdep.o mcore-rom.o monitor.o dsrec.o
|
|
||||||
SIM_OBS = remote-sim.o
|
|
||||||
SIM = ../sim/mcore/libsim.a
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Target: Matsushita mn10300
|
|
||||||
TDEPFILES= mn10300-tdep.o
|
|
||||||
SIM_OBS = remote-sim.o
|
|
||||||
SIM = ../sim/mn10300/libsim.a
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Host: PC532 running NetBSD
|
|
||||||
NATDEPFILES= fork-child.o infptrace.o inftarg.o corelow.o ns32knbsd-nat.o \
|
|
||||||
solib.o solib-sunos.o
|
|
||||||
NAT_FILE= nm-nbsdaout.h
|
|
|
@ -1,3 +0,0 @@
|
||||||
# Target: PC532 running NetBSD
|
|
||||||
TDEPFILES= ns32k-tdep.o ns32knbsd-tdep.o
|
|
||||||
DEPRECATED_TM_FILE= tm-ns32k.h
|
|
|
@ -1,33 +0,0 @@
|
||||||
/* Native-dependent definitions for ns32k running NetBSD, for GDB.
|
|
||||||
Copyright 1986, 1987, 1989, 1992, 1994, 2000
|
|
||||||
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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifndef NM_NBSD_H
|
|
||||||
#define NM_NBSD_H
|
|
||||||
|
|
||||||
/* Get generic NetBSD native definitions. */
|
|
||||||
#include "config/nm-nbsd.h"
|
|
||||||
|
|
||||||
#define REGISTER_U_ADDR(addr, blockend, regno) \
|
|
||||||
(addr) = ns32k_register_u_addr ((blockend),(regno));
|
|
||||||
|
|
||||||
extern int ns32k_register_u_addr (int, int);
|
|
||||||
|
|
||||||
#endif /* NM_NBSD_H */
|
|
|
@ -1,30 +0,0 @@
|
||||||
/* Native-dependent definitions for ns32k running NetBSD, for GDB.
|
|
||||||
Copyright 1986, 1987, 1989, 1992, 1994, 2000, 2002
|
|
||||||
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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifndef NM_NBSDAOUT_H
|
|
||||||
#define NM_NBSDAOUT_H
|
|
||||||
|
|
||||||
#include "ns32k/nm-nbsd.h"
|
|
||||||
|
|
||||||
/* Get generic NetBSD native definitions. */
|
|
||||||
#include "config/nm-nbsdaout.h"
|
|
||||||
|
|
||||||
#endif /* NM_NBSDAOUT_H */
|
|
|
@ -1,35 +0,0 @@
|
||||||
/* Definitions to make GDB run on an encore under umax 4.2
|
|
||||||
Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 2002
|
|
||||||
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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifndef TM_NS32K_H
|
|
||||||
#define TM_NS32K_H
|
|
||||||
|
|
||||||
/* Need to get function ends by adding this to epilogue address from .bf
|
|
||||||
record, not using x_fsize field. */
|
|
||||||
#define FUNCTION_EPILOGUE_SIZE 4
|
|
||||||
|
|
||||||
/* Address of end of stack space. */
|
|
||||||
|
|
||||||
#ifndef STACK_END_ADDR
|
|
||||||
#define STACK_END_ADDR (0xfffff000)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* TM_NS32K_H */
|
|
|
@ -1,4 +0,0 @@
|
||||||
# Target: NEC V850 processor
|
|
||||||
TDEPFILES= v850-tdep.o
|
|
||||||
SIM_OBS = remote-sim.o
|
|
||||||
SIM = ../sim/v850/libsim.a
|
|
|
@ -106,8 +106,6 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
|
||||||
gdb_host=nbsd ;;
|
gdb_host=nbsd ;;
|
||||||
mips64*-*-openbsd*) gdb_host=obsd64 ;;
|
mips64*-*-openbsd*) gdb_host=obsd64 ;;
|
||||||
|
|
||||||
ns32k-*-netbsd*) gdb_host=nbsdaout ;;
|
|
||||||
|
|
||||||
powerpc-*-aix*) gdb_host=aix ;;
|
powerpc-*-aix*) gdb_host=aix ;;
|
||||||
powerpc-*-linux*) gdb_host=linux ;;
|
powerpc-*-linux*) gdb_host=linux ;;
|
||||||
powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
|
powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
|
||||||
|
|
|
@ -28,7 +28,6 @@ s390*) gdb_target_cpu=s390 ;;
|
||||||
sh*) gdb_target_cpu=sh ;;
|
sh*) gdb_target_cpu=sh ;;
|
||||||
strongarm*) gdb_target_cpu=arm ;;
|
strongarm*) gdb_target_cpu=arm ;;
|
||||||
xscale*) gdb_target_cpu=arm ;;
|
xscale*) gdb_target_cpu=arm ;;
|
||||||
v850*) gdb_target_cpu=v850 ;;
|
|
||||||
x86_64*) gdb_target_cpu=i386 ;;
|
x86_64*) gdb_target_cpu=i386 ;;
|
||||||
*) gdb_target_cpu=$target_cpu ;;
|
*) gdb_target_cpu=$target_cpu ;;
|
||||||
|
|
||||||
|
@ -71,9 +70,6 @@ cris*) gdb_target=cris ;;
|
||||||
|
|
||||||
# OBSOLETE d10v-*-*) gdb_target=d10v ;;
|
# OBSOLETE d10v-*-*) gdb_target=d10v ;;
|
||||||
|
|
||||||
h8300-*-*) gdb_target=h8300 ;;
|
|
||||||
|
|
||||||
|
|
||||||
frv-*-*) gdb_target=frv ;;
|
frv-*-*) gdb_target=frv ;;
|
||||||
|
|
||||||
hppa*64*-*-hpux11*) gdb_target=hppa64 ;;
|
hppa*64*-*-hpux11*) gdb_target=hppa64 ;;
|
||||||
|
@ -127,8 +123,6 @@ m68*-*-uclinux*) gdb_target=monitor ;;
|
||||||
|
|
||||||
m88*-*-openbsd*) gdb_target=obsd ;;
|
m88*-*-openbsd*) gdb_target=obsd ;;
|
||||||
|
|
||||||
mcore*-*-*) gdb_target=mcore ;;
|
|
||||||
|
|
||||||
mips*-*-pe) gdb_target=wince ;;
|
mips*-*-pe) gdb_target=wince ;;
|
||||||
mips*-sgi-irix5*) gdb_target=irix5 ;;
|
mips*-sgi-irix5*) gdb_target=irix5 ;;
|
||||||
mips*-sgi-irix6*) gdb_target=irix6 ;;
|
mips*-sgi-irix6*) gdb_target=irix6 ;;
|
||||||
|
@ -140,10 +134,6 @@ mips*-*-netbsd* | mips*-*-knetbsd*-gnu)
|
||||||
mips64*-*-openbsd*) gdb_target=obsd64 ;;
|
mips64*-*-openbsd*) gdb_target=obsd64 ;;
|
||||||
mips*-*-*) gdb_target=embed ;;
|
mips*-*-*) gdb_target=embed ;;
|
||||||
|
|
||||||
mn10300-*-*) gdb_target=mn10300 ;;
|
|
||||||
|
|
||||||
ns32k-*-netbsd*) gdb_target=nbsdaout ;;
|
|
||||||
|
|
||||||
powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
|
powerpc-*-netbsd* | powerpc-*-knetbsd*-gnu)
|
||||||
gdb_target=nbsd ;;
|
gdb_target=nbsd ;;
|
||||||
powerpc-*-openbsd*) gdb_target=obsd ;;
|
powerpc-*-openbsd*) gdb_target=obsd ;;
|
||||||
|
@ -202,14 +192,6 @@ vax-*-netbsd* | vax-*-knetbsd*-gnu)
|
||||||
vax-*-openbsd*) gdb_target=nbsd ;;
|
vax-*-openbsd*) gdb_target=nbsd ;;
|
||||||
vax-*-*) gdb_target=vax ;;
|
vax-*-*) gdb_target=vax ;;
|
||||||
|
|
||||||
v850*-*-*) gdb_target=v850
|
|
||||||
case ${gdb_host} in
|
|
||||||
cygwin*)
|
|
||||||
CONFIG_OBS="${CONFIG_OBS} v850ice.o" ;;
|
|
||||||
* ) ;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
|
|
||||||
x86_64-*-linux*) gdb_target=linux64
|
x86_64-*-linux*) gdb_target=linux64
|
||||||
build_gdbserver=yes
|
build_gdbserver=yes
|
||||||
;;
|
;;
|
||||||
|
|
1383
gdb/h8300-tdep.c
1383
gdb/h8300-tdep.c
File diff suppressed because it is too large
Load Diff
208
gdb/mcore-rom.c
208
gdb/mcore-rom.c
|
@ -1,208 +0,0 @@
|
||||||
/* Remote debugging interface to Motorola picobug monitor for gdb,
|
|
||||||
the GNU debugger.
|
|
||||||
Copyright 1999, 2000, 2001 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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "gdbcore.h"
|
|
||||||
#include "target.h"
|
|
||||||
#include "monitor.h"
|
|
||||||
#include "gdb_string.h"
|
|
||||||
#include "regcache.h"
|
|
||||||
#include "serial.h"
|
|
||||||
|
|
||||||
/* Functions used only in this file. */
|
|
||||||
|
|
||||||
static void init_picobug_cmds (void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Functions exported from this file. */
|
|
||||||
|
|
||||||
void _initialize_picobug_rom (void);
|
|
||||||
|
|
||||||
void picobug_open (char *args, int from_tty);
|
|
||||||
|
|
||||||
int picobug_dumpregs (void);
|
|
||||||
|
|
||||||
|
|
||||||
static char *picobug_inits[] =
|
|
||||||
{"\r", NULL};
|
|
||||||
|
|
||||||
static struct target_ops picobug_ops;
|
|
||||||
static struct monitor_ops picobug_cmds;
|
|
||||||
|
|
||||||
/* Picobug only supports a subset of registers from MCore. In reality,
|
|
||||||
it doesn't support ss1, either. */
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
static char *picobug_regnames[] = {
|
|
||||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
||||||
"r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15",
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
"psr", "vbr", "epsr", "fpsr", "epc", "fpc", 0, "ss1",
|
|
||||||
"ss2", "ss3", "ss4", 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
0, 0, 0, 0, 0, 0, 0, 0,
|
|
||||||
"pc" };
|
|
||||||
/* *INDENT-ON* */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
picobug_open (char *args, int from_tty)
|
|
||||||
{
|
|
||||||
monitor_open (args, &picobug_cmds, from_tty);
|
|
||||||
}
|
|
||||||
/* *INDENT-OFF* */
|
|
||||||
/* We choose to write our own dumpregs routine, since the output of
|
|
||||||
the register dumping is rather difficult to encapsulate in a
|
|
||||||
regexp:
|
|
||||||
|
|
||||||
picobug> rd
|
|
||||||
pc 2f00031e epc 2f00031e fpc 00000000
|
|
||||||
psr 80000101 epsr 80000101 fpsr 00000000
|
|
||||||
ss0-ss4 bad0beef 00000000 00000000 00000000 00000000 vbr 30005c00
|
|
||||||
r0-r7 2f0fff4c 00000090 00000001 00000002 00000003 00000004 00000005 00000006
|
|
||||||
r8-r15 2f0fff64 00000000 00000000 00000000 00000000 00000000 00000000 2f00031e */
|
|
||||||
/* *INDENT-ON* */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
picobug_dumpregs (void)
|
|
||||||
{
|
|
||||||
char buf[1024];
|
|
||||||
int resp_len;
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
/* Send the dump register command to the monitor and
|
|
||||||
get the reply. */
|
|
||||||
monitor_printf (picobug_cmds.dump_registers);
|
|
||||||
resp_len = monitor_expect_prompt (buf, sizeof (buf));
|
|
||||||
|
|
||||||
p = strtok (buf, " \t\r\n");
|
|
||||||
while (p)
|
|
||||||
{
|
|
||||||
if (strchr (p, '-'))
|
|
||||||
{
|
|
||||||
/* got a range. either r0-r7, r8-r15 or ss0-ss4 */
|
|
||||||
if (DEPRECATED_STREQN (p, "r0", 2) || DEPRECATED_STREQN (p, "r8", 2))
|
|
||||||
{
|
|
||||||
int rn = (p[1] == '0' ? 0 : 8);
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
/* Get the next 8 values and record them. */
|
|
||||||
while (i < 8)
|
|
||||||
{
|
|
||||||
p = strtok (NULL, " \t\r\n");
|
|
||||||
if (p)
|
|
||||||
monitor_supply_register (rn + i, p);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (DEPRECATED_STREQN (p, "ss", 2))
|
|
||||||
{
|
|
||||||
/* get the next five values, ignoring the first */
|
|
||||||
int rn;
|
|
||||||
p = strtok (NULL, " \t\r\n");
|
|
||||||
for (rn = 39; rn < 43; rn++)
|
|
||||||
{
|
|
||||||
p = strtok (NULL, " \t\r\n");
|
|
||||||
if (p)
|
|
||||||
monitor_supply_register (rn, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* Simple register type, paired */
|
|
||||||
char *name = p;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Get and record value */
|
|
||||||
p = strtok (NULL, " \t\r\n");
|
|
||||||
if (p)
|
|
||||||
{
|
|
||||||
for (i = 0; i < NUM_REGS; i++)
|
|
||||||
{
|
|
||||||
if (picobug_regnames[i] && DEPRECATED_STREQ (picobug_regnames[i], name))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i <= NUM_REGS)
|
|
||||||
monitor_supply_register (i, p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
p = strtok (NULL, " \t\r\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_picobug_cmds (void)
|
|
||||||
{
|
|
||||||
picobug_cmds.flags = MO_GETMEM_NEEDS_RANGE | MO_CLR_BREAK_USES_ADDR | MO_PRINT_PROGRAM_OUTPUT;
|
|
||||||
|
|
||||||
picobug_cmds.init = picobug_inits; /* Init strings */
|
|
||||||
picobug_cmds.cont = "g\n"; /* continue command */
|
|
||||||
picobug_cmds.step = "s\n"; /* single step */
|
|
||||||
picobug_cmds.set_break = "br %x\n"; /* set a breakpoint */
|
|
||||||
picobug_cmds.clr_break = "nobr %x\n"; /* clear a breakpoint */
|
|
||||||
picobug_cmds.clr_all_break = "nobr\n"; /* clear all breakpoints */
|
|
||||||
picobug_cmds.setmem.cmdb = "mm %x %x ;b\n"; /* setmem.cmdb (addr, value) */
|
|
||||||
picobug_cmds.setmem.cmdw = "mm %x %x ;h\n"; /* setmem.cmdw (addr, value) */
|
|
||||||
picobug_cmds.setmem.cmdl = "mm %x %x ;w\n"; /* setmem.cmdl (addr, value) */
|
|
||||||
picobug_cmds.getmem.cmdb = "md %x %x\n"; /* getmem.cmdb (start addr, end addr) */
|
|
||||||
picobug_cmds.getmem.resp_delim = ":"; /* getmem.resp_delim */
|
|
||||||
picobug_cmds.setreg.cmd = "rm %s %x\n"; /* setreg.cmd (name, value) */
|
|
||||||
picobug_cmds.getreg.cmd = "rd %s\n"; /* getreg.cmd (name) */
|
|
||||||
picobug_cmds.getreg.resp_delim = ":"; /* getreg.resp_delim */
|
|
||||||
picobug_cmds.dump_registers = "rd\n"; /* dump_registers */
|
|
||||||
picobug_cmds.dumpregs = picobug_dumpregs; /* dump registers parser */
|
|
||||||
picobug_cmds.load = "lo\n"; /* download command */
|
|
||||||
picobug_cmds.prompt = "picobug> "; /* monitor command prompt */
|
|
||||||
picobug_cmds.line_term = "\n"; /* end-of-line terminator */
|
|
||||||
picobug_cmds.target = &picobug_ops; /* target operations */
|
|
||||||
picobug_cmds.stopbits = SERIAL_1_STOPBITS; /* number of stop bits */
|
|
||||||
picobug_cmds.regnames = picobug_regnames; /* registers names */
|
|
||||||
picobug_cmds.num_breakpoints = 20; /* number of breakpoints */
|
|
||||||
picobug_cmds.magic = MONITOR_OPS_MAGIC; /* magic */
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_picobug_rom (void)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Initialize m32r RevC monitor target */
|
|
||||||
init_picobug_cmds ();
|
|
||||||
init_monitor_ops (&picobug_ops);
|
|
||||||
picobug_ops.to_shortname = "picobug";
|
|
||||||
picobug_ops.to_longname = "picobug monitor";
|
|
||||||
picobug_ops.to_doc = "Debug via the picobug monitor.\n\
|
|
||||||
Specify the serial device it is connected to (e.g. /dev/ttya).";
|
|
||||||
picobug_ops.to_open = picobug_open;
|
|
||||||
|
|
||||||
add_target (&picobug_ops);
|
|
||||||
}
|
|
1111
gdb/mcore-tdep.c
1111
gdb/mcore-tdep.c
File diff suppressed because it is too large
Load Diff
|
@ -1,505 +0,0 @@
|
||||||
/* Target-dependent code for the Matsushita MN10300 for GDB, the GNU debugger.
|
|
||||||
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
/* MVS Notes:
|
|
||||||
|
|
||||||
To get from 1.1 to 1.2, add:
|
|
||||||
use_struct_convention
|
|
||||||
store_return_value
|
|
||||||
extract_return_value
|
|
||||||
extract_struct_value_address
|
|
||||||
|
|
||||||
Make sure to use regcache. */
|
|
||||||
|
|
||||||
/* MVS Notes:
|
|
||||||
|
|
||||||
Apparently cannot run without a stub placeholder for unwind_dummy_id.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* MVS Notes:
|
|
||||||
|
|
||||||
To get from 1.2 to 1.3, add:
|
|
||||||
read_pc, write_pc
|
|
||||||
frame_unwind_init
|
|
||||||
struct mn10300_unwind_cache
|
|
||||||
unwind_pc
|
|
||||||
unwind_dummy_id
|
|
||||||
frame_this_id
|
|
||||||
frame_prev_register
|
|
||||||
frame_sniffer (struct mn10300_frame_unwind)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "arch-utils.h"
|
|
||||||
#include "dis-asm.h"
|
|
||||||
#include "gdbtypes.h"
|
|
||||||
#include "regcache.h"
|
|
||||||
#include "gdb_string.h"
|
|
||||||
#include "gdb_assert.h"
|
|
||||||
#include "frame.h"
|
|
||||||
#include "frame-unwind.h"
|
|
||||||
#include "frame-base.h"
|
|
||||||
#include "trad-frame.h"
|
|
||||||
#include "symtab.h"
|
|
||||||
#include "dwarf2-frame.h"
|
|
||||||
#include "regcache.h"
|
|
||||||
|
|
||||||
enum {
|
|
||||||
E_D0_REGNUM = 0,
|
|
||||||
E_D1_REGNUM = 1,
|
|
||||||
E_D2_REGNUM = 2,
|
|
||||||
E_D3_REGNUM = 3,
|
|
||||||
E_A0_REGNUM = 4,
|
|
||||||
E_A1_REGNUM = 5,
|
|
||||||
E_A2_REGNUM = 6,
|
|
||||||
E_A3_REGNUM = 7,
|
|
||||||
E_SP_REGNUM = 8,
|
|
||||||
E_PC_REGNUM = 9,
|
|
||||||
E_MDR_REGNUM = 10,
|
|
||||||
E_PSW_REGNUM = 11,
|
|
||||||
E_LIR_REGNUM = 12,
|
|
||||||
E_LAR_REGNUM = 13,
|
|
||||||
E_MDRQ_REGNUM = 14,
|
|
||||||
E_E0_REGNUM = 15,
|
|
||||||
E_MCRH_REGNUM = 26,
|
|
||||||
E_MCRL_REGNUM = 27,
|
|
||||||
E_MCVF_REGNUM = 28,
|
|
||||||
E_NUM_REGS = 32
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/* Compute the alignment required by a type. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
mn10300_type_align (struct type *type)
|
|
||||||
{
|
|
||||||
int i, align = 1;
|
|
||||||
|
|
||||||
switch (TYPE_CODE (type))
|
|
||||||
{
|
|
||||||
case TYPE_CODE_INT:
|
|
||||||
case TYPE_CODE_ENUM:
|
|
||||||
case TYPE_CODE_SET:
|
|
||||||
case TYPE_CODE_RANGE:
|
|
||||||
case TYPE_CODE_CHAR:
|
|
||||||
case TYPE_CODE_BOOL:
|
|
||||||
case TYPE_CODE_FLT:
|
|
||||||
case TYPE_CODE_PTR:
|
|
||||||
case TYPE_CODE_REF:
|
|
||||||
return TYPE_LENGTH (type);
|
|
||||||
|
|
||||||
case TYPE_CODE_COMPLEX:
|
|
||||||
return TYPE_LENGTH (type) / 2;
|
|
||||||
|
|
||||||
case TYPE_CODE_STRUCT:
|
|
||||||
case TYPE_CODE_UNION:
|
|
||||||
for (i = 0; i < TYPE_NFIELDS (type); i++)
|
|
||||||
{
|
|
||||||
int falign = mn10300_type_align (TYPE_FIELD_TYPE (type, i));
|
|
||||||
while (align < falign)
|
|
||||||
align <<= 1;
|
|
||||||
}
|
|
||||||
return align;
|
|
||||||
|
|
||||||
case TYPE_CODE_ARRAY:
|
|
||||||
/* HACK! Structures containing arrays, even small ones, are not
|
|
||||||
elligible for returning in registers. */
|
|
||||||
return 256;
|
|
||||||
|
|
||||||
case TYPE_CODE_TYPEDEF:
|
|
||||||
return mn10300_type_align (check_typedef (type));
|
|
||||||
|
|
||||||
default:
|
|
||||||
internal_error (__FILE__, __LINE__, "bad switch");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MVS note this is deprecated. */
|
|
||||||
/* Should call_function allocate stack space for a struct return? */
|
|
||||||
/* gcc_p unused */
|
|
||||||
static int
|
|
||||||
mn10300_use_struct_convention (int gcc_p, struct type *type)
|
|
||||||
{
|
|
||||||
/* Structures bigger than a pair of words can't be returned in
|
|
||||||
registers. */
|
|
||||||
if (TYPE_LENGTH (type) > 8)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
switch (TYPE_CODE (type))
|
|
||||||
{
|
|
||||||
case TYPE_CODE_STRUCT:
|
|
||||||
case TYPE_CODE_UNION:
|
|
||||||
/* Structures with a single field are handled as the field
|
|
||||||
itself. */
|
|
||||||
if (TYPE_NFIELDS (type) == 1)
|
|
||||||
return mn10300_use_struct_convention (gcc_p,
|
|
||||||
TYPE_FIELD_TYPE (type, 0));
|
|
||||||
|
|
||||||
/* Structures with word or double-word size are passed in memory, as
|
|
||||||
long as they require at least word alignment. */
|
|
||||||
if (mn10300_type_align (type) >= 4)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
/* Arrays are addressable, so they're never returned in
|
|
||||||
registers. This condition can only hold when the array is
|
|
||||||
the only field of a struct or union. */
|
|
||||||
case TYPE_CODE_ARRAY:
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
case TYPE_CODE_TYPEDEF:
|
|
||||||
return mn10300_use_struct_convention (gcc_p, check_typedef (type));
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MVS note this is deprecated. */
|
|
||||||
static void
|
|
||||||
mn10300_store_return_value (struct type *type,
|
|
||||||
struct regcache *regcache, const void *valbuf)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
|
||||||
int len = TYPE_LENGTH (type);
|
|
||||||
int reg, regsz;
|
|
||||||
|
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
|
||||||
reg = 4;
|
|
||||||
else
|
|
||||||
reg = 0;
|
|
||||||
|
|
||||||
regsz = register_size (gdbarch, reg);
|
|
||||||
|
|
||||||
if (len <= regsz)
|
|
||||||
regcache_raw_write_part (regcache, reg, 0, len, valbuf);
|
|
||||||
else if (len <= 2 * regsz)
|
|
||||||
{
|
|
||||||
regcache_raw_write (regcache, reg, valbuf);
|
|
||||||
gdb_assert (regsz == register_size (gdbarch, reg + 1));
|
|
||||||
regcache_raw_write_part (regcache, reg+1, 0,
|
|
||||||
len - regsz, (char *) valbuf + regsz);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
"Cannot store return value %d bytes long.", len);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MVS note deprecated. */
|
|
||||||
static void
|
|
||||||
mn10300_extract_return_value (struct type *type,
|
|
||||||
struct regcache *regcache, void *valbuf)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch = get_regcache_arch (regcache);
|
|
||||||
char buf[MAX_REGISTER_SIZE];
|
|
||||||
int len = TYPE_LENGTH (type);
|
|
||||||
int reg, regsz;
|
|
||||||
|
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_PTR)
|
|
||||||
reg = 4;
|
|
||||||
else
|
|
||||||
reg = 0;
|
|
||||||
|
|
||||||
regsz = register_size (gdbarch, reg);
|
|
||||||
if (len <= regsz)
|
|
||||||
{
|
|
||||||
regcache_raw_read (regcache, reg, buf);
|
|
||||||
memcpy (valbuf, buf, len);
|
|
||||||
}
|
|
||||||
else if (len <= 2 * regsz)
|
|
||||||
{
|
|
||||||
regcache_raw_read (regcache, reg, buf);
|
|
||||||
memcpy (valbuf, buf, regsz);
|
|
||||||
gdb_assert (regsz == register_size (gdbarch, reg + 1));
|
|
||||||
regcache_raw_read (regcache, reg + 1, buf);
|
|
||||||
memcpy ((char *) valbuf + regsz, buf, len - regsz);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
"Cannot extract return value %d bytes long.", len);
|
|
||||||
}
|
|
||||||
|
|
||||||
static char *
|
|
||||||
register_name (int reg, char **regs, long sizeof_regs)
|
|
||||||
{
|
|
||||||
if (reg < 0 || reg >= sizeof_regs / sizeof (regs[0]))
|
|
||||||
return NULL;
|
|
||||||
else
|
|
||||||
return regs[reg];
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
mn10300_generic_register_name (int reg)
|
|
||||||
{
|
|
||||||
static char *regs[] =
|
|
||||||
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
|
|
||||||
"sp", "pc", "mdr", "psw", "lir", "lar", "", "",
|
|
||||||
"", "", "", "", "", "", "", "",
|
|
||||||
"", "", "", "", "", "", "", "fp"
|
|
||||||
};
|
|
||||||
return register_name (reg, regs, sizeof regs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
am33_register_name (int reg)
|
|
||||||
{
|
|
||||||
static char *regs[] =
|
|
||||||
{ "d0", "d1", "d2", "d3", "a0", "a1", "a2", "a3",
|
|
||||||
"sp", "pc", "mdr", "psw", "lir", "lar", "",
|
|
||||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
||||||
"ssp", "msp", "usp", "mcrh", "mcrl", "mcvf", "", "", ""
|
|
||||||
};
|
|
||||||
return register_name (reg, regs, sizeof regs);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct type *
|
|
||||||
mn10300_register_type (struct gdbarch *gdbarch, int reg)
|
|
||||||
{
|
|
||||||
return builtin_type_int;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
mn10300_read_pc (ptid_t ptid)
|
|
||||||
{
|
|
||||||
return read_register_pid (E_PC_REGNUM, ptid);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
mn10300_write_pc (CORE_ADDR val, ptid_t ptid)
|
|
||||||
{
|
|
||||||
return write_register_pid (E_PC_REGNUM, val, ptid);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The breakpoint instruction must be the same size as the smallest
|
|
||||||
instruction in the instruction set.
|
|
||||||
|
|
||||||
The Matsushita mn10x00 processors have single byte instructions
|
|
||||||
so we need a single byte breakpoint. Matsushita hasn't defined
|
|
||||||
one, so we defined it ourselves. */
|
|
||||||
|
|
||||||
const static unsigned char *
|
|
||||||
mn10300_breakpoint_from_pc (CORE_ADDR *bp_addr, int *bp_size)
|
|
||||||
{
|
|
||||||
static char breakpoint[] = {0xff};
|
|
||||||
*bp_size = 1;
|
|
||||||
return breakpoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Function: skip_prologue
|
|
||||||
Return the address of the first inst past the prologue of the function. */
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
mn10300_skip_prologue (CORE_ADDR pc)
|
|
||||||
{
|
|
||||||
/* FIXME: not implemented. */
|
|
||||||
/* First approximation, try simply using scan_prologue_using_sal. */
|
|
||||||
return skip_prologue_using_sal (pc);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Simple frame_unwind_cache.
|
|
||||||
This finds the "extra info" for the frame. */
|
|
||||||
static struct trad_frame_cache *
|
|
||||||
mn10300_frame_unwind_cache (struct frame_info *next_frame,
|
|
||||||
void **this_prologue_cache)
|
|
||||||
{
|
|
||||||
struct trad_frame_cache *cache;
|
|
||||||
|
|
||||||
if (*this_prologue_cache)
|
|
||||||
return (*this_prologue_cache);
|
|
||||||
|
|
||||||
cache = trad_frame_cache_zalloc (next_frame);
|
|
||||||
trad_frame_set_id (cache,
|
|
||||||
frame_id_build (gdbarch_unwind_sp (current_gdbarch,
|
|
||||||
next_frame),
|
|
||||||
gdbarch_unwind_pc (current_gdbarch,
|
|
||||||
next_frame)));
|
|
||||||
|
|
||||||
/* FIXME: The SP isn't the frame base, so this is 0th approximation. */
|
|
||||||
/* FIXME: The A3 reg isn't always the frame register either, so this
|
|
||||||
is 1st approximation. */
|
|
||||||
trad_frame_set_this_base (cache,
|
|
||||||
frame_unwind_register_signed (next_frame,
|
|
||||||
E_A3_REGNUM));
|
|
||||||
(*this_prologue_cache) = cache;
|
|
||||||
return cache;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Here is a dummy implementation. */
|
|
||||||
static struct frame_id
|
|
||||||
mn10300_dummy_unwind_dummy_id (struct gdbarch *gdbarch,
|
|
||||||
struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return frame_id_build (0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Trad frame implementation. */
|
|
||||||
static void
|
|
||||||
mn10300_frame_this_id (struct frame_info *next_frame,
|
|
||||||
void **this_prologue_cache,
|
|
||||||
struct frame_id *this_id)
|
|
||||||
{
|
|
||||||
struct trad_frame_cache *cache =
|
|
||||||
mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
|
|
||||||
|
|
||||||
trad_frame_get_id (cache, this_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
mn10300_frame_prev_register (struct frame_info *next_frame,
|
|
||||||
void **this_prologue_cache,
|
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, void *bufferp)
|
|
||||||
{
|
|
||||||
struct trad_frame_cache *cache =
|
|
||||||
mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
|
|
||||||
|
|
||||||
trad_frame_get_register (cache, next_frame, regnum, optimizedp,
|
|
||||||
lvalp, addrp, realnump, bufferp);
|
|
||||||
/* Or...
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->prev_regs, regnum,
|
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct frame_unwind mn10300_frame_unwind = {
|
|
||||||
NORMAL_FRAME,
|
|
||||||
mn10300_frame_this_id,
|
|
||||||
mn10300_frame_prev_register
|
|
||||||
};
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
mn10300_frame_base_address (struct frame_info *next_frame,
|
|
||||||
void **this_prologue_cache)
|
|
||||||
{
|
|
||||||
struct trad_frame_cache *cache =
|
|
||||||
mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
|
|
||||||
|
|
||||||
return trad_frame_get_this_base (cache);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
mn10300_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &mn10300_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct frame_base mn10300_frame_base = {
|
|
||||||
&mn10300_frame_unwind,
|
|
||||||
mn10300_frame_base_address,
|
|
||||||
mn10300_frame_base_address,
|
|
||||||
mn10300_frame_base_address
|
|
||||||
};
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
mn10300_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
ULONGEST pc;
|
|
||||||
|
|
||||||
frame_unwind_unsigned_register (next_frame, E_PC_REGNUM, &pc);
|
|
||||||
return pc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
ULONGEST sp;
|
|
||||||
|
|
||||||
frame_unwind_unsigned_register (next_frame, E_SP_REGNUM, &sp);
|
|
||||||
return sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
mn10300_frame_unwind_init (struct gdbarch *gdbarch)
|
|
||||||
{
|
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
|
||||||
frame_unwind_append_sniffer (gdbarch, mn10300_frame_sniffer);
|
|
||||||
frame_base_set_default (gdbarch, &mn10300_frame_base);
|
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, mn10300_dummy_unwind_dummy_id);
|
|
||||||
set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
|
|
||||||
set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct gdbarch *
|
|
||||||
mn10300_gdbarch_init (struct gdbarch_info info,
|
|
||||||
struct gdbarch_list *arches)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch;
|
|
||||||
|
|
||||||
arches = gdbarch_list_lookup_by_info (arches, &info);
|
|
||||||
if (arches != NULL)
|
|
||||||
return arches->gdbarch;
|
|
||||||
gdbarch = gdbarch_alloc (&info, NULL);
|
|
||||||
|
|
||||||
switch (info.bfd_arch_info->mach)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
case bfd_mach_mn10300:
|
|
||||||
set_gdbarch_register_name (gdbarch, mn10300_generic_register_name);
|
|
||||||
break;
|
|
||||||
case bfd_mach_am33:
|
|
||||||
set_gdbarch_register_name (gdbarch, am33_register_name);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
internal_error (__FILE__, __LINE__,
|
|
||||||
"mn10300_gdbarch_init: Unknown mn10300 variant");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Registers. */
|
|
||||||
set_gdbarch_num_regs (gdbarch, E_NUM_REGS);
|
|
||||||
set_gdbarch_register_type (gdbarch, mn10300_register_type);
|
|
||||||
set_gdbarch_skip_prologue (gdbarch, mn10300_skip_prologue);
|
|
||||||
set_gdbarch_read_pc (gdbarch, mn10300_read_pc);
|
|
||||||
set_gdbarch_write_pc (gdbarch, mn10300_write_pc);
|
|
||||||
set_gdbarch_pc_regnum (gdbarch, E_PC_REGNUM);
|
|
||||||
set_gdbarch_sp_regnum (gdbarch, E_SP_REGNUM);
|
|
||||||
|
|
||||||
/* Stack unwinding. */
|
|
||||||
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
|
||||||
/* Breakpoints. */
|
|
||||||
set_gdbarch_breakpoint_from_pc (gdbarch, mn10300_breakpoint_from_pc);
|
|
||||||
/* decr_pc_after_break? */
|
|
||||||
/* Disassembly. */
|
|
||||||
set_gdbarch_print_insn (gdbarch, print_insn_mn10300);
|
|
||||||
|
|
||||||
/* Stage 2 */
|
|
||||||
/* MVS Note: at least the first one is deprecated! */
|
|
||||||
set_gdbarch_deprecated_use_struct_convention (gdbarch,
|
|
||||||
mn10300_use_struct_convention);
|
|
||||||
set_gdbarch_store_return_value (gdbarch, mn10300_store_return_value);
|
|
||||||
set_gdbarch_extract_return_value (gdbarch, mn10300_extract_return_value);
|
|
||||||
|
|
||||||
mn10300_frame_unwind_init (gdbarch);
|
|
||||||
|
|
||||||
return gdbarch;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_mn10300_tdep (void)
|
|
||||||
{
|
|
||||||
register_gdbarch_init (bfd_arch_mn10300, mn10300_gdbarch_init);
|
|
||||||
}
|
|
||||||
|
|
573
gdb/ns32k-tdep.c
573
gdb/ns32k-tdep.c
|
@ -1,573 +0,0 @@
|
||||||
/* Target dependent code for the NS32000, for GDB.
|
|
||||||
|
|
||||||
Copyright 1986, 1988, 1991, 1992, 1994, 1995, 1998, 1999, 2000,
|
|
||||||
2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "frame.h"
|
|
||||||
#include "gdbtypes.h"
|
|
||||||
#include "gdbcore.h"
|
|
||||||
#include "inferior.h"
|
|
||||||
#include "regcache.h"
|
|
||||||
#include "target.h"
|
|
||||||
#include "arch-utils.h"
|
|
||||||
#include "osabi.h"
|
|
||||||
#include "dis-asm.h"
|
|
||||||
|
|
||||||
#include "ns32k-tdep.h"
|
|
||||||
#include "gdb_string.h"
|
|
||||||
|
|
||||||
static int sign_extend (int value, int bits);
|
|
||||||
static CORE_ADDR ns32k_get_enter_addr (CORE_ADDR);
|
|
||||||
static int ns32k_localcount (CORE_ADDR enter_pc);
|
|
||||||
static void flip_bytes (void *, int);
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
ns32k_register_name_32082 (int regno)
|
|
||||||
{
|
|
||||||
static char *register_names[] =
|
|
||||||
{
|
|
||||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
||||||
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
|
|
||||||
"sp", "fp", "pc", "ps",
|
|
||||||
"l0", "l1", "l2", "l3", "xx",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (regno < 0)
|
|
||||||
return NULL;
|
|
||||||
if (regno >= sizeof (register_names) / sizeof (*register_names))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return (register_names[regno]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
ns32k_register_name_32382 (int regno)
|
|
||||||
{
|
|
||||||
static char *register_names[] =
|
|
||||||
{
|
|
||||||
"r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7",
|
|
||||||
"f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7",
|
|
||||||
"sp", "fp", "pc", "ps",
|
|
||||||
"fsr",
|
|
||||||
"l0", "l1", "l2", "l3", "l4", "l5", "l6", "l7", "xx",
|
|
||||||
};
|
|
||||||
|
|
||||||
if (regno < 0)
|
|
||||||
return NULL;
|
|
||||||
if (regno >= sizeof (register_names) / sizeof (*register_names))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return (register_names[regno]);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ns32k_register_byte_32082 (int regno)
|
|
||||||
{
|
|
||||||
if (regno >= NS32K_LP0_REGNUM)
|
|
||||||
return (NS32K_LP0_REGNUM * 4) + ((regno - NS32K_LP0_REGNUM) * 8);
|
|
||||||
|
|
||||||
return (regno * 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ns32k_register_byte_32382 (int regno)
|
|
||||||
{
|
|
||||||
/* This is a bit yuk. The even numbered double precision floating
|
|
||||||
point long registers occupy the same space as the even:odd numbered
|
|
||||||
single precision floating point registers, but the extra 32381 FPU
|
|
||||||
registers are at the end. Doing it this way is compatible for both
|
|
||||||
32081 and 32381 equipped machines. */
|
|
||||||
|
|
||||||
return ((regno < NS32K_LP0_REGNUM ? regno
|
|
||||||
: (regno - NS32K_LP0_REGNUM) & 1 ? regno - 1
|
|
||||||
: (regno - NS32K_LP0_REGNUM + FP0_REGNUM)) * 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ns32k_register_raw_size (int regno)
|
|
||||||
{
|
|
||||||
/* All registers are 4 bytes, except for the doubled floating
|
|
||||||
registers. */
|
|
||||||
|
|
||||||
return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ns32k_register_virtual_size (int regno)
|
|
||||||
{
|
|
||||||
return ((regno >= NS32K_LP0_REGNUM) ? 8 : 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct type *
|
|
||||||
ns32k_register_virtual_type (int regno)
|
|
||||||
{
|
|
||||||
if (regno < FP0_REGNUM)
|
|
||||||
return (builtin_type_int);
|
|
||||||
|
|
||||||
if (regno < FP0_REGNUM + 8)
|
|
||||||
return (builtin_type_float);
|
|
||||||
|
|
||||||
if (regno < NS32K_LP0_REGNUM)
|
|
||||||
return (builtin_type_int);
|
|
||||||
|
|
||||||
return (builtin_type_double);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Immediately after a function call, return the saved PC. Can't
|
|
||||||
always go through the frames for this because on some systems,
|
|
||||||
the new frame is not set up until the new function executes some
|
|
||||||
instructions. */
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_saved_pc_after_call (struct frame_info *frame)
|
|
||||||
{
|
|
||||||
return (read_memory_integer (read_register (SP_REGNUM), 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Advance PC across any function entry prologue instructions
|
|
||||||
to reach some "real" code. */
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
umax_skip_prologue (CORE_ADDR pc)
|
|
||||||
{
|
|
||||||
unsigned char op = read_memory_integer (pc, 1);
|
|
||||||
if (op == 0x82)
|
|
||||||
{
|
|
||||||
op = read_memory_integer (pc + 2, 1);
|
|
||||||
if ((op & 0x80) == 0)
|
|
||||||
pc += 3;
|
|
||||||
else if ((op & 0xc0) == 0x80)
|
|
||||||
pc += 4;
|
|
||||||
else
|
|
||||||
pc += 6;
|
|
||||||
}
|
|
||||||
return pc;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const unsigned char *
|
|
||||||
ns32k_breakpoint_from_pc (CORE_ADDR *pcp, int *lenp)
|
|
||||||
{
|
|
||||||
static const unsigned char breakpoint_insn[] = { 0xf2 };
|
|
||||||
|
|
||||||
*lenp = sizeof (breakpoint_insn);
|
|
||||||
return breakpoint_insn;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return number of args passed to a frame.
|
|
||||||
Can return -1, meaning no way to tell.
|
|
||||||
Encore's C compiler often reuses same area on stack for args,
|
|
||||||
so this will often not work properly. If the arg names
|
|
||||||
are known, it's likely most of them will be printed. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
umax_frame_num_args (struct frame_info *fi)
|
|
||||||
{
|
|
||||||
int numargs;
|
|
||||||
CORE_ADDR pc;
|
|
||||||
CORE_ADDR enter_addr;
|
|
||||||
unsigned int insn;
|
|
||||||
unsigned int addr_mode;
|
|
||||||
int width;
|
|
||||||
|
|
||||||
numargs = -1;
|
|
||||||
enter_addr = ns32k_get_enter_addr (get_frame_pc (fi));
|
|
||||||
if (enter_addr > 0)
|
|
||||||
{
|
|
||||||
pc = ((enter_addr == 1)
|
|
||||||
? DEPRECATED_SAVED_PC_AFTER_CALL (fi)
|
|
||||||
: DEPRECATED_FRAME_SAVED_PC (fi));
|
|
||||||
insn = read_memory_integer (pc, 2);
|
|
||||||
addr_mode = (insn >> 11) & 0x1f;
|
|
||||||
insn = insn & 0x7ff;
|
|
||||||
if ((insn & 0x7fc) == 0x57c
|
|
||||||
&& addr_mode == 0x14) /* immediate */
|
|
||||||
{
|
|
||||||
if (insn == 0x57c) /* adjspb */
|
|
||||||
width = 1;
|
|
||||||
else if (insn == 0x57d) /* adjspw */
|
|
||||||
width = 2;
|
|
||||||
else if (insn == 0x57f) /* adjspd */
|
|
||||||
width = 4;
|
|
||||||
else
|
|
||||||
internal_error (__FILE__, __LINE__, "bad else");
|
|
||||||
numargs = read_memory_integer (pc + 2, width);
|
|
||||||
if (width > 1)
|
|
||||||
flip_bytes (&numargs, width);
|
|
||||||
numargs = -sign_extend (numargs, width * 8) / 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return numargs;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
sign_extend (int value, int bits)
|
|
||||||
{
|
|
||||||
value = value & ((1 << bits) - 1);
|
|
||||||
return (value & (1 << (bits - 1))
|
|
||||||
? value | (~((1 << bits) - 1))
|
|
||||||
: value);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
flip_bytes (void *p, int count)
|
|
||||||
{
|
|
||||||
char tmp;
|
|
||||||
char *ptr = 0;
|
|
||||||
|
|
||||||
while (count > 0)
|
|
||||||
{
|
|
||||||
tmp = *ptr;
|
|
||||||
ptr[0] = ptr[count - 1];
|
|
||||||
ptr[count - 1] = tmp;
|
|
||||||
ptr++;
|
|
||||||
count -= 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the number of locals in the current frame given a
|
|
||||||
pc pointing to the enter instruction. This is used by
|
|
||||||
ns32k_frame_init_saved_regs. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
ns32k_localcount (CORE_ADDR enter_pc)
|
|
||||||
{
|
|
||||||
unsigned char localtype;
|
|
||||||
int localcount;
|
|
||||||
|
|
||||||
localtype = read_memory_integer (enter_pc + 2, 1);
|
|
||||||
if ((localtype & 0x80) == 0)
|
|
||||||
localcount = localtype;
|
|
||||||
else if ((localtype & 0xc0) == 0x80)
|
|
||||||
localcount = (((localtype & 0x3f) << 8)
|
|
||||||
| (read_memory_integer (enter_pc + 3, 1) & 0xff));
|
|
||||||
else
|
|
||||||
localcount = (((localtype & 0x3f) << 24)
|
|
||||||
| ((read_memory_integer (enter_pc + 3, 1) & 0xff) << 16)
|
|
||||||
| ((read_memory_integer (enter_pc + 4, 1) & 0xff) << 8)
|
|
||||||
| (read_memory_integer (enter_pc + 5, 1) & 0xff));
|
|
||||||
return localcount;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Nonzero if instruction at PC is a return instruction. */
|
|
||||||
|
|
||||||
static int
|
|
||||||
ns32k_about_to_return (CORE_ADDR pc)
|
|
||||||
{
|
|
||||||
return (read_memory_integer (pc, 1) == 0x12);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the address of the enter opcode for this function, if it is active.
|
|
||||||
Returns positive address > 1 if pc is between enter/exit,
|
|
||||||
1 if pc before enter or after exit, 0 otherwise. */
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_get_enter_addr (CORE_ADDR pc)
|
|
||||||
{
|
|
||||||
CORE_ADDR enter_addr;
|
|
||||||
unsigned char op;
|
|
||||||
|
|
||||||
if (pc == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (ns32k_about_to_return (pc))
|
|
||||||
return 1; /* after exit */
|
|
||||||
|
|
||||||
enter_addr = get_pc_function_start (pc);
|
|
||||||
|
|
||||||
if (pc == enter_addr)
|
|
||||||
return 1; /* before enter */
|
|
||||||
|
|
||||||
op = read_memory_integer (enter_addr, 1);
|
|
||||||
|
|
||||||
if (op != 0x82)
|
|
||||||
return 0; /* function has no enter/exit */
|
|
||||||
|
|
||||||
return enter_addr; /* pc is between enter and exit */
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_frame_chain (struct frame_info *frame)
|
|
||||||
{
|
|
||||||
/* In the case of the NS32000 series, the frame's nominal address is the
|
|
||||||
FP value, and that address is saved at the previous FP value as a
|
|
||||||
4-byte word. */
|
|
||||||
return (read_memory_integer (get_frame_base (frame), 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_sigtramp_saved_pc (struct frame_info *frame)
|
|
||||||
{
|
|
||||||
CORE_ADDR sigcontext_addr;
|
|
||||||
char *buf;
|
|
||||||
int ptrbytes = TYPE_LENGTH (builtin_type_void_func_ptr);
|
|
||||||
int sigcontext_offs = (2 * TARGET_INT_BIT) / TARGET_CHAR_BIT;
|
|
||||||
|
|
||||||
buf = alloca (ptrbytes);
|
|
||||||
/* Get sigcontext address, it is the third parameter on the stack. */
|
|
||||||
if (get_next_frame (frame))
|
|
||||||
sigcontext_addr = read_memory_typed_address
|
|
||||||
(DEPRECATED_FRAME_ARGS_ADDRESS (get_next_frame (frame)) + FRAME_ARGS_SKIP + sigcontext_offs,
|
|
||||||
builtin_type_void_data_ptr);
|
|
||||||
else
|
|
||||||
sigcontext_addr = read_memory_typed_address
|
|
||||||
(read_register (SP_REGNUM) + sigcontext_offs, builtin_type_void_data_ptr);
|
|
||||||
|
|
||||||
/* Offset to saved PC in sigcontext, from <machine/signal.h>. Don't
|
|
||||||
cause a memory_error when accessing sigcontext in case the stack
|
|
||||||
layout has changed or the stack is corrupt. */
|
|
||||||
target_read_memory (sigcontext_addr + 20, buf, ptrbytes);
|
|
||||||
return extract_typed_address (buf, builtin_type_void_func_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_frame_saved_pc (struct frame_info *frame)
|
|
||||||
{
|
|
||||||
if ((get_frame_type (frame) == SIGTRAMP_FRAME))
|
|
||||||
return (ns32k_sigtramp_saved_pc (frame)); /* XXXJRT */
|
|
||||||
|
|
||||||
return (read_memory_integer (get_frame_base (frame) + 4, 4));
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_frame_args_address (struct frame_info *frame)
|
|
||||||
{
|
|
||||||
if (ns32k_get_enter_addr (get_frame_pc (frame)) > 1)
|
|
||||||
return (get_frame_base (frame));
|
|
||||||
|
|
||||||
return (read_register (SP_REGNUM) - 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Code to initialize the addresses of the saved registers of frame described
|
|
||||||
by FRAME_INFO. This includes special registers such as pc and fp saved in
|
|
||||||
special ways in the stack frame. sp is even more special: the address we
|
|
||||||
return for it IS the sp for the next frame. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32k_frame_init_saved_regs (struct frame_info *frame)
|
|
||||||
{
|
|
||||||
int regmask, regnum;
|
|
||||||
int localcount;
|
|
||||||
CORE_ADDR enter_addr, next_addr;
|
|
||||||
|
|
||||||
if (deprecated_get_frame_saved_regs (frame))
|
|
||||||
return;
|
|
||||||
|
|
||||||
frame_saved_regs_zalloc (frame);
|
|
||||||
|
|
||||||
enter_addr = ns32k_get_enter_addr (get_frame_pc (frame));
|
|
||||||
if (enter_addr > 1)
|
|
||||||
{
|
|
||||||
regmask = read_memory_integer (enter_addr + 1, 1) & 0xff;
|
|
||||||
localcount = ns32k_localcount (enter_addr);
|
|
||||||
next_addr = get_frame_base (frame) + localcount;
|
|
||||||
|
|
||||||
for (regnum = 0; regnum < 8; regnum++)
|
|
||||||
{
|
|
||||||
if (regmask & (1 << regnum))
|
|
||||||
deprecated_get_frame_saved_regs (frame)[regnum] = next_addr -= 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
deprecated_get_frame_saved_regs (frame)[SP_REGNUM] = get_frame_base (frame) + 4;
|
|
||||||
deprecated_get_frame_saved_regs (frame)[PC_REGNUM] = get_frame_base (frame) + 4;
|
|
||||||
deprecated_get_frame_saved_regs (frame)[DEPRECATED_FP_REGNUM] = read_memory_integer (get_frame_base (frame), 4);
|
|
||||||
}
|
|
||||||
else if (enter_addr == 1)
|
|
||||||
{
|
|
||||||
CORE_ADDR sp = read_register (SP_REGNUM);
|
|
||||||
deprecated_get_frame_saved_regs (frame)[PC_REGNUM] = sp;
|
|
||||||
deprecated_get_frame_saved_regs (frame)[SP_REGNUM] = sp + 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32k_pop_frame (void)
|
|
||||||
{
|
|
||||||
struct frame_info *frame = get_current_frame ();
|
|
||||||
CORE_ADDR fp;
|
|
||||||
int regnum;
|
|
||||||
|
|
||||||
fp = get_frame_base (frame);
|
|
||||||
DEPRECATED_FRAME_INIT_SAVED_REGS (frame);
|
|
||||||
|
|
||||||
for (regnum = 0; regnum < 8; regnum++)
|
|
||||||
if (deprecated_get_frame_saved_regs (frame)[regnum])
|
|
||||||
write_register (regnum,
|
|
||||||
read_memory_integer (deprecated_get_frame_saved_regs (frame)[regnum], 4));
|
|
||||||
|
|
||||||
write_register (DEPRECATED_FP_REGNUM, read_memory_integer (fp, 4));
|
|
||||||
write_register (PC_REGNUM, read_memory_integer (fp + 4, 4));
|
|
||||||
write_register (SP_REGNUM, fp + 8);
|
|
||||||
flush_cached_frames ();
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
|
||||||
ns32k_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
|
|
||||||
int struct_return, CORE_ADDR struct_addr)
|
|
||||||
{
|
|
||||||
/* ASSERT ( !struct_return); */
|
|
||||||
int i;
|
|
||||||
for (i = nargs - 1; i >= 0; i--)
|
|
||||||
{
|
|
||||||
struct value *arg = args[i];
|
|
||||||
int len = TYPE_LENGTH (VALUE_ENCLOSING_TYPE (arg));
|
|
||||||
int container_len = len;
|
|
||||||
int offset;
|
|
||||||
|
|
||||||
/* Are we going to put it at the high or low end of the
|
|
||||||
container? */
|
|
||||||
if (TARGET_BYTE_ORDER == BFD_ENDIAN_BIG)
|
|
||||||
offset = container_len - len;
|
|
||||||
else
|
|
||||||
offset = 0;
|
|
||||||
|
|
||||||
/* Stack grows downward. */
|
|
||||||
sp -= container_len;
|
|
||||||
write_memory (sp + offset, VALUE_CONTENTS_ALL (arg), len);
|
|
||||||
}
|
|
||||||
return sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32k_store_struct_return (CORE_ADDR addr, CORE_ADDR sp)
|
|
||||||
{
|
|
||||||
/* On this machine, this is a no-op (Encore Umax didn't use GCC). */
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32k_extract_return_value (struct type *valtype, char *regbuf, char *valbuf)
|
|
||||||
{
|
|
||||||
memcpy (valbuf,
|
|
||||||
regbuf + DEPRECATED_REGISTER_BYTE (TYPE_CODE (valtype) == TYPE_CODE_FLT ?
|
|
||||||
FP0_REGNUM : 0), TYPE_LENGTH (valtype));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32k_store_return_value (struct type *valtype, char *valbuf)
|
|
||||||
{
|
|
||||||
deprecated_write_register_bytes (TYPE_CODE (valtype) == TYPE_CODE_FLT
|
|
||||||
? FP0_REGNUM : 0, valbuf,
|
|
||||||
TYPE_LENGTH (valtype));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ns32k_gdbarch_init_32082 (struct gdbarch *gdbarch)
|
|
||||||
{
|
|
||||||
set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32082);
|
|
||||||
|
|
||||||
set_gdbarch_register_name (gdbarch, ns32k_register_name_32082);
|
|
||||||
set_gdbarch_deprecated_register_byte (gdbarch, ns32k_register_byte_32082);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ns32k_gdbarch_init_32382 (struct gdbarch *gdbarch)
|
|
||||||
{
|
|
||||||
set_gdbarch_num_regs (gdbarch, NS32K_NUM_REGS_32382);
|
|
||||||
|
|
||||||
set_gdbarch_register_name (gdbarch, ns32k_register_name_32382);
|
|
||||||
set_gdbarch_deprecated_register_byte (gdbarch, ns32k_register_byte_32382);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Initialize the current architecture based on INFO. If possible, re-use an
|
|
||||||
architecture from ARCHES, which is a list of architectures already created
|
|
||||||
during this debugging session.
|
|
||||||
|
|
||||||
Called e.g. at program startup, when reading a core file, and when reading
|
|
||||||
a binary file. */
|
|
||||||
|
|
||||||
static struct gdbarch *
|
|
||||||
ns32k_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|
||||||
{
|
|
||||||
struct gdbarch *gdbarch;
|
|
||||||
|
|
||||||
/* If there is already a candidate, use it. */
|
|
||||||
arches = gdbarch_list_lookup_by_info (arches, &info);
|
|
||||||
if (arches != NULL)
|
|
||||||
return arches->gdbarch;
|
|
||||||
|
|
||||||
gdbarch = gdbarch_alloc (&info, NULL);
|
|
||||||
|
|
||||||
/* NOTE: cagney/2002-12-06: This can be deleted when this arch is
|
|
||||||
ready to unwind the PC first (see frame.c:get_prev_frame()). */
|
|
||||||
set_gdbarch_deprecated_init_frame_pc (gdbarch, deprecated_init_frame_pc_default);
|
|
||||||
|
|
||||||
/* Register info */
|
|
||||||
ns32k_gdbarch_init_32082 (gdbarch);
|
|
||||||
set_gdbarch_num_regs (gdbarch, NS32K_SP_REGNUM);
|
|
||||||
set_gdbarch_num_regs (gdbarch, NS32K_FP_REGNUM);
|
|
||||||
set_gdbarch_num_regs (gdbarch, NS32K_PC_REGNUM);
|
|
||||||
set_gdbarch_num_regs (gdbarch, NS32K_PS_REGNUM);
|
|
||||||
|
|
||||||
set_gdbarch_deprecated_register_size (gdbarch, NS32K_REGISTER_SIZE);
|
|
||||||
set_gdbarch_deprecated_register_raw_size (gdbarch, ns32k_register_raw_size);
|
|
||||||
set_gdbarch_deprecated_register_virtual_size (gdbarch, ns32k_register_virtual_size);
|
|
||||||
set_gdbarch_deprecated_register_virtual_type (gdbarch, ns32k_register_virtual_type);
|
|
||||||
|
|
||||||
/* Frame and stack info */
|
|
||||||
set_gdbarch_skip_prologue (gdbarch, umax_skip_prologue);
|
|
||||||
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, ns32k_saved_pc_after_call);
|
|
||||||
|
|
||||||
set_gdbarch_frame_num_args (gdbarch, umax_frame_num_args);
|
|
||||||
|
|
||||||
set_gdbarch_deprecated_frame_chain (gdbarch, ns32k_frame_chain);
|
|
||||||
set_gdbarch_deprecated_frame_saved_pc (gdbarch, ns32k_frame_saved_pc);
|
|
||||||
|
|
||||||
set_gdbarch_deprecated_frame_args_address (gdbarch, ns32k_frame_args_address);
|
|
||||||
|
|
||||||
set_gdbarch_deprecated_frame_init_saved_regs (gdbarch, ns32k_frame_init_saved_regs);
|
|
||||||
|
|
||||||
set_gdbarch_frame_args_skip (gdbarch, 8);
|
|
||||||
|
|
||||||
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
|
||||||
|
|
||||||
/* Return value info */
|
|
||||||
set_gdbarch_deprecated_store_struct_return (gdbarch, ns32k_store_struct_return);
|
|
||||||
set_gdbarch_deprecated_extract_return_value (gdbarch, ns32k_extract_return_value);
|
|
||||||
set_gdbarch_deprecated_store_return_value (gdbarch, ns32k_store_return_value);
|
|
||||||
|
|
||||||
/* Call dummy info */
|
|
||||||
set_gdbarch_deprecated_pop_frame (gdbarch, ns32k_pop_frame);
|
|
||||||
set_gdbarch_call_dummy_location (gdbarch, ON_STACK);
|
|
||||||
set_gdbarch_deprecated_push_arguments (gdbarch, ns32k_push_arguments);
|
|
||||||
|
|
||||||
/* Breakpoint info */
|
|
||||||
set_gdbarch_breakpoint_from_pc (gdbarch, ns32k_breakpoint_from_pc);
|
|
||||||
|
|
||||||
/* Should be using push_dummy_call. */
|
|
||||||
set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
|
|
||||||
|
|
||||||
set_gdbarch_print_insn (gdbarch, print_insn_ns32k);
|
|
||||||
|
|
||||||
/* Hook in OS ABI-specific overrides, if they have been registered. */
|
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
|
||||||
|
|
||||||
return (gdbarch);
|
|
||||||
}
|
|
||||||
|
|
||||||
extern initialize_file_ftype _initialize_ns32k_tdep; /* -Wmissing-prototypes */
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_ns32k_tdep (void)
|
|
||||||
{
|
|
||||||
gdbarch_register (bfd_arch_ns32k, ns32k_gdbarch_init, NULL);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,57 +0,0 @@
|
||||||
/* Target-dependent definitions for GDB on NS32000 systems.
|
|
||||||
Copyright 1987, 1989, 1991, 1993, 1994, 1998, 1999, 2000, 2001, 2002, 2003
|
|
||||||
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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifndef NS32K_TDEP_H
|
|
||||||
#define NS32K_TDEP_H
|
|
||||||
|
|
||||||
/* Register numbers of various important registers.
|
|
||||||
Note that some of these values are "real" register numbers,
|
|
||||||
and correspond to the general registers of the machine,
|
|
||||||
and some are "phony" register numbers which are too large
|
|
||||||
to be actual register numbers as far as the user is concerned
|
|
||||||
but do serve to get the desired values when passed to read_register. */
|
|
||||||
|
|
||||||
#define NS32K_R0_REGNUM 0 /* General register 0 */
|
|
||||||
#define NS32K_FP0_REGNUM 8 /* Floating point register 0 */
|
|
||||||
#define NS32K_SP_REGNUM 16 /* Contains address of top of stack */
|
|
||||||
#define NS32K_AP_REGNUM NS32K_FP_REGNUM
|
|
||||||
#define NS32K_FP_REGNUM 17 /* Contains address of executing stack frame */
|
|
||||||
#define NS32K_PC_REGNUM 18 /* Contains program counter */
|
|
||||||
#define NS32K_PS_REGNUM 19 /* Contains processor status */
|
|
||||||
#define NS32K_FPS_REGNUM 20 /* Floating point status register */
|
|
||||||
#define NS32K_LP0_REGNUM 21 /* Double register 0 (same as FP0) */
|
|
||||||
|
|
||||||
#define NS32K_NUM_REGS_32082 25
|
|
||||||
#define NS32K_REGISTER_BYTES_32082 \
|
|
||||||
((NS32K_NUM_REGS_32082 - 4) * 4 /* size of general purpose regs */ \
|
|
||||||
+ 4 * 8 /* size of floating point regs */)
|
|
||||||
|
|
||||||
#define NS32K_NUM_REGS_32382 29
|
|
||||||
#define NS32K_REGISTER_BYTES_32382 \
|
|
||||||
((NS32K_NUM_REGS_32382 - 4) * 4 /* size of general purpose regs */ \
|
|
||||||
+ 8 * 8 /* size of floating point regs */)
|
|
||||||
|
|
||||||
#define NS32K_REGISTER_SIZE 4
|
|
||||||
|
|
||||||
void ns32k_gdbarch_init_32082 (struct gdbarch *);
|
|
||||||
void ns32k_gdbarch_init_32382 (struct gdbarch *);
|
|
||||||
|
|
||||||
#endif /* NS32K_TDEP_H */
|
|
|
@ -1,367 +0,0 @@
|
||||||
/* Functions specific to running gdb native on an ns32k running NetBSD
|
|
||||||
|
|
||||||
Copyright 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001,
|
|
||||||
2004 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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
|
||||||
#include <sys/ptrace.h>
|
|
||||||
#include <machine/reg.h>
|
|
||||||
#include <machine/frame.h>
|
|
||||||
#include <machine/pcb.h>
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "inferior.h"
|
|
||||||
#include "target.h"
|
|
||||||
#include "gdbcore.h"
|
|
||||||
#include "regcache.h"
|
|
||||||
|
|
||||||
#define RF(dst, src) \
|
|
||||||
memcpy(&deprecated_registers[DEPRECATED_REGISTER_BYTE(dst)], &src, sizeof(src))
|
|
||||||
|
|
||||||
#define RS(src, dst) \
|
|
||||||
memcpy(&dst, &deprecated_registers[DEPRECATED_REGISTER_BYTE(src)], sizeof(dst))
|
|
||||||
|
|
||||||
void
|
|
||||||
fetch_inferior_registers (int regno)
|
|
||||||
{
|
|
||||||
struct reg inferior_registers;
|
|
||||||
struct fpreg inferior_fpregisters;
|
|
||||||
|
|
||||||
ptrace (PT_GETREGS, PIDGET (inferior_ptid),
|
|
||||||
(PTRACE_TYPE_ARG3) & inferior_registers, 0);
|
|
||||||
ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
|
|
||||||
(PTRACE_TYPE_ARG3) & inferior_fpregisters, 0);
|
|
||||||
|
|
||||||
RF (R0_REGNUM + 0, inferior_registers.r_r0);
|
|
||||||
RF (R0_REGNUM + 1, inferior_registers.r_r1);
|
|
||||||
RF (R0_REGNUM + 2, inferior_registers.r_r2);
|
|
||||||
RF (R0_REGNUM + 3, inferior_registers.r_r3);
|
|
||||||
RF (R0_REGNUM + 4, inferior_registers.r_r4);
|
|
||||||
RF (R0_REGNUM + 5, inferior_registers.r_r5);
|
|
||||||
RF (R0_REGNUM + 6, inferior_registers.r_r6);
|
|
||||||
RF (R0_REGNUM + 7, inferior_registers.r_r7);
|
|
||||||
|
|
||||||
RF (SP_REGNUM, inferior_registers.r_sp);
|
|
||||||
RF (DEPRECATED_FP_REGNUM, inferior_registers.r_fp);
|
|
||||||
RF (PC_REGNUM, inferior_registers.r_pc);
|
|
||||||
RF (PS_REGNUM, inferior_registers.r_psr);
|
|
||||||
|
|
||||||
RF (FPS_REGNUM, inferior_fpregisters.r_fsr);
|
|
||||||
RF (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
|
|
||||||
RF (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
|
|
||||||
RF (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
|
|
||||||
RF (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
|
|
||||||
RF (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
|
|
||||||
RF (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
|
|
||||||
RF (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
|
|
||||||
RF (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
|
|
||||||
deprecated_registers_fetched ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
store_inferior_registers (int regno)
|
|
||||||
{
|
|
||||||
struct reg inferior_registers;
|
|
||||||
struct fpreg inferior_fpregisters;
|
|
||||||
|
|
||||||
RS (R0_REGNUM + 0, inferior_registers.r_r0);
|
|
||||||
RS (R0_REGNUM + 1, inferior_registers.r_r1);
|
|
||||||
RS (R0_REGNUM + 2, inferior_registers.r_r2);
|
|
||||||
RS (R0_REGNUM + 3, inferior_registers.r_r3);
|
|
||||||
RS (R0_REGNUM + 4, inferior_registers.r_r4);
|
|
||||||
RS (R0_REGNUM + 5, inferior_registers.r_r5);
|
|
||||||
RS (R0_REGNUM + 6, inferior_registers.r_r6);
|
|
||||||
RS (R0_REGNUM + 7, inferior_registers.r_r7);
|
|
||||||
|
|
||||||
RS (SP_REGNUM, inferior_registers.r_sp);
|
|
||||||
RS (DEPRECATED_FP_REGNUM, inferior_registers.r_fp);
|
|
||||||
RS (PC_REGNUM, inferior_registers.r_pc);
|
|
||||||
RS (PS_REGNUM, inferior_registers.r_psr);
|
|
||||||
|
|
||||||
RS (FPS_REGNUM, inferior_fpregisters.r_fsr);
|
|
||||||
RS (FP0_REGNUM + 0, inferior_fpregisters.r_freg[0]);
|
|
||||||
RS (FP0_REGNUM + 2, inferior_fpregisters.r_freg[2]);
|
|
||||||
RS (FP0_REGNUM + 4, inferior_fpregisters.r_freg[4]);
|
|
||||||
RS (FP0_REGNUM + 6, inferior_fpregisters.r_freg[6]);
|
|
||||||
RS (LP0_REGNUM + 1, inferior_fpregisters.r_freg[1]);
|
|
||||||
RS (LP0_REGNUM + 3, inferior_fpregisters.r_freg[3]);
|
|
||||||
RS (LP0_REGNUM + 5, inferior_fpregisters.r_freg[5]);
|
|
||||||
RS (LP0_REGNUM + 7, inferior_fpregisters.r_freg[7]);
|
|
||||||
|
|
||||||
ptrace (PT_SETREGS, PIDGET (inferior_ptid),
|
|
||||||
(PTRACE_TYPE_ARG3) & inferior_registers, 0);
|
|
||||||
ptrace (PT_SETFPREGS, PIDGET (inferior_ptid),
|
|
||||||
(PTRACE_TYPE_ARG3) & inferior_fpregisters, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* XXX - Add this to machine/regs.h instead? */
|
|
||||||
struct coreregs
|
|
||||||
{
|
|
||||||
struct reg intreg;
|
|
||||||
struct fpreg freg;
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Get registers from a core file. REG_ADDR is unused. */
|
|
||||||
static void
|
|
||||||
fetch_core_registers (char *core_reg_sect, unsigned core_reg_size, int which,
|
|
||||||
unsigned int reg_addr)
|
|
||||||
{
|
|
||||||
struct coreregs *core_reg;
|
|
||||||
|
|
||||||
core_reg = (struct coreregs *) core_reg_sect;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* We have *all* registers
|
|
||||||
* in the first core section.
|
|
||||||
* Ignore which.
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (core_reg_size < sizeof (*core_reg))
|
|
||||||
{
|
|
||||||
fprintf_unfiltered (gdb_stderr, "Couldn't read regs from core file\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Integer registers */
|
|
||||||
RF (R0_REGNUM + 0, core_reg->intreg.r_r0);
|
|
||||||
RF (R0_REGNUM + 1, core_reg->intreg.r_r1);
|
|
||||||
RF (R0_REGNUM + 2, core_reg->intreg.r_r2);
|
|
||||||
RF (R0_REGNUM + 3, core_reg->intreg.r_r3);
|
|
||||||
RF (R0_REGNUM + 4, core_reg->intreg.r_r4);
|
|
||||||
RF (R0_REGNUM + 5, core_reg->intreg.r_r5);
|
|
||||||
RF (R0_REGNUM + 6, core_reg->intreg.r_r6);
|
|
||||||
RF (R0_REGNUM + 7, core_reg->intreg.r_r7);
|
|
||||||
|
|
||||||
RF (SP_REGNUM, core_reg->intreg.r_sp);
|
|
||||||
RF (DEPRECATED_FP_REGNUM, core_reg->intreg.r_fp);
|
|
||||||
RF (PC_REGNUM, core_reg->intreg.r_pc);
|
|
||||||
RF (PS_REGNUM, core_reg->intreg.r_psr);
|
|
||||||
|
|
||||||
/* Floating point registers */
|
|
||||||
RF (FPS_REGNUM, core_reg->freg.r_fsr);
|
|
||||||
RF (FP0_REGNUM + 0, core_reg->freg.r_freg[0]);
|
|
||||||
RF (FP0_REGNUM + 2, core_reg->freg.r_freg[2]);
|
|
||||||
RF (FP0_REGNUM + 4, core_reg->freg.r_freg[4]);
|
|
||||||
RF (FP0_REGNUM + 6, core_reg->freg.r_freg[6]);
|
|
||||||
RF (LP0_REGNUM + 1, core_reg->freg.r_freg[1]);
|
|
||||||
RF (LP0_REGNUM + 3, core_reg->freg.r_freg[3]);
|
|
||||||
RF (LP0_REGNUM + 5, core_reg->freg.r_freg[5]);
|
|
||||||
RF (LP0_REGNUM + 7, core_reg->freg.r_freg[7]);
|
|
||||||
deprecated_registers_fetched ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Register that we are able to handle ns32knbsd core file formats.
|
|
||||||
FIXME: is this really bfd_target_unknown_flavour? */
|
|
||||||
|
|
||||||
static struct core_fns nat_core_fns =
|
|
||||||
{
|
|
||||||
bfd_target_unknown_flavour, /* core_flavour */
|
|
||||||
default_check_format, /* check_format */
|
|
||||||
default_core_sniffer, /* core_sniffer */
|
|
||||||
fetch_core_registers, /* core_read_registers */
|
|
||||||
NULL /* next */
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_ns32knbsd_nat (void)
|
|
||||||
{
|
|
||||||
deprecated_add_core_fns (&nat_core_fns);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* kernel_u_size() is not helpful on NetBSD because
|
|
||||||
* the "u" struct is NOT in the core dump file.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef FETCH_KCORE_REGISTERS
|
|
||||||
/*
|
|
||||||
* Get registers from a kernel crash dump or live kernel.
|
|
||||||
* Called by kcore-nbsd.c:get_kcore_registers().
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
fetch_kcore_registers (struct pcb *pcb)
|
|
||||||
{
|
|
||||||
struct switchframe sf;
|
|
||||||
struct reg intreg;
|
|
||||||
int dummy;
|
|
||||||
|
|
||||||
/* Integer registers */
|
|
||||||
if (target_read_memory ((CORE_ADDR) pcb->pcb_ksp, (char *) &sf, sizeof sf))
|
|
||||||
error ("Cannot read integer registers.");
|
|
||||||
|
|
||||||
/* We use the psr at kernel entry */
|
|
||||||
if (target_read_memory ((CORE_ADDR) pcb->pcb_onstack, (char *) &intreg, sizeof intreg))
|
|
||||||
error ("Cannot read processor status register.");
|
|
||||||
|
|
||||||
dummy = 0;
|
|
||||||
RF (R0_REGNUM + 0, dummy);
|
|
||||||
RF (R0_REGNUM + 1, dummy);
|
|
||||||
RF (R0_REGNUM + 2, dummy);
|
|
||||||
RF (R0_REGNUM + 3, sf.sf_r3);
|
|
||||||
RF (R0_REGNUM + 4, sf.sf_r4);
|
|
||||||
RF (R0_REGNUM + 5, sf.sf_r5);
|
|
||||||
RF (R0_REGNUM + 6, sf.sf_r6);
|
|
||||||
RF (R0_REGNUM + 7, sf.sf_r7);
|
|
||||||
|
|
||||||
dummy = pcb->pcb_kfp + 8;
|
|
||||||
RF (SP_REGNUM, dummy);
|
|
||||||
RF (DEPRECATED_FP_REGNUM, sf.sf_fp);
|
|
||||||
RF (PC_REGNUM, sf.sf_pc);
|
|
||||||
RF (PS_REGNUM, intreg.r_psr);
|
|
||||||
|
|
||||||
/* Floating point registers */
|
|
||||||
RF (FPS_REGNUM, pcb->pcb_fsr);
|
|
||||||
RF (FP0_REGNUM + 0, pcb->pcb_freg[0]);
|
|
||||||
RF (FP0_REGNUM + 2, pcb->pcb_freg[2]);
|
|
||||||
RF (FP0_REGNUM + 4, pcb->pcb_freg[4]);
|
|
||||||
RF (FP0_REGNUM + 6, pcb->pcb_freg[6]);
|
|
||||||
RF (LP0_REGNUM + 1, pcb->pcb_freg[1]);
|
|
||||||
RF (LP0_REGNUM + 3, pcb->pcb_freg[3]);
|
|
||||||
RF (LP0_REGNUM + 5, pcb->pcb_freg[5]);
|
|
||||||
RF (LP0_REGNUM + 7, pcb->pcb_freg[7]);
|
|
||||||
deprecated_registers_fetched ();
|
|
||||||
}
|
|
||||||
#endif /* FETCH_KCORE_REGISTERS */
|
|
||||||
|
|
||||||
void
|
|
||||||
clear_regs (void)
|
|
||||||
{
|
|
||||||
double zero = 0.0;
|
|
||||||
int null = 0;
|
|
||||||
|
|
||||||
/* Integer registers */
|
|
||||||
RF (R0_REGNUM + 0, null);
|
|
||||||
RF (R0_REGNUM + 1, null);
|
|
||||||
RF (R0_REGNUM + 2, null);
|
|
||||||
RF (R0_REGNUM + 3, null);
|
|
||||||
RF (R0_REGNUM + 4, null);
|
|
||||||
RF (R0_REGNUM + 5, null);
|
|
||||||
RF (R0_REGNUM + 6, null);
|
|
||||||
RF (R0_REGNUM + 7, null);
|
|
||||||
|
|
||||||
RF (SP_REGNUM, null);
|
|
||||||
RF (DEPRECATED_FP_REGNUM, null);
|
|
||||||
RF (PC_REGNUM, null);
|
|
||||||
RF (PS_REGNUM, null);
|
|
||||||
|
|
||||||
/* Floating point registers */
|
|
||||||
RF (FPS_REGNUM, zero);
|
|
||||||
RF (FP0_REGNUM + 0, zero);
|
|
||||||
RF (FP0_REGNUM + 2, zero);
|
|
||||||
RF (FP0_REGNUM + 4, zero);
|
|
||||||
RF (FP0_REGNUM + 6, zero);
|
|
||||||
RF (LP0_REGNUM + 0, zero);
|
|
||||||
RF (LP0_REGNUM + 1, zero);
|
|
||||||
RF (LP0_REGNUM + 2, zero);
|
|
||||||
RF (LP0_REGNUM + 3, zero);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return number of args passed to a frame.
|
|
||||||
Can return -1, meaning no way to tell. */
|
|
||||||
|
|
||||||
int
|
|
||||||
frame_num_args (struct frame_info *fi)
|
|
||||||
{
|
|
||||||
CORE_ADDR enter_addr;
|
|
||||||
CORE_ADDR argp;
|
|
||||||
int inst;
|
|
||||||
int args;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (read_memory_integer (fi->frame, 4) == 0 && fi->pc < 0x10000)
|
|
||||||
{
|
|
||||||
/* main is always called with three args */
|
|
||||||
return (3);
|
|
||||||
}
|
|
||||||
enter_addr = ns32k_get_enter_addr (fi->pc);
|
|
||||||
if (enter_addr = 0)
|
|
||||||
return (-1);
|
|
||||||
argp = (enter_addr == 1
|
|
||||||
? DEPRECATED_SAVED_PC_AFTER_CALL (fi)
|
|
||||||
: DEPRECATED_FRAME_SAVED_PC (fi));
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* After a bsr gcc may emit the following instructions
|
|
||||||
* to remove the arguments from the stack:
|
|
||||||
* cmpqd 0,tos - to remove 4 bytes from the stack
|
|
||||||
* cmpd tos,tos - to remove 8 bytes from the stack
|
|
||||||
* adjsp[bwd] -n - to remove n bytes from the stack
|
|
||||||
* Gcc sometimes delays emitting these instructions and
|
|
||||||
* may even throw a branch between our feet.
|
|
||||||
*/
|
|
||||||
inst = read_memory_integer (argp, 4);
|
|
||||||
args = read_memory_integer (argp + 2, 4);
|
|
||||||
if ((inst & 0xff) == 0xea)
|
|
||||||
{ /* br */
|
|
||||||
args = ((inst >> 8) & 0xffffff) | (args << 24);
|
|
||||||
if (args & 0x80)
|
|
||||||
{
|
|
||||||
if (args & 0x40)
|
|
||||||
{
|
|
||||||
args = ntohl (args);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
args = ntohs (args & 0xffff);
|
|
||||||
if (args & 0x2000)
|
|
||||||
args |= 0xc000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
args = args & 0xff;
|
|
||||||
if (args & 0x40)
|
|
||||||
args |= 0x80;
|
|
||||||
}
|
|
||||||
argp += args;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ((inst & 0xffff) == 0xb81f) /* cmpqd 0,tos */
|
|
||||||
return (1);
|
|
||||||
else if ((inst & 0xffff) == 0xbdc7) /* cmpd tos,tos */
|
|
||||||
return (2);
|
|
||||||
else if ((inst & 0xfffc) == 0xa57c)
|
|
||||||
{ /* adjsp[bwd] */
|
|
||||||
switch (inst & 3)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
args = ((args & 0xff) + 0x80);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
args = ((ntohs (args) & 0xffff) + 0x8000);
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
args = -ntohl (args);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
if (args / 4 > 10 || (args & 3) != 0)
|
|
||||||
continue;
|
|
||||||
return (args / 4);
|
|
||||||
}
|
|
||||||
argp += 1;
|
|
||||||
}
|
|
||||||
return (-1);
|
|
||||||
}
|
|
|
@ -1,62 +0,0 @@
|
||||||
/* Target-dependent code for NS32000 systems running NetBSD.
|
|
||||||
Copyright 2002, 2003 Free Software Foundation, Inc.
|
|
||||||
Contributed by Wasabi Systems, 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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "osabi.h"
|
|
||||||
|
|
||||||
#include "ns32k-tdep.h"
|
|
||||||
#include "gdb_string.h"
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32knbsd_init_abi_common (struct gdbarch_info info,
|
|
||||||
struct gdbarch *gdbarch)
|
|
||||||
{
|
|
||||||
/* We only support machines with the 32382 FPU. */
|
|
||||||
ns32k_gdbarch_init_32382 (gdbarch);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
ns32knbsd_init_abi_aout (struct gdbarch_info info,
|
|
||||||
struct gdbarch *gdbarch)
|
|
||||||
{
|
|
||||||
ns32knbsd_init_abi_common (info, gdbarch);
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum gdb_osabi
|
|
||||||
ns32knbsd_aout_osabi_sniffer (bfd *abfd)
|
|
||||||
{
|
|
||||||
if (strcmp (bfd_get_target (abfd), "a.out-ns32k-netbsd") == 0)
|
|
||||||
return GDB_OSABI_NETBSD_AOUT;
|
|
||||||
|
|
||||||
return GDB_OSABI_UNKNOWN;
|
|
||||||
}
|
|
||||||
|
|
||||||
extern initialize_file_ftype _initialize_ns32knbsd_tdep; /* -Wmissing-prototypes */
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_ns32knbsd_tdep (void)
|
|
||||||
{
|
|
||||||
gdbarch_register_osabi_sniffer (bfd_arch_ns32k, bfd_target_aout_flavour,
|
|
||||||
ns32knbsd_aout_osabi_sniffer);
|
|
||||||
|
|
||||||
gdbarch_register_osabi (bfd_arch_ns32k, 0, GDB_OSABI_NETBSD_AOUT,
|
|
||||||
ns32knbsd_init_abi_aout);
|
|
||||||
}
|
|
1249
gdb/v850-tdep.c
1249
gdb/v850-tdep.c
File diff suppressed because it is too large
Load Diff
927
gdb/v850ice.c
927
gdb/v850ice.c
|
@ -1,927 +0,0 @@
|
||||||
/* ICE interface for the NEC V850 for GDB, the GNU debugger.
|
|
||||||
Copyright 1996, 1997, 1998, 1999, 2000, 2001
|
|
||||||
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., 59 Temple Place - Suite 330,
|
|
||||||
Boston, MA 02111-1307, USA. */
|
|
||||||
|
|
||||||
#include "defs.h"
|
|
||||||
#include "gdb_string.h"
|
|
||||||
#include "frame.h"
|
|
||||||
#include "symtab.h"
|
|
||||||
#include "inferior.h"
|
|
||||||
#include "breakpoint.h"
|
|
||||||
#include "symfile.h"
|
|
||||||
#include "target.h"
|
|
||||||
#include "objfiles.h"
|
|
||||||
#include "gdbcore.h"
|
|
||||||
#include "value.h"
|
|
||||||
#include "command.h"
|
|
||||||
#include "regcache.h"
|
|
||||||
|
|
||||||
#include <tcl.h>
|
|
||||||
#include <windows.h>
|
|
||||||
#include <winuser.h> /* for WM_USER */
|
|
||||||
|
|
||||||
extern unsigned long int strtoul (const char *nptr, char **endptr,
|
|
||||||
int base);
|
|
||||||
|
|
||||||
/* Local data definitions */
|
|
||||||
struct MessageIO
|
|
||||||
{
|
|
||||||
int size; /* length of input or output in bytes */
|
|
||||||
char *buf; /* buffer having the input/output information */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Prototypes for functions located in other files */
|
|
||||||
extern void break_command (char *, int);
|
|
||||||
|
|
||||||
/* Prototypes for local functions */
|
|
||||||
static int init_hidden_window (void);
|
|
||||||
|
|
||||||
static LRESULT CALLBACK v850ice_wndproc (HWND, UINT, WPARAM, LPARAM);
|
|
||||||
|
|
||||||
static void v850ice_files_info (struct target_ops *ignore);
|
|
||||||
|
|
||||||
static int v850ice_xfer_memory (CORE_ADDR memaddr, char *myaddr,
|
|
||||||
int len, int should_write,
|
|
||||||
struct target_ops *target);
|
|
||||||
|
|
||||||
static void v850ice_prepare_to_store (void);
|
|
||||||
|
|
||||||
static void v850ice_fetch_registers (int regno);
|
|
||||||
|
|
||||||
static void v850ice_resume (ptid_t ptid, int step,
|
|
||||||
enum target_signal siggnal);
|
|
||||||
|
|
||||||
static void v850ice_open (char *name, int from_tty);
|
|
||||||
|
|
||||||
static void v850ice_close (int quitting);
|
|
||||||
|
|
||||||
static void v850ice_stop (void);
|
|
||||||
|
|
||||||
static void v850ice_store_registers (int regno);
|
|
||||||
|
|
||||||
static void v850ice_mourn (void);
|
|
||||||
|
|
||||||
static ptid_t v850ice_wait (ptid_t ptid,
|
|
||||||
struct target_waitstatus *status);
|
|
||||||
|
|
||||||
static void v850ice_kill (void);
|
|
||||||
|
|
||||||
static void v850ice_detach (char *args, int from_tty);
|
|
||||||
|
|
||||||
static int v850ice_insert_breakpoint (CORE_ADDR, char *);
|
|
||||||
|
|
||||||
static int v850ice_remove_breakpoint (CORE_ADDR, char *);
|
|
||||||
|
|
||||||
static void v850ice_command (char *, int);
|
|
||||||
|
|
||||||
static int ice_disassemble (unsigned long, int, char *);
|
|
||||||
|
|
||||||
static int ice_lookup_addr (unsigned long *, char *, char *);
|
|
||||||
|
|
||||||
static int ice_lookup_symbol (unsigned long, char *);
|
|
||||||
|
|
||||||
static void ice_SimulateDisassemble (char *, int);
|
|
||||||
|
|
||||||
static void ice_SimulateAddrLookup (char *, int);
|
|
||||||
|
|
||||||
static void ice_Simulate_SymLookup (char *, int);
|
|
||||||
|
|
||||||
static void ice_fputs (const char *, struct ui_file *);
|
|
||||||
|
|
||||||
static int ice_file (char *);
|
|
||||||
|
|
||||||
static int ice_cont (char *);
|
|
||||||
|
|
||||||
static int ice_stepi (char *);
|
|
||||||
|
|
||||||
static int ice_nexti (char *);
|
|
||||||
|
|
||||||
static void togdb_force_update (void);
|
|
||||||
|
|
||||||
static void view_source (CORE_ADDR);
|
|
||||||
|
|
||||||
static void do_gdb (char *, char *, void (*func) (char *, int), int);
|
|
||||||
|
|
||||||
|
|
||||||
/* Globals */
|
|
||||||
static HWND hidden_hwnd; /* HWND for messages */
|
|
||||||
|
|
||||||
long (__stdcall * ExeAppReq) (char *, long, char *, struct MessageIO *);
|
|
||||||
|
|
||||||
long (__stdcall * RegisterClient) (HWND);
|
|
||||||
|
|
||||||
long (__stdcall * UnregisterClient) (void);
|
|
||||||
|
|
||||||
extern Tcl_Interp *gdbtk_interp;
|
|
||||||
|
|
||||||
/* Globals local to this file only */
|
|
||||||
static int ice_open = 0; /* Is ICE open? */
|
|
||||||
|
|
||||||
static char *v850_CB_Result; /* special char array for saving 'callback' results */
|
|
||||||
|
|
||||||
static int SimulateCallback; /* simulate a callback event */
|
|
||||||
|
|
||||||
#define MAX_BLOCK_SIZE 64*1024 /* Cannot transfer memory in blocks bigger
|
|
||||||
than this */
|
|
||||||
/* MDI/ICE Message IDs */
|
|
||||||
#define GSINGLESTEP 0x200 /* single-step target */
|
|
||||||
#define GRESUME 0x201 /* resume target */
|
|
||||||
#define GREADREG 0x202 /* read a register */
|
|
||||||
#define GWRITEREG 0x203 /* write a register */
|
|
||||||
#define GWRITEBLOCK 0x204 /* write a block of memory */
|
|
||||||
#define GREADBLOCK 0x205 /* read a block of memory */
|
|
||||||
#define GSETBREAK 0x206 /* set a breakpoint */
|
|
||||||
#define GREMOVEBREAK 0x207 /* remove a breakpoint */
|
|
||||||
#define GHALT 0x208 /* ??? */
|
|
||||||
#define GCHECKSTATUS 0x209 /* check status of ICE */
|
|
||||||
#define GMDIREPLY 0x210 /* Reply for previous query - NOT USED */
|
|
||||||
#define GDOWNLOAD 0x211 /* something for MDI */
|
|
||||||
#define GCOMMAND 0x212 /* execute command in ice */
|
|
||||||
#define GLOADFILENAME 0x213 /* retrieve load filename */
|
|
||||||
#define GWRITEMEM 0x214 /* write word, half-word, or byte */
|
|
||||||
|
|
||||||
/* GCHECKSTATUS return codes: */
|
|
||||||
#define ICE_Idle 0x00
|
|
||||||
#define ICE_Breakpoint 0x01 /* hit a breakpoint */
|
|
||||||
#define ICE_Stepped 0x02 /* have stepped */
|
|
||||||
#define ICE_Exception 0x03 /* have exception */
|
|
||||||
#define ICE_Halted 0x04 /* hit a user halt */
|
|
||||||
#define ICE_Exited 0x05 /* called exit */
|
|
||||||
#define ICE_Terminated 0x06 /* user terminated */
|
|
||||||
#define ICE_Running 0x07
|
|
||||||
#define ICE_Unknown 0x99
|
|
||||||
|
|
||||||
/* Windows messages */
|
|
||||||
#define WM_STATE_CHANGE WM_USER+101
|
|
||||||
#define WM_SYM_TO_ADDR WM_USER+102
|
|
||||||
#define WM_ADDR_TO_SYM WM_USER+103
|
|
||||||
#define WM_DISASSEMBLY WM_USER+104
|
|
||||||
#define WM_SOURCE WM_USER+105
|
|
||||||
|
|
||||||
/* STATE_CHANGE codes */
|
|
||||||
#define STATE_CHANGE_REGS 1 /* Register(s) changed */
|
|
||||||
#define STATE_CHANGE_LOAD 2 /* HW reset */
|
|
||||||
#define STATE_CHANGE_RESET 3 /* Load new file */
|
|
||||||
#define STATE_CHANGE_CONT 4 /* Run target */
|
|
||||||
#define STATE_CHANGE_STOP 5 /* Stop target */
|
|
||||||
#define STATE_CHANGE_STEPI 6 /* Stepi target */
|
|
||||||
#define STATE_CHANGE_NEXTI 7 /* Nexti target */
|
|
||||||
|
|
||||||
static struct target_ops v850ice_ops; /* Forward decl */
|
|
||||||
|
|
||||||
/* This function creates a hidden window */
|
|
||||||
static int
|
|
||||||
init_hidden_window (void)
|
|
||||||
{
|
|
||||||
WNDCLASS class;
|
|
||||||
|
|
||||||
if (hidden_hwnd != NULL)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
class.style = 0;
|
|
||||||
class.cbClsExtra = 0;
|
|
||||||
class.cbWndExtra = 0;
|
|
||||||
class.hInstance = GetModuleHandle (0);
|
|
||||||
class.hbrBackground = NULL;
|
|
||||||
class.lpszMenuName = NULL;
|
|
||||||
class.lpszClassName = "gdb_v850ice";
|
|
||||||
class.lpfnWndProc = v850ice_wndproc;
|
|
||||||
class.hIcon = NULL;
|
|
||||||
class.hCursor = NULL;
|
|
||||||
|
|
||||||
if (!RegisterClass (&class))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
hidden_hwnd = CreateWindow ("gdb_v850ice", "gdb_v850ice", WS_TILED,
|
|
||||||
0, 0, 0, 0, NULL, NULL, class.hInstance,
|
|
||||||
NULL);
|
|
||||||
if (hidden_hwnd == NULL)
|
|
||||||
{
|
|
||||||
char buf[200];
|
|
||||||
DWORD err;
|
|
||||||
|
|
||||||
err = GetLastError ();
|
|
||||||
FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, err,
|
|
||||||
0, buf, 200, NULL);
|
|
||||||
printf_unfiltered ("Could not create window: %s", buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
This function is installed as the message handler for the hidden window
|
|
||||||
which QBox will use to communicate with gdb. It recognize and acts
|
|
||||||
on the following messages:
|
|
||||||
|
|
||||||
WM_SYM_TO_ADDR \
|
|
||||||
WM_ADDR_TO_SYM | Not implemented at NEC's request
|
|
||||||
WM_DISASSEMBLY /
|
|
||||||
WM_STATE_CHANGE - tells us that a state change has occured in the ICE
|
|
||||||
*/
|
|
||||||
static LRESULT CALLBACK
|
|
||||||
v850ice_wndproc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
||||||
{
|
|
||||||
LRESULT result = FALSE;
|
|
||||||
|
|
||||||
switch (message)
|
|
||||||
{
|
|
||||||
case WM_SYM_TO_ADDR:
|
|
||||||
MessageBox (0, "Symbol resolution\nNot implemented", "GDB", MB_OK);
|
|
||||||
break;
|
|
||||||
case WM_ADDR_TO_SYM:
|
|
||||||
MessageBox (0, "Address resolution\nNot implemented", "GDB", MB_OK);
|
|
||||||
break;
|
|
||||||
case WM_SOURCE:
|
|
||||||
view_source ((CORE_ADDR) lParam);
|
|
||||||
break;
|
|
||||||
case WM_STATE_CHANGE:
|
|
||||||
switch (wParam)
|
|
||||||
{
|
|
||||||
case STATE_CHANGE_LOAD:
|
|
||||||
{
|
|
||||||
struct MessageIO iob;
|
|
||||||
char buf[128];
|
|
||||||
|
|
||||||
iob.buf = buf;
|
|
||||||
iob.size = 128;
|
|
||||||
|
|
||||||
/* Load in a new file... Need filename */
|
|
||||||
ExeAppReq ("GDB", GLOADFILENAME, NULL, &iob);
|
|
||||||
if (!catch_errors ((catch_errors_ftype *) ice_file, iob.buf, "", RETURN_MASK_ALL))
|
|
||||||
printf_unfiltered ("load errored\n");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case STATE_CHANGE_RESET:
|
|
||||||
registers_changed ();
|
|
||||||
flush_cached_frames ();
|
|
||||||
togdb_force_update ();
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
case STATE_CHANGE_REGS:
|
|
||||||
registers_changed ();
|
|
||||||
togdb_force_update ();
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
case STATE_CHANGE_CONT:
|
|
||||||
if (!catch_errors ((catch_errors_ftype *) ice_cont, NULL, "", RETURN_MASK_ALL))
|
|
||||||
printf_unfiltered ("continue errored\n");
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
case STATE_CHANGE_STEPI:
|
|
||||||
if (!catch_errors ((catch_errors_ftype *) ice_stepi, (int) lParam, "",
|
|
||||||
RETURN_MASK_ALL))
|
|
||||||
printf_unfiltered ("stepi errored\n");
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
case STATE_CHANGE_NEXTI:
|
|
||||||
if (!catch_errors ((catch_errors_ftype *) ice_nexti, (int) lParam, "",
|
|
||||||
RETURN_MASK_ALL))
|
|
||||||
printf_unfiltered ("nexti errored\n");
|
|
||||||
result = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result == FALSE)
|
|
||||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Code for opening a connection to the ICE. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_open (char *name, int from_tty)
|
|
||||||
{
|
|
||||||
HINSTANCE handle;
|
|
||||||
|
|
||||||
if (name)
|
|
||||||
error ("Too many arguments.");
|
|
||||||
|
|
||||||
target_preopen (from_tty);
|
|
||||||
|
|
||||||
unpush_target (&v850ice_ops);
|
|
||||||
|
|
||||||
if (from_tty)
|
|
||||||
puts_filtered ("V850ice debugging\n");
|
|
||||||
|
|
||||||
push_target (&v850ice_ops); /* Switch to using v850ice target now */
|
|
||||||
|
|
||||||
target_terminal_init ();
|
|
||||||
|
|
||||||
/* Initialize everything necessary to facilitate communication
|
|
||||||
between QBox, gdb, and the DLLs which control the ICE */
|
|
||||||
if (ExeAppReq == NULL)
|
|
||||||
{
|
|
||||||
handle = LoadLibrary ("necmsg.dll");
|
|
||||||
if (handle == NULL)
|
|
||||||
error ("Cannot load necmsg.dll");
|
|
||||||
|
|
||||||
ExeAppReq = (long (*) (char *, long, char *, struct MessageIO *))
|
|
||||||
GetProcAddress (handle, "ExeAppReq");
|
|
||||||
RegisterClient = (long (*) (HWND))
|
|
||||||
GetProcAddress (handle, "RegisterClient");
|
|
||||||
UnregisterClient = (long (*) (void))
|
|
||||||
GetProcAddress (handle, "UnregisterClient");
|
|
||||||
|
|
||||||
if (ExeAppReq == NULL || RegisterClient == NULL || UnregisterClient == NULL)
|
|
||||||
error ("Could not find requisite functions in necmsg.dll.");
|
|
||||||
|
|
||||||
if (!init_hidden_window ())
|
|
||||||
error ("could not initialize message handling");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tell the DLL we are here */
|
|
||||||
RegisterClient (hidden_hwnd);
|
|
||||||
|
|
||||||
ice_open = 1;
|
|
||||||
|
|
||||||
/* Without this, some commands which require an active target (such as kill)
|
|
||||||
won't work. This variable serves (at least) double duty as both the pid
|
|
||||||
of the target process (if it has such), and as a flag indicating that a
|
|
||||||
target is active. These functions should be split out into seperate
|
|
||||||
variables, especially since GDB will someday have a notion of debugging
|
|
||||||
several processes. */
|
|
||||||
inferior_ptid = pid_to_ptid (42000);
|
|
||||||
|
|
||||||
start_remote ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Clean up connection to a remote debugger. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_close (int quitting)
|
|
||||||
{
|
|
||||||
if (ice_open)
|
|
||||||
{
|
|
||||||
UnregisterClient ();
|
|
||||||
ice_open = 0;
|
|
||||||
inferior_ptid = null_ptid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Stop the process on the ice. */
|
|
||||||
static void
|
|
||||||
v850ice_stop (void)
|
|
||||||
{
|
|
||||||
/* This is silly, but it works... */
|
|
||||||
v850ice_command ("stop", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_detach (char *args, int from_tty)
|
|
||||||
{
|
|
||||||
if (args)
|
|
||||||
error ("Argument given to \"detach\" when remotely debugging.");
|
|
||||||
|
|
||||||
pop_target ();
|
|
||||||
if (from_tty)
|
|
||||||
puts_filtered ("Ending v850ice debugging.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tell the remote machine to resume. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_resume (ptid_t ptid, int step, enum target_signal siggnal)
|
|
||||||
{
|
|
||||||
long retval;
|
|
||||||
char buf[256];
|
|
||||||
struct MessageIO iob;
|
|
||||||
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
|
|
||||||
if (step)
|
|
||||||
retval = ExeAppReq ("GDB", GSINGLESTEP, "step", &iob);
|
|
||||||
else
|
|
||||||
retval = ExeAppReq ("GDB", GRESUME, "run", &iob);
|
|
||||||
|
|
||||||
if (retval)
|
|
||||||
error ("ExeAppReq (step = %d) returned %d", step, retval);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Wait until the remote machine stops, then return,
|
|
||||||
storing status in STATUS just as `wait' would.
|
|
||||||
Returns "pid" (though it's not clear what, if anything, that
|
|
||||||
means in the case of this target). */
|
|
||||||
|
|
||||||
static ptid_t
|
|
||||||
v850ice_wait (ptid_t ptid, struct target_waitstatus *status)
|
|
||||||
{
|
|
||||||
long v850_status;
|
|
||||||
char buf[256];
|
|
||||||
struct MessageIO iob;
|
|
||||||
int done = 0;
|
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
if (count++ % 100000)
|
|
||||||
{
|
|
||||||
deprecated_ui_loop_hook (0);
|
|
||||||
count = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
v850_status = ExeAppReq ("GDB", GCHECKSTATUS, NULL, &iob);
|
|
||||||
|
|
||||||
switch (v850_status)
|
|
||||||
{
|
|
||||||
case ICE_Idle:
|
|
||||||
case ICE_Breakpoint:
|
|
||||||
case ICE_Stepped:
|
|
||||||
case ICE_Halted:
|
|
||||||
status->kind = TARGET_WAITKIND_STOPPED;
|
|
||||||
status->value.sig = TARGET_SIGNAL_TRAP;
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
case ICE_Exception:
|
|
||||||
status->kind = TARGET_WAITKIND_SIGNALLED;
|
|
||||||
status->value.sig = TARGET_SIGNAL_SEGV;
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
case ICE_Exited:
|
|
||||||
status->kind = TARGET_WAITKIND_EXITED;
|
|
||||||
status->value.integer = 0;
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
case ICE_Terminated:
|
|
||||||
status->kind = TARGET_WAITKIND_SIGNALLED;
|
|
||||||
status->value.sig = TARGET_SIGNAL_KILL;
|
|
||||||
done = 1;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (!done);
|
|
||||||
|
|
||||||
return inferior_ptid;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
convert_register (int regno, char *buf)
|
|
||||||
{
|
|
||||||
if (regno <= 31)
|
|
||||||
sprintf (buf, "r%d", regno);
|
|
||||||
else if (REGISTER_NAME (regno)[0] == 's'
|
|
||||||
&& REGISTER_NAME (regno)[1] == 'r')
|
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
sprintf (buf, "%s", REGISTER_NAME (regno));
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read the remote registers into the block REGS. */
|
|
||||||
/* Note that the ICE returns register contents as ascii hex strings. We have
|
|
||||||
to convert that to an unsigned long, and then call store_unsigned_integer to
|
|
||||||
convert it to target byte-order if necessary. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_fetch_registers (int regno)
|
|
||||||
{
|
|
||||||
long retval;
|
|
||||||
char cmd[100];
|
|
||||||
char val[100];
|
|
||||||
struct MessageIO iob;
|
|
||||||
unsigned long regval;
|
|
||||||
char *p;
|
|
||||||
|
|
||||||
if (regno == -1)
|
|
||||||
{
|
|
||||||
for (regno = 0; regno < NUM_REGS; regno++)
|
|
||||||
v850ice_fetch_registers (regno);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
strcpy (cmd, "reg ");
|
|
||||||
if (!convert_register (regno, &cmd[4]))
|
|
||||||
return;
|
|
||||||
|
|
||||||
iob.size = sizeof val;
|
|
||||||
iob.buf = val;
|
|
||||||
retval = ExeAppReq ("GDB", GREADREG, cmd, &iob);
|
|
||||||
if (retval)
|
|
||||||
error ("1: ExeAppReq returned %d: cmd = %s", retval, cmd);
|
|
||||||
|
|
||||||
regval = strtoul (val, NULL, 16);
|
|
||||||
if (regval == 0 && p == val)
|
|
||||||
error ("v850ice_fetch_registers (%d): bad value from ICE: %s.",
|
|
||||||
regno, val);
|
|
||||||
|
|
||||||
store_unsigned_integer (val, register_size (current_gdbarch, regno), regval);
|
|
||||||
regcache_raw_supply (current_regcache, regno, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Store register REGNO, or all registers if REGNO == -1, from the contents
|
|
||||||
of REGISTERS. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_store_registers (int regno)
|
|
||||||
{
|
|
||||||
long retval;
|
|
||||||
char cmd[100];
|
|
||||||
unsigned long regval;
|
|
||||||
char buf[256];
|
|
||||||
struct MessageIO iob;
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
|
|
||||||
if (regno == -1)
|
|
||||||
{
|
|
||||||
for (regno = 0; regno < NUM_REGS; regno++)
|
|
||||||
v850ice_store_registers (regno);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
regval = extract_unsigned_integer (&deprecated_registers[DEPRECATED_REGISTER_BYTE (regno)],
|
|
||||||
register_size (current_gdbarch, regno));
|
|
||||||
strcpy (cmd, "reg ");
|
|
||||||
if (!convert_register (regno, &cmd[4]))
|
|
||||||
return;
|
|
||||||
sprintf (cmd + strlen (cmd), "=0x%x", regval);
|
|
||||||
|
|
||||||
retval = ExeAppReq ("GDB", GWRITEREG, cmd, &iob);
|
|
||||||
if (retval)
|
|
||||||
error ("2: ExeAppReq returned %d: cmd = %s", retval, cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prepare to store registers. Nothing to do here, since the ICE can write one
|
|
||||||
register at a time. */
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_prepare_to_store (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Read or write LEN bytes from inferior memory at MEMADDR, transferring
|
|
||||||
to or from debugger address MYADDR. Write to inferior if SHOULD_WRITE is
|
|
||||||
nonzero. TARGET is unused. Returns length of data written or read;
|
|
||||||
0 for error.
|
|
||||||
|
|
||||||
We can only read/write MAX_BLOCK_SIZE bytes at a time, though, or the DLL
|
|
||||||
dies. */
|
|
||||||
static int
|
|
||||||
v850ice_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
|
|
||||||
int should_write, struct target_ops *target)
|
|
||||||
{
|
|
||||||
long retval;
|
|
||||||
char cmd[100];
|
|
||||||
struct MessageIO iob;
|
|
||||||
int sent;
|
|
||||||
|
|
||||||
if (should_write)
|
|
||||||
{
|
|
||||||
if (len == 4 || len == 2 || len == 1)
|
|
||||||
{
|
|
||||||
long value = 0;
|
|
||||||
char buf[256];
|
|
||||||
char c;
|
|
||||||
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
|
|
||||||
sent = 0;
|
|
||||||
switch (len)
|
|
||||||
{
|
|
||||||
case 4:
|
|
||||||
c = 'w';
|
|
||||||
value |= (long) ((myaddr[3] << 24) & 0xff000000);
|
|
||||||
value |= (long) ((myaddr[2] << 16) & 0x00ff0000);
|
|
||||||
value |= (long) ((myaddr[1] << 8) & 0x0000ff00);
|
|
||||||
value |= (long) (myaddr[0] & 0x000000ff);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
c = 'h';
|
|
||||||
value |= (long) ((myaddr[1] << 8) & 0xff00);
|
|
||||||
value |= (long) (myaddr[0] & 0x00ff);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
c = 'b';
|
|
||||||
value |= (long) (myaddr[0] & 0xff);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
sprintf (cmd, "memory %c c 0x%x=0x%x", c, (int) memaddr, value);
|
|
||||||
retval = ExeAppReq ("GDB", GWRITEMEM, cmd, &iob);
|
|
||||||
if (retval == 0)
|
|
||||||
sent = len;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sent = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
iob.size = len > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : len;
|
|
||||||
iob.buf = myaddr;
|
|
||||||
sprintf (cmd, "memory b c 0x%x=0x00 l=%d", (int) memaddr, iob.size);
|
|
||||||
retval = ExeAppReq ("GDB", GWRITEBLOCK, cmd, &iob);
|
|
||||||
if (retval != 0)
|
|
||||||
break;
|
|
||||||
len -= iob.size;
|
|
||||||
memaddr += iob.size;
|
|
||||||
myaddr += iob.size;
|
|
||||||
sent += iob.size;
|
|
||||||
}
|
|
||||||
while (len > 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
unsigned char *tmp;
|
|
||||||
unsigned char *t;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
tmp = alloca (len + 100);
|
|
||||||
t = tmp;
|
|
||||||
memset (tmp + len, 0xff, 100);
|
|
||||||
|
|
||||||
sent = 0;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
iob.size = len > MAX_BLOCK_SIZE ? MAX_BLOCK_SIZE : len;
|
|
||||||
iob.buf = tmp;
|
|
||||||
sprintf (cmd, "memory b 0x%x l=%d", (int) memaddr, iob.size);
|
|
||||||
retval = ExeAppReq ("GDB", GREADBLOCK, cmd, &iob);
|
|
||||||
if (retval != 0)
|
|
||||||
break;
|
|
||||||
len -= iob.size;
|
|
||||||
memaddr += iob.size;
|
|
||||||
sent += iob.size;
|
|
||||||
tmp += iob.size;
|
|
||||||
}
|
|
||||||
while (len > 0);
|
|
||||||
|
|
||||||
if (retval == 0)
|
|
||||||
{
|
|
||||||
for (i = 0; i < 100; i++)
|
|
||||||
{
|
|
||||||
if (t[sent + i] != 0xff)
|
|
||||||
{
|
|
||||||
warning ("GREADBLOCK trashed bytes after transfer area.");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
memcpy (myaddr, t, sent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (retval != 0)
|
|
||||||
error ("3: ExeAppReq returned %d: cmd = %s", retval, cmd);
|
|
||||||
|
|
||||||
return sent;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_files_info (struct target_ops *ignore)
|
|
||||||
{
|
|
||||||
puts_filtered ("Debugging a target via the NEC V850 ICE.\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
v850ice_insert_breakpoint (CORE_ADDR addr, char *contents_cache)
|
|
||||||
{
|
|
||||||
long retval;
|
|
||||||
char cmd[100];
|
|
||||||
char buf[256];
|
|
||||||
struct MessageIO iob;
|
|
||||||
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
sprintf (cmd, "%d, ", addr);
|
|
||||||
|
|
||||||
retval = ExeAppReq ("GDB", GSETBREAK, cmd, &iob);
|
|
||||||
if (retval)
|
|
||||||
error ("ExeAppReq (GSETBREAK) returned %d: cmd = %s", retval, cmd);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
v850ice_remove_breakpoint (CORE_ADDR addr, char *contents_cache)
|
|
||||||
{
|
|
||||||
long retval;
|
|
||||||
char cmd[100];
|
|
||||||
char buf[256];
|
|
||||||
struct MessageIO iob;
|
|
||||||
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
|
|
||||||
sprintf (cmd, "%d, ", addr);
|
|
||||||
|
|
||||||
retval = ExeAppReq ("GDB", GREMOVEBREAK, cmd, &iob);
|
|
||||||
if (retval)
|
|
||||||
error ("ExeAppReq (GREMOVEBREAK) returned %d: cmd = %s", retval, cmd);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_kill (void)
|
|
||||||
{
|
|
||||||
target_mourn_inferior ();
|
|
||||||
inferior_ptid = null_ptid;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_mourn (void)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_load (char *filename, int from_tty)
|
|
||||||
{
|
|
||||||
struct MessageIO iob;
|
|
||||||
char buf[256];
|
|
||||||
|
|
||||||
iob.size = 0;
|
|
||||||
iob.buf = buf;
|
|
||||||
generic_load (filename, from_tty);
|
|
||||||
ExeAppReq ("GDB", GDOWNLOAD, filename, &iob);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ice_file (char *arg)
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
target_detach (NULL, 0);
|
|
||||||
pop_target ();
|
|
||||||
|
|
||||||
printf_unfiltered ("\n");
|
|
||||||
|
|
||||||
s = arg;
|
|
||||||
while (*s != '\0')
|
|
||||||
{
|
|
||||||
if (*s == '\\')
|
|
||||||
*s = '/';
|
|
||||||
s++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Safegaurd against confusing the breakpoint routines... */
|
|
||||||
delete_command (NULL, 0);
|
|
||||||
|
|
||||||
/* Must supress from_tty, otherwise we could start asking if the
|
|
||||||
user really wants to load a new symbol table, etc... */
|
|
||||||
printf_unfiltered ("Reading symbols from %s...", arg);
|
|
||||||
exec_open (arg, 0);
|
|
||||||
symbol_file_add_main (arg, 0);
|
|
||||||
printf_unfiltered ("done\n");
|
|
||||||
|
|
||||||
/* exec_open will kill our target, so reinstall the ICE as
|
|
||||||
the target. */
|
|
||||||
v850ice_open (NULL, 0);
|
|
||||||
|
|
||||||
togdb_force_update ();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ice_cont (char *c)
|
|
||||||
{
|
|
||||||
printf_filtered ("continue (ice)\n");
|
|
||||||
ReplyMessage ((LRESULT) 1);
|
|
||||||
|
|
||||||
if (gdbtk_interp == NULL)
|
|
||||||
{
|
|
||||||
continue_command (NULL, 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Tcl_Eval (gdbtk_interp, "gdb_immediate continue");
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
do_gdb (char *cmd, char *str, void (*func) (char *, int), int count)
|
|
||||||
{
|
|
||||||
ReplyMessage ((LRESULT) 1);
|
|
||||||
|
|
||||||
while (count--)
|
|
||||||
{
|
|
||||||
printf_unfiltered (str);
|
|
||||||
|
|
||||||
if (gdbtk_interp == NULL)
|
|
||||||
{
|
|
||||||
func (NULL, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
Tcl_Eval (gdbtk_interp, cmd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
|
||||||
ice_stepi (char *c)
|
|
||||||
{
|
|
||||||
int count = (int) c;
|
|
||||||
|
|
||||||
do_gdb ("gdb_immediate stepi", "stepi (ice)\n", stepi_command, count);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
ice_nexti (char *c)
|
|
||||||
{
|
|
||||||
int count = (int) c;
|
|
||||||
|
|
||||||
do_gdb ("gdb_immediate nexti", "nexti (ice)\n", nexti_command, count);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
v850ice_command (char *arg, int from_tty)
|
|
||||||
{
|
|
||||||
struct MessageIO iob;
|
|
||||||
char buf[256];
|
|
||||||
|
|
||||||
iob.buf = buf;
|
|
||||||
iob.size = 0;
|
|
||||||
ExeAppReq ("GDB", GCOMMAND, arg, &iob);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
togdb_force_update (void)
|
|
||||||
{
|
|
||||||
if (gdbtk_interp != NULL)
|
|
||||||
Tcl_Eval (gdbtk_interp, "gdbtk_update");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
view_source (CORE_ADDR addr)
|
|
||||||
{
|
|
||||||
char c[256];
|
|
||||||
|
|
||||||
if (gdbtk_interp != NULL)
|
|
||||||
{
|
|
||||||
sprintf (c, "catch {set src [lindex [ManagedWin::find SrcWin] 0]\n$src location BROWSE [gdb_loc *0x%x]}", addr);
|
|
||||||
Tcl_Eval (gdbtk_interp, c);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Define the target subroutine names */
|
|
||||||
|
|
||||||
static void
|
|
||||||
init_850ice_ops (void)
|
|
||||||
{
|
|
||||||
v850ice_ops.to_shortname = "ice";
|
|
||||||
v850ice_ops.to_longname = "NEC V850 ICE interface";
|
|
||||||
v850ice_ops.to_doc = "Debug a system controlled by a NEC 850 ICE.";
|
|
||||||
v850ice_ops.to_open = v850ice_open;
|
|
||||||
v850ice_ops.to_close = v850ice_close;
|
|
||||||
v850ice_ops.to_detach = v850ice_detach;
|
|
||||||
v850ice_ops.to_resume = v850ice_resume;
|
|
||||||
v850ice_ops.to_wait = v850ice_wait;
|
|
||||||
v850ice_ops.to_fetch_registers = v850ice_fetch_registers;
|
|
||||||
v850ice_ops.to_store_registers = v850ice_store_registers;
|
|
||||||
v850ice_ops.to_prepare_to_store = v850ice_prepare_to_store;
|
|
||||||
v850ice_ops.deprecated_xfer_memory = v850ice_xfer_memory;
|
|
||||||
v850ice_ops.to_files_info = v850ice_files_info;
|
|
||||||
v850ice_ops.to_insert_breakpoint = v850ice_insert_breakpoint;
|
|
||||||
v850ice_ops.to_remove_breakpoint = v850ice_remove_breakpoint;
|
|
||||||
v850ice_ops.to_kill = v850ice_kill;
|
|
||||||
v850ice_ops.to_load = v850ice_load;
|
|
||||||
v850ice_ops.to_mourn_inferior = v850ice_mourn;
|
|
||||||
v850ice_ops.to_stop = v850ice_stop;
|
|
||||||
v850ice_ops.to_stratum = process_stratum;
|
|
||||||
v850ice_ops.to_has_all_memory = 1;
|
|
||||||
v850ice_ops.to_has_memory = 1;
|
|
||||||
v850ice_ops.to_has_stack = 1;
|
|
||||||
v850ice_ops.to_has_registers = 1;
|
|
||||||
v850ice_ops.to_has_execution = 1;
|
|
||||||
v850ice_ops.to_magic = OPS_MAGIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_initialize_v850ice (void)
|
|
||||||
{
|
|
||||||
init_850ice_ops ();
|
|
||||||
add_target (&v850ice_ops);
|
|
||||||
|
|
||||||
add_com ("ice", class_obscure, v850ice_command,
|
|
||||||
"Send command to ICE");
|
|
||||||
}
|
|
Loading…
Reference in New Issue