diff options
author | Andrew Cagney <cagney@redhat.com> | 2002-07-24 23:51:36 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2002-07-24 23:51:36 +0000 |
commit | 7fb623f7ad6de82eb44730ca15d863029eb767f0 (patch) | |
tree | 57aabf4fe379286539cce8456db33faef38d0e11 /gdb | |
parent | 37611a2b102505daefdae7cb47a60c84fb2a9a09 (diff) | |
download | gdb-7fb623f7ad6de82eb44730ca15d863029eb767f0.zip gdb-7fb623f7ad6de82eb44730ca15d863029eb767f0.tar.gz gdb-7fb623f7ad6de82eb44730ca15d863029eb767f0.tar.bz2 |
Obsolete m88k.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 31 | ||||
-rw-r--r-- | gdb/MAINTAINERS | 5 | ||||
-rw-r--r-- | gdb/Makefile.in | 11 | ||||
-rw-r--r-- | gdb/NEWS | 1 | ||||
-rw-r--r-- | gdb/README | 1 | ||||
-rw-r--r-- | gdb/config/m88k/delta88.mh | 12 | ||||
-rw-r--r-- | gdb/config/m88k/delta88.mt | 6 | ||||
-rw-r--r-- | gdb/config/m88k/delta88v4.mh | 16 | ||||
-rw-r--r-- | gdb/config/m88k/delta88v4.mt | 6 | ||||
-rw-r--r-- | gdb/config/m88k/m88k.mh | 8 | ||||
-rw-r--r-- | gdb/config/m88k/m88k.mt | 6 | ||||
-rw-r--r-- | gdb/config/m88k/nm-delta88v4.h | 46 | ||||
-rw-r--r-- | gdb/config/m88k/nm-m88k.h | 50 | ||||
-rw-r--r-- | gdb/config/m88k/tm-delta88.h | 56 | ||||
-rw-r--r-- | gdb/config/m88k/tm-delta88v4.h | 64 | ||||
-rw-r--r-- | gdb/config/m88k/tm-m88k.h | 1174 | ||||
-rw-r--r-- | gdb/config/m88k/xm-delta88.h | 88 | ||||
-rw-r--r-- | gdb/config/m88k/xm-dgux.h | 110 | ||||
-rw-r--r-- | gdb/configure.host | 8 | ||||
-rw-r--r-- | gdb/configure.tgt | 8 | ||||
-rw-r--r-- | gdb/cxux-nat.c | 1074 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/doc/gdb.texinfo | 22 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 6 | ||||
-rw-r--r-- | gdb/elfread.c | 13 | ||||
-rw-r--r-- | gdb/m88k-nat.c | 580 | ||||
-rw-r--r-- | gdb/m88k-tdep.c | 1322 | ||||
-rw-r--r-- | gdb/remote-bug.c | 2054 |
28 files changed, 3405 insertions, 3380 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f55379b..2a4fe73 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,36 @@ 2002-07-24 Andrew Cagney <cagney@redhat.com> + * README: Remove reference to remote-bug. + * Makefile.in (ALLDEPFILES): Remove m88k-nat.c, m88k-tdep.c and + remote-bug.c. + (m88k-nat.o): Delete rule. + (m88k-tdep.o): Delete rule. + (remote-bug.o): Delete rule. + * MAINTAINERS: Mark as obsolete. + * elfread.c (elf_symtab_read): Mention that m88k is obsolete. + * m88k-tdep.c: Make file obsolete. + * config/m88k/m88k.mh: Ditto. + * config/m88k/delta88v4.mh: Ditto. + * config/m88k/delta88v4.mt: Ditto. + * config/m88k/delta88.mt: Ditto. + * config/m88k/delta88.mh: Ditto. + * remote-bug.c: Ditto. + * config/m88k/tm-delta88.h: Ditto. + * config/m88k/nm-delta88v4.h: Ditto. + * config/m88k/xm-delta88.h: Ditto. + * config/m88k/xm-dgux.h: Ditto. + * config/m88k/tm-m88k.h: Ditto. + * config/m88k/nm-m88k.h: Ditto. + * config/m88k/tm-delta88v4.h: Ditto. + * m88k-nat.c: Ditto. + * cxux-nat.c: Ditto. + * configure.host: Make m88*-motorola-sysv4*, m88*-motorola-sysv* + and m88*-*-* obsolete. + * configure.tgt: Make m88*-motorola-sysv4*, m88*-motorola-* and + m88*-*-* obsolete. + +2002-07-24 Andrew Cagney <cagney@redhat.com> + * findvar.c (extract_unsigned_integer): Make `addr' parameter constant. Same for local pointer variables. (extract_signed_integer): Ditto. diff --git a/gdb/MAINTAINERS b/gdb/MAINTAINERS index ffbda98..78e1cf8 100644 --- a/gdb/MAINTAINERS +++ b/gdb/MAINTAINERS @@ -113,10 +113,7 @@ maintainer works with the native maintainer when resolving API issues. m68k --target=m68k-elf ,-Werror Maintenance only - m88k --target=m88k ,-Werror - Known problem in 5.1 - Maintenance only - OBSOLETE candidate, not multi-arch + m88k (--target=m88k OBSOLETE) mcore --target=mcore-elf,mcore-pe ,-Werror Maintenance only diff --git a/gdb/Makefile.in b/gdb/Makefile.in index d8dc6e0..60d7937 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1222,7 +1222,6 @@ ALLDEPFILES = a68v-nat.c \ lynx-nat.c m3-nat.c \ m68hc11-tdep.c \ m68k-tdep.c \ - m88k-nat.c m88k-tdep.c \ mcore-tdep.c \ mips-linux-nat.c mips-linux-tdep.c \ mips-nat.c \ @@ -1236,7 +1235,7 @@ ALLDEPFILES = a68v-nat.c \ ppc-sysv-tdep.o ppc-linux-nat.c ppc-linux-tdep.c \ ppcnbsd-nat.o ppcnbsd-tdep.o \ procfs.c \ - remote-array.c remote-bug.c remote-e7000.c \ + remote-array.c remote-e7000.c \ remote-es.c remote-hms.c remote-mips.c \ remote-nindy.c remote-rdp.c remote-sim.c \ remote-st.c remote-utils.c dcache.c \ @@ -1771,10 +1770,6 @@ m68kly-nat.o: m68kly-nat.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) m68klinux-nat.o: m68klinux-nat.c $(defs_h) $(frame_h) $(inferior_h) \ $(language_h) $(gdbcore_h) $(floatformat_h) $(target_h) $(regcache_h) -m88k-nat.o: m88k-nat.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) - -m88k-tdep.o: m88k-tdep.c $(defs_h) $(gdbcore_h) $(inferior_h) $(regcache_h) - mac-nat.o: mac-nat.c $(defs_h) $(gdb_string_h) $(regcache_h) main.o: main.c $(top_h) $(defs_h) $(gdb_string_h) $(event_loop_h) \ @@ -1978,10 +1973,6 @@ rdi-share/libangsd.a: force remote-rdp.o: remote-rdp.c $(defs_h) $(gdbcore_h) \ $(inferior_h) $(gdb_string_h) $(arm_tdep_h) $(callback_h) -remote-bug.o: remote-bug.c $(defs_h) $(gdbcore_h) $(serial_h) \ - $(inferior_h) $(target_h) $(terminal_h) $(remote_utils_h) \ - $(gdb_string_h) $(regcache_h) - remote-e7000.o: remote-e7000.c $(defs_h) $(gdbcore_h) $(target_h) \ $(serial_h) $(gdb_string_h) $(regcache_h) @@ -62,6 +62,7 @@ permanently REMOVED. Mitsubishi D30V d30v-*-* OS/9000 i[34]86-*-os9k Fujitsu FR30 fr30-*-elf* +Motorola Delta 88000 running Sys V m88k-motorola-sysv or delta88 * REMOVED configurations and files @@ -451,7 +451,6 @@ monitors and other hardware: remote-adapt.c AMD 29000 "Adapt" remote-array.c Array Tech RAID controller - remote-bug.c Motorola BUG monitor remote-e7000.c Hitachi E7000 ICE remote-eb.c AMD 29000 "EBMON" remote-es.c Ericsson 1800 monitor diff --git a/gdb/config/m88k/delta88.mh b/gdb/config/m88k/delta88.mh index 13dc6c2..3c079fe 100644 --- a/gdb/config/m88k/delta88.mh +++ b/gdb/config/m88k/delta88.mh @@ -1,6 +1,6 @@ -# Host: Motorola 88k running SVR3 - -XM_FILE= xm-delta88.h - -NAT_FILE= nm-m88k.h -NATDEPFILES= infptrace.o inftarg.o fork-child.o m88k-nat.o corelow.o core-aout.o +# OBSOLETE # Host: Motorola 88k running SVR3 +# OBSOLETE +# OBSOLETE XM_FILE= xm-delta88.h +# OBSOLETE +# OBSOLETE NAT_FILE= nm-m88k.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o m88k-nat.o corelow.o core-aout.o diff --git a/gdb/config/m88k/delta88.mt b/gdb/config/m88k/delta88.mt index c8e669b..83d4ad1 100644 --- a/gdb/config/m88k/delta88.mt +++ b/gdb/config/m88k/delta88.mt @@ -1,3 +1,3 @@ -# Target: Motorola 88k running SVR3 -TDEPFILES= m88k-tdep.o -TM_FILE= tm-delta88.h +# OBSOLETE # Target: Motorola 88k running SVR3 +# OBSOLETE TDEPFILES= m88k-tdep.o +# OBSOLETE TM_FILE= tm-delta88.h diff --git a/gdb/config/m88k/delta88v4.mh b/gdb/config/m88k/delta88v4.mh index ba3dd7b..bc2abc5 100644 --- a/gdb/config/m88k/delta88v4.mh +++ b/gdb/config/m88k/delta88v4.mh @@ -1,8 +1,8 @@ -# Host: Motorola 88k running SVR4 - -XM_FILE= xm-delta88v4.h - -NAT_FILE= nm-delta88v4.h -NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o \ - solib.o solib-svr4.o solib-legacy.o \ - procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o +# OBSOLETE # Host: Motorola 88k running SVR4 +# OBSOLETE +# OBSOLETE XM_FILE= xm-delta88v4.h +# OBSOLETE +# OBSOLETE NAT_FILE= nm-delta88v4.h +# OBSOLETE NATDEPFILES= fork-child.o m88k-nat.o corelow.o core-regset.o \ +# OBSOLETE solib.o solib-svr4.o solib-legacy.o \ +# OBSOLETE procfs.o proc-api.o proc-events.o proc-flags.o proc-why.o diff --git a/gdb/config/m88k/delta88v4.mt b/gdb/config/m88k/delta88v4.mt index 7797d4b..c8f9df2 100644 --- a/gdb/config/m88k/delta88v4.mt +++ b/gdb/config/m88k/delta88v4.mt @@ -1,3 +1,3 @@ -# Target: Motorola 88k running SVR4 -TDEPFILES= m88k-tdep.o -TM_FILE= tm-delta88v4.h +# OBSOLETE # Target: Motorola 88k running SVR4 +# OBSOLETE TDEPFILES= m88k-tdep.o +# OBSOLETE TM_FILE= tm-delta88v4.h diff --git a/gdb/config/m88k/m88k.mh b/gdb/config/m88k/m88k.mh index 5d4350b..a09e7a1 100644 --- a/gdb/config/m88k/m88k.mh +++ b/gdb/config/m88k/m88k.mh @@ -1,4 +1,4 @@ -# Host: Motorola 88000 running DGUX -XM_FILE= xm-dgux.h -NAT_FILE= nm-m88k.h -NATDEPFILES= infptrace.o inftarg.o fork-child.o m88k-nat.o +# OBSOLETE # Host: Motorola 88000 running DGUX +# OBSOLETE XM_FILE= xm-dgux.h +# OBSOLETE NAT_FILE= nm-m88k.h +# OBSOLETE NATDEPFILES= infptrace.o inftarg.o fork-child.o m88k-nat.o diff --git a/gdb/config/m88k/m88k.mt b/gdb/config/m88k/m88k.mt index ca3fab4..c4068e0 100644 --- a/gdb/config/m88k/m88k.mt +++ b/gdb/config/m88k/m88k.mt @@ -1,3 +1,3 @@ -# Target: Motorola 88k Binary Compatibility Standard -TDEPFILES= m88k-tdep.o remote-bug.o -TM_FILE= tm-m88k.h +# OBSOLETE # Target: Motorola 88k Binary Compatibility Standard +# OBSOLETE TDEPFILES= m88k-tdep.o remote-bug.o +# OBSOLETE TM_FILE= tm-m88k.h diff --git a/gdb/config/m88k/nm-delta88v4.h b/gdb/config/m88k/nm-delta88v4.h index 97f75f2..976cfa0 100644 --- a/gdb/config/m88k/nm-delta88v4.h +++ b/gdb/config/m88k/nm-delta88v4.h @@ -1,23 +1,23 @@ -/* Native machine description for Motorola Delta 88 box, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993 - 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 "m88k/nm-m88k.h" -#include "config/nm-sysv4.h" +// OBSOLETE /* Native machine description for Motorola Delta 88 box, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "m88k/nm-m88k.h" +// OBSOLETE #include "config/nm-sysv4.h" diff --git a/gdb/config/m88k/nm-m88k.h b/gdb/config/m88k/nm-m88k.h index 4c402bd..6521a2a 100644 --- a/gdb/config/m88k/nm-m88k.h +++ b/gdb/config/m88k/nm-m88k.h @@ -1,25 +1,25 @@ -/* Native support macros for m88k, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 - 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. */ - -#define FETCH_INFERIOR_REGISTERS - -#define REGISTER_U_ADDR(addr, blockend, regno) \ - (addr) = m88k_register_u_addr ((blockend),(regno)); +// OBSOLETE /* Native support macros for m88k, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define FETCH_INFERIOR_REGISTERS +// OBSOLETE +// OBSOLETE #define REGISTER_U_ADDR(addr, blockend, regno) \ +// OBSOLETE (addr) = m88k_register_u_addr ((blockend),(regno)); diff --git a/gdb/config/m88k/tm-delta88.h b/gdb/config/m88k/tm-delta88.h index f44b1f7..f63fca3 100644 --- a/gdb/config/m88k/tm-delta88.h +++ b/gdb/config/m88k/tm-delta88.h @@ -1,28 +1,28 @@ -/* Target machine description for Motorola Delta 88 box, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994 - 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 "m88k/tm-m88k.h" - -#define DELTA88 - -#define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", (name))) -#define SIGTRAMP_FRAME_FIXUP(frame) (frame) += 0x20 -#define SIGTRAMP_SP_FIXUP(sp) (sp) = read_memory_integer((sp), 4) +// OBSOLETE /* Target machine description for Motorola Delta 88 box, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "m88k/tm-m88k.h" +// OBSOLETE +// OBSOLETE #define DELTA88 +// OBSOLETE +// OBSOLETE #define IN_SIGTRAMP(pc, name) ((name) && STREQ ("_sigcode", (name))) +// OBSOLETE #define SIGTRAMP_FRAME_FIXUP(frame) (frame) += 0x20 +// OBSOLETE #define SIGTRAMP_SP_FIXUP(sp) (sp) = read_memory_integer((sp), 4) diff --git a/gdb/config/m88k/tm-delta88v4.h b/gdb/config/m88k/tm-delta88v4.h index 44e488f..e343a05 100644 --- a/gdb/config/m88k/tm-delta88v4.h +++ b/gdb/config/m88k/tm-delta88v4.h @@ -1,32 +1,32 @@ -/* Target machine description for Motorola Delta 88 box, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1998, 1999 - 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. */ - -#define DELTA88 - -#include "m88k/tm-m88k.h" -#include "config/tm-sysv4.h" - -/* If we don't define this, backtraces go on forever. */ -#define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) - -#define IN_SIGTRAMP(pc, name) ((name) && (STREQ ("signalhandler", (name)) \ - || STREQ("sigacthandler", (name)))) -#define SIGTRAMP_SP_FIXUP(sp) (sp) = read_memory_integer((sp)+0xcd8, 4) +// OBSOLETE /* Target machine description for Motorola Delta 88 box, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1998, 1999 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #define DELTA88 +// OBSOLETE +// OBSOLETE #include "m88k/tm-m88k.h" +// OBSOLETE #include "config/tm-sysv4.h" +// OBSOLETE +// OBSOLETE /* If we don't define this, backtraces go on forever. */ +// OBSOLETE #define FRAME_CHAIN_VALID(fp,fi) func_frame_chain_valid (fp, fi) +// OBSOLETE +// OBSOLETE #define IN_SIGTRAMP(pc, name) ((name) && (STREQ ("signalhandler", (name)) \ +// OBSOLETE || STREQ("sigacthandler", (name)))) +// OBSOLETE #define SIGTRAMP_SP_FIXUP(sp) (sp) = read_memory_integer((sp)+0xcd8, 4) diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h index 22e069db..2f08f1a 100644 --- a/gdb/config/m88k/tm-m88k.h +++ b/gdb/config/m88k/tm-m88k.h @@ -1,587 +1,587 @@ -/* Target machine description for generic Motorola 88000, for GDB. - - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1996, - 1998, 1999, 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. */ - -#include "doublest.h" -#include "regcache.h" - -/* g++ support is not yet included. */ - -/* We cache information about saved registers in the frame structure, - to save us from having to re-scan function prologues every time - a register in a non-current frame is accessed. */ - -#define EXTRA_FRAME_INFO \ - struct frame_saved_regs *fsr; \ - CORE_ADDR locals_pointer; \ - CORE_ADDR args_pointer; - -/* Zero the frame_saved_regs pointer when the frame is initialized, - so that FRAME_FIND_SAVED_REGS () will know to allocate and - initialize a frame_saved_regs struct the first time it is called. - Set the arg_pointer to -1, which is not valid; 0 and other values - indicate real, cached values. */ - -#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ - init_extra_frame_info (fromleaf, fi) -extern void init_extra_frame_info (); - -/* Offset from address of function to start of its code. - Zero on most machines. */ - -#define FUNCTION_START_OFFSET 0 - -/* Advance PC across any function entry prologue instructions - to reach some "real" code. */ - -extern CORE_ADDR m88k_skip_prologue (CORE_ADDR); -#define SKIP_PROLOGUE(frompc) (m88k_skip_prologue (frompc)) - -/* The m88k kernel aligns all instructions on 4-byte boundaries. The - kernel also uses the least significant two bits for its own hocus - pocus. When gdb receives an address from the kernel, it needs to - preserve those right-most two bits, but gdb also needs to be careful - to realize that those two bits are not really a part of the address - of an instruction. Shrug. */ - -extern CORE_ADDR m88k_addr_bits_remove (CORE_ADDR); -#define ADDR_BITS_REMOVE(addr) m88k_addr_bits_remove (addr) - -/* Immediately after a function call, return the saved pc. - Can't always go through the frames for this because on some machines - the new frame is not set up until the new function executes - some instructions. */ - -#define SAVED_PC_AFTER_CALL(frame) \ - (ADDR_BITS_REMOVE (read_register (SRP_REGNUM))) - -/* Stack grows downward. */ - -#define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) - -/* Sequence of bytes for breakpoint instruction. */ - -/* instruction 0xF000D1FF is 'tb0 0,r0,511' - If Bit bit 0 of r0 is clear (always true), - initiate exception processing (trap). - */ -#define BREAKPOINT {0xF0, 0x00, 0xD1, 0xFF} - -/* Amount PC must be decremented by after a breakpoint. - This is often the number of bytes in BREAKPOINT - but not always. */ - -#define DECR_PC_AFTER_BREAK 0 - -/* Say how long (ordinary) registers are. This is a piece of bogosity - used in push_word and a few other places; REGISTER_RAW_SIZE is the - real way to know how big a register is. */ - -#define REGISTER_SIZE 4 - -/* Number of machine registers */ - -#define GP_REGS (38) -#define FP_REGS (32) -#define NUM_REGS (GP_REGS + FP_REGS) - -/* Initializer for an array of names of registers. - There should be NUM_REGS strings in this initializer. */ - -#define REGISTER_NAMES {\ - "r0",\ - "r1",\ - "r2",\ - "r3",\ - "r4",\ - "r5",\ - "r6",\ - "r7",\ - "r8",\ - "r9",\ - "r10",\ - "r11",\ - "r12",\ - "r13",\ - "r14",\ - "r15",\ - "r16",\ - "r17",\ - "r18",\ - "r19",\ - "r20",\ - "r21",\ - "r22",\ - "r23",\ - "r24",\ - "r25",\ - "r26",\ - "r27",\ - "r28",\ - "r29",\ - "r30",\ - "r31",\ - "psr",\ - "fpsr",\ - "fpcr",\ - "sxip",\ - "snip",\ - "sfip",\ - "x0",\ - "x1",\ - "x2",\ - "x3",\ - "x4",\ - "x5",\ - "x6",\ - "x7",\ - "x8",\ - "x9",\ - "x10",\ - "x11",\ - "x12",\ - "x13",\ - "x14",\ - "x15",\ - "x16",\ - "x17",\ - "x18",\ - "x19",\ - "x20",\ - "x21",\ - "x22",\ - "x23",\ - "x24",\ - "x25",\ - "x26",\ - "x27",\ - "x28",\ - "x29",\ - "x30",\ - "x31",\ - "vbr",\ - "dmt0",\ - "dmd0",\ - "dma0",\ - "dmt1",\ - "dmd1",\ - "dma1",\ - "dmt2",\ - "dmd2",\ - "dma2",\ - "sr0",\ - "sr1",\ - "sr2",\ - "sr3",\ - "fpecr",\ - "fphs1",\ - "fpls1",\ - "fphs2",\ - "fpls2",\ - "fppt",\ - "fprh",\ - "fprl",\ - "fpit",\ - "fpsr",\ - "fpcr",\ - } - - -/* 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 R0_REGNUM 0 /* Contains the constant zero */ -#define SRP_REGNUM 1 /* Contains subroutine return pointer */ -#define RV_REGNUM 2 /* Contains simple return values */ -#define SRA_REGNUM 12 /* Contains address of struct return values */ -#define SP_REGNUM 31 /* Contains address of top of stack */ - -/* Instruction pointer notes... - - On the m88100: - - * cr04 = sxip. On exception, contains the excepting pc (probably). - On rte, is ignored. - - * cr05 = snip. On exception, contains the NPC (next pc). On rte, - pc is loaded from here. - - * cr06 = sfip. On exception, contains the NNPC (next next pc). On - rte, the NPC is loaded from here. - - * lower two bits of each are flag bits. Bit 1 is V means address - is valid. If address is not valid, bit 0 is ignored. Otherwise, - bit 0 is E and asks for an exception to be taken if this - instruction is executed. - - On the m88110: - - * cr04 = exip. On exception, contains the address of the excepting - pc (always). On rte, pc is loaded from here. Bit 0, aka the D - bit, is a flag saying that the offending instruction was in a - branch delay slot. If set, then cr05 contains the NPC. - - * cr05 = enip. On exception, if the instruction pointed to by cr04 - was in a delay slot as indicated by the bit 0 of cr04, aka the D - bit, the cr05 contains the NPC. Otherwise ignored. - - * cr06 is invalid */ - -/* Note that the Harris Unix kernels emulate the m88100's behavior on - the m88110. */ - -#define SXIP_REGNUM 35 /* On m88100, Contains Shadow Execute - Instruction Pointer. */ -#define SNIP_REGNUM 36 /* On m88100, Contains Shadow Next - Instruction Pointer. */ -#define SFIP_REGNUM 37 /* On m88100, Contains Shadow Fetched - Intruction pointer. */ - -#define EXIP_REGNUM 35 /* On m88110, Contains Exception - Executing Instruction Pointer. */ -#define ENIP_REGNUM 36 /* On m88110, Contains the Exception - Next Instruction Pointer. */ - -#define PC_REGNUM SXIP_REGNUM /* Program Counter */ -#define NPC_REGNUM SNIP_REGNUM /* Next Program Counter */ -#define M88K_NNPC_REGNUM SFIP_REGNUM /* Next Next Program Counter */ - - -#define PSR_REGNUM 32 /* Processor Status Register */ -#define FPSR_REGNUM 33 /* Floating Point Status Register */ -#define FPCR_REGNUM 34 /* Floating Point Control Register */ -#define XFP_REGNUM 38 /* First Extended Float Register */ -#define X0_REGNUM XFP_REGNUM /* Which also contains the constant zero */ - -/* This is rather a confusing lie. Our m88k port using a stack pointer value - for the frame address. Hence, the frame address and the frame pointer are - only indirectly related. The value of this macro is the register number - fetched by the machine "independent" portions of gdb when they want to know - about a frame address. Thus, we lie here and claim that FP_REGNUM is - SP_REGNUM. */ -#define FP_REGNUM SP_REGNUM /* Reg fetched to locate frame when pgm stops */ -#define ACTUAL_FP_REGNUM 30 - -/* PSR status bit definitions. */ - -#define PSR_MODE 0x80000000 -#define PSR_BYTE_ORDER 0x40000000 -#define PSR_SERIAL_MODE 0x20000000 -#define PSR_CARRY 0x10000000 -#define PSR_SFU_DISABLE 0x000003f0 -#define PSR_SFU1_DISABLE 0x00000008 -#define PSR_MXM 0x00000004 -#define PSR_IND 0x00000002 -#define PSR_SFRZ 0x00000001 - - - -/* The following two comments come from the days prior to the m88110 - port. The m88110 handles the instruction pointers differently. I - do not know what any m88110 kernels do as the m88110 port I'm - working with is for an embedded system. rich@cygnus.com - 13-sept-93. */ - -/* BCS requires that the SXIP_REGNUM (or PC_REGNUM) contain the - address of the next instr to be executed when a breakpoint occurs. - Because the kernel gets the next instr (SNIP_REGNUM), the instr in - SNIP needs to be put back into SFIP, and the instr in SXIP should - be shifted to SNIP */ - -/* Are you sitting down? It turns out that the 88K BCS (binary - compatibility standard) folks originally felt that the debugger - should be responsible for backing up the IPs, not the kernel (as is - usually done). Well, they have reversed their decision, and in - future releases our kernel will be handling the backing up of the - IPs. So, eventually, we won't need to do the SHIFT_INST_REGS - stuff. But, for now, since there are 88K systems out there that do - need the debugger to do the IP shifting, and since there will be - systems where the kernel does the shifting, the code is a little - more complex than perhaps it needs to be (we still go inside - SHIFT_INST_REGS, and if the shifting hasn't occurred then gdb goes - ahead and shifts). */ - -extern int target_is_m88110; -#define SHIFT_INST_REGS() \ -if (!target_is_m88110) \ -{ \ - CORE_ADDR pc = read_register (PC_REGNUM); \ - CORE_ADDR npc = read_register (NPC_REGNUM); \ - if (pc != npc) \ - { \ - write_register (M88K_NNPC_REGNUM, npc); \ - write_register (NPC_REGNUM, pc); \ - } \ -} - - /* Storing the following registers is a no-op. */ -#define CANNOT_STORE_REGISTER(regno) (((regno) == R0_REGNUM) \ - || ((regno) == X0_REGNUM)) - - /* Number of bytes of storage in the actual machine representation - for register N. On the m88k, the general purpose registers are 4 - bytes and the 88110 extended registers are 10 bytes. */ - -#define REGISTER_RAW_SIZE(N) ((N) < XFP_REGNUM ? 4 : 10) - - /* Total amount of space needed to store our copies of the machine's - register state, the array `registers'. */ - -#define REGISTER_BYTES ((GP_REGS * REGISTER_RAW_SIZE(0)) \ - + (FP_REGS * REGISTER_RAW_SIZE(XFP_REGNUM))) - - /* Index within `registers' of the first byte of the space for - register N. */ - -#define REGISTER_BYTE(N) (((N) * REGISTER_RAW_SIZE(0)) \ - + ((N) >= XFP_REGNUM \ - ? (((N) - XFP_REGNUM) \ - * REGISTER_RAW_SIZE(XFP_REGNUM)) \ - : 0)) - - /* Number of bytes of storage in the program's representation for - register N. On the m88k, all registers are 4 bytes excepting the - m88110 extended registers which are 8 byte doubles. */ - -#define REGISTER_VIRTUAL_SIZE(N) ((N) < XFP_REGNUM ? 4 : 8) - - /* Largest value REGISTER_RAW_SIZE can have. */ - -#define MAX_REGISTER_RAW_SIZE (REGISTER_RAW_SIZE(XFP_REGNUM)) - - /* Largest value REGISTER_VIRTUAL_SIZE can have. - Are FPS1, FPS2, FPR "virtual" regisers? */ - -#define MAX_REGISTER_VIRTUAL_SIZE (REGISTER_RAW_SIZE(XFP_REGNUM)) - -/* Return the GDB type object for the "standard" data type - of data in register N. */ - -struct type *m88k_register_type (int regnum); -#define REGISTER_VIRTUAL_TYPE(N) m88k_register_type (N) - -/* The 88k call/return conventions call for "small" values to be returned - into consecutive registers starting from r2. */ - -#define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ - memcpy ((VALBUF), &(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), TYPE_LENGTH (TYPE)) - -#define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) - -/* Write into appropriate registers a function return value - of type TYPE, given in virtual format. */ - -#define STORE_RETURN_VALUE(TYPE,VALBUF) \ - write_register_bytes (2*REGISTER_RAW_SIZE(0), (VALBUF), TYPE_LENGTH (TYPE)) - -/* In COFF, if PCC says a parameter is a short or a char, do not - change it to int (it seems the convention is to change it). */ - -#define BELIEVE_PCC_PROMOTION 1 - -/* Describe the pointer in each stack frame to the previous stack frame - (its caller). */ - -/* FRAME_CHAIN takes a frame's nominal address - and produces the frame's chain-pointer. - - However, if FRAME_CHAIN_VALID returns zero, - it means the given frame is the outermost one and has no caller. */ - -extern CORE_ADDR frame_chain (); -extern int frame_chain_valid (); -extern int frameless_function_invocation (); - -#define FRAME_CHAIN(thisframe) \ - frame_chain (thisframe) - -#define FRAMELESS_FUNCTION_INVOCATION(frame) \ - (frameless_function_invocation (frame)) - -/* Define other aspects of the stack frame. */ - -#define FRAME_SAVED_PC(FRAME) \ - frame_saved_pc (FRAME) -extern CORE_ADDR frame_saved_pc (); - -#define FRAME_ARGS_ADDRESS(fi) \ - frame_args_address (fi) -extern CORE_ADDR frame_args_address (); - -#define FRAME_LOCALS_ADDRESS(fi) \ - frame_locals_address (fi) -extern CORE_ADDR frame_locals_address (); - -/* Return number of args passed to a frame. - Can return -1, meaning no way to tell. */ - -#define FRAME_NUM_ARGS(fi) (-1) - -/* Return number of bytes at start of arglist that are not really args. */ - -#define FRAME_ARGS_SKIP 0 - -/* Put here the code to store, into a struct frame_saved_regs, - 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. */ - -/* On the 88k, parameter registers get stored into the so called "homing" - area. This *always* happens when you compiled with GCC and use -g. - Also, (with GCC and -g) the saving of the parameter register values - always happens right within the function prologue code, so these register - values can generally be relied upon to be already copied into their - respective homing slots by the time you will normally try to look at - them (we hope). - - Note that homing area stack slots are always at *positive* offsets from - the frame pointer. Thus, the homing area stack slots for the parameter - registers (passed values) for a given function are actually part of the - frame area of the caller. This is unusual, but it should not present - any special problems for GDB. - - Note also that on the 88k, we are only interested in finding the - registers that might have been saved in memory. This is a subset of - the whole set of registers because the standard calling sequence allows - the called routine to clobber many registers. - - We could manage to locate values for all of the so called "preserved" - registers (some of which may get saved within any particular frame) but - that would require decoding all of the tdesc information. That would be - nice information for GDB to have, but it is not strictly manditory if we - can live without the ability to look at values within (or backup to) - previous frames. - */ - -struct frame_saved_regs; -struct frame_info; - -void frame_find_saved_regs (struct frame_info *fi, - struct frame_saved_regs *fsr); - -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ - frame_find_saved_regs (frame_info, &frame_saved_regs) - - -#define POP_FRAME pop_frame () -extern void pop_frame (); - -/* Call function stuff contributed by Kevin Buettner of Motorola. */ - -#define CALL_DUMMY_LOCATION AFTER_TEXT_END - -extern void m88k_push_dummy_frame (); -#define PUSH_DUMMY_FRAME m88k_push_dummy_frame() - -#define CALL_DUMMY { \ -0x67ff00c0, /* 0: subu #sp,#sp,0xc0 */ \ -0x243f0004, /* 4: st #r1,#sp,0x4 */ \ -0x245f0008, /* 8: st #r2,#sp,0x8 */ \ -0x247f000c, /* c: st #r3,#sp,0xc */ \ -0x249f0010, /* 10: st #r4,#sp,0x10 */ \ -0x24bf0014, /* 14: st #r5,#sp,0x14 */ \ -0x24df0018, /* 18: st #r6,#sp,0x18 */ \ -0x24ff001c, /* 1c: st #r7,#sp,0x1c */ \ -0x251f0020, /* 20: st #r8,#sp,0x20 */ \ -0x253f0024, /* 24: st #r9,#sp,0x24 */ \ -0x255f0028, /* 28: st #r10,#sp,0x28 */ \ -0x257f002c, /* 2c: st #r11,#sp,0x2c */ \ -0x259f0030, /* 30: st #r12,#sp,0x30 */ \ -0x25bf0034, /* 34: st #r13,#sp,0x34 */ \ -0x25df0038, /* 38: st #r14,#sp,0x38 */ \ -0x25ff003c, /* 3c: st #r15,#sp,0x3c */ \ -0x261f0040, /* 40: st #r16,#sp,0x40 */ \ -0x263f0044, /* 44: st #r17,#sp,0x44 */ \ -0x265f0048, /* 48: st #r18,#sp,0x48 */ \ -0x267f004c, /* 4c: st #r19,#sp,0x4c */ \ -0x269f0050, /* 50: st #r20,#sp,0x50 */ \ -0x26bf0054, /* 54: st #r21,#sp,0x54 */ \ -0x26df0058, /* 58: st #r22,#sp,0x58 */ \ -0x26ff005c, /* 5c: st #r23,#sp,0x5c */ \ -0x271f0060, /* 60: st #r24,#sp,0x60 */ \ -0x273f0064, /* 64: st #r25,#sp,0x64 */ \ -0x275f0068, /* 68: st #r26,#sp,0x68 */ \ -0x277f006c, /* 6c: st #r27,#sp,0x6c */ \ -0x279f0070, /* 70: st #r28,#sp,0x70 */ \ -0x27bf0074, /* 74: st #r29,#sp,0x74 */ \ -0x27df0078, /* 78: st #r30,#sp,0x78 */ \ -0x63df0000, /* 7c: addu #r30,#sp,0x0 */ \ -0x145f0000, /* 80: ld #r2,#sp,0x0 */ \ -0x147f0004, /* 84: ld #r3,#sp,0x4 */ \ -0x149f0008, /* 88: ld #r4,#sp,0x8 */ \ -0x14bf000c, /* 8c: ld #r5,#sp,0xc */ \ -0x14df0010, /* 90: ld #r6,#sp,0x10 */ \ -0x14ff0014, /* 94: ld #r7,#sp,0x14 */ \ -0x151f0018, /* 98: ld #r8,#sp,0x18 */ \ -0x153f001c, /* 9c: ld #r9,#sp,0x1c */ \ -0x5c200000, /* a0: or.u #r1,#r0,0x0 */ \ -0x58210000, /* a4: or #r1,#r1,0x0 */ \ -0xf400c801, /* a8: jsr #r1 */ \ -0xf000d1ff /* ac: tb0 0x0,#r0,0x1ff */ \ -} - -#define CALL_DUMMY_START_OFFSET 0x80 -#define CALL_DUMMY_LENGTH 0xb0 - -/* FIXME: byteswapping. */ -#define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) \ -{ \ - *(unsigned long *)((char *) (dummy) + 0xa0) |= \ - (((unsigned long) (fun)) >> 16); \ - *(unsigned long *)((char *) (dummy) + 0xa4) |= \ - (((unsigned long) (fun)) & 0xffff); \ -} - -/* Stack must be aligned on 64-bit boundaries when synthesizing - function calls. */ - -#define STACK_ALIGN(addr) (((addr) + 7) & -8) - -#define STORE_STRUCT_RETURN(addr, sp) \ - write_register (SRA_REGNUM, (addr)) - -#define NEED_TEXT_START_END 1 - -/* According to the MC88100 RISC Microprocessor User's Manual, section - 6.4.3.1.2: - - ... can be made to return to a particular instruction by placing a - valid instruction address in the SNIP and the next sequential - instruction address in the SFIP (with V bits set and E bits clear). - The rte resumes execution at the instruction pointed to by the - SNIP, then the SFIP. - - The E bit is the least significant bit (bit 0). The V (valid) bit is - bit 1. This is why we logical or 2 into the values we are writing - below. It turns out that SXIP plays no role when returning from an - exception so nothing special has to be done with it. We could even - (presumably) give it a totally bogus value. - - -- Kevin Buettner - */ - -extern void m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid); -#define TARGET_WRITE_PC(VAL, PID) m88k_target_write_pc (VAL, PID) +// OBSOLETE /* Target machine description for generic Motorola 88000, for GDB. +// OBSOLETE +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1994, 1996, +// OBSOLETE 1998, 1999, 2000, 2002 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "doublest.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* g++ support is not yet included. */ +// OBSOLETE +// OBSOLETE /* We cache information about saved registers in the frame structure, +// OBSOLETE to save us from having to re-scan function prologues every time +// OBSOLETE a register in a non-current frame is accessed. */ +// OBSOLETE +// OBSOLETE #define EXTRA_FRAME_INFO \ +// OBSOLETE struct frame_saved_regs *fsr; \ +// OBSOLETE CORE_ADDR locals_pointer; \ +// OBSOLETE CORE_ADDR args_pointer; +// OBSOLETE +// OBSOLETE /* Zero the frame_saved_regs pointer when the frame is initialized, +// OBSOLETE so that FRAME_FIND_SAVED_REGS () will know to allocate and +// OBSOLETE initialize a frame_saved_regs struct the first time it is called. +// OBSOLETE Set the arg_pointer to -1, which is not valid; 0 and other values +// OBSOLETE indicate real, cached values. */ +// OBSOLETE +// OBSOLETE #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \ +// OBSOLETE init_extra_frame_info (fromleaf, fi) +// OBSOLETE extern void init_extra_frame_info (); +// OBSOLETE +// OBSOLETE /* Offset from address of function to start of its code. +// OBSOLETE Zero on most machines. */ +// OBSOLETE +// OBSOLETE #define FUNCTION_START_OFFSET 0 +// OBSOLETE +// OBSOLETE /* Advance PC across any function entry prologue instructions +// OBSOLETE to reach some "real" code. */ +// OBSOLETE +// OBSOLETE extern CORE_ADDR m88k_skip_prologue (CORE_ADDR); +// OBSOLETE #define SKIP_PROLOGUE(frompc) (m88k_skip_prologue (frompc)) +// OBSOLETE +// OBSOLETE /* The m88k kernel aligns all instructions on 4-byte boundaries. The +// OBSOLETE kernel also uses the least significant two bits for its own hocus +// OBSOLETE pocus. When gdb receives an address from the kernel, it needs to +// OBSOLETE preserve those right-most two bits, but gdb also needs to be careful +// OBSOLETE to realize that those two bits are not really a part of the address +// OBSOLETE of an instruction. Shrug. */ +// OBSOLETE +// OBSOLETE extern CORE_ADDR m88k_addr_bits_remove (CORE_ADDR); +// OBSOLETE #define ADDR_BITS_REMOVE(addr) m88k_addr_bits_remove (addr) +// OBSOLETE +// OBSOLETE /* Immediately after a function call, return the saved pc. +// OBSOLETE Can't always go through the frames for this because on some machines +// OBSOLETE the new frame is not set up until the new function executes +// OBSOLETE some instructions. */ +// OBSOLETE +// OBSOLETE #define SAVED_PC_AFTER_CALL(frame) \ +// OBSOLETE (ADDR_BITS_REMOVE (read_register (SRP_REGNUM))) +// OBSOLETE +// OBSOLETE /* Stack grows downward. */ +// OBSOLETE +// OBSOLETE #define INNER_THAN(lhs,rhs) ((lhs) < (rhs)) +// OBSOLETE +// OBSOLETE /* Sequence of bytes for breakpoint instruction. */ +// OBSOLETE +// OBSOLETE /* instruction 0xF000D1FF is 'tb0 0,r0,511' +// OBSOLETE If Bit bit 0 of r0 is clear (always true), +// OBSOLETE initiate exception processing (trap). +// OBSOLETE */ +// OBSOLETE #define BREAKPOINT {0xF0, 0x00, 0xD1, 0xFF} +// OBSOLETE +// OBSOLETE /* Amount PC must be decremented by after a breakpoint. +// OBSOLETE This is often the number of bytes in BREAKPOINT +// OBSOLETE but not always. */ +// OBSOLETE +// OBSOLETE #define DECR_PC_AFTER_BREAK 0 +// OBSOLETE +// OBSOLETE /* Say how long (ordinary) registers are. This is a piece of bogosity +// OBSOLETE used in push_word and a few other places; REGISTER_RAW_SIZE is the +// OBSOLETE real way to know how big a register is. */ +// OBSOLETE +// OBSOLETE #define REGISTER_SIZE 4 +// OBSOLETE +// OBSOLETE /* Number of machine registers */ +// OBSOLETE +// OBSOLETE #define GP_REGS (38) +// OBSOLETE #define FP_REGS (32) +// OBSOLETE #define NUM_REGS (GP_REGS + FP_REGS) +// OBSOLETE +// OBSOLETE /* Initializer for an array of names of registers. +// OBSOLETE There should be NUM_REGS strings in this initializer. */ +// OBSOLETE +// OBSOLETE #define REGISTER_NAMES {\ +// OBSOLETE "r0",\ +// OBSOLETE "r1",\ +// OBSOLETE "r2",\ +// OBSOLETE "r3",\ +// OBSOLETE "r4",\ +// OBSOLETE "r5",\ +// OBSOLETE "r6",\ +// OBSOLETE "r7",\ +// OBSOLETE "r8",\ +// OBSOLETE "r9",\ +// OBSOLETE "r10",\ +// OBSOLETE "r11",\ +// OBSOLETE "r12",\ +// OBSOLETE "r13",\ +// OBSOLETE "r14",\ +// OBSOLETE "r15",\ +// OBSOLETE "r16",\ +// OBSOLETE "r17",\ +// OBSOLETE "r18",\ +// OBSOLETE "r19",\ +// OBSOLETE "r20",\ +// OBSOLETE "r21",\ +// OBSOLETE "r22",\ +// OBSOLETE "r23",\ +// OBSOLETE "r24",\ +// OBSOLETE "r25",\ +// OBSOLETE "r26",\ +// OBSOLETE "r27",\ +// OBSOLETE "r28",\ +// OBSOLETE "r29",\ +// OBSOLETE "r30",\ +// OBSOLETE "r31",\ +// OBSOLETE "psr",\ +// OBSOLETE "fpsr",\ +// OBSOLETE "fpcr",\ +// OBSOLETE "sxip",\ +// OBSOLETE "snip",\ +// OBSOLETE "sfip",\ +// OBSOLETE "x0",\ +// OBSOLETE "x1",\ +// OBSOLETE "x2",\ +// OBSOLETE "x3",\ +// OBSOLETE "x4",\ +// OBSOLETE "x5",\ +// OBSOLETE "x6",\ +// OBSOLETE "x7",\ +// OBSOLETE "x8",\ +// OBSOLETE "x9",\ +// OBSOLETE "x10",\ +// OBSOLETE "x11",\ +// OBSOLETE "x12",\ +// OBSOLETE "x13",\ +// OBSOLETE "x14",\ +// OBSOLETE "x15",\ +// OBSOLETE "x16",\ +// OBSOLETE "x17",\ +// OBSOLETE "x18",\ +// OBSOLETE "x19",\ +// OBSOLETE "x20",\ +// OBSOLETE "x21",\ +// OBSOLETE "x22",\ +// OBSOLETE "x23",\ +// OBSOLETE "x24",\ +// OBSOLETE "x25",\ +// OBSOLETE "x26",\ +// OBSOLETE "x27",\ +// OBSOLETE "x28",\ +// OBSOLETE "x29",\ +// OBSOLETE "x30",\ +// OBSOLETE "x31",\ +// OBSOLETE "vbr",\ +// OBSOLETE "dmt0",\ +// OBSOLETE "dmd0",\ +// OBSOLETE "dma0",\ +// OBSOLETE "dmt1",\ +// OBSOLETE "dmd1",\ +// OBSOLETE "dma1",\ +// OBSOLETE "dmt2",\ +// OBSOLETE "dmd2",\ +// OBSOLETE "dma2",\ +// OBSOLETE "sr0",\ +// OBSOLETE "sr1",\ +// OBSOLETE "sr2",\ +// OBSOLETE "sr3",\ +// OBSOLETE "fpecr",\ +// OBSOLETE "fphs1",\ +// OBSOLETE "fpls1",\ +// OBSOLETE "fphs2",\ +// OBSOLETE "fpls2",\ +// OBSOLETE "fppt",\ +// OBSOLETE "fprh",\ +// OBSOLETE "fprl",\ +// OBSOLETE "fpit",\ +// OBSOLETE "fpsr",\ +// OBSOLETE "fpcr",\ +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Register numbers of various important registers. +// OBSOLETE Note that some of these values are "real" register numbers, +// OBSOLETE and correspond to the general registers of the machine, +// OBSOLETE and some are "phony" register numbers which are too large +// OBSOLETE to be actual register numbers as far as the user is concerned +// OBSOLETE but do serve to get the desired values when passed to read_register. */ +// OBSOLETE +// OBSOLETE #define R0_REGNUM 0 /* Contains the constant zero */ +// OBSOLETE #define SRP_REGNUM 1 /* Contains subroutine return pointer */ +// OBSOLETE #define RV_REGNUM 2 /* Contains simple return values */ +// OBSOLETE #define SRA_REGNUM 12 /* Contains address of struct return values */ +// OBSOLETE #define SP_REGNUM 31 /* Contains address of top of stack */ +// OBSOLETE +// OBSOLETE /* Instruction pointer notes... +// OBSOLETE +// OBSOLETE On the m88100: +// OBSOLETE +// OBSOLETE * cr04 = sxip. On exception, contains the excepting pc (probably). +// OBSOLETE On rte, is ignored. +// OBSOLETE +// OBSOLETE * cr05 = snip. On exception, contains the NPC (next pc). On rte, +// OBSOLETE pc is loaded from here. +// OBSOLETE +// OBSOLETE * cr06 = sfip. On exception, contains the NNPC (next next pc). On +// OBSOLETE rte, the NPC is loaded from here. +// OBSOLETE +// OBSOLETE * lower two bits of each are flag bits. Bit 1 is V means address +// OBSOLETE is valid. If address is not valid, bit 0 is ignored. Otherwise, +// OBSOLETE bit 0 is E and asks for an exception to be taken if this +// OBSOLETE instruction is executed. +// OBSOLETE +// OBSOLETE On the m88110: +// OBSOLETE +// OBSOLETE * cr04 = exip. On exception, contains the address of the excepting +// OBSOLETE pc (always). On rte, pc is loaded from here. Bit 0, aka the D +// OBSOLETE bit, is a flag saying that the offending instruction was in a +// OBSOLETE branch delay slot. If set, then cr05 contains the NPC. +// OBSOLETE +// OBSOLETE * cr05 = enip. On exception, if the instruction pointed to by cr04 +// OBSOLETE was in a delay slot as indicated by the bit 0 of cr04, aka the D +// OBSOLETE bit, the cr05 contains the NPC. Otherwise ignored. +// OBSOLETE +// OBSOLETE * cr06 is invalid */ +// OBSOLETE +// OBSOLETE /* Note that the Harris Unix kernels emulate the m88100's behavior on +// OBSOLETE the m88110. */ +// OBSOLETE +// OBSOLETE #define SXIP_REGNUM 35 /* On m88100, Contains Shadow Execute +// OBSOLETE Instruction Pointer. */ +// OBSOLETE #define SNIP_REGNUM 36 /* On m88100, Contains Shadow Next +// OBSOLETE Instruction Pointer. */ +// OBSOLETE #define SFIP_REGNUM 37 /* On m88100, Contains Shadow Fetched +// OBSOLETE Intruction pointer. */ +// OBSOLETE +// OBSOLETE #define EXIP_REGNUM 35 /* On m88110, Contains Exception +// OBSOLETE Executing Instruction Pointer. */ +// OBSOLETE #define ENIP_REGNUM 36 /* On m88110, Contains the Exception +// OBSOLETE Next Instruction Pointer. */ +// OBSOLETE +// OBSOLETE #define PC_REGNUM SXIP_REGNUM /* Program Counter */ +// OBSOLETE #define NPC_REGNUM SNIP_REGNUM /* Next Program Counter */ +// OBSOLETE #define M88K_NNPC_REGNUM SFIP_REGNUM /* Next Next Program Counter */ +// OBSOLETE +// OBSOLETE +// OBSOLETE #define PSR_REGNUM 32 /* Processor Status Register */ +// OBSOLETE #define FPSR_REGNUM 33 /* Floating Point Status Register */ +// OBSOLETE #define FPCR_REGNUM 34 /* Floating Point Control Register */ +// OBSOLETE #define XFP_REGNUM 38 /* First Extended Float Register */ +// OBSOLETE #define X0_REGNUM XFP_REGNUM /* Which also contains the constant zero */ +// OBSOLETE +// OBSOLETE /* This is rather a confusing lie. Our m88k port using a stack pointer value +// OBSOLETE for the frame address. Hence, the frame address and the frame pointer are +// OBSOLETE only indirectly related. The value of this macro is the register number +// OBSOLETE fetched by the machine "independent" portions of gdb when they want to know +// OBSOLETE about a frame address. Thus, we lie here and claim that FP_REGNUM is +// OBSOLETE SP_REGNUM. */ +// OBSOLETE #define FP_REGNUM SP_REGNUM /* Reg fetched to locate frame when pgm stops */ +// OBSOLETE #define ACTUAL_FP_REGNUM 30 +// OBSOLETE +// OBSOLETE /* PSR status bit definitions. */ +// OBSOLETE +// OBSOLETE #define PSR_MODE 0x80000000 +// OBSOLETE #define PSR_BYTE_ORDER 0x40000000 +// OBSOLETE #define PSR_SERIAL_MODE 0x20000000 +// OBSOLETE #define PSR_CARRY 0x10000000 +// OBSOLETE #define PSR_SFU_DISABLE 0x000003f0 +// OBSOLETE #define PSR_SFU1_DISABLE 0x00000008 +// OBSOLETE #define PSR_MXM 0x00000004 +// OBSOLETE #define PSR_IND 0x00000002 +// OBSOLETE #define PSR_SFRZ 0x00000001 +// OBSOLETE +// OBSOLETE +// OBSOLETE +// OBSOLETE /* The following two comments come from the days prior to the m88110 +// OBSOLETE port. The m88110 handles the instruction pointers differently. I +// OBSOLETE do not know what any m88110 kernels do as the m88110 port I'm +// OBSOLETE working with is for an embedded system. rich@cygnus.com +// OBSOLETE 13-sept-93. */ +// OBSOLETE +// OBSOLETE /* BCS requires that the SXIP_REGNUM (or PC_REGNUM) contain the +// OBSOLETE address of the next instr to be executed when a breakpoint occurs. +// OBSOLETE Because the kernel gets the next instr (SNIP_REGNUM), the instr in +// OBSOLETE SNIP needs to be put back into SFIP, and the instr in SXIP should +// OBSOLETE be shifted to SNIP */ +// OBSOLETE +// OBSOLETE /* Are you sitting down? It turns out that the 88K BCS (binary +// OBSOLETE compatibility standard) folks originally felt that the debugger +// OBSOLETE should be responsible for backing up the IPs, not the kernel (as is +// OBSOLETE usually done). Well, they have reversed their decision, and in +// OBSOLETE future releases our kernel will be handling the backing up of the +// OBSOLETE IPs. So, eventually, we won't need to do the SHIFT_INST_REGS +// OBSOLETE stuff. But, for now, since there are 88K systems out there that do +// OBSOLETE need the debugger to do the IP shifting, and since there will be +// OBSOLETE systems where the kernel does the shifting, the code is a little +// OBSOLETE more complex than perhaps it needs to be (we still go inside +// OBSOLETE SHIFT_INST_REGS, and if the shifting hasn't occurred then gdb goes +// OBSOLETE ahead and shifts). */ +// OBSOLETE +// OBSOLETE extern int target_is_m88110; +// OBSOLETE #define SHIFT_INST_REGS() \ +// OBSOLETE if (!target_is_m88110) \ +// OBSOLETE { \ +// OBSOLETE CORE_ADDR pc = read_register (PC_REGNUM); \ +// OBSOLETE CORE_ADDR npc = read_register (NPC_REGNUM); \ +// OBSOLETE if (pc != npc) \ +// OBSOLETE { \ +// OBSOLETE write_register (M88K_NNPC_REGNUM, npc); \ +// OBSOLETE write_register (NPC_REGNUM, pc); \ +// OBSOLETE } \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Storing the following registers is a no-op. */ +// OBSOLETE #define CANNOT_STORE_REGISTER(regno) (((regno) == R0_REGNUM) \ +// OBSOLETE || ((regno) == X0_REGNUM)) +// OBSOLETE +// OBSOLETE /* Number of bytes of storage in the actual machine representation +// OBSOLETE for register N. On the m88k, the general purpose registers are 4 +// OBSOLETE bytes and the 88110 extended registers are 10 bytes. */ +// OBSOLETE +// OBSOLETE #define REGISTER_RAW_SIZE(N) ((N) < XFP_REGNUM ? 4 : 10) +// OBSOLETE +// OBSOLETE /* Total amount of space needed to store our copies of the machine's +// OBSOLETE register state, the array `registers'. */ +// OBSOLETE +// OBSOLETE #define REGISTER_BYTES ((GP_REGS * REGISTER_RAW_SIZE(0)) \ +// OBSOLETE + (FP_REGS * REGISTER_RAW_SIZE(XFP_REGNUM))) +// OBSOLETE +// OBSOLETE /* Index within `registers' of the first byte of the space for +// OBSOLETE register N. */ +// OBSOLETE +// OBSOLETE #define REGISTER_BYTE(N) (((N) * REGISTER_RAW_SIZE(0)) \ +// OBSOLETE + ((N) >= XFP_REGNUM \ +// OBSOLETE ? (((N) - XFP_REGNUM) \ +// OBSOLETE * REGISTER_RAW_SIZE(XFP_REGNUM)) \ +// OBSOLETE : 0)) +// OBSOLETE +// OBSOLETE /* Number of bytes of storage in the program's representation for +// OBSOLETE register N. On the m88k, all registers are 4 bytes excepting the +// OBSOLETE m88110 extended registers which are 8 byte doubles. */ +// OBSOLETE +// OBSOLETE #define REGISTER_VIRTUAL_SIZE(N) ((N) < XFP_REGNUM ? 4 : 8) +// OBSOLETE +// OBSOLETE /* Largest value REGISTER_RAW_SIZE can have. */ +// OBSOLETE +// OBSOLETE #define MAX_REGISTER_RAW_SIZE (REGISTER_RAW_SIZE(XFP_REGNUM)) +// OBSOLETE +// OBSOLETE /* Largest value REGISTER_VIRTUAL_SIZE can have. +// OBSOLETE Are FPS1, FPS2, FPR "virtual" regisers? */ +// OBSOLETE +// OBSOLETE #define MAX_REGISTER_VIRTUAL_SIZE (REGISTER_RAW_SIZE(XFP_REGNUM)) +// OBSOLETE +// OBSOLETE /* Return the GDB type object for the "standard" data type +// OBSOLETE of data in register N. */ +// OBSOLETE +// OBSOLETE struct type *m88k_register_type (int regnum); +// OBSOLETE #define REGISTER_VIRTUAL_TYPE(N) m88k_register_type (N) +// OBSOLETE +// OBSOLETE /* The 88k call/return conventions call for "small" values to be returned +// OBSOLETE into consecutive registers starting from r2. */ +// OBSOLETE +// OBSOLETE #define DEPRECATED_EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \ +// OBSOLETE memcpy ((VALBUF), &(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), TYPE_LENGTH (TYPE)) +// OBSOLETE +// OBSOLETE #define DEPRECATED_EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF)) +// OBSOLETE +// OBSOLETE /* Write into appropriate registers a function return value +// OBSOLETE of type TYPE, given in virtual format. */ +// OBSOLETE +// OBSOLETE #define STORE_RETURN_VALUE(TYPE,VALBUF) \ +// OBSOLETE write_register_bytes (2*REGISTER_RAW_SIZE(0), (VALBUF), TYPE_LENGTH (TYPE)) +// OBSOLETE +// OBSOLETE /* In COFF, if PCC says a parameter is a short or a char, do not +// OBSOLETE change it to int (it seems the convention is to change it). */ +// OBSOLETE +// OBSOLETE #define BELIEVE_PCC_PROMOTION 1 +// OBSOLETE +// OBSOLETE /* Describe the pointer in each stack frame to the previous stack frame +// OBSOLETE (its caller). */ +// OBSOLETE +// OBSOLETE /* FRAME_CHAIN takes a frame's nominal address +// OBSOLETE and produces the frame's chain-pointer. +// OBSOLETE +// OBSOLETE However, if FRAME_CHAIN_VALID returns zero, +// OBSOLETE it means the given frame is the outermost one and has no caller. */ +// OBSOLETE +// OBSOLETE extern CORE_ADDR frame_chain (); +// OBSOLETE extern int frame_chain_valid (); +// OBSOLETE extern int frameless_function_invocation (); +// OBSOLETE +// OBSOLETE #define FRAME_CHAIN(thisframe) \ +// OBSOLETE frame_chain (thisframe) +// OBSOLETE +// OBSOLETE #define FRAMELESS_FUNCTION_INVOCATION(frame) \ +// OBSOLETE (frameless_function_invocation (frame)) +// OBSOLETE +// OBSOLETE /* Define other aspects of the stack frame. */ +// OBSOLETE +// OBSOLETE #define FRAME_SAVED_PC(FRAME) \ +// OBSOLETE frame_saved_pc (FRAME) +// OBSOLETE extern CORE_ADDR frame_saved_pc (); +// OBSOLETE +// OBSOLETE #define FRAME_ARGS_ADDRESS(fi) \ +// OBSOLETE frame_args_address (fi) +// OBSOLETE extern CORE_ADDR frame_args_address (); +// OBSOLETE +// OBSOLETE #define FRAME_LOCALS_ADDRESS(fi) \ +// OBSOLETE frame_locals_address (fi) +// OBSOLETE extern CORE_ADDR frame_locals_address (); +// OBSOLETE +// OBSOLETE /* Return number of args passed to a frame. +// OBSOLETE Can return -1, meaning no way to tell. */ +// OBSOLETE +// OBSOLETE #define FRAME_NUM_ARGS(fi) (-1) +// OBSOLETE +// OBSOLETE /* Return number of bytes at start of arglist that are not really args. */ +// OBSOLETE +// OBSOLETE #define FRAME_ARGS_SKIP 0 +// OBSOLETE +// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, +// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. +// OBSOLETE This includes special registers such as pc and fp saved in special +// OBSOLETE ways in the stack frame. sp is even more special: +// OBSOLETE the address we return for it IS the sp for the next frame. */ +// OBSOLETE +// OBSOLETE /* On the 88k, parameter registers get stored into the so called "homing" +// OBSOLETE area. This *always* happens when you compiled with GCC and use -g. +// OBSOLETE Also, (with GCC and -g) the saving of the parameter register values +// OBSOLETE always happens right within the function prologue code, so these register +// OBSOLETE values can generally be relied upon to be already copied into their +// OBSOLETE respective homing slots by the time you will normally try to look at +// OBSOLETE them (we hope). +// OBSOLETE +// OBSOLETE Note that homing area stack slots are always at *positive* offsets from +// OBSOLETE the frame pointer. Thus, the homing area stack slots for the parameter +// OBSOLETE registers (passed values) for a given function are actually part of the +// OBSOLETE frame area of the caller. This is unusual, but it should not present +// OBSOLETE any special problems for GDB. +// OBSOLETE +// OBSOLETE Note also that on the 88k, we are only interested in finding the +// OBSOLETE registers that might have been saved in memory. This is a subset of +// OBSOLETE the whole set of registers because the standard calling sequence allows +// OBSOLETE the called routine to clobber many registers. +// OBSOLETE +// OBSOLETE We could manage to locate values for all of the so called "preserved" +// OBSOLETE registers (some of which may get saved within any particular frame) but +// OBSOLETE that would require decoding all of the tdesc information. That would be +// OBSOLETE nice information for GDB to have, but it is not strictly manditory if we +// OBSOLETE can live without the ability to look at values within (or backup to) +// OBSOLETE previous frames. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE struct frame_saved_regs; +// OBSOLETE struct frame_info; +// OBSOLETE +// OBSOLETE void frame_find_saved_regs (struct frame_info *fi, +// OBSOLETE struct frame_saved_regs *fsr); +// OBSOLETE +// OBSOLETE #define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \ +// OBSOLETE frame_find_saved_regs (frame_info, &frame_saved_regs) +// OBSOLETE +// OBSOLETE +// OBSOLETE #define POP_FRAME pop_frame () +// OBSOLETE extern void pop_frame (); +// OBSOLETE +// OBSOLETE /* Call function stuff contributed by Kevin Buettner of Motorola. */ +// OBSOLETE +// OBSOLETE #define CALL_DUMMY_LOCATION AFTER_TEXT_END +// OBSOLETE +// OBSOLETE extern void m88k_push_dummy_frame (); +// OBSOLETE #define PUSH_DUMMY_FRAME m88k_push_dummy_frame() +// OBSOLETE +// OBSOLETE #define CALL_DUMMY { \ +// OBSOLETE 0x67ff00c0, /* 0: subu #sp,#sp,0xc0 */ \ +// OBSOLETE 0x243f0004, /* 4: st #r1,#sp,0x4 */ \ +// OBSOLETE 0x245f0008, /* 8: st #r2,#sp,0x8 */ \ +// OBSOLETE 0x247f000c, /* c: st #r3,#sp,0xc */ \ +// OBSOLETE 0x249f0010, /* 10: st #r4,#sp,0x10 */ \ +// OBSOLETE 0x24bf0014, /* 14: st #r5,#sp,0x14 */ \ +// OBSOLETE 0x24df0018, /* 18: st #r6,#sp,0x18 */ \ +// OBSOLETE 0x24ff001c, /* 1c: st #r7,#sp,0x1c */ \ +// OBSOLETE 0x251f0020, /* 20: st #r8,#sp,0x20 */ \ +// OBSOLETE 0x253f0024, /* 24: st #r9,#sp,0x24 */ \ +// OBSOLETE 0x255f0028, /* 28: st #r10,#sp,0x28 */ \ +// OBSOLETE 0x257f002c, /* 2c: st #r11,#sp,0x2c */ \ +// OBSOLETE 0x259f0030, /* 30: st #r12,#sp,0x30 */ \ +// OBSOLETE 0x25bf0034, /* 34: st #r13,#sp,0x34 */ \ +// OBSOLETE 0x25df0038, /* 38: st #r14,#sp,0x38 */ \ +// OBSOLETE 0x25ff003c, /* 3c: st #r15,#sp,0x3c */ \ +// OBSOLETE 0x261f0040, /* 40: st #r16,#sp,0x40 */ \ +// OBSOLETE 0x263f0044, /* 44: st #r17,#sp,0x44 */ \ +// OBSOLETE 0x265f0048, /* 48: st #r18,#sp,0x48 */ \ +// OBSOLETE 0x267f004c, /* 4c: st #r19,#sp,0x4c */ \ +// OBSOLETE 0x269f0050, /* 50: st #r20,#sp,0x50 */ \ +// OBSOLETE 0x26bf0054, /* 54: st #r21,#sp,0x54 */ \ +// OBSOLETE 0x26df0058, /* 58: st #r22,#sp,0x58 */ \ +// OBSOLETE 0x26ff005c, /* 5c: st #r23,#sp,0x5c */ \ +// OBSOLETE 0x271f0060, /* 60: st #r24,#sp,0x60 */ \ +// OBSOLETE 0x273f0064, /* 64: st #r25,#sp,0x64 */ \ +// OBSOLETE 0x275f0068, /* 68: st #r26,#sp,0x68 */ \ +// OBSOLETE 0x277f006c, /* 6c: st #r27,#sp,0x6c */ \ +// OBSOLETE 0x279f0070, /* 70: st #r28,#sp,0x70 */ \ +// OBSOLETE 0x27bf0074, /* 74: st #r29,#sp,0x74 */ \ +// OBSOLETE 0x27df0078, /* 78: st #r30,#sp,0x78 */ \ +// OBSOLETE 0x63df0000, /* 7c: addu #r30,#sp,0x0 */ \ +// OBSOLETE 0x145f0000, /* 80: ld #r2,#sp,0x0 */ \ +// OBSOLETE 0x147f0004, /* 84: ld #r3,#sp,0x4 */ \ +// OBSOLETE 0x149f0008, /* 88: ld #r4,#sp,0x8 */ \ +// OBSOLETE 0x14bf000c, /* 8c: ld #r5,#sp,0xc */ \ +// OBSOLETE 0x14df0010, /* 90: ld #r6,#sp,0x10 */ \ +// OBSOLETE 0x14ff0014, /* 94: ld #r7,#sp,0x14 */ \ +// OBSOLETE 0x151f0018, /* 98: ld #r8,#sp,0x18 */ \ +// OBSOLETE 0x153f001c, /* 9c: ld #r9,#sp,0x1c */ \ +// OBSOLETE 0x5c200000, /* a0: or.u #r1,#r0,0x0 */ \ +// OBSOLETE 0x58210000, /* a4: or #r1,#r1,0x0 */ \ +// OBSOLETE 0xf400c801, /* a8: jsr #r1 */ \ +// OBSOLETE 0xf000d1ff /* ac: tb0 0x0,#r0,0x1ff */ \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define CALL_DUMMY_START_OFFSET 0x80 +// OBSOLETE #define CALL_DUMMY_LENGTH 0xb0 +// OBSOLETE +// OBSOLETE /* FIXME: byteswapping. */ +// OBSOLETE #define FIX_CALL_DUMMY(dummy, pc, fun, nargs, args, type, gcc_p) \ +// OBSOLETE { \ +// OBSOLETE *(unsigned long *)((char *) (dummy) + 0xa0) |= \ +// OBSOLETE (((unsigned long) (fun)) >> 16); \ +// OBSOLETE *(unsigned long *)((char *) (dummy) + 0xa4) |= \ +// OBSOLETE (((unsigned long) (fun)) & 0xffff); \ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Stack must be aligned on 64-bit boundaries when synthesizing +// OBSOLETE function calls. */ +// OBSOLETE +// OBSOLETE #define STACK_ALIGN(addr) (((addr) + 7) & -8) +// OBSOLETE +// OBSOLETE #define STORE_STRUCT_RETURN(addr, sp) \ +// OBSOLETE write_register (SRA_REGNUM, (addr)) +// OBSOLETE +// OBSOLETE #define NEED_TEXT_START_END 1 +// OBSOLETE +// OBSOLETE /* According to the MC88100 RISC Microprocessor User's Manual, section +// OBSOLETE 6.4.3.1.2: +// OBSOLETE +// OBSOLETE ... can be made to return to a particular instruction by placing a +// OBSOLETE valid instruction address in the SNIP and the next sequential +// OBSOLETE instruction address in the SFIP (with V bits set and E bits clear). +// OBSOLETE The rte resumes execution at the instruction pointed to by the +// OBSOLETE SNIP, then the SFIP. +// OBSOLETE +// OBSOLETE The E bit is the least significant bit (bit 0). The V (valid) bit is +// OBSOLETE bit 1. This is why we logical or 2 into the values we are writing +// OBSOLETE below. It turns out that SXIP plays no role when returning from an +// OBSOLETE exception so nothing special has to be done with it. We could even +// OBSOLETE (presumably) give it a totally bogus value. +// OBSOLETE +// OBSOLETE -- Kevin Buettner +// OBSOLETE */ +// OBSOLETE +// OBSOLETE extern void m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid); +// OBSOLETE #define TARGET_WRITE_PC(VAL, PID) m88k_target_write_pc (VAL, PID) diff --git a/gdb/config/m88k/xm-delta88.h b/gdb/config/m88k/xm-delta88.h index 27c8fe2..df2b8e6 100644 --- a/gdb/config/m88k/xm-delta88.h +++ b/gdb/config/m88k/xm-delta88.h @@ -1,44 +1,44 @@ -/* Host machine description for Motorola Delta 88 system, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993 - 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. */ - -#if !defined (USG) -#define USG 1 -#endif - -#include <sys/param.h> -#include <sys/time.h> - -#define HAVE_TERMIO - -/*#define USIZE 2048 */ -/*#define NBPG NBPC */ -/* Might be defined in <sys/param.h>. I suspect this define was a relic - from before when BFD did core files. */ -/* #define UPAGES USIZE */ - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -/* Since registers r0 through r31 are stored directly in the struct ptrace_user, - (for m88k BCS) - the ptrace_user offsets are sufficient and KERNEL_U_ADDRESS can be 0 */ - -#define KERNEL_U_ADDR 0 +// OBSOLETE /* Host machine description for Motorola Delta 88 system, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #if !defined (USG) +// OBSOLETE #define USG 1 +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE #include <sys/param.h> +// OBSOLETE #include <sys/time.h> +// OBSOLETE +// OBSOLETE #define HAVE_TERMIO +// OBSOLETE +// OBSOLETE /*#define USIZE 2048 */ +// OBSOLETE /*#define NBPG NBPC */ +// OBSOLETE /* Might be defined in <sys/param.h>. I suspect this define was a relic +// OBSOLETE from before when BFD did core files. */ +// OBSOLETE /* #define UPAGES USIZE */ +// OBSOLETE +// OBSOLETE /* This is the amount to subtract from u.u_ar0 +// OBSOLETE to get the offset in the core file of the register values. */ +// OBSOLETE +// OBSOLETE /* Since registers r0 through r31 are stored directly in the struct ptrace_user, +// OBSOLETE (for m88k BCS) +// OBSOLETE the ptrace_user offsets are sufficient and KERNEL_U_ADDRESS can be 0 */ +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0 diff --git a/gdb/config/m88k/xm-dgux.h b/gdb/config/m88k/xm-dgux.h index b6f7f99..dc99f97 100644 --- a/gdb/config/m88k/xm-dgux.h +++ b/gdb/config/m88k/xm-dgux.h @@ -1,55 +1,55 @@ -/* Host-machine dependent parameters for Motorola 88000, for GDB. - Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1998 - 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. */ - -#if !defined (USG) -#define USG 1 -#endif - -#include <sys/param.h> - -#ifdef __GNUC__ -#define memcpy __builtin_memcpy -/* gcc doesn't have this, at least not gcc 1.92. */ -/* #define memset __builtin_memset */ -#define strcmp __builtin_strcmp -#endif - -#define x_foff _x_x._x_offset -#define x_fname _x_name -#define USER ptrace_user -#define _BSD_WAIT_FLAVOR - -#define HAVE_TERMIO - -#ifndef USIZE -#define USIZE 2048 -#endif -#define NBPG NBPC -#define UPAGES USIZE - -/* This is the amount to subtract from u.u_ar0 - to get the offset in the core file of the register values. */ - -/* Since registers r0 through r31 are stored directly in the struct ptrace_user, - (for m88k BCS) - the ptrace_user offsets are sufficient and KERNEL_U_ADDRESS can be 0 */ - -#define KERNEL_U_ADDR 0 +// OBSOLETE /* Host-machine dependent parameters for Motorola 88000, for GDB. +// OBSOLETE Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1993, 1998 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #if !defined (USG) +// OBSOLETE #define USG 1 +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE #include <sys/param.h> +// OBSOLETE +// OBSOLETE #ifdef __GNUC__ +// OBSOLETE #define memcpy __builtin_memcpy +// OBSOLETE /* gcc doesn't have this, at least not gcc 1.92. */ +// OBSOLETE /* #define memset __builtin_memset */ +// OBSOLETE #define strcmp __builtin_strcmp +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE #define x_foff _x_x._x_offset +// OBSOLETE #define x_fname _x_name +// OBSOLETE #define USER ptrace_user +// OBSOLETE #define _BSD_WAIT_FLAVOR +// OBSOLETE +// OBSOLETE #define HAVE_TERMIO +// OBSOLETE +// OBSOLETE #ifndef USIZE +// OBSOLETE #define USIZE 2048 +// OBSOLETE #endif +// OBSOLETE #define NBPG NBPC +// OBSOLETE #define UPAGES USIZE +// OBSOLETE +// OBSOLETE /* This is the amount to subtract from u.u_ar0 +// OBSOLETE to get the offset in the core file of the register values. */ +// OBSOLETE +// OBSOLETE /* Since registers r0 through r31 are stored directly in the struct ptrace_user, +// OBSOLETE (for m88k BCS) +// OBSOLETE the ptrace_user offsets are sufficient and KERNEL_U_ADDRESS can be 0 */ +// OBSOLETE +// OBSOLETE #define KERNEL_U_ADDR 0 diff --git a/gdb/configure.host b/gdb/configure.host index 4256db3..fcc2d38 100644 --- a/gdb/configure.host +++ b/gdb/configure.host @@ -15,7 +15,7 @@ arm*) gdb_host_cpu=arm ;; hppa*) gdb_host_cpu=pa ;; i[3456]86*) gdb_host_cpu=i386 ;; m68*) gdb_host_cpu=m68k ;; -m88*) gdb_host_cpu=m88k ;; +# OBSOLETE m88*) gdb_host_cpu=m88k ;; mips*) gdb_host_cpu=mips ;; powerpc*) gdb_host_cpu=powerpc ;; sparcv9 | sparc64) gdb_host_cpu=sparc ;; @@ -106,9 +106,9 @@ m68*-sun-sunos3*) gdb_host=sun3os3 ;; m68*-sun-sunos4*) gdb_host=sun3os4 ;; m68*-sun-*) gdb_host=sun3os4 ;; -m88*-motorola-sysv4*) gdb_host=delta88v4 ;; -m88*-motorola-sysv*) gdb_host=delta88 ;; -m88*-*-*) gdb_host=m88k ;; +# OBSOLETE m88*-motorola-sysv4*) gdb_host=delta88v4 ;; +# OBSOLETE m88*-motorola-sysv*) gdb_host=delta88 ;; +# OBSOLETE m88*-*-*) gdb_host=m88k ;; mips-dec-mach3*) gdb_host=mipsm3 ;; mips-dec-*) gdb_host=decstation ;; diff --git a/gdb/configure.tgt b/gdb/configure.tgt index f61b7ef..11274ec 100644 --- a/gdb/configure.tgt +++ b/gdb/configure.tgt @@ -19,7 +19,7 @@ hppa*) gdb_target_cpu=pa ;; i[3456]86*) gdb_target_cpu=i386 ;; m68hc11*|m6811*) gdb_target_cpu=m68hc11 ;; m68*) gdb_target_cpu=m68k ;; -m88*) gdb_target_cpu=m88k ;; +# OBSOLETE m88*) gdb_target_cpu=m88k ;; mips*) gdb_target_cpu=mips ;; powerpc*) gdb_target_cpu=powerpc ;; sparc*) gdb_target_cpu=sparc ;; @@ -165,9 +165,9 @@ m68*-*-sunos4*) gdb_target=sun3os4 ;; m68*-*-sysv4*) gdb_target=m68kv4 ;; m68*-*-vxworks*) gdb_target=vxworks68 ;; -m88*-motorola-sysv4*) gdb_target=delta88v4 ;; -m88*-motorola-*) gdb_target=delta88 ;; -m88*-*-*) gdb_target=m88k ;; +# OBSOLETE m88*-motorola-sysv4*) gdb_target=delta88v4 ;; +# OBSOLETE m88*-motorola-*) gdb_target=delta88 ;; +# OBSOLETE m88*-*-*) gdb_target=m88k ;; mcore*-*-*) gdb_target=mcore ;; mips64*-big-*) gdb_target=bigmips64 ;; diff --git a/gdb/cxux-nat.c b/gdb/cxux-nat.c index 742f89c..e8f35a3 100644 --- a/gdb/cxux-nat.c +++ b/gdb/cxux-nat.c @@ -1,537 +1,537 @@ -/* Native support for Motorola 88k running Harris CX/UX. - Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 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 "frame.h" -#include "inferior.h" - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/dir.h> -#include <signal.h> -#include "gdbcore.h" -#include <sys/user.h> - -#include "bfd.h" -#include "symfile.h" -#include "objfiles.h" -#include "symtab.h" -#include "regcache.h" - -#ifndef USER /* added to support BCS ptrace_user */ -#define USER ptrace_user -#endif -#include <sys/ioctl.h> -#include <fcntl.h> -#include <sys/file.h> -#include "gdb_stat.h" - -#include "symtab.h" -#include "setjmp.h" -#include "value.h" - -#include <sys/ptrace.h> - -/* CX/UX provides them already, but as word offsets instead of char offsets */ -#define SXIP_OFFSET (PT_SXIP * 4) -#define SNIP_OFFSET (PT_SNIP * 4) -#define SFIP_OFFSET (PT_SFIP * 4) -#define PSR_OFFSET (PT_PSR * sizeof(int)) -#define FPSR_OFFSET (PT_FPSR * sizeof(int)) -#define FPCR_OFFSET (PT_FPCR * sizeof(int)) - -#define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \ - ((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE)) - -extern int have_symbol_file_p (); - -extern jmp_buf stack_jmp; - -extern int errno; - -void -fetch_inferior_registers (int regno) -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - struct USER u; - unsigned int offset; - - offset = (char *) &u.pt_r0 - (char *) &u; - regaddr = offset; /* byte offset to r0; */ - -/* offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ - for (regno = 0; regno < PC_REGNUM; regno++) - { - /*regaddr = register_addr (regno, offset); */ - /* 88k enhancement */ - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - /* now load up registers 32-37; special pc registers */ - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) PSR_OFFSET, 0); - supply_register (PSR_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) FPSR_OFFSET, 0); - supply_register (FPSR_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) FPCR_OFFSET, 0); - supply_register (FPCR_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SXIP_OFFSET, 0); - supply_register (SXIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SNIP_OFFSET, 0); - supply_register (SNIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SFIP_OFFSET, 0); - supply_register (SFIP_REGNUM, buf); - - if (target_is_m88110) - { - for (regaddr = XREGADDR (X0_REGNUM), regno = X0_REGNUM; - regno < NUM_REGS; - regno++, regaddr += 16) - { - X_REGISTER_RAW_TYPE xval; - - *(int *) &xval.w1 = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, 0); - *(int *) &xval.w2 = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) (regaddr + 4), 0); - *(int *) &xval.w3 = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) (regaddr + 8), 0); - *(int *) &xval.w4 = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) (regaddr + 12), 0); - supply_register (regno, (void *) &xval); - } - } -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (int regno) -{ - register unsigned int regaddr; - char buf[80]; - - struct USER u; - - unsigned int offset = (char *) &u.pt_r0 - (char *) &u; - - regaddr = offset; - - /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either - svr3 doesn't run on an 88110, or the kernel isolates the different (not - completely sure this is true, but seems to be. */ - if (regno >= 0) - { - /* regaddr = register_addr (regno, offset); */ - if (regno < PC_REGNUM) - { - regaddr = offset + regno * sizeof (int); - errno = 0; - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else if (regno == PSR_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno)); - else if (regno == FPSR_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno)); - else if (regno == FPCR_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno)); - else if (regno == SXIP_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno)); - else if (regno == SNIP_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno)); - else if (regno == SFIP_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno)); - else if (target_is_m88110 && regno < NUM_REGS) - { - X_REGISTER_RAW_TYPE xval; - - read_register_bytes (REGISTER_BYTE (regno), (char *) &xval, - sizeof (X_REGISTER_RAW_TYPE)); - regaddr = XREGADDR (regno); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 4, xval.w2); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 8, xval.w3); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 12, xval.w4); - } - else - printf_unfiltered ("Bad register number for store_inferior routine\n"); - } - else - { - for (regno = 0; regno < PC_REGNUM; regno++) - { - /* regaddr = register_addr (regno, offset); */ - errno = 0; - regaddr = offset + regno * sizeof (int); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM)); - if (target_is_m88110) - { - for (regno = X0_REGNUM; regno < NUM_REGS; regno++) - { - X_REGISTER_RAW_TYPE xval; - - read_register_bytes (REGISTER_BYTE (regno), (char *) &xval, - sizeof (X_REGISTER_RAW_TYPE)); - regaddr = XREGADDR (regno); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 4), xval.w2); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 8), xval.w3); - ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 12), xval.w4); - } - } - } -} - -/* blockend is the address of the end of the user structure */ - -m88k_register_u_addr (int blockend, int regnum) -{ - struct USER u; - int ustart = blockend - sizeof (struct USER); - - if (regnum < PSR_REGNUM) - return (ustart + ((int) &u.pt_r0 - (int) &u) + - REGISTER_SIZE * regnum); - else if (regnum == PSR_REGNUM) - return (ustart + ((int) &u.pt_psr) - (int) &u); - else if (regnum == FPSR_REGNUM) - return (ustart + ((int) &u.pt_fpsr) - (int) &u); - else if (regnum == FPCR_REGNUM) - return (ustart + ((int) &u.pt_fpcr) - (int) &u); - else if (regnum == SXIP_REGNUM) - return (ustart + SXIP_OFFSET); - else if (regnum == SNIP_REGNUM) - return (ustart + SNIP_OFFSET); - else if (regnum == SFIP_REGNUM) - return (ustart + SFIP_OFFSET); - else if (target_is_m88110) - return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */ - sizeof (u.pt_x0) * (regnum - X0_REGNUM)); - else - return (blockend + REGISTER_SIZE * regnum); -} - -#ifdef USE_PROC_FS - -#include <sys/procfs.h> - -/* Prototypes for supply_gregset etc. */ -#include "gregset.h" - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregset_t *gregsetp) -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi <= SP_REGNUM; regi++) - supply_register (regi, (char *) (regp + regi)); - - supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); - supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); - supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); - supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); - supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); - supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); -} - -void -fill_gregset (gregset_t *gregsetp, int regno) -{ - int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi <= R_R31; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; - - if ((regno == -1) || (regno == SXIP_REGNUM)) - *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)]; - if ((regno == -1) || (regno == SNIP_REGNUM)) - *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)]; - if ((regno == -1) || (regno == SFIP_REGNUM)) - *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)]; - if ((regno == -1) || (regno == PSR_REGNUM)) - *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)]; - if ((regno == -1) || (regno == FPSR_REGNUM)) - *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)]; - if ((regno == -1) || (regno == FPCR_REGNUM)) - *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)]; -} - -#endif /* USE_PROC_FS */ - -/* This support adds the equivalent of adb's % command. When - the `add-shared-symbol-files' command is given, this routine scans - the dynamic linker's link map and reads the minimal symbols - from each shared object file listed in the map. */ - -struct link_map -{ - unsigned long l_addr; /* address at which object is mapped */ - char *l_name; /* full name of loaded object */ - void *l_ld; /* dynamic structure of object */ - struct link_map *l_next; /* next link object */ - struct link_map *l_prev; /* previous link object */ -}; - -#define LINKS_MAP_POINTER "_ld_tail" -#define LIBC_FILE "/usr/lib/libc.so.1" -#define SHARED_OFFSET 0xf0001000 - -#ifndef PATH_MAX -#define PATH_MAX 1023 /* maximum size of path name on OS */ -#endif - -void -add_shared_symbol_files (void) -{ - void *desc; - struct link_map *ld_map, *lm, lms; - struct minimal_symbol *minsym; - struct objfile *objfile; - char *path_name; - - if (ptid_equal (inferior_ptid, null_ptid)) - { - warning ("The program has not yet been started."); - return; - } - - objfile = symbol_file_add (LIBC_FILE, 0, NULL, 0, OBJF_READNOW); - minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile); - - ld_map = (struct link_map *) - read_memory_integer (((int) SYMBOL_VALUE_ADDRESS (minsym) + SHARED_OFFSET), 4); - lm = ld_map; - while (lm) - { - int local_errno = 0; - - read_memory ((CORE_ADDR) lm, (char *) &lms, sizeof (struct link_map)); - if (lms.l_name) - { - if (target_read_string ((CORE_ADDR) lms.l_name, &path_name, - PATH_MAX, &local_errno)) - { - struct section_addr_info section_addrs; - memset (§ion_addrs, 0, sizeof (section_addrs)); - section_addrs.other[0].addr = lms.l_addr; - section_addrs.other[0].name = ".text"; - symbol_file_add (path_name, 1, §ion_addrs, 0, 0); - xfree (path_name); - } - } - /* traverse links in reverse order so that we get the - the symbols the user actually gets. */ - lm = lms.l_prev; - } - - /* Getting new symbols may change our opinion about what is - frameless. */ - reinit_frame_cache (); -} - -#if defined(_ES_MP) - -#include <sys/regset.h> - -unsigned int -m88k_harris_core_register_addr (int regno, int reg_ptr) -{ - unsigned int word_offset; - - switch (regno) - { - case PSR_REGNUM: - word_offset = R_EPSR; - break; - case FPSR_REGNUM: - word_offset = R_FPSR; - break; - case FPCR_REGNUM: - word_offset = R_FPCR; - break; - case SXIP_REGNUM: - word_offset = R_EXIP; - break; - case SNIP_REGNUM: - word_offset = R_ENIP; - break; - case SFIP_REGNUM: - word_offset = R_EFIP; - break; - default: - if (regno <= FP_REGNUM) - word_offset = regno; - else - word_offset = ((regno - X0_REGNUM) * 4); - } - return (word_offset * 4); -} - -#endif /* _ES_MP */ - -void -_initialize_m88k_nat (void) -{ -#ifdef _ES_MP - /* Enable 88110 support, as we don't support the 88100 under ES/MP. */ - - target_is_m88110 = 1; -#elif defined(_CX_UX) - /* Determine whether we're running on an 88100 or an 88110. */ - target_is_m88110 = (sinfo (SYSMACHINE, 0) == SYS5800); -#endif /* _CX_UX */ -} - -#ifdef _ES_MP -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregset_t *gregsetp) -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi < R_R31; regi++) - { - supply_register (regi, (char *) (regp + regi)); - } - supply_register (PSR_REGNUM, (char *) (regp + R_EPSR)); - supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); - supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); - supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP)); - supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP)); - supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP)); -} - -/* Given a pointer to a floating point register set in /proc format - (fpregset_t *), unpack the register contents and supply them as gdb's - idea of the current floating point register values. */ - -void -supply_fpregset (fpregset_t *fpregsetp) -{ - register int regi; - char *from; - - for (regi = FP0_REGNUM; regi <= FPLAST_REGNUM; regi++) - { - from = (char *) &((*fpregsetp)[regi - FP0_REGNUM]); - supply_register (regi, from); - } -} - -#endif /* _ES_MP */ - -#ifdef _CX_UX - -#include <sys/regset.h> - -unsigned int -m88k_harris_core_register_addr (int regno, int reg_ptr) -{ - unsigned int word_offset; - - switch (regno) - { - case PSR_REGNUM: - word_offset = R_PSR; - break; - case FPSR_REGNUM: - word_offset = R_FPSR; - break; - case FPCR_REGNUM: - word_offset = R_FPCR; - break; - case SXIP_REGNUM: - word_offset = R_XIP; - break; - case SNIP_REGNUM: - word_offset = R_NIP; - break; - case SFIP_REGNUM: - word_offset = R_FIP; - break; - default: - if (regno <= FP_REGNUM) - word_offset = regno; - else - word_offset = ((regno - X0_REGNUM) * 4) + R_X0; - } - return (word_offset * 4); -} - -#endif /* _CX_UX */ +// OBSOLETE /* Native support for Motorola 88k running Harris CX/UX. +// OBSOLETE Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2000, +// OBSOLETE 2001 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "frame.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE +// OBSOLETE #include <sys/types.h> +// OBSOLETE #include <sys/param.h> +// OBSOLETE #include <sys/dir.h> +// OBSOLETE #include <signal.h> +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include <sys/user.h> +// OBSOLETE +// OBSOLETE #include "bfd.h" +// OBSOLETE #include "symfile.h" +// OBSOLETE #include "objfiles.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #ifndef USER /* added to support BCS ptrace_user */ +// OBSOLETE #define USER ptrace_user +// OBSOLETE #endif +// OBSOLETE #include <sys/ioctl.h> +// OBSOLETE #include <fcntl.h> +// OBSOLETE #include <sys/file.h> +// OBSOLETE #include "gdb_stat.h" +// OBSOLETE +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "setjmp.h" +// OBSOLETE #include "value.h" +// OBSOLETE +// OBSOLETE #include <sys/ptrace.h> +// OBSOLETE +// OBSOLETE /* CX/UX provides them already, but as word offsets instead of char offsets */ +// OBSOLETE #define SXIP_OFFSET (PT_SXIP * 4) +// OBSOLETE #define SNIP_OFFSET (PT_SNIP * 4) +// OBSOLETE #define SFIP_OFFSET (PT_SFIP * 4) +// OBSOLETE #define PSR_OFFSET (PT_PSR * sizeof(int)) +// OBSOLETE #define FPSR_OFFSET (PT_FPSR * sizeof(int)) +// OBSOLETE #define FPCR_OFFSET (PT_FPCR * sizeof(int)) +// OBSOLETE +// OBSOLETE #define XREGADDR(r) (((char *)&u.pt_x0-(char *)&u) + \ +// OBSOLETE ((r)-X0_REGNUM)*sizeof(X_REGISTER_RAW_TYPE)) +// OBSOLETE +// OBSOLETE extern int have_symbol_file_p (); +// OBSOLETE +// OBSOLETE extern jmp_buf stack_jmp; +// OBSOLETE +// OBSOLETE extern int errno; +// OBSOLETE +// OBSOLETE void +// OBSOLETE fetch_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE register unsigned int regaddr; +// OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; +// OBSOLETE register int i; +// OBSOLETE +// OBSOLETE struct USER u; +// OBSOLETE unsigned int offset; +// OBSOLETE +// OBSOLETE offset = (char *) &u.pt_r0 - (char *) &u; +// OBSOLETE regaddr = offset; /* byte offset to r0; */ +// OBSOLETE +// OBSOLETE /* offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ +// OBSOLETE for (regno = 0; regno < PC_REGNUM; regno++) +// OBSOLETE { +// OBSOLETE /*regaddr = register_addr (regno, offset); */ +// OBSOLETE /* 88k enhancement */ +// OBSOLETE +// OBSOLETE for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) +// OBSOLETE { +// OBSOLETE *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, 0); +// OBSOLETE regaddr += sizeof (int); +// OBSOLETE } +// OBSOLETE supply_register (regno, buf); +// OBSOLETE } +// OBSOLETE /* now load up registers 32-37; special pc registers */ +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) PSR_OFFSET, 0); +// OBSOLETE supply_register (PSR_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) FPSR_OFFSET, 0); +// OBSOLETE supply_register (FPSR_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) FPCR_OFFSET, 0); +// OBSOLETE supply_register (FPCR_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SXIP_OFFSET, 0); +// OBSOLETE supply_register (SXIP_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SNIP_OFFSET, 0); +// OBSOLETE supply_register (SNIP_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SFIP_OFFSET, 0); +// OBSOLETE supply_register (SFIP_REGNUM, buf); +// OBSOLETE +// OBSOLETE if (target_is_m88110) +// OBSOLETE { +// OBSOLETE for (regaddr = XREGADDR (X0_REGNUM), regno = X0_REGNUM; +// OBSOLETE regno < NUM_REGS; +// OBSOLETE regno++, regaddr += 16) +// OBSOLETE { +// OBSOLETE X_REGISTER_RAW_TYPE xval; +// OBSOLETE +// OBSOLETE *(int *) &xval.w1 = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, 0); +// OBSOLETE *(int *) &xval.w2 = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) (regaddr + 4), 0); +// OBSOLETE *(int *) &xval.w3 = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) (regaddr + 8), 0); +// OBSOLETE *(int *) &xval.w4 = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) (regaddr + 12), 0); +// OBSOLETE supply_register (regno, (void *) &xval); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store our register values back into the inferior. +// OBSOLETE If REGNO is -1, do this for all registers. +// OBSOLETE Otherwise, REGNO specifies which register (so we can save time). */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE store_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE register unsigned int regaddr; +// OBSOLETE char buf[80]; +// OBSOLETE +// OBSOLETE struct USER u; +// OBSOLETE +// OBSOLETE unsigned int offset = (char *) &u.pt_r0 - (char *) &u; +// OBSOLETE +// OBSOLETE regaddr = offset; +// OBSOLETE +// OBSOLETE /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either +// OBSOLETE svr3 doesn't run on an 88110, or the kernel isolates the different (not +// OBSOLETE completely sure this is true, but seems to be. */ +// OBSOLETE if (regno >= 0) +// OBSOLETE { +// OBSOLETE /* regaddr = register_addr (regno, offset); */ +// OBSOLETE if (regno < PC_REGNUM) +// OBSOLETE { +// OBSOLETE regaddr = offset + regno * sizeof (int); +// OBSOLETE errno = 0; +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); +// OBSOLETE if (errno != 0) +// OBSOLETE { +// OBSOLETE sprintf (buf, "writing register number %d", regno); +// OBSOLETE perror_with_name (buf); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else if (regno == PSR_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == FPSR_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == FPCR_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == SXIP_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == SNIP_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == SFIP_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno)); +// OBSOLETE else if (target_is_m88110 && regno < NUM_REGS) +// OBSOLETE { +// OBSOLETE X_REGISTER_RAW_TYPE xval; +// OBSOLETE +// OBSOLETE read_register_bytes (REGISTER_BYTE (regno), (char *) &xval, +// OBSOLETE sizeof (X_REGISTER_RAW_TYPE)); +// OBSOLETE regaddr = XREGADDR (regno); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 4, xval.w2); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 8, xval.w3); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr + 12, xval.w4); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE printf_unfiltered ("Bad register number for store_inferior routine\n"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE for (regno = 0; regno < PC_REGNUM; regno++) +// OBSOLETE { +// OBSOLETE /* regaddr = register_addr (regno, offset); */ +// OBSOLETE errno = 0; +// OBSOLETE regaddr = offset + regno * sizeof (int); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); +// OBSOLETE if (errno != 0) +// OBSOLETE { +// OBSOLETE sprintf (buf, "writing register number %d", regno); +// OBSOLETE perror_with_name (buf); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) PSR_OFFSET, read_register (regno)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) FPSR_OFFSET, read_register (regno)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) FPCR_OFFSET, read_register (regno)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM)); +// OBSOLETE if (target_is_m88110) +// OBSOLETE { +// OBSOLETE for (regno = X0_REGNUM; regno < NUM_REGS; regno++) +// OBSOLETE { +// OBSOLETE X_REGISTER_RAW_TYPE xval; +// OBSOLETE +// OBSOLETE read_register_bytes (REGISTER_BYTE (regno), (char *) &xval, +// OBSOLETE sizeof (X_REGISTER_RAW_TYPE)); +// OBSOLETE regaddr = XREGADDR (regno); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) regaddr, xval.w1); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 4), xval.w2); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 8), xval.w3); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) (regaddr + 12), xval.w4); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* blockend is the address of the end of the user structure */ +// OBSOLETE +// OBSOLETE m88k_register_u_addr (int blockend, int regnum) +// OBSOLETE { +// OBSOLETE struct USER u; +// OBSOLETE int ustart = blockend - sizeof (struct USER); +// OBSOLETE +// OBSOLETE if (regnum < PSR_REGNUM) +// OBSOLETE return (ustart + ((int) &u.pt_r0 - (int) &u) + +// OBSOLETE REGISTER_SIZE * regnum); +// OBSOLETE else if (regnum == PSR_REGNUM) +// OBSOLETE return (ustart + ((int) &u.pt_psr) - (int) &u); +// OBSOLETE else if (regnum == FPSR_REGNUM) +// OBSOLETE return (ustart + ((int) &u.pt_fpsr) - (int) &u); +// OBSOLETE else if (regnum == FPCR_REGNUM) +// OBSOLETE return (ustart + ((int) &u.pt_fpcr) - (int) &u); +// OBSOLETE else if (regnum == SXIP_REGNUM) +// OBSOLETE return (ustart + SXIP_OFFSET); +// OBSOLETE else if (regnum == SNIP_REGNUM) +// OBSOLETE return (ustart + SNIP_OFFSET); +// OBSOLETE else if (regnum == SFIP_REGNUM) +// OBSOLETE return (ustart + SFIP_OFFSET); +// OBSOLETE else if (target_is_m88110) +// OBSOLETE return (ustart + ((int) &u.pt_x0 - (int) &u) + /* Must be X register */ +// OBSOLETE sizeof (u.pt_x0) * (regnum - X0_REGNUM)); +// OBSOLETE else +// OBSOLETE return (blockend + REGISTER_SIZE * regnum); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef USE_PROC_FS +// OBSOLETE +// OBSOLETE #include <sys/procfs.h> +// OBSOLETE +// OBSOLETE /* Prototypes for supply_gregset etc. */ +// OBSOLETE #include "gregset.h" +// OBSOLETE +// OBSOLETE /* Given a pointer to a general register set in /proc format (gregset_t *), +// OBSOLETE unpack the register contents and supply them as gdb's idea of the current +// OBSOLETE register values. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE supply_gregset (gregset_t *gregsetp) +// OBSOLETE { +// OBSOLETE register int regi; +// OBSOLETE register greg_t *regp = (greg_t *) gregsetp; +// OBSOLETE +// OBSOLETE for (regi = 0; regi <= SP_REGNUM; regi++) +// OBSOLETE supply_register (regi, (char *) (regp + regi)); +// OBSOLETE +// OBSOLETE supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); +// OBSOLETE supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); +// OBSOLETE supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); +// OBSOLETE supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); +// OBSOLETE supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); +// OBSOLETE supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE fill_gregset (gregset_t *gregsetp, int regno) +// OBSOLETE { +// OBSOLETE int regi; +// OBSOLETE register greg_t *regp = (greg_t *) gregsetp; +// OBSOLETE +// OBSOLETE for (regi = 0; regi <= R_R31; regi++) +// OBSOLETE if ((regno == -1) || (regno == regi)) +// OBSOLETE *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; +// OBSOLETE +// OBSOLETE if ((regno == -1) || (regno == SXIP_REGNUM)) +// OBSOLETE *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == SNIP_REGNUM)) +// OBSOLETE *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == SFIP_REGNUM)) +// OBSOLETE *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == PSR_REGNUM)) +// OBSOLETE *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == FPSR_REGNUM)) +// OBSOLETE *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == FPCR_REGNUM)) +// OBSOLETE *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* USE_PROC_FS */ +// OBSOLETE +// OBSOLETE /* This support adds the equivalent of adb's % command. When +// OBSOLETE the `add-shared-symbol-files' command is given, this routine scans +// OBSOLETE the dynamic linker's link map and reads the minimal symbols +// OBSOLETE from each shared object file listed in the map. */ +// OBSOLETE +// OBSOLETE struct link_map +// OBSOLETE { +// OBSOLETE unsigned long l_addr; /* address at which object is mapped */ +// OBSOLETE char *l_name; /* full name of loaded object */ +// OBSOLETE void *l_ld; /* dynamic structure of object */ +// OBSOLETE struct link_map *l_next; /* next link object */ +// OBSOLETE struct link_map *l_prev; /* previous link object */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE #define LINKS_MAP_POINTER "_ld_tail" +// OBSOLETE #define LIBC_FILE "/usr/lib/libc.so.1" +// OBSOLETE #define SHARED_OFFSET 0xf0001000 +// OBSOLETE +// OBSOLETE #ifndef PATH_MAX +// OBSOLETE #define PATH_MAX 1023 /* maximum size of path name on OS */ +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE void +// OBSOLETE add_shared_symbol_files (void) +// OBSOLETE { +// OBSOLETE void *desc; +// OBSOLETE struct link_map *ld_map, *lm, lms; +// OBSOLETE struct minimal_symbol *minsym; +// OBSOLETE struct objfile *objfile; +// OBSOLETE char *path_name; +// OBSOLETE +// OBSOLETE if (ptid_equal (inferior_ptid, null_ptid)) +// OBSOLETE { +// OBSOLETE warning ("The program has not yet been started."); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE objfile = symbol_file_add (LIBC_FILE, 0, NULL, 0, OBJF_READNOW); +// OBSOLETE minsym = lookup_minimal_symbol (LINKS_MAP_POINTER, objfile); +// OBSOLETE +// OBSOLETE ld_map = (struct link_map *) +// OBSOLETE read_memory_integer (((int) SYMBOL_VALUE_ADDRESS (minsym) + SHARED_OFFSET), 4); +// OBSOLETE lm = ld_map; +// OBSOLETE while (lm) +// OBSOLETE { +// OBSOLETE int local_errno = 0; +// OBSOLETE +// OBSOLETE read_memory ((CORE_ADDR) lm, (char *) &lms, sizeof (struct link_map)); +// OBSOLETE if (lms.l_name) +// OBSOLETE { +// OBSOLETE if (target_read_string ((CORE_ADDR) lms.l_name, &path_name, +// OBSOLETE PATH_MAX, &local_errno)) +// OBSOLETE { +// OBSOLETE struct section_addr_info section_addrs; +// OBSOLETE memset (§ion_addrs, 0, sizeof (section_addrs)); +// OBSOLETE section_addrs.other[0].addr = lms.l_addr; +// OBSOLETE section_addrs.other[0].name = ".text"; +// OBSOLETE symbol_file_add (path_name, 1, §ion_addrs, 0, 0); +// OBSOLETE xfree (path_name); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE /* traverse links in reverse order so that we get the +// OBSOLETE the symbols the user actually gets. */ +// OBSOLETE lm = lms.l_prev; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Getting new symbols may change our opinion about what is +// OBSOLETE frameless. */ +// OBSOLETE reinit_frame_cache (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if defined(_ES_MP) +// OBSOLETE +// OBSOLETE #include <sys/regset.h> +// OBSOLETE +// OBSOLETE unsigned int +// OBSOLETE m88k_harris_core_register_addr (int regno, int reg_ptr) +// OBSOLETE { +// OBSOLETE unsigned int word_offset; +// OBSOLETE +// OBSOLETE switch (regno) +// OBSOLETE { +// OBSOLETE case PSR_REGNUM: +// OBSOLETE word_offset = R_EPSR; +// OBSOLETE break; +// OBSOLETE case FPSR_REGNUM: +// OBSOLETE word_offset = R_FPSR; +// OBSOLETE break; +// OBSOLETE case FPCR_REGNUM: +// OBSOLETE word_offset = R_FPCR; +// OBSOLETE break; +// OBSOLETE case SXIP_REGNUM: +// OBSOLETE word_offset = R_EXIP; +// OBSOLETE break; +// OBSOLETE case SNIP_REGNUM: +// OBSOLETE word_offset = R_ENIP; +// OBSOLETE break; +// OBSOLETE case SFIP_REGNUM: +// OBSOLETE word_offset = R_EFIP; +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE if (regno <= FP_REGNUM) +// OBSOLETE word_offset = regno; +// OBSOLETE else +// OBSOLETE word_offset = ((regno - X0_REGNUM) * 4); +// OBSOLETE } +// OBSOLETE return (word_offset * 4); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* _ES_MP */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_m88k_nat (void) +// OBSOLETE { +// OBSOLETE #ifdef _ES_MP +// OBSOLETE /* Enable 88110 support, as we don't support the 88100 under ES/MP. */ +// OBSOLETE +// OBSOLETE target_is_m88110 = 1; +// OBSOLETE #elif defined(_CX_UX) +// OBSOLETE /* Determine whether we're running on an 88100 or an 88110. */ +// OBSOLETE target_is_m88110 = (sinfo (SYSMACHINE, 0) == SYS5800); +// OBSOLETE #endif /* _CX_UX */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef _ES_MP +// OBSOLETE /* Given a pointer to a general register set in /proc format (gregset_t *), +// OBSOLETE unpack the register contents and supply them as gdb's idea of the current +// OBSOLETE register values. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE supply_gregset (gregset_t *gregsetp) +// OBSOLETE { +// OBSOLETE register int regi; +// OBSOLETE register greg_t *regp = (greg_t *) gregsetp; +// OBSOLETE +// OBSOLETE for (regi = 0; regi < R_R31; regi++) +// OBSOLETE { +// OBSOLETE supply_register (regi, (char *) (regp + regi)); +// OBSOLETE } +// OBSOLETE supply_register (PSR_REGNUM, (char *) (regp + R_EPSR)); +// OBSOLETE supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); +// OBSOLETE supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); +// OBSOLETE supply_register (SXIP_REGNUM, (char *) (regp + R_EXIP)); +// OBSOLETE supply_register (SNIP_REGNUM, (char *) (regp + R_ENIP)); +// OBSOLETE supply_register (SFIP_REGNUM, (char *) (regp + R_EFIP)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Given a pointer to a floating point register set in /proc format +// OBSOLETE (fpregset_t *), unpack the register contents and supply them as gdb's +// OBSOLETE idea of the current floating point register values. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE supply_fpregset (fpregset_t *fpregsetp) +// OBSOLETE { +// OBSOLETE register int regi; +// OBSOLETE char *from; +// OBSOLETE +// OBSOLETE for (regi = FP0_REGNUM; regi <= FPLAST_REGNUM; regi++) +// OBSOLETE { +// OBSOLETE from = (char *) &((*fpregsetp)[regi - FP0_REGNUM]); +// OBSOLETE supply_register (regi, from); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* _ES_MP */ +// OBSOLETE +// OBSOLETE #ifdef _CX_UX +// OBSOLETE +// OBSOLETE #include <sys/regset.h> +// OBSOLETE +// OBSOLETE unsigned int +// OBSOLETE m88k_harris_core_register_addr (int regno, int reg_ptr) +// OBSOLETE { +// OBSOLETE unsigned int word_offset; +// OBSOLETE +// OBSOLETE switch (regno) +// OBSOLETE { +// OBSOLETE case PSR_REGNUM: +// OBSOLETE word_offset = R_PSR; +// OBSOLETE break; +// OBSOLETE case FPSR_REGNUM: +// OBSOLETE word_offset = R_FPSR; +// OBSOLETE break; +// OBSOLETE case FPCR_REGNUM: +// OBSOLETE word_offset = R_FPCR; +// OBSOLETE break; +// OBSOLETE case SXIP_REGNUM: +// OBSOLETE word_offset = R_XIP; +// OBSOLETE break; +// OBSOLETE case SNIP_REGNUM: +// OBSOLETE word_offset = R_NIP; +// OBSOLETE break; +// OBSOLETE case SFIP_REGNUM: +// OBSOLETE word_offset = R_FIP; +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE if (regno <= FP_REGNUM) +// OBSOLETE word_offset = regno; +// OBSOLETE else +// OBSOLETE word_offset = ((regno - X0_REGNUM) * 4) + R_X0; +// OBSOLETE } +// OBSOLETE return (word_offset * 4); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* _CX_UX */ diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 13cff43..3cbd58c 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,6 +1,11 @@ +2002-07-24 Andrew Cagney <cagney@redhat.com> + + * gdbint.texinfo: Obsolete references to m88k. + * gdb.texinfo: Ditto. + 2002-07-10 Joel Brobecker <brobecker@gnat.com> - * gdb.texinfo (Create a release candiate): Add the location + * gdbint.texinfo (Create a release candiate): Add the location where the proper version of autoconf can be retrieved. 2002-07-09 Don Howard <dhoward@redhat.com> diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index d72613b..87b15a3 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -11307,7 +11307,7 @@ configurations. * i960:: Intel i960 * M32R/D:: Mitsubishi M32R/D * M68K:: Motorola M68K -* M88K:: Motorola M88K +@c OBSOLETE * M88K:: Motorola M88K * MIPS Embedded:: MIPS Embedded * PA:: HP PA Embedded * PowerPC: PowerPC @@ -11742,16 +11742,16 @@ ROMBUG ROM monitor for OS/9000. @end table -@node M88K -@subsection M88K - -@table @code - -@kindex target bug -@item target bug @var{dev} -BUG monitor, running on a MVME187 (m88k) board. - -@end table +@c OBSOLETE @node M88K +@c OBSOLETE @subsection M88K +@c OBSOLETE +@c OBSOLETE @table @code +@c OBSOLETE +@c OBSOLETE @kindex target bug +@c OBSOLETE @item target bug @var{dev} +@c OBSOLETE BUG monitor, running on a MVME187 (m88k) board. +@c OBSOLETE +@c OBSOLETE @end table @node MIPS Embedded @subsection MIPS Embedded diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 519d65e..cd7a4eb 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -3629,9 +3629,9 @@ for parameters/results have been allocated on the stack. Define this to convert sdb register numbers into @value{GDBN} regnums. If not defined, no conversion will be done. -@item SHIFT_INST_REGS -@findex SHIFT_INST_REGS -(Only used for m88k targets.) +@c OBSOLETE @item SHIFT_INST_REGS +@c OBSOLETE @findex SHIFT_INST_REGS +@c OBSOLETE (Only used for m88k targets.) @item SKIP_PERMANENT_BREAKPOINT @findex SKIP_PERMANENT_BREAKPOINT diff --git a/gdb/elfread.c b/gdb/elfread.c index 9b0718e..7d37297 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -357,12 +357,13 @@ elf_symtab_read (struct objfile *objfile, int dynamic) || ((sym->flags & BSF_LOCAL) && sym->name[0] == '$' && sym->name[1] == 'L')) - /* Looks like a compiler-generated label. Skip it. - The assembler should be skipping these (to keep - executables small), but apparently with gcc on the - delta m88k SVR4, it loses. So to have us check too - should be harmless (but I encourage people to fix this - in the assembler instead of adding checks here). */ + /* Looks like a compiler-generated label. Skip + it. The assembler should be skipping these (to + keep executables small), but apparently with + gcc on the (OBSOLETE) delta m88k SVR4, it + loses. So to have us check too should be + harmless (but I encourage people to fix this in + the assembler instead of adding checks here). */ continue; else { diff --git a/gdb/m88k-nat.c b/gdb/m88k-nat.c index b631cda..11bde57 100644 --- a/gdb/m88k-nat.c +++ b/gdb/m88k-nat.c @@ -1,290 +1,290 @@ -/* Native-dependent Motorola 88xxx support for GDB, the GNU Debugger. - Copyright 1988, 1990, 1991, 1992, 1993, 1995, 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 "frame.h" -#include "inferior.h" -#include "regcache.h" - -#include <sys/types.h> -#include <sys/param.h> -#include <sys/dir.h> -#include <signal.h> -#include "gdbcore.h" -#include <sys/user.h> - -#ifndef USER /* added to support BCS ptrace_user */ -#define USER ptrace_user -#endif -#include <sys/ioctl.h> -#include <fcntl.h> -#include <sys/file.h> -#include "gdb_stat.h" - -#include "symtab.h" -#include "setjmp.h" -#include "value.h" - -#ifdef DELTA88 -#include <sys/ptrace.h> - -/* define offsets to the pc instruction offsets in ptrace_user struct */ -#define SXIP_OFFSET ((char *)&u.pt_sigframe.sig_sxip - (char *)&u) -#define SNIP_OFFSET ((char *)&u.pt_sigframe.sig_snip - (char *)&u) -#define SFIP_OFFSET ((char *)&u.pt_sigframe.sig_sfip - (char *)&u) -#else -/* define offsets to the pc instruction offsets in ptrace_user struct */ -#define SXIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sxip - (char *)&u) -#define SNIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_snip - (char *)&u) -#define SFIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sfip - (char *)&u) -#endif - -extern int have_symbol_file_p (); - -extern jmp_buf stack_jmp; - -extern int errno; - -void -fetch_inferior_registers (int regno) -{ - register unsigned int regaddr; - char buf[MAX_REGISTER_RAW_SIZE]; - register int i; - - struct USER u; - unsigned int offset; - - offset = (char *) &u.pt_r0 - (char *) &u; - regaddr = offset; /* byte offset to r0; */ - -/* offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ - for (regno = 0; regno < NUM_REGS; regno++) - { - /*regaddr = register_addr (regno, offset); */ - /* 88k enhancement */ - - for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) - { - *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, 0); - regaddr += sizeof (int); - } - supply_register (regno, buf); - } - /* now load up registers 36 - 38; special pc registers */ - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SXIP_OFFSET, 0); - supply_register (SXIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SNIP_OFFSET, 0); - supply_register (SNIP_REGNUM, buf); - *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SFIP_OFFSET, 0); - supply_register (SFIP_REGNUM, buf); -} - -/* Store our register values back into the inferior. - If REGNO is -1, do this for all registers. - Otherwise, REGNO specifies which register (so we can save time). */ - -void -store_inferior_registers (int regno) -{ - register unsigned int regaddr; - char buf[80]; - - struct USER u; - - unsigned int offset = (char *) &u.pt_r0 - (char *) &u; - - regaddr = offset; - - /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either - svr3 doesn't run on an 88110, or the kernel isolates the different (not - completely sure this is true, but seems to be. */ - if (regno >= 0) - { - /* regaddr = register_addr (regno, offset); */ - if (regno < PC_REGNUM) - { - regaddr = offset + regno * sizeof (int); - errno = 0; - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - else if (regno == SXIP_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno)); - else if (regno == SNIP_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno)); - else if (regno == SFIP_REGNUM) - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno)); - else - printf_unfiltered ("Bad register number for store_inferior routine\n"); - } - else - { - for (regno = 0; regno < PC_REGNUM; regno++) - { - /* regaddr = register_addr (regno, offset); */ - errno = 0; - regaddr = offset + regno * sizeof (int); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); - if (errno != 0) - { - sprintf (buf, "writing register number %d", regno); - perror_with_name (buf); - } - } - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM)); - ptrace (6, PIDGET (inferior_ptid), - (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM)); - } -} - - -/* blockend is the address of the end of the user structure */ -m88k_register_u_addr (int blockend, int regnum) -{ - struct USER u; - int ustart = blockend - sizeof (struct USER); - switch (regnum) - { - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - case 17: - case 18: - case 19: - case 20: - case 21: - case 22: - case 23: - case 24: - case 25: - case 26: - case 27: - case 28: - case 29: - case 30: - case 31: - return (ustart + ((int) &u.pt_r0 - (int) &u) + REGISTER_SIZE * regnum); - case PSR_REGNUM: - return (ustart + ((int) &u.pt_psr - (int) &u)); - case FPSR_REGNUM: - return (ustart + ((int) &u.pt_fpsr - (int) &u)); - case FPCR_REGNUM: - return (ustart + ((int) &u.pt_fpcr - (int) &u)); - case SXIP_REGNUM: - return (ustart + SXIP_OFFSET); - case SNIP_REGNUM: - return (ustart + SNIP_OFFSET); - case SFIP_REGNUM: - return (ustart + SFIP_OFFSET); - default: - if (regnum < NUM_REGS) - /* The register is one of those which is not defined... - give it zero */ - return (ustart + ((int) &u.pt_r0 - (int) &u)); - else - return (blockend + REGISTER_SIZE * regnum); - } -} - -#ifdef USE_PROC_FS - -#include <sys/procfs.h> - -/* Prototypes for supply_gregset etc. */ -#include "gregset.h" - -/* Given a pointer to a general register set in /proc format (gregset_t *), - unpack the register contents and supply them as gdb's idea of the current - register values. */ - -void -supply_gregset (gregset_t *gregsetp) -{ - register int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi <= SP_REGNUM; regi++) - supply_register (regi, (char *) (regp + regi)); - - supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); - supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); - supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); - supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); - supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); - supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); -} - -void -fill_gregset (gregset_t *gregsetp, int regno) -{ - int regi; - register greg_t *regp = (greg_t *) gregsetp; - - for (regi = 0; regi <= R_R31; regi++) - if ((regno == -1) || (regno == regi)) - *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; - - if ((regno == -1) || (regno == SXIP_REGNUM)) - *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)]; - if ((regno == -1) || (regno == SNIP_REGNUM)) - *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)]; - if ((regno == -1) || (regno == SFIP_REGNUM)) - *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)]; - if ((regno == -1) || (regno == PSR_REGNUM)) - *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)]; - if ((regno == -1) || (regno == FPSR_REGNUM)) - *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)]; - if ((regno == -1) || (regno == FPCR_REGNUM)) - *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)]; -} - -#endif /* USE_PROC_FS */ +// OBSOLETE /* Native-dependent Motorola 88xxx support for GDB, the GNU Debugger. +// OBSOLETE Copyright 1988, 1990, 1991, 1992, 1993, 1995, 1999, 2000, 2001 +// OBSOLETE Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "frame.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE #include <sys/types.h> +// OBSOLETE #include <sys/param.h> +// OBSOLETE #include <sys/dir.h> +// OBSOLETE #include <signal.h> +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include <sys/user.h> +// OBSOLETE +// OBSOLETE #ifndef USER /* added to support BCS ptrace_user */ +// OBSOLETE #define USER ptrace_user +// OBSOLETE #endif +// OBSOLETE #include <sys/ioctl.h> +// OBSOLETE #include <fcntl.h> +// OBSOLETE #include <sys/file.h> +// OBSOLETE #include "gdb_stat.h" +// OBSOLETE +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "setjmp.h" +// OBSOLETE #include "value.h" +// OBSOLETE +// OBSOLETE #ifdef DELTA88 +// OBSOLETE #include <sys/ptrace.h> +// OBSOLETE +// OBSOLETE /* define offsets to the pc instruction offsets in ptrace_user struct */ +// OBSOLETE #define SXIP_OFFSET ((char *)&u.pt_sigframe.sig_sxip - (char *)&u) +// OBSOLETE #define SNIP_OFFSET ((char *)&u.pt_sigframe.sig_snip - (char *)&u) +// OBSOLETE #define SFIP_OFFSET ((char *)&u.pt_sigframe.sig_sfip - (char *)&u) +// OBSOLETE #else +// OBSOLETE /* define offsets to the pc instruction offsets in ptrace_user struct */ +// OBSOLETE #define SXIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sxip - (char *)&u) +// OBSOLETE #define SNIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_snip - (char *)&u) +// OBSOLETE #define SFIP_OFFSET ((char *)&u.pt_sigframe.dg_sigframe.sc_sfip - (char *)&u) +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE extern int have_symbol_file_p (); +// OBSOLETE +// OBSOLETE extern jmp_buf stack_jmp; +// OBSOLETE +// OBSOLETE extern int errno; +// OBSOLETE +// OBSOLETE void +// OBSOLETE fetch_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE register unsigned int regaddr; +// OBSOLETE char buf[MAX_REGISTER_RAW_SIZE]; +// OBSOLETE register int i; +// OBSOLETE +// OBSOLETE struct USER u; +// OBSOLETE unsigned int offset; +// OBSOLETE +// OBSOLETE offset = (char *) &u.pt_r0 - (char *) &u; +// OBSOLETE regaddr = offset; /* byte offset to r0; */ +// OBSOLETE +// OBSOLETE /* offset = ptrace (3, PIDGET (inferior_ptid), (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */ +// OBSOLETE for (regno = 0; regno < NUM_REGS; regno++) +// OBSOLETE { +// OBSOLETE /*regaddr = register_addr (regno, offset); */ +// OBSOLETE /* 88k enhancement */ +// OBSOLETE +// OBSOLETE for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int)) +// OBSOLETE { +// OBSOLETE *(int *) &buf[i] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, 0); +// OBSOLETE regaddr += sizeof (int); +// OBSOLETE } +// OBSOLETE supply_register (regno, buf); +// OBSOLETE } +// OBSOLETE /* now load up registers 36 - 38; special pc registers */ +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SXIP_OFFSET, 0); +// OBSOLETE supply_register (SXIP_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SNIP_OFFSET, 0); +// OBSOLETE supply_register (SNIP_REGNUM, buf); +// OBSOLETE *(int *) &buf[0] = ptrace (3, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SFIP_OFFSET, 0); +// OBSOLETE supply_register (SFIP_REGNUM, buf); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store our register values back into the inferior. +// OBSOLETE If REGNO is -1, do this for all registers. +// OBSOLETE Otherwise, REGNO specifies which register (so we can save time). */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE store_inferior_registers (int regno) +// OBSOLETE { +// OBSOLETE register unsigned int regaddr; +// OBSOLETE char buf[80]; +// OBSOLETE +// OBSOLETE struct USER u; +// OBSOLETE +// OBSOLETE unsigned int offset = (char *) &u.pt_r0 - (char *) &u; +// OBSOLETE +// OBSOLETE regaddr = offset; +// OBSOLETE +// OBSOLETE /* Don't try to deal with EXIP_REGNUM or ENIP_REGNUM, because I think either +// OBSOLETE svr3 doesn't run on an 88110, or the kernel isolates the different (not +// OBSOLETE completely sure this is true, but seems to be. */ +// OBSOLETE if (regno >= 0) +// OBSOLETE { +// OBSOLETE /* regaddr = register_addr (regno, offset); */ +// OBSOLETE if (regno < PC_REGNUM) +// OBSOLETE { +// OBSOLETE regaddr = offset + regno * sizeof (int); +// OBSOLETE errno = 0; +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); +// OBSOLETE if (errno != 0) +// OBSOLETE { +// OBSOLETE sprintf (buf, "writing register number %d", regno); +// OBSOLETE perror_with_name (buf); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else if (regno == SXIP_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == SNIP_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (regno)); +// OBSOLETE else if (regno == SFIP_REGNUM) +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (regno)); +// OBSOLETE else +// OBSOLETE printf_unfiltered ("Bad register number for store_inferior routine\n"); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE for (regno = 0; regno < PC_REGNUM; regno++) +// OBSOLETE { +// OBSOLETE /* regaddr = register_addr (regno, offset); */ +// OBSOLETE errno = 0; +// OBSOLETE regaddr = offset + regno * sizeof (int); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) regaddr, read_register (regno)); +// OBSOLETE if (errno != 0) +// OBSOLETE { +// OBSOLETE sprintf (buf, "writing register number %d", regno); +// OBSOLETE perror_with_name (buf); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register (SXIP_REGNUM)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register (SNIP_REGNUM)); +// OBSOLETE ptrace (6, PIDGET (inferior_ptid), +// OBSOLETE (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register (SFIP_REGNUM)); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* blockend is the address of the end of the user structure */ +// OBSOLETE m88k_register_u_addr (int blockend, int regnum) +// OBSOLETE { +// OBSOLETE struct USER u; +// OBSOLETE int ustart = blockend - sizeof (struct USER); +// OBSOLETE switch (regnum) +// OBSOLETE { +// OBSOLETE case 0: +// OBSOLETE case 1: +// OBSOLETE case 2: +// OBSOLETE case 3: +// OBSOLETE case 4: +// OBSOLETE case 5: +// OBSOLETE case 6: +// OBSOLETE case 7: +// OBSOLETE case 8: +// OBSOLETE case 9: +// OBSOLETE case 10: +// OBSOLETE case 11: +// OBSOLETE case 12: +// OBSOLETE case 13: +// OBSOLETE case 14: +// OBSOLETE case 15: +// OBSOLETE case 16: +// OBSOLETE case 17: +// OBSOLETE case 18: +// OBSOLETE case 19: +// OBSOLETE case 20: +// OBSOLETE case 21: +// OBSOLETE case 22: +// OBSOLETE case 23: +// OBSOLETE case 24: +// OBSOLETE case 25: +// OBSOLETE case 26: +// OBSOLETE case 27: +// OBSOLETE case 28: +// OBSOLETE case 29: +// OBSOLETE case 30: +// OBSOLETE case 31: +// OBSOLETE return (ustart + ((int) &u.pt_r0 - (int) &u) + REGISTER_SIZE * regnum); +// OBSOLETE case PSR_REGNUM: +// OBSOLETE return (ustart + ((int) &u.pt_psr - (int) &u)); +// OBSOLETE case FPSR_REGNUM: +// OBSOLETE return (ustart + ((int) &u.pt_fpsr - (int) &u)); +// OBSOLETE case FPCR_REGNUM: +// OBSOLETE return (ustart + ((int) &u.pt_fpcr - (int) &u)); +// OBSOLETE case SXIP_REGNUM: +// OBSOLETE return (ustart + SXIP_OFFSET); +// OBSOLETE case SNIP_REGNUM: +// OBSOLETE return (ustart + SNIP_OFFSET); +// OBSOLETE case SFIP_REGNUM: +// OBSOLETE return (ustart + SFIP_OFFSET); +// OBSOLETE default: +// OBSOLETE if (regnum < NUM_REGS) +// OBSOLETE /* The register is one of those which is not defined... +// OBSOLETE give it zero */ +// OBSOLETE return (ustart + ((int) &u.pt_r0 - (int) &u)); +// OBSOLETE else +// OBSOLETE return (blockend + REGISTER_SIZE * regnum); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE #ifdef USE_PROC_FS +// OBSOLETE +// OBSOLETE #include <sys/procfs.h> +// OBSOLETE +// OBSOLETE /* Prototypes for supply_gregset etc. */ +// OBSOLETE #include "gregset.h" +// OBSOLETE +// OBSOLETE /* Given a pointer to a general register set in /proc format (gregset_t *), +// OBSOLETE unpack the register contents and supply them as gdb's idea of the current +// OBSOLETE register values. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE supply_gregset (gregset_t *gregsetp) +// OBSOLETE { +// OBSOLETE register int regi; +// OBSOLETE register greg_t *regp = (greg_t *) gregsetp; +// OBSOLETE +// OBSOLETE for (regi = 0; regi <= SP_REGNUM; regi++) +// OBSOLETE supply_register (regi, (char *) (regp + regi)); +// OBSOLETE +// OBSOLETE supply_register (SXIP_REGNUM, (char *) (regp + R_XIP)); +// OBSOLETE supply_register (SNIP_REGNUM, (char *) (regp + R_NIP)); +// OBSOLETE supply_register (SFIP_REGNUM, (char *) (regp + R_FIP)); +// OBSOLETE supply_register (PSR_REGNUM, (char *) (regp + R_PSR)); +// OBSOLETE supply_register (FPSR_REGNUM, (char *) (regp + R_FPSR)); +// OBSOLETE supply_register (FPCR_REGNUM, (char *) (regp + R_FPCR)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE fill_gregset (gregset_t *gregsetp, int regno) +// OBSOLETE { +// OBSOLETE int regi; +// OBSOLETE register greg_t *regp = (greg_t *) gregsetp; +// OBSOLETE +// OBSOLETE for (regi = 0; regi <= R_R31; regi++) +// OBSOLETE if ((regno == -1) || (regno == regi)) +// OBSOLETE *(regp + regi) = *(int *) ®isters[REGISTER_BYTE (regi)]; +// OBSOLETE +// OBSOLETE if ((regno == -1) || (regno == SXIP_REGNUM)) +// OBSOLETE *(regp + R_XIP) = *(int *) ®isters[REGISTER_BYTE (SXIP_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == SNIP_REGNUM)) +// OBSOLETE *(regp + R_NIP) = *(int *) ®isters[REGISTER_BYTE (SNIP_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == SFIP_REGNUM)) +// OBSOLETE *(regp + R_FIP) = *(int *) ®isters[REGISTER_BYTE (SFIP_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == PSR_REGNUM)) +// OBSOLETE *(regp + R_PSR) = *(int *) ®isters[REGISTER_BYTE (PSR_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == FPSR_REGNUM)) +// OBSOLETE *(regp + R_FPSR) = *(int *) ®isters[REGISTER_BYTE (FPSR_REGNUM)]; +// OBSOLETE if ((regno == -1) || (regno == FPCR_REGNUM)) +// OBSOLETE *(regp + R_FPCR) = *(int *) ®isters[REGISTER_BYTE (FPCR_REGNUM)]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #endif /* USE_PROC_FS */ diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index 3c96d37..da0b67c 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -1,661 +1,661 @@ -/* Target-machine dependent code for Motorola 88000 series, for GDB. - - Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, - 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. */ - -#include "defs.h" -#include "frame.h" -#include "inferior.h" -#include "value.h" -#include "gdbcore.h" -#include "symtab.h" -#include "setjmp.h" -#include "value.h" -#include "regcache.h" - -/* Size of an instruction */ -#define BYTES_PER_88K_INSN 4 - -void frame_find_saved_regs (); - -/* Is this target an m88110? Otherwise assume m88100. This has - relevance for the ways in which we screw with instruction pointers. */ - -int target_is_m88110 = 0; - -void -m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid) -{ - /* According to the MC88100 RISC Microprocessor User's Manual, - section 6.4.3.1.2: - - ... can be made to return to a particular instruction by placing - a valid instruction address in the SNIP and the next sequential - instruction address in the SFIP (with V bits set and E bits - clear). The rte resumes execution at the instruction pointed to - by the SNIP, then the SFIP. - - The E bit is the least significant bit (bit 0). The V (valid) - bit is bit 1. This is why we logical or 2 into the values we are - writing below. It turns out that SXIP plays no role when - returning from an exception so nothing special has to be done - with it. We could even (presumably) give it a totally bogus - value. - - -- Kevin Buettner */ - - write_register_pid (SXIP_REGNUM, pc, ptid); - write_register_pid (SNIP_REGNUM, (pc | 2), ptid); - write_register_pid (SFIP_REGNUM, (pc | 2) + 4, ptid); -} - -/* The type of a register. */ -struct type * -m88k_register_type (int regnum) -{ - if (regnum >= XFP_REGNUM) - return builtin_type_m88110_ext; - else if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) - return builtin_type_void_func_ptr; - else - return builtin_type_int32; -} - - -/* The m88k kernel aligns all instructions on 4-byte boundaries. The - kernel also uses the least significant two bits for its own hocus - pocus. When gdb receives an address from the kernel, it needs to - preserve those right-most two bits, but gdb also needs to be careful - to realize that those two bits are not really a part of the address - of an instruction. Shrug. */ - -CORE_ADDR -m88k_addr_bits_remove (CORE_ADDR addr) -{ - return ((addr) & ~3); -} - - -/* Given a GDB frame, determine the address of the calling function's frame. - This will be used to create a new GDB frame struct, and then - INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. - - For us, the frame address is its stack pointer value, so we look up - the function prologue to determine the caller's sp value, and return it. */ - -CORE_ADDR -frame_chain (struct frame_info *thisframe) -{ - - frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0); - /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not - the ADDRESS, of SP_REGNUM. It also depends on the cache of - frame_find_saved_regs results. */ - if (thisframe->fsr->regs[SP_REGNUM]) - return thisframe->fsr->regs[SP_REGNUM]; - else - return thisframe->frame; /* Leaf fn -- next frame up has same SP. */ -} - -int -frameless_function_invocation (struct frame_info *frame) -{ - - frame_find_saved_regs (frame, (struct frame_saved_regs *) 0); - /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not - the ADDRESS, of SP_REGNUM. It also depends on the cache of - frame_find_saved_regs results. */ - if (frame->fsr->regs[SP_REGNUM]) - return 0; /* Frameful -- return addr saved somewhere */ - else - return 1; /* Frameless -- no saved return address */ -} - -void -init_extra_frame_info (int fromleaf, struct frame_info *frame) -{ - frame->fsr = 0; /* Not yet allocated */ - frame->args_pointer = 0; /* Unknown */ - frame->locals_pointer = 0; /* Unknown */ -} - -/* Examine an m88k function prologue, recording the addresses at which - registers are saved explicitly by the prologue code, and returning - the address of the first instruction after the prologue (but not - after the instruction at address LIMIT, as explained below). - - LIMIT places an upper bound on addresses of the instructions to be - examined. If the prologue code scan reaches LIMIT, the scan is - aborted and LIMIT is returned. This is used, when examining the - prologue for the current frame, to keep examine_prologue () from - claiming that a given register has been saved when in fact the - instruction that saves it has not yet been executed. LIMIT is used - at other times to stop the scan when we hit code after the true - function prologue (e.g. for the first source line) which might - otherwise be mistaken for function prologue. - - The format of the function prologue matched by this routine is - derived from examination of the source to gcc 1.95, particularly - the routine output_prologue () in config/out-m88k.c. - - subu r31,r31,n # stack pointer update - - (st rn,r31,offset)? # save incoming regs - (st.d rn,r31,offset)? - - (addu r30,r31,n)? # frame pointer update - - (pic sequence)? # PIC code prologue - - (or rn,rm,0)? # Move parameters to other regs - */ - -/* Macros for extracting fields from instructions. */ - -#define BITMASK(pos, width) (((0x1 << (width)) - 1) << (pos)) -#define EXTRACT_FIELD(val, pos, width) ((val) >> (pos) & BITMASK (0, width)) -#define SUBU_OFFSET(x) ((unsigned)(x & 0xFFFF)) -#define ST_OFFSET(x) ((unsigned)((x) & 0xFFFF)) -#define ST_SRC(x) EXTRACT_FIELD ((x), 21, 5) -#define ADDU_OFFSET(x) ((unsigned)(x & 0xFFFF)) - -/* - * prologue_insn_tbl is a table of instructions which may comprise a - * function prologue. Associated with each table entry (corresponding - * to a single instruction or group of instructions), is an action. - * This action is used by examine_prologue (below) to determine - * the state of certain machine registers and where the stack frame lives. - */ - -enum prologue_insn_action -{ - PIA_SKIP, /* don't care what the instruction does */ - PIA_NOTE_ST, /* note register stored and where */ - PIA_NOTE_STD, /* note pair of registers stored and where */ - PIA_NOTE_SP_ADJUSTMENT, /* note stack pointer adjustment */ - PIA_NOTE_FP_ASSIGNMENT, /* note frame pointer assignment */ - PIA_NOTE_PROLOGUE_END, /* no more prologue */ -}; - -struct prologue_insns - { - unsigned long insn; - unsigned long mask; - enum prologue_insn_action action; - }; - -struct prologue_insns prologue_insn_tbl[] = -{ - /* Various register move instructions */ - {0x58000000, 0xf800ffff, PIA_SKIP}, /* or/or.u with immed of 0 */ - {0xf4005800, 0xfc1fffe0, PIA_SKIP}, /* or rd, r0, rs */ - {0xf4005800, 0xfc00ffff, PIA_SKIP}, /* or rd, rs, r0 */ - - /* Stack pointer setup: "subu sp, sp, n" where n is a multiple of 8 */ - {0x67ff0000, 0xffff0007, PIA_NOTE_SP_ADJUSTMENT}, - - /* Frame pointer assignment: "addu r30, r31, n" */ - {0x63df0000, 0xffff0000, PIA_NOTE_FP_ASSIGNMENT}, - - /* Store to stack instructions; either "st rx, sp, n" or "st.d rx, sp, n" */ - {0x241f0000, 0xfc1f0000, PIA_NOTE_ST}, /* st rx, sp, n */ - {0x201f0000, 0xfc1f0000, PIA_NOTE_STD}, /* st.d rs, sp, n */ - - /* Instructions needed for setting up r25 for pic code. */ - {0x5f200000, 0xffff0000, PIA_SKIP}, /* or.u r25, r0, offset_high */ - {0xcc000002, 0xffffffff, PIA_SKIP}, /* bsr.n Lab */ - {0x5b390000, 0xffff0000, PIA_SKIP}, /* or r25, r25, offset_low */ - {0xf7396001, 0xffffffff, PIA_SKIP}, /* Lab: addu r25, r25, r1 */ - - /* Various branch or jump instructions which have a delay slot -- these - do not form part of the prologue, but the instruction in the delay - slot might be a store instruction which should be noted. */ - {0xc4000000, 0xe4000000, PIA_NOTE_PROLOGUE_END}, - /* br.n, bsr.n, bb0.n, or bb1.n */ - {0xec000000, 0xfc000000, PIA_NOTE_PROLOGUE_END}, /* bcnd.n */ - {0xf400c400, 0xfffff7e0, PIA_NOTE_PROLOGUE_END} /* jmp.n or jsr.n */ - -}; - - -/* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or - is not the address of a valid instruction, the address of the next - instruction beyond ADDR otherwise. *PWORD1 receives the first word - of the instruction. */ - -#define NEXT_PROLOGUE_INSN(addr, lim, pword1) \ - (((addr) < (lim)) ? next_insn (addr, pword1) : 0) - -/* Read the m88k instruction at 'memaddr' and return the address of - the next instruction after that, or 0 if 'memaddr' is not the - address of a valid instruction. The instruction - is stored at 'pword1'. */ - -CORE_ADDR -next_insn (CORE_ADDR memaddr, unsigned long *pword1) -{ - *pword1 = read_memory_integer (memaddr, BYTES_PER_88K_INSN); - return memaddr + BYTES_PER_88K_INSN; -} - -/* Read a register from frames called by us (or from the hardware regs). */ - -static int -read_next_frame_reg (struct frame_info *frame, int regno) -{ - for (; frame; frame = frame->next) - { - if (regno == SP_REGNUM) - return FRAME_FP (frame); - else if (frame->fsr->regs[regno]) - return read_memory_integer (frame->fsr->regs[regno], 4); - } - return read_register (regno); -} - -/* Examine the prologue of a function. `ip' points to the first instruction. - `limit' is the limit of the prologue (e.g. the addr of the first - linenumber, or perhaps the program counter if we're stepping through). - `frame_sp' is the stack pointer value in use in this frame. - `fsr' is a pointer to a frame_saved_regs structure into which we put - info about the registers saved by this frame. - `fi' is a struct frame_info pointer; we fill in various fields in it - to reflect the offsets of the arg pointer and the locals pointer. */ - -static CORE_ADDR -examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, - CORE_ADDR frame_sp, struct frame_saved_regs *fsr, - struct frame_info *fi) -{ - register CORE_ADDR next_ip; - register int src; - unsigned long insn; - int size, offset; - char must_adjust[32]; /* If set, must adjust offsets in fsr */ - int sp_offset = -1; /* -1 means not set (valid must be mult of 8) */ - int fp_offset = -1; /* -1 means not set */ - CORE_ADDR frame_fp; - CORE_ADDR prologue_end = 0; - - memset (must_adjust, '\0', sizeof (must_adjust)); - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn); - - while (next_ip) - { - struct prologue_insns *pip; - - for (pip = prologue_insn_tbl; (insn & pip->mask) != pip->insn;) - if (++pip >= prologue_insn_tbl + sizeof prologue_insn_tbl) - goto end_of_prologue_found; /* not a prologue insn */ - - switch (pip->action) - { - case PIA_NOTE_ST: - case PIA_NOTE_STD: - if (sp_offset != -1) - { - src = ST_SRC (insn); - offset = ST_OFFSET (insn); - must_adjust[src] = 1; - fsr->regs[src++] = offset; /* Will be adjusted later */ - if (pip->action == PIA_NOTE_STD && src < 32) - { - offset += 4; - must_adjust[src] = 1; - fsr->regs[src++] = offset; - } - } - else - goto end_of_prologue_found; - break; - case PIA_NOTE_SP_ADJUSTMENT: - if (sp_offset == -1) - sp_offset = -SUBU_OFFSET (insn); - else - goto end_of_prologue_found; - break; - case PIA_NOTE_FP_ASSIGNMENT: - if (fp_offset == -1) - fp_offset = ADDU_OFFSET (insn); - else - goto end_of_prologue_found; - break; - case PIA_NOTE_PROLOGUE_END: - if (!prologue_end) - prologue_end = ip; - break; - case PIA_SKIP: - default: - /* Do nothing */ - break; - } - - ip = next_ip; - next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn); - } - -end_of_prologue_found: - - if (prologue_end) - ip = prologue_end; - - /* We're done with the prologue. If we don't care about the stack - frame itself, just return. (Note that fsr->regs has been trashed, - but the one caller who calls with fi==0 passes a dummy there.) */ - - if (fi == 0) - return ip; - - /* - OK, now we have: - - sp_offset original (before any alloca calls) displacement of SP - (will be negative). - - fp_offset displacement from original SP to the FP for this frame - or -1. - - fsr->regs[0..31] displacement from original SP to the stack - location where reg[0..31] is stored. - - must_adjust[0..31] set if corresponding offset was set. - - If alloca has been called between the function prologue and the current - IP, then the current SP (frame_sp) will not be the original SP as set by - the function prologue. If the current SP is not the original SP, then the - compiler will have allocated an FP for this frame, fp_offset will be set, - and we can use it to calculate the original SP. - - Then, we figure out where the arguments and locals are, and relocate the - offsets in fsr->regs to absolute addresses. */ - - if (fp_offset != -1) - { - /* We have a frame pointer, so get it, and base our calc's on it. */ - frame_fp = (CORE_ADDR) read_next_frame_reg (fi->next, ACTUAL_FP_REGNUM); - frame_sp = frame_fp - fp_offset; - } - else - { - /* We have no frame pointer, therefore frame_sp is still the same value - as set by prologue. But where is the frame itself? */ - if (must_adjust[SRP_REGNUM]) - { - /* Function header saved SRP (r1), the return address. Frame starts - 4 bytes down from where it was saved. */ - frame_fp = frame_sp + fsr->regs[SRP_REGNUM] - 4; - fi->locals_pointer = frame_fp; - } - else - { - /* Function header didn't save SRP (r1), so we are in a leaf fn or - are otherwise confused. */ - frame_fp = -1; - } - } - - /* The locals are relative to the FP (whether it exists as an allocated - register, or just as an assumed offset from the SP) */ - fi->locals_pointer = frame_fp; - - /* The arguments are just above the SP as it was before we adjusted it - on entry. */ - fi->args_pointer = frame_sp - sp_offset; - - /* Now that we know the SP value used by the prologue, we know where - it saved all the registers. */ - for (src = 0; src < 32; src++) - if (must_adjust[src]) - fsr->regs[src] += frame_sp; - - /* The saved value of the SP is always known. */ - /* (we hope...) */ - if (fsr->regs[SP_REGNUM] != 0 - && fsr->regs[SP_REGNUM] != frame_sp - sp_offset) - fprintf_unfiltered (gdb_stderr, "Bad saved SP value %lx != %lx, offset %x!\n", - fsr->regs[SP_REGNUM], - frame_sp - sp_offset, sp_offset); - - fsr->regs[SP_REGNUM] = frame_sp - sp_offset; - - return (ip); -} - -/* Given an ip value corresponding to the start of a function, - return the ip of the first instruction after the function - prologue. */ - -CORE_ADDR -m88k_skip_prologue (CORE_ADDR ip) -{ - struct frame_saved_regs saved_regs_dummy; - struct symtab_and_line sal; - CORE_ADDR limit; - - sal = find_pc_line (ip, 0); - limit = (sal.end) ? sal.end : 0xffffffff; - - return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy, - (struct frame_info *) 0)); -} - -/* Put here the code to store, into a struct frame_saved_regs, - 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. - - We cache the result of doing this in the frame_obstack, since it is - fairly expensive. */ - -void -frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr) -{ - register struct frame_saved_regs *cache_fsr; - CORE_ADDR ip; - struct symtab_and_line sal; - CORE_ADDR limit; - - if (!fi->fsr) - { - cache_fsr = (struct frame_saved_regs *) - frame_obstack_alloc (sizeof (struct frame_saved_regs)); - memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); - fi->fsr = cache_fsr; - - /* Find the start and end of the function prologue. If the PC - is in the function prologue, we only consider the part that - has executed already. In the case where the PC is not in - the function prologue, we set limit to two instructions beyond - where the prologue ends in case if any of the prologue instructions - were moved into a delay slot of a branch instruction. */ - - ip = get_pc_function_start (fi->pc); - sal = find_pc_line (ip, 0); - limit = (sal.end && sal.end < fi->pc) ? sal.end + 2 * BYTES_PER_88K_INSN - : fi->pc; - - /* This will fill in fields in *fi as well as in cache_fsr. */ -#ifdef SIGTRAMP_FRAME_FIXUP - if (fi->signal_handler_caller) - SIGTRAMP_FRAME_FIXUP (fi->frame); -#endif - examine_prologue (ip, limit, fi->frame, cache_fsr, fi); -#ifdef SIGTRAMP_SP_FIXUP - if (fi->signal_handler_caller && fi->fsr->regs[SP_REGNUM]) - SIGTRAMP_SP_FIXUP (fi->fsr->regs[SP_REGNUM]); -#endif - } - - if (fsr) - *fsr = *fi->fsr; -} - -/* Return the address of the locals block for the frame - described by FI. Returns 0 if the address is unknown. - NOTE! Frame locals are referred to by negative offsets from the - argument pointer, so this is the same as frame_args_address(). */ - -CORE_ADDR -frame_locals_address (struct frame_info *fi) -{ - struct frame_saved_regs fsr; - - if (fi->args_pointer) /* Cached value is likely there. */ - return fi->args_pointer; - - /* Nope, generate it. */ - - get_frame_saved_regs (fi, &fsr); - - return fi->args_pointer; -} - -/* Return the address of the argument block for the frame - described by FI. Returns 0 if the address is unknown. */ - -CORE_ADDR -frame_args_address (struct frame_info *fi) -{ - struct frame_saved_regs fsr; - - if (fi->args_pointer) /* Cached value is likely there. */ - return fi->args_pointer; - - /* Nope, generate it. */ - - get_frame_saved_regs (fi, &fsr); - - return fi->args_pointer; -} - -/* Return the saved PC from this frame. - - If the frame has a memory copy of SRP_REGNUM, use that. If not, - just use the register SRP_REGNUM itself. */ - -CORE_ADDR -frame_saved_pc (struct frame_info *frame) -{ - return read_next_frame_reg (frame, SRP_REGNUM); -} - - -#define DUMMY_FRAME_SIZE 192 - -static void -write_word (CORE_ADDR sp, ULONGEST word) -{ - register int len = REGISTER_SIZE; - char buffer[MAX_REGISTER_RAW_SIZE]; - - store_unsigned_integer (buffer, len, word); - write_memory (sp, buffer, len); -} - -void -m88k_push_dummy_frame (void) -{ - register CORE_ADDR sp = read_register (SP_REGNUM); - register int rn; - int offset; - - sp -= DUMMY_FRAME_SIZE; /* allocate a bunch of space */ - - for (rn = 0, offset = 0; rn <= SP_REGNUM; rn++, offset += 4) - write_word (sp + offset, read_register (rn)); - - write_word (sp + offset, read_register (SXIP_REGNUM)); - offset += 4; - - write_word (sp + offset, read_register (SNIP_REGNUM)); - offset += 4; - - write_word (sp + offset, read_register (SFIP_REGNUM)); - offset += 4; - - write_word (sp + offset, read_register (PSR_REGNUM)); - offset += 4; - - write_word (sp + offset, read_register (FPSR_REGNUM)); - offset += 4; - - write_word (sp + offset, read_register (FPCR_REGNUM)); - offset += 4; - - write_register (SP_REGNUM, sp); - write_register (ACTUAL_FP_REGNUM, sp); -} - -void -pop_frame (void) -{ - register struct frame_info *frame = get_current_frame (); - register int regnum; - struct frame_saved_regs fsr; - - get_frame_saved_regs (frame, &fsr); - - if (PC_IN_CALL_DUMMY (read_pc (), read_register (SP_REGNUM), frame->frame)) - { - /* FIXME: I think get_frame_saved_regs should be handling this so - that we can deal with the saved registers properly (e.g. frame - 1 is a call dummy, the user types "frame 2" and then "print $ps"). */ - register CORE_ADDR sp = read_register (ACTUAL_FP_REGNUM); - int offset; - - for (regnum = 0, offset = 0; regnum <= SP_REGNUM; regnum++, offset += 4) - (void) write_register (regnum, read_memory_integer (sp + offset, 4)); - - write_register (SXIP_REGNUM, read_memory_integer (sp + offset, 4)); - offset += 4; - - write_register (SNIP_REGNUM, read_memory_integer (sp + offset, 4)); - offset += 4; - - write_register (SFIP_REGNUM, read_memory_integer (sp + offset, 4)); - offset += 4; - - write_register (PSR_REGNUM, read_memory_integer (sp + offset, 4)); - offset += 4; - - write_register (FPSR_REGNUM, read_memory_integer (sp + offset, 4)); - offset += 4; - - write_register (FPCR_REGNUM, read_memory_integer (sp + offset, 4)); - offset += 4; - - } - else - { - for (regnum = FP_REGNUM; regnum > 0; regnum--) - if (fsr.regs[regnum]) - write_register (regnum, - read_memory_integer (fsr.regs[regnum], 4)); - write_pc (frame_saved_pc (frame)); - } - reinit_frame_cache (); -} - -void -_initialize_m88k_tdep (void) -{ - tm_print_insn = print_insn_m88k; -} +// OBSOLETE /* Target-machine dependent code for Motorola 88000 series, for GDB. +// OBSOLETE +// OBSOLETE Copyright 1988, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, +// OBSOLETE 2000, 2001, 2002 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "frame.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "value.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include "symtab.h" +// OBSOLETE #include "setjmp.h" +// OBSOLETE #include "value.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE +// OBSOLETE /* Size of an instruction */ +// OBSOLETE #define BYTES_PER_88K_INSN 4 +// OBSOLETE +// OBSOLETE void frame_find_saved_regs (); +// OBSOLETE +// OBSOLETE /* Is this target an m88110? Otherwise assume m88100. This has +// OBSOLETE relevance for the ways in which we screw with instruction pointers. */ +// OBSOLETE +// OBSOLETE int target_is_m88110 = 0; +// OBSOLETE +// OBSOLETE void +// OBSOLETE m88k_target_write_pc (CORE_ADDR pc, ptid_t ptid) +// OBSOLETE { +// OBSOLETE /* According to the MC88100 RISC Microprocessor User's Manual, +// OBSOLETE section 6.4.3.1.2: +// OBSOLETE +// OBSOLETE ... can be made to return to a particular instruction by placing +// OBSOLETE a valid instruction address in the SNIP and the next sequential +// OBSOLETE instruction address in the SFIP (with V bits set and E bits +// OBSOLETE clear). The rte resumes execution at the instruction pointed to +// OBSOLETE by the SNIP, then the SFIP. +// OBSOLETE +// OBSOLETE The E bit is the least significant bit (bit 0). The V (valid) +// OBSOLETE bit is bit 1. This is why we logical or 2 into the values we are +// OBSOLETE writing below. It turns out that SXIP plays no role when +// OBSOLETE returning from an exception so nothing special has to be done +// OBSOLETE with it. We could even (presumably) give it a totally bogus +// OBSOLETE value. +// OBSOLETE +// OBSOLETE -- Kevin Buettner */ +// OBSOLETE +// OBSOLETE write_register_pid (SXIP_REGNUM, pc, ptid); +// OBSOLETE write_register_pid (SNIP_REGNUM, (pc | 2), ptid); +// OBSOLETE write_register_pid (SFIP_REGNUM, (pc | 2) + 4, ptid); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* The type of a register. */ +// OBSOLETE struct type * +// OBSOLETE m88k_register_type (int regnum) +// OBSOLETE { +// OBSOLETE if (regnum >= XFP_REGNUM) +// OBSOLETE return builtin_type_m88110_ext; +// OBSOLETE else if (regnum == PC_REGNUM || regnum == FP_REGNUM || regnum == SP_REGNUM) +// OBSOLETE return builtin_type_void_func_ptr; +// OBSOLETE else +// OBSOLETE return builtin_type_int32; +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* The m88k kernel aligns all instructions on 4-byte boundaries. The +// OBSOLETE kernel also uses the least significant two bits for its own hocus +// OBSOLETE pocus. When gdb receives an address from the kernel, it needs to +// OBSOLETE preserve those right-most two bits, but gdb also needs to be careful +// OBSOLETE to realize that those two bits are not really a part of the address +// OBSOLETE of an instruction. Shrug. */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE m88k_addr_bits_remove (CORE_ADDR addr) +// OBSOLETE { +// OBSOLETE return ((addr) & ~3); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Given a GDB frame, determine the address of the calling function's frame. +// OBSOLETE This will be used to create a new GDB frame struct, and then +// OBSOLETE INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame. +// OBSOLETE +// OBSOLETE For us, the frame address is its stack pointer value, so we look up +// OBSOLETE the function prologue to determine the caller's sp value, and return it. */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE frame_chain (struct frame_info *thisframe) +// OBSOLETE { +// OBSOLETE +// OBSOLETE frame_find_saved_regs (thisframe, (struct frame_saved_regs *) 0); +// OBSOLETE /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not +// OBSOLETE the ADDRESS, of SP_REGNUM. It also depends on the cache of +// OBSOLETE frame_find_saved_regs results. */ +// OBSOLETE if (thisframe->fsr->regs[SP_REGNUM]) +// OBSOLETE return thisframe->fsr->regs[SP_REGNUM]; +// OBSOLETE else +// OBSOLETE return thisframe->frame; /* Leaf fn -- next frame up has same SP. */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE int +// OBSOLETE frameless_function_invocation (struct frame_info *frame) +// OBSOLETE { +// OBSOLETE +// OBSOLETE frame_find_saved_regs (frame, (struct frame_saved_regs *) 0); +// OBSOLETE /* NOTE: this depends on frame_find_saved_regs returning the VALUE, not +// OBSOLETE the ADDRESS, of SP_REGNUM. It also depends on the cache of +// OBSOLETE frame_find_saved_regs results. */ +// OBSOLETE if (frame->fsr->regs[SP_REGNUM]) +// OBSOLETE return 0; /* Frameful -- return addr saved somewhere */ +// OBSOLETE else +// OBSOLETE return 1; /* Frameless -- no saved return address */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE init_extra_frame_info (int fromleaf, struct frame_info *frame) +// OBSOLETE { +// OBSOLETE frame->fsr = 0; /* Not yet allocated */ +// OBSOLETE frame->args_pointer = 0; /* Unknown */ +// OBSOLETE frame->locals_pointer = 0; /* Unknown */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Examine an m88k function prologue, recording the addresses at which +// OBSOLETE registers are saved explicitly by the prologue code, and returning +// OBSOLETE the address of the first instruction after the prologue (but not +// OBSOLETE after the instruction at address LIMIT, as explained below). +// OBSOLETE +// OBSOLETE LIMIT places an upper bound on addresses of the instructions to be +// OBSOLETE examined. If the prologue code scan reaches LIMIT, the scan is +// OBSOLETE aborted and LIMIT is returned. This is used, when examining the +// OBSOLETE prologue for the current frame, to keep examine_prologue () from +// OBSOLETE claiming that a given register has been saved when in fact the +// OBSOLETE instruction that saves it has not yet been executed. LIMIT is used +// OBSOLETE at other times to stop the scan when we hit code after the true +// OBSOLETE function prologue (e.g. for the first source line) which might +// OBSOLETE otherwise be mistaken for function prologue. +// OBSOLETE +// OBSOLETE The format of the function prologue matched by this routine is +// OBSOLETE derived from examination of the source to gcc 1.95, particularly +// OBSOLETE the routine output_prologue () in config/out-m88k.c. +// OBSOLETE +// OBSOLETE subu r31,r31,n # stack pointer update +// OBSOLETE +// OBSOLETE (st rn,r31,offset)? # save incoming regs +// OBSOLETE (st.d rn,r31,offset)? +// OBSOLETE +// OBSOLETE (addu r30,r31,n)? # frame pointer update +// OBSOLETE +// OBSOLETE (pic sequence)? # PIC code prologue +// OBSOLETE +// OBSOLETE (or rn,rm,0)? # Move parameters to other regs +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* Macros for extracting fields from instructions. */ +// OBSOLETE +// OBSOLETE #define BITMASK(pos, width) (((0x1 << (width)) - 1) << (pos)) +// OBSOLETE #define EXTRACT_FIELD(val, pos, width) ((val) >> (pos) & BITMASK (0, width)) +// OBSOLETE #define SUBU_OFFSET(x) ((unsigned)(x & 0xFFFF)) +// OBSOLETE #define ST_OFFSET(x) ((unsigned)((x) & 0xFFFF)) +// OBSOLETE #define ST_SRC(x) EXTRACT_FIELD ((x), 21, 5) +// OBSOLETE #define ADDU_OFFSET(x) ((unsigned)(x & 0xFFFF)) +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * prologue_insn_tbl is a table of instructions which may comprise a +// OBSOLETE * function prologue. Associated with each table entry (corresponding +// OBSOLETE * to a single instruction or group of instructions), is an action. +// OBSOLETE * This action is used by examine_prologue (below) to determine +// OBSOLETE * the state of certain machine registers and where the stack frame lives. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE enum prologue_insn_action +// OBSOLETE { +// OBSOLETE PIA_SKIP, /* don't care what the instruction does */ +// OBSOLETE PIA_NOTE_ST, /* note register stored and where */ +// OBSOLETE PIA_NOTE_STD, /* note pair of registers stored and where */ +// OBSOLETE PIA_NOTE_SP_ADJUSTMENT, /* note stack pointer adjustment */ +// OBSOLETE PIA_NOTE_FP_ASSIGNMENT, /* note frame pointer assignment */ +// OBSOLETE PIA_NOTE_PROLOGUE_END, /* no more prologue */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE struct prologue_insns +// OBSOLETE { +// OBSOLETE unsigned long insn; +// OBSOLETE unsigned long mask; +// OBSOLETE enum prologue_insn_action action; +// OBSOLETE }; +// OBSOLETE +// OBSOLETE struct prologue_insns prologue_insn_tbl[] = +// OBSOLETE { +// OBSOLETE /* Various register move instructions */ +// OBSOLETE {0x58000000, 0xf800ffff, PIA_SKIP}, /* or/or.u with immed of 0 */ +// OBSOLETE {0xf4005800, 0xfc1fffe0, PIA_SKIP}, /* or rd, r0, rs */ +// OBSOLETE {0xf4005800, 0xfc00ffff, PIA_SKIP}, /* or rd, rs, r0 */ +// OBSOLETE +// OBSOLETE /* Stack pointer setup: "subu sp, sp, n" where n is a multiple of 8 */ +// OBSOLETE {0x67ff0000, 0xffff0007, PIA_NOTE_SP_ADJUSTMENT}, +// OBSOLETE +// OBSOLETE /* Frame pointer assignment: "addu r30, r31, n" */ +// OBSOLETE {0x63df0000, 0xffff0000, PIA_NOTE_FP_ASSIGNMENT}, +// OBSOLETE +// OBSOLETE /* Store to stack instructions; either "st rx, sp, n" or "st.d rx, sp, n" */ +// OBSOLETE {0x241f0000, 0xfc1f0000, PIA_NOTE_ST}, /* st rx, sp, n */ +// OBSOLETE {0x201f0000, 0xfc1f0000, PIA_NOTE_STD}, /* st.d rs, sp, n */ +// OBSOLETE +// OBSOLETE /* Instructions needed for setting up r25 for pic code. */ +// OBSOLETE {0x5f200000, 0xffff0000, PIA_SKIP}, /* or.u r25, r0, offset_high */ +// OBSOLETE {0xcc000002, 0xffffffff, PIA_SKIP}, /* bsr.n Lab */ +// OBSOLETE {0x5b390000, 0xffff0000, PIA_SKIP}, /* or r25, r25, offset_low */ +// OBSOLETE {0xf7396001, 0xffffffff, PIA_SKIP}, /* Lab: addu r25, r25, r1 */ +// OBSOLETE +// OBSOLETE /* Various branch or jump instructions which have a delay slot -- these +// OBSOLETE do not form part of the prologue, but the instruction in the delay +// OBSOLETE slot might be a store instruction which should be noted. */ +// OBSOLETE {0xc4000000, 0xe4000000, PIA_NOTE_PROLOGUE_END}, +// OBSOLETE /* br.n, bsr.n, bb0.n, or bb1.n */ +// OBSOLETE {0xec000000, 0xfc000000, PIA_NOTE_PROLOGUE_END}, /* bcnd.n */ +// OBSOLETE {0xf400c400, 0xfffff7e0, PIA_NOTE_PROLOGUE_END} /* jmp.n or jsr.n */ +// OBSOLETE +// OBSOLETE }; +// OBSOLETE +// OBSOLETE +// OBSOLETE /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or +// OBSOLETE is not the address of a valid instruction, the address of the next +// OBSOLETE instruction beyond ADDR otherwise. *PWORD1 receives the first word +// OBSOLETE of the instruction. */ +// OBSOLETE +// OBSOLETE #define NEXT_PROLOGUE_INSN(addr, lim, pword1) \ +// OBSOLETE (((addr) < (lim)) ? next_insn (addr, pword1) : 0) +// OBSOLETE +// OBSOLETE /* Read the m88k instruction at 'memaddr' and return the address of +// OBSOLETE the next instruction after that, or 0 if 'memaddr' is not the +// OBSOLETE address of a valid instruction. The instruction +// OBSOLETE is stored at 'pword1'. */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE next_insn (CORE_ADDR memaddr, unsigned long *pword1) +// OBSOLETE { +// OBSOLETE *pword1 = read_memory_integer (memaddr, BYTES_PER_88K_INSN); +// OBSOLETE return memaddr + BYTES_PER_88K_INSN; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Read a register from frames called by us (or from the hardware regs). */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE read_next_frame_reg (struct frame_info *frame, int regno) +// OBSOLETE { +// OBSOLETE for (; frame; frame = frame->next) +// OBSOLETE { +// OBSOLETE if (regno == SP_REGNUM) +// OBSOLETE return FRAME_FP (frame); +// OBSOLETE else if (frame->fsr->regs[regno]) +// OBSOLETE return read_memory_integer (frame->fsr->regs[regno], 4); +// OBSOLETE } +// OBSOLETE return read_register (regno); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Examine the prologue of a function. `ip' points to the first instruction. +// OBSOLETE `limit' is the limit of the prologue (e.g. the addr of the first +// OBSOLETE linenumber, or perhaps the program counter if we're stepping through). +// OBSOLETE `frame_sp' is the stack pointer value in use in this frame. +// OBSOLETE `fsr' is a pointer to a frame_saved_regs structure into which we put +// OBSOLETE info about the registers saved by this frame. +// OBSOLETE `fi' is a struct frame_info pointer; we fill in various fields in it +// OBSOLETE to reflect the offsets of the arg pointer and the locals pointer. */ +// OBSOLETE +// OBSOLETE static CORE_ADDR +// OBSOLETE examine_prologue (register CORE_ADDR ip, register CORE_ADDR limit, +// OBSOLETE CORE_ADDR frame_sp, struct frame_saved_regs *fsr, +// OBSOLETE struct frame_info *fi) +// OBSOLETE { +// OBSOLETE register CORE_ADDR next_ip; +// OBSOLETE register int src; +// OBSOLETE unsigned long insn; +// OBSOLETE int size, offset; +// OBSOLETE char must_adjust[32]; /* If set, must adjust offsets in fsr */ +// OBSOLETE int sp_offset = -1; /* -1 means not set (valid must be mult of 8) */ +// OBSOLETE int fp_offset = -1; /* -1 means not set */ +// OBSOLETE CORE_ADDR frame_fp; +// OBSOLETE CORE_ADDR prologue_end = 0; +// OBSOLETE +// OBSOLETE memset (must_adjust, '\0', sizeof (must_adjust)); +// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn); +// OBSOLETE +// OBSOLETE while (next_ip) +// OBSOLETE { +// OBSOLETE struct prologue_insns *pip; +// OBSOLETE +// OBSOLETE for (pip = prologue_insn_tbl; (insn & pip->mask) != pip->insn;) +// OBSOLETE if (++pip >= prologue_insn_tbl + sizeof prologue_insn_tbl) +// OBSOLETE goto end_of_prologue_found; /* not a prologue insn */ +// OBSOLETE +// OBSOLETE switch (pip->action) +// OBSOLETE { +// OBSOLETE case PIA_NOTE_ST: +// OBSOLETE case PIA_NOTE_STD: +// OBSOLETE if (sp_offset != -1) +// OBSOLETE { +// OBSOLETE src = ST_SRC (insn); +// OBSOLETE offset = ST_OFFSET (insn); +// OBSOLETE must_adjust[src] = 1; +// OBSOLETE fsr->regs[src++] = offset; /* Will be adjusted later */ +// OBSOLETE if (pip->action == PIA_NOTE_STD && src < 32) +// OBSOLETE { +// OBSOLETE offset += 4; +// OBSOLETE must_adjust[src] = 1; +// OBSOLETE fsr->regs[src++] = offset; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE else +// OBSOLETE goto end_of_prologue_found; +// OBSOLETE break; +// OBSOLETE case PIA_NOTE_SP_ADJUSTMENT: +// OBSOLETE if (sp_offset == -1) +// OBSOLETE sp_offset = -SUBU_OFFSET (insn); +// OBSOLETE else +// OBSOLETE goto end_of_prologue_found; +// OBSOLETE break; +// OBSOLETE case PIA_NOTE_FP_ASSIGNMENT: +// OBSOLETE if (fp_offset == -1) +// OBSOLETE fp_offset = ADDU_OFFSET (insn); +// OBSOLETE else +// OBSOLETE goto end_of_prologue_found; +// OBSOLETE break; +// OBSOLETE case PIA_NOTE_PROLOGUE_END: +// OBSOLETE if (!prologue_end) +// OBSOLETE prologue_end = ip; +// OBSOLETE break; +// OBSOLETE case PIA_SKIP: +// OBSOLETE default: +// OBSOLETE /* Do nothing */ +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE ip = next_ip; +// OBSOLETE next_ip = NEXT_PROLOGUE_INSN (ip, limit, &insn); +// OBSOLETE } +// OBSOLETE +// OBSOLETE end_of_prologue_found: +// OBSOLETE +// OBSOLETE if (prologue_end) +// OBSOLETE ip = prologue_end; +// OBSOLETE +// OBSOLETE /* We're done with the prologue. If we don't care about the stack +// OBSOLETE frame itself, just return. (Note that fsr->regs has been trashed, +// OBSOLETE but the one caller who calls with fi==0 passes a dummy there.) */ +// OBSOLETE +// OBSOLETE if (fi == 0) +// OBSOLETE return ip; +// OBSOLETE +// OBSOLETE /* +// OBSOLETE OK, now we have: +// OBSOLETE +// OBSOLETE sp_offset original (before any alloca calls) displacement of SP +// OBSOLETE (will be negative). +// OBSOLETE +// OBSOLETE fp_offset displacement from original SP to the FP for this frame +// OBSOLETE or -1. +// OBSOLETE +// OBSOLETE fsr->regs[0..31] displacement from original SP to the stack +// OBSOLETE location where reg[0..31] is stored. +// OBSOLETE +// OBSOLETE must_adjust[0..31] set if corresponding offset was set. +// OBSOLETE +// OBSOLETE If alloca has been called between the function prologue and the current +// OBSOLETE IP, then the current SP (frame_sp) will not be the original SP as set by +// OBSOLETE the function prologue. If the current SP is not the original SP, then the +// OBSOLETE compiler will have allocated an FP for this frame, fp_offset will be set, +// OBSOLETE and we can use it to calculate the original SP. +// OBSOLETE +// OBSOLETE Then, we figure out where the arguments and locals are, and relocate the +// OBSOLETE offsets in fsr->regs to absolute addresses. */ +// OBSOLETE +// OBSOLETE if (fp_offset != -1) +// OBSOLETE { +// OBSOLETE /* We have a frame pointer, so get it, and base our calc's on it. */ +// OBSOLETE frame_fp = (CORE_ADDR) read_next_frame_reg (fi->next, ACTUAL_FP_REGNUM); +// OBSOLETE frame_sp = frame_fp - fp_offset; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* We have no frame pointer, therefore frame_sp is still the same value +// OBSOLETE as set by prologue. But where is the frame itself? */ +// OBSOLETE if (must_adjust[SRP_REGNUM]) +// OBSOLETE { +// OBSOLETE /* Function header saved SRP (r1), the return address. Frame starts +// OBSOLETE 4 bytes down from where it was saved. */ +// OBSOLETE frame_fp = frame_sp + fsr->regs[SRP_REGNUM] - 4; +// OBSOLETE fi->locals_pointer = frame_fp; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* Function header didn't save SRP (r1), so we are in a leaf fn or +// OBSOLETE are otherwise confused. */ +// OBSOLETE frame_fp = -1; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* The locals are relative to the FP (whether it exists as an allocated +// OBSOLETE register, or just as an assumed offset from the SP) */ +// OBSOLETE fi->locals_pointer = frame_fp; +// OBSOLETE +// OBSOLETE /* The arguments are just above the SP as it was before we adjusted it +// OBSOLETE on entry. */ +// OBSOLETE fi->args_pointer = frame_sp - sp_offset; +// OBSOLETE +// OBSOLETE /* Now that we know the SP value used by the prologue, we know where +// OBSOLETE it saved all the registers. */ +// OBSOLETE for (src = 0; src < 32; src++) +// OBSOLETE if (must_adjust[src]) +// OBSOLETE fsr->regs[src] += frame_sp; +// OBSOLETE +// OBSOLETE /* The saved value of the SP is always known. */ +// OBSOLETE /* (we hope...) */ +// OBSOLETE if (fsr->regs[SP_REGNUM] != 0 +// OBSOLETE && fsr->regs[SP_REGNUM] != frame_sp - sp_offset) +// OBSOLETE fprintf_unfiltered (gdb_stderr, "Bad saved SP value %lx != %lx, offset %x!\n", +// OBSOLETE fsr->regs[SP_REGNUM], +// OBSOLETE frame_sp - sp_offset, sp_offset); +// OBSOLETE +// OBSOLETE fsr->regs[SP_REGNUM] = frame_sp - sp_offset; +// OBSOLETE +// OBSOLETE return (ip); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Given an ip value corresponding to the start of a function, +// OBSOLETE return the ip of the first instruction after the function +// OBSOLETE prologue. */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE m88k_skip_prologue (CORE_ADDR ip) +// OBSOLETE { +// OBSOLETE struct frame_saved_regs saved_regs_dummy; +// OBSOLETE struct symtab_and_line sal; +// OBSOLETE CORE_ADDR limit; +// OBSOLETE +// OBSOLETE sal = find_pc_line (ip, 0); +// OBSOLETE limit = (sal.end) ? sal.end : 0xffffffff; +// OBSOLETE +// OBSOLETE return (examine_prologue (ip, limit, (CORE_ADDR) 0, &saved_regs_dummy, +// OBSOLETE (struct frame_info *) 0)); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Put here the code to store, into a struct frame_saved_regs, +// OBSOLETE the addresses of the saved registers of frame described by FRAME_INFO. +// OBSOLETE This includes special registers such as pc and fp saved in special +// OBSOLETE ways in the stack frame. sp is even more special: +// OBSOLETE the address we return for it IS the sp for the next frame. +// OBSOLETE +// OBSOLETE We cache the result of doing this in the frame_obstack, since it is +// OBSOLETE fairly expensive. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE frame_find_saved_regs (struct frame_info *fi, struct frame_saved_regs *fsr) +// OBSOLETE { +// OBSOLETE register struct frame_saved_regs *cache_fsr; +// OBSOLETE CORE_ADDR ip; +// OBSOLETE struct symtab_and_line sal; +// OBSOLETE CORE_ADDR limit; +// OBSOLETE +// OBSOLETE if (!fi->fsr) +// OBSOLETE { +// OBSOLETE cache_fsr = (struct frame_saved_regs *) +// OBSOLETE frame_obstack_alloc (sizeof (struct frame_saved_regs)); +// OBSOLETE memset (cache_fsr, '\0', sizeof (struct frame_saved_regs)); +// OBSOLETE fi->fsr = cache_fsr; +// OBSOLETE +// OBSOLETE /* Find the start and end of the function prologue. If the PC +// OBSOLETE is in the function prologue, we only consider the part that +// OBSOLETE has executed already. In the case where the PC is not in +// OBSOLETE the function prologue, we set limit to two instructions beyond +// OBSOLETE where the prologue ends in case if any of the prologue instructions +// OBSOLETE were moved into a delay slot of a branch instruction. */ +// OBSOLETE +// OBSOLETE ip = get_pc_function_start (fi->pc); +// OBSOLETE sal = find_pc_line (ip, 0); +// OBSOLETE limit = (sal.end && sal.end < fi->pc) ? sal.end + 2 * BYTES_PER_88K_INSN +// OBSOLETE : fi->pc; +// OBSOLETE +// OBSOLETE /* This will fill in fields in *fi as well as in cache_fsr. */ +// OBSOLETE #ifdef SIGTRAMP_FRAME_FIXUP +// OBSOLETE if (fi->signal_handler_caller) +// OBSOLETE SIGTRAMP_FRAME_FIXUP (fi->frame); +// OBSOLETE #endif +// OBSOLETE examine_prologue (ip, limit, fi->frame, cache_fsr, fi); +// OBSOLETE #ifdef SIGTRAMP_SP_FIXUP +// OBSOLETE if (fi->signal_handler_caller && fi->fsr->regs[SP_REGNUM]) +// OBSOLETE SIGTRAMP_SP_FIXUP (fi->fsr->regs[SP_REGNUM]); +// OBSOLETE #endif +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (fsr) +// OBSOLETE *fsr = *fi->fsr; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return the address of the locals block for the frame +// OBSOLETE described by FI. Returns 0 if the address is unknown. +// OBSOLETE NOTE! Frame locals are referred to by negative offsets from the +// OBSOLETE argument pointer, so this is the same as frame_args_address(). */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE frame_locals_address (struct frame_info *fi) +// OBSOLETE { +// OBSOLETE struct frame_saved_regs fsr; +// OBSOLETE +// OBSOLETE if (fi->args_pointer) /* Cached value is likely there. */ +// OBSOLETE return fi->args_pointer; +// OBSOLETE +// OBSOLETE /* Nope, generate it. */ +// OBSOLETE +// OBSOLETE get_frame_saved_regs (fi, &fsr); +// OBSOLETE +// OBSOLETE return fi->args_pointer; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return the address of the argument block for the frame +// OBSOLETE described by FI. Returns 0 if the address is unknown. */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE frame_args_address (struct frame_info *fi) +// OBSOLETE { +// OBSOLETE struct frame_saved_regs fsr; +// OBSOLETE +// OBSOLETE if (fi->args_pointer) /* Cached value is likely there. */ +// OBSOLETE return fi->args_pointer; +// OBSOLETE +// OBSOLETE /* Nope, generate it. */ +// OBSOLETE +// OBSOLETE get_frame_saved_regs (fi, &fsr); +// OBSOLETE +// OBSOLETE return fi->args_pointer; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return the saved PC from this frame. +// OBSOLETE +// OBSOLETE If the frame has a memory copy of SRP_REGNUM, use that. If not, +// OBSOLETE just use the register SRP_REGNUM itself. */ +// OBSOLETE +// OBSOLETE CORE_ADDR +// OBSOLETE frame_saved_pc (struct frame_info *frame) +// OBSOLETE { +// OBSOLETE return read_next_frame_reg (frame, SRP_REGNUM); +// OBSOLETE } +// OBSOLETE +// OBSOLETE +// OBSOLETE #define DUMMY_FRAME_SIZE 192 +// OBSOLETE +// OBSOLETE static void +// OBSOLETE write_word (CORE_ADDR sp, ULONGEST word) +// OBSOLETE { +// OBSOLETE register int len = REGISTER_SIZE; +// OBSOLETE char buffer[MAX_REGISTER_RAW_SIZE]; +// OBSOLETE +// OBSOLETE store_unsigned_integer (buffer, len, word); +// OBSOLETE write_memory (sp, buffer, len); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE m88k_push_dummy_frame (void) +// OBSOLETE { +// OBSOLETE register CORE_ADDR sp = read_register (SP_REGNUM); +// OBSOLETE register int rn; +// OBSOLETE int offset; +// OBSOLETE +// OBSOLETE sp -= DUMMY_FRAME_SIZE; /* allocate a bunch of space */ +// OBSOLETE +// OBSOLETE for (rn = 0, offset = 0; rn <= SP_REGNUM; rn++, offset += 4) +// OBSOLETE write_word (sp + offset, read_register (rn)); +// OBSOLETE +// OBSOLETE write_word (sp + offset, read_register (SXIP_REGNUM)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_word (sp + offset, read_register (SNIP_REGNUM)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_word (sp + offset, read_register (SFIP_REGNUM)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_word (sp + offset, read_register (PSR_REGNUM)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_word (sp + offset, read_register (FPSR_REGNUM)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_word (sp + offset, read_register (FPCR_REGNUM)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_register (SP_REGNUM, sp); +// OBSOLETE write_register (ACTUAL_FP_REGNUM, sp); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE pop_frame (void) +// OBSOLETE { +// OBSOLETE register struct frame_info *frame = get_current_frame (); +// OBSOLETE register int regnum; +// OBSOLETE struct frame_saved_regs fsr; +// OBSOLETE +// OBSOLETE get_frame_saved_regs (frame, &fsr); +// OBSOLETE +// OBSOLETE if (PC_IN_CALL_DUMMY (read_pc (), read_register (SP_REGNUM), frame->frame)) +// OBSOLETE { +// OBSOLETE /* FIXME: I think get_frame_saved_regs should be handling this so +// OBSOLETE that we can deal with the saved registers properly (e.g. frame +// OBSOLETE 1 is a call dummy, the user types "frame 2" and then "print $ps"). */ +// OBSOLETE register CORE_ADDR sp = read_register (ACTUAL_FP_REGNUM); +// OBSOLETE int offset; +// OBSOLETE +// OBSOLETE for (regnum = 0, offset = 0; regnum <= SP_REGNUM; regnum++, offset += 4) +// OBSOLETE (void) write_register (regnum, read_memory_integer (sp + offset, 4)); +// OBSOLETE +// OBSOLETE write_register (SXIP_REGNUM, read_memory_integer (sp + offset, 4)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_register (SNIP_REGNUM, read_memory_integer (sp + offset, 4)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_register (SFIP_REGNUM, read_memory_integer (sp + offset, 4)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_register (PSR_REGNUM, read_memory_integer (sp + offset, 4)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_register (FPSR_REGNUM, read_memory_integer (sp + offset, 4)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE write_register (FPCR_REGNUM, read_memory_integer (sp + offset, 4)); +// OBSOLETE offset += 4; +// OBSOLETE +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE for (regnum = FP_REGNUM; regnum > 0; regnum--) +// OBSOLETE if (fsr.regs[regnum]) +// OBSOLETE write_register (regnum, +// OBSOLETE read_memory_integer (fsr.regs[regnum], 4)); +// OBSOLETE write_pc (frame_saved_pc (frame)); +// OBSOLETE } +// OBSOLETE reinit_frame_cache (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_m88k_tdep (void) +// OBSOLETE { +// OBSOLETE tm_print_insn = print_insn_m88k; +// OBSOLETE } diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c index f74ce97..a6ffb8e 100644 --- a/gdb/remote-bug.c +++ b/gdb/remote-bug.c @@ -1,1027 +1,1027 @@ -/* Remote debugging interface for Motorola's MVME187BUG monitor, an embedded - monitor for the m88k. - - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, - 2002 Free Software Foundation, Inc. - - Contributed by Cygnus Support. Written by K. Richard Pixley. - - 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 "inferior.h" -#include "gdb_string.h" -#include "regcache.h" -#include <ctype.h> -#include <fcntl.h> -#include <setjmp.h> -#include <errno.h> - -#include "terminal.h" -#include "gdbcore.h" -#include "gdbcmd.h" - -#include "serial.h" -#include "remote-utils.h" - -/* External data declarations */ -extern int stop_soon_quietly; /* for wait_for_inferior */ - -/* Forward data declarations */ -extern struct target_ops bug_ops; /* Forward declaration */ - -/* Forward function declarations */ -static int bug_clear_breakpoints (void); - -static int bug_read_memory (CORE_ADDR memaddr, - unsigned char *myaddr, int len); - -static int bug_write_memory (CORE_ADDR memaddr, - unsigned char *myaddr, int len); - -/* This variable is somewhat arbitrary. It's here so that it can be - set from within a running gdb. */ - -static int srec_max_retries = 3; - -/* Each S-record download to the target consists of an S0 header - record, some number of S3 data records, and one S7 termination - record. I call this download a "frame". Srec_frame says how many - bytes will be represented in each frame. */ - -#define SREC_SIZE 160 -static int srec_frame = SREC_SIZE; - -/* This variable determines how many bytes will be represented in each - S3 s-record. */ - -static int srec_bytes = 40; - -/* At one point it appeared to me as though the bug monitor could not - really be expected to receive two sequential characters at 9600 - baud reliably. Echo-pacing is an attempt to force data across the - line even in this condition. Specifically, in echo-pace mode, each - character is sent one at a time and we look for the echo before - sending the next. This is excruciatingly slow. */ - -static int srec_echo_pace = 0; - -/* How long to wait after an srec for a possible error message. - Similar to the above, I tried sleeping after sending each S3 record - in hopes that I might actually see error messages from the bug - monitor. This might actually work if we were to use sleep - intervals smaller than 1 second. */ - -static int srec_sleep = 0; - -/* Every srec_noise records, flub the checksum. This is a debugging - feature. Set the variable to something other than 1 in order to - inject *deliberate* checksum errors. One might do this if one - wanted to test error handling and recovery. */ - -static int srec_noise = 0; - -/* Called when SIGALRM signal sent due to alarm() timeout. */ - -/* Number of SIGTRAPs we need to simulate. That is, the next - NEED_ARTIFICIAL_TRAP calls to bug_wait should just return - SIGTRAP without actually waiting for anything. */ - -static int need_artificial_trap = 0; - -/* - * Download a file specified in 'args', to the bug. - */ - -static void -bug_load (char *args, int fromtty) -{ - bfd *abfd; - asection *s; - char buffer[1024]; - - sr_check_open (); - - inferior_ptid = null_ptid; - abfd = bfd_openr (args, 0); - if (!abfd) - { - printf_filtered ("Unable to open file %s\n", args); - return; - } - - if (bfd_check_format (abfd, bfd_object) == 0) - { - printf_filtered ("File is not an object file\n"); - return; - } - - s = abfd->sections; - while (s != (asection *) NULL) - { - srec_frame = SREC_SIZE; - if (s->flags & SEC_LOAD) - { - int i; - - char *buffer = xmalloc (srec_frame); - - printf_filtered ("%s\t: 0x%4lx .. 0x%4lx ", s->name, s->vma, s->vma + s->_raw_size); - gdb_flush (gdb_stdout); - for (i = 0; i < s->_raw_size; i += srec_frame) - { - if (srec_frame > s->_raw_size - i) - srec_frame = s->_raw_size - i; - - bfd_get_section_contents (abfd, s, buffer, i, srec_frame); - bug_write_memory (s->vma + i, buffer, srec_frame); - printf_filtered ("*"); - gdb_flush (gdb_stdout); - } - printf_filtered ("\n"); - xfree (buffer); - } - s = s->next; - } - sprintf (buffer, "rs ip %lx", (unsigned long) abfd->start_address); - sr_write_cr (buffer); - gr_expect_prompt (); -} - -#if 0 -static char * -get_word (char **p) -{ - char *s = *p; - char *word; - char *copy; - size_t len; - - while (isspace (*s)) - s++; - - word = s; - - len = 0; - - while (*s && !isspace (*s)) - { - s++; - len++; - - } - copy = xmalloc (len + 1); - memcpy (copy, word, len); - copy[len] = 0; - *p = s; - return copy; -} -#endif - -static struct gr_settings bug_settings = -{ - "Bug>", /* prompt */ - &bug_ops, /* ops */ - bug_clear_breakpoints, /* clear_all_breakpoints */ - gr_generic_checkin, /* checkin */ -}; - -static char *cpu_check_strings[] = -{ - "=", - "Invalid Register", -}; - -static void -bug_open (char *args, int from_tty) -{ - if (args == NULL) - args = ""; - - gr_open (args, from_tty, &bug_settings); - /* decide *now* whether we are on an 88100 or an 88110 */ - sr_write_cr ("rs cr06"); - sr_expect ("rs cr06"); - - switch (gr_multi_scan (cpu_check_strings, 0)) - { - case 0: /* this is an m88100 */ - target_is_m88110 = 0; - break; - case 1: /* this is an m88110 */ - target_is_m88110 = 1; - break; - default: - internal_error (__FILE__, __LINE__, "failed internal consistency check"); - } -} - -/* Tell the remote machine to resume. */ - -void -bug_resume (ptid_t ptid, int step, enum target_signal sig) -{ - if (step) - { - sr_write_cr ("t"); - - /* Force the next bug_wait to return a trap. Not doing anything - about I/O from the target means that the user has to type - "continue" to see any. FIXME, this should be fixed. */ - need_artificial_trap = 1; - } - else - sr_write_cr ("g"); - - return; -} - -/* Wait until the remote machine stops, then return, - storing status in STATUS just as `wait' would. */ - -static char *wait_strings[] = -{ - "At Breakpoint", - "Exception: Data Access Fault (Local Bus Timeout)", - "\r8??\?-Bug>", /* The '\?' avoids creating a trigraph */ - "\r197-Bug>", - NULL, -}; - -ptid_t -bug_wait (ptid_t ptid, struct target_waitstatus *status) -{ - int old_timeout = sr_get_timeout (); - int old_immediate_quit = immediate_quit; - - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - - /* read off leftovers from resume so that the rest can be passed - back out as stdout. */ - if (need_artificial_trap == 0) - { - sr_expect ("Effective address: "); - (void) sr_get_hex_word (); - sr_expect ("\r\n"); - } - - sr_set_timeout (-1); /* Don't time out -- user program is running. */ - immediate_quit = 1; /* Helps ability to QUIT */ - - switch (gr_multi_scan (wait_strings, need_artificial_trap == 0)) - { - case 0: /* breakpoint case */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - /* user output from the target can be discarded here. (?) */ - gr_expect_prompt (); - break; - - case 1: /* bus error */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_BUS; - /* user output from the target can be discarded here. (?) */ - gr_expect_prompt (); - break; - - case 2: /* normal case */ - case 3: - if (need_artificial_trap != 0) - { - /* stepping */ - status->kind = TARGET_WAITKIND_STOPPED; - status->value.sig = TARGET_SIGNAL_TRAP; - need_artificial_trap--; - break; - } - else - { - /* exit case */ - status->kind = TARGET_WAITKIND_EXITED; - status->value.integer = 0; - break; - } - - case -1: /* trouble */ - default: - fprintf_filtered (gdb_stderr, - "Trouble reading target during wait\n"); - break; - } - - sr_set_timeout (old_timeout); - immediate_quit = old_immediate_quit; - return inferior_ptid; -} - -/* Return the name of register number REGNO - in the form input and output by bug. - - Returns a pointer to a static buffer containing the answer. */ -static char * -get_reg_name (int regno) -{ - static char *rn[] = - { - "r00", "r01", "r02", "r03", "r04", "r05", "r06", "r07", - "r08", "r09", "r10", "r11", "r12", "r13", "r14", "r15", - "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", - "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", - - /* these get confusing because we omit a few and switch some ordering around. */ - - "cr01", /* 32 = psr */ - "fcr62", /* 33 = fpsr */ - "fcr63", /* 34 = fpcr */ - "ip", /* this is something of a cheat. */ - /* 35 = sxip */ - "cr05", /* 36 = snip */ - "cr06", /* 37 = sfip */ - - "x00", "x01", "x02", "x03", "x04", "x05", "x06", "x07", - "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15", - "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", - "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31", - }; - - return rn[regno]; -} - -#if 0 /* not currently used */ -/* Read from remote while the input matches STRING. Return zero on - success, -1 on failure. */ - -static int -bug_scan (char *s) -{ - int c; - - while (*s) - { - c = sr_readchar (); - if (c != *s++) - { - fflush (stdout); - printf ("\nNext character is '%c' - %d and s is \"%s\".\n", c, c, --s); - return (-1); - } - } - - return (0); -} -#endif /* never */ - -static int -bug_srec_write_cr (char *s) -{ - char *p = s; - - if (srec_echo_pace) - for (p = s; *p; ++p) - { - if (sr_get_debug () > 0) - printf ("%c", *p); - - do - serial_write (sr_get_desc (), p, 1); - while (sr_pollchar () != *p); - } - else - { - sr_write_cr (s); -/* return(bug_scan (s) || bug_scan ("\n")); */ - } - - return (0); -} - -/* Store register REGNO, or all if REGNO == -1. */ - -static void -bug_fetch_register (int regno) -{ - sr_check_open (); - - if (regno == -1) - { - int i; - - for (i = 0; i < NUM_REGS; ++i) - bug_fetch_register (i); - } - else if (target_is_m88110 && regno == SFIP_REGNUM) - { - /* m88110 has no sfip. */ - long l = 0; - supply_register (regno, (char *) &l); - } - else if (regno < XFP_REGNUM) - { - char buffer[MAX_REGISTER_RAW_SIZE]; - - sr_write ("rs ", 3); - sr_write_cr (get_reg_name (regno)); - sr_expect ("="); - store_unsigned_integer (buffer, REGISTER_RAW_SIZE (regno), - sr_get_hex_word ()); - gr_expect_prompt (); - supply_register (regno, buffer); - } - else - { - /* Float register so we need to parse a strange data format. */ - long p; - unsigned char fpreg_buf[10]; - - sr_write ("rs ", 3); - sr_write (get_reg_name (regno), strlen (get_reg_name (regno))); - sr_write_cr (";d"); - sr_expect ("rs"); - sr_expect (get_reg_name (regno)); - sr_expect (";d"); - sr_expect ("="); - - /* sign */ - p = sr_get_hex_digit (1); - fpreg_buf[0] = p << 7; - - /* exponent */ - sr_expect ("_"); - p = sr_get_hex_digit (1); - fpreg_buf[0] += (p << 4); - fpreg_buf[0] += sr_get_hex_digit (1); - - fpreg_buf[1] = sr_get_hex_digit (1) << 4; - - /* fraction */ - sr_expect ("_"); - fpreg_buf[1] += sr_get_hex_digit (1); - - fpreg_buf[2] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); - fpreg_buf[3] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); - fpreg_buf[4] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); - fpreg_buf[5] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); - fpreg_buf[6] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); - fpreg_buf[7] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); - fpreg_buf[8] = 0; - fpreg_buf[9] = 0; - - gr_expect_prompt (); - supply_register (regno, fpreg_buf); - } - - return; -} - -/* Store register REGNO, or all if REGNO == -1. */ - -static void -bug_store_register (int regno) -{ - char buffer[1024]; - sr_check_open (); - - if (regno == -1) - { - int i; - - for (i = 0; i < NUM_REGS; ++i) - bug_store_register (i); - } - else - { - char *regname; - - regname = get_reg_name (regno); - - if (target_is_m88110 && regno == SFIP_REGNUM) - return; - else if (regno < XFP_REGNUM) - sprintf (buffer, "rs %s %08lx", - regname, - (long) read_register (regno)); - else - { - unsigned char *fpreg_buf = - (unsigned char *) ®isters[REGISTER_BYTE (regno)]; - - sprintf (buffer, "rs %s %1x_%02x%1x_%1x%02x%02x%02x%02x%02x%02x;d", - regname, - /* sign */ - (fpreg_buf[0] >> 7) & 0xf, - /* exponent */ - fpreg_buf[0] & 0x7f, - (fpreg_buf[1] >> 8) & 0xf, - /* fraction */ - fpreg_buf[1] & 0xf, - fpreg_buf[2], - fpreg_buf[3], - fpreg_buf[4], - fpreg_buf[5], - fpreg_buf[6], - fpreg_buf[7]); - } - - sr_write_cr (buffer); - gr_expect_prompt (); - } - - return; -} - -/* Transfer LEN bytes between GDB address MYADDR and target address - MEMADDR. If WRITE is non-zero, transfer them to the target, - otherwise transfer them from the target. TARGET is unused. - - Returns the number of bytes transferred. */ - -int -bug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, - struct mem_attrib *attrib, struct target_ops *target) -{ - int res; - - if (len <= 0) - return 0; - - if (write) - res = bug_write_memory (memaddr, myaddr, len); - else - res = bug_read_memory (memaddr, myaddr, len); - - return res; -} - -static void -start_load (void) -{ - char *command; - - command = (srec_echo_pace ? "lo 0 ;x" : "lo 0"); - - sr_write_cr (command); - sr_expect (command); - sr_expect ("\r\n"); - bug_srec_write_cr ("S0030000FC"); - return; -} - -/* This is an extremely vulnerable and fragile function. I've made - considerable attempts to make this deterministic, but I've - certainly forgotten something. The trouble is that S-records are - only a partial file format, not a protocol. Worse, apparently the - m88k bug monitor does not run in real time while receiving - S-records. Hence, we must pay excruciating attention to when and - where error messages are returned, and what has actually been sent. - - Each call represents a chunk of memory to be sent to the target. - We break that chunk into an S0 header record, some number of S3 - data records each containing srec_bytes, and an S7 termination - record. */ - -static char *srecord_strings[] = -{ - "S-RECORD", - "-Bug>", - NULL, -}; - -static int -bug_write_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) -{ - int done; - int checksum; - int x; - int retries; - char *buffer = alloca ((srec_bytes + 8) << 1); - - retries = 0; - - do - { - done = 0; - - if (retries > srec_max_retries) - return (-1); - - if (retries > 0) - { - if (sr_get_debug () > 0) - printf ("\n<retrying...>\n"); - - /* This gr_expect_prompt call is extremely important. Without - it, we will tend to resend our packet so fast that it - will arrive before the bug monitor is ready to receive - it. This would lead to a very ugly resend loop. */ - - gr_expect_prompt (); - } - - start_load (); - - while (done < len) - { - int thisgo; - int idx; - char *buf = buffer; - CORE_ADDR address; - - checksum = 0; - thisgo = len - done; - if (thisgo > srec_bytes) - thisgo = srec_bytes; - - address = memaddr + done; - sprintf (buf, "S3%02X%08lX", thisgo + 4 + 1, (long) address); - buf += 12; - - checksum += (thisgo + 4 + 1 - + (address & 0xff) - + ((address >> 8) & 0xff) - + ((address >> 16) & 0xff) - + ((address >> 24) & 0xff)); - - for (idx = 0; idx < thisgo; idx++) - { - sprintf (buf, "%02X", myaddr[idx + done]); - checksum += myaddr[idx + done]; - buf += 2; - } - - if (srec_noise > 0) - { - /* FIXME-NOW: insert a deliberate error every now and then. - This is intended for testing/debugging the error handling - stuff. */ - static int counter = 0; - if (++counter > srec_noise) - { - counter = 0; - ++checksum; - } - } - - sprintf (buf, "%02X", ~checksum & 0xff); - bug_srec_write_cr (buffer); - - if (srec_sleep != 0) - sleep (srec_sleep); - - /* This pollchar is probably redundant to the gr_multi_scan - below. Trouble is, we can't be sure when or where an - error message will appear. Apparently, when running at - full speed from a typical sun4, error messages tend to - appear to arrive only *after* the s7 record. */ - - if ((x = sr_pollchar ()) != 0) - { - if (sr_get_debug () > 0) - printf ("\n<retrying...>\n"); - - ++retries; - - /* flush any remaining input and verify that we are back - at the prompt level. */ - gr_expect_prompt (); - /* start all over again. */ - start_load (); - done = 0; - continue; - } - - done += thisgo; - } - - bug_srec_write_cr ("S7060000000000F9"); - ++retries; - - /* Having finished the load, we need to figure out whether we - had any errors. */ - } - while (gr_multi_scan (srecord_strings, 0) == 0);; - - return (0); -} - -/* Copy LEN bytes of data from debugger memory at MYADDR - to inferior's memory at MEMADDR. Returns errno value. - * sb/sh instructions don't work on unaligned addresses, when TU=1. - */ - -/* Read LEN bytes from inferior memory at MEMADDR. Put the result - at debugger address MYADDR. Returns errno value. */ -static int -bug_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) -{ - char request[100]; - char *buffer; - char *p; - char type; - char size; - unsigned char c; - unsigned int inaddr; - unsigned int checksum; - - sprintf (request, "du 0 %lx:&%d", (long) memaddr, len); - sr_write_cr (request); - - p = buffer = alloca (len); - - /* scan up through the header */ - sr_expect ("S0030000FC"); - - while (p < buffer + len) - { - /* scan off any white space. */ - while (sr_readchar () != 'S');; - - /* what kind of s-rec? */ - type = sr_readchar (); - - /* scan record size */ - sr_get_hex_byte (&size); - checksum = size; - --size; - inaddr = 0; - - switch (type) - { - case '7': - case '8': - case '9': - goto done; - - case '3': - sr_get_hex_byte (&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - /* intentional fall through */ - case '2': - sr_get_hex_byte (&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - /* intentional fall through */ - case '1': - sr_get_hex_byte (&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - sr_get_hex_byte (&c); - inaddr = (inaddr << 8) + c; - checksum += c; - --size; - break; - - default: - /* bonk */ - error ("reading s-records."); - } - - if (inaddr < memaddr - || (memaddr + len) < (inaddr + size)) - error ("srec out of memory range."); - - if (p != buffer + inaddr - memaddr) - error ("srec out of sequence."); - - for (; size; --size, ++p) - { - sr_get_hex_byte (p); - checksum += *p; - } - - sr_get_hex_byte (&c); - if (c != (~checksum & 0xff)) - error ("bad s-rec checksum"); - } - -done: - gr_expect_prompt (); - if (p != buffer + len) - return (1); - - memcpy (myaddr, buffer, len); - return (0); -} - -#define MAX_BREAKS 16 -static int num_brkpts = 0; - -/* Insert a breakpoint at ADDR. SAVE is normally the address of the - pattern buffer where the instruction that the breakpoint overwrites - is saved. It is unused here since the bug is responsible for - saving/restoring the original instruction. */ - -static int -bug_insert_breakpoint (CORE_ADDR addr, char *save) -{ - sr_check_open (); - - if (num_brkpts < MAX_BREAKS) - { - char buffer[100]; - - num_brkpts++; - sprintf (buffer, "br %lx", (long) addr); - sr_write_cr (buffer); - gr_expect_prompt (); - return (0); - } - else - { - fprintf_filtered (gdb_stderr, - "Too many break points, break point not installed\n"); - return (1); - } - -} - -/* Remove a breakpoint at ADDR. SAVE is normally the previously - saved pattern, but is unused here since the bug is responsible - for saving/restoring instructions. */ - -static int -bug_remove_breakpoint (CORE_ADDR addr, char *save) -{ - if (num_brkpts > 0) - { - char buffer[100]; - - num_brkpts--; - sprintf (buffer, "nobr %lx", (long) addr); - sr_write_cr (buffer); - gr_expect_prompt (); - - } - return (0); -} - -/* Clear the bugs notion of what the break points are */ -static int -bug_clear_breakpoints (void) -{ - - if (sr_is_open ()) - { - sr_write_cr ("nobr"); - sr_expect ("nobr"); - gr_expect_prompt (); - } - num_brkpts = 0; - return (0); -} - -struct target_ops bug_ops; - -static void -init_bug_ops (void) -{ - bug_ops.to_shortname = "bug"; - "Remote BUG monitor", - bug_ops.to_longname = "Use the mvme187 board running the BUG monitor connected by a serial line."; - bug_ops.to_doc = " "; - bug_ops.to_open = bug_open; - bug_ops.to_close = gr_close; - bug_ops.to_attach = 0; - bug_ops.to_post_attach = NULL; - bug_ops.to_require_attach = NULL; - bug_ops.to_detach = gr_detach; - bug_ops.to_require_detach = NULL; - bug_ops.to_resume = bug_resume; - bug_ops.to_wait = bug_wait; - bug_ops.to_post_wait = NULL; - bug_ops.to_fetch_registers = bug_fetch_register; - bug_ops.to_store_registers = bug_store_register; - bug_ops.to_prepare_to_store = gr_prepare_to_store; - bug_ops.to_xfer_memory = bug_xfer_memory; - bug_ops.to_files_info = gr_files_info; - bug_ops.to_insert_breakpoint = bug_insert_breakpoint; - bug_ops.to_remove_breakpoint = bug_remove_breakpoint; - bug_ops.to_terminal_init = 0; - bug_ops.to_terminal_inferior = 0; - bug_ops.to_terminal_ours_for_output = 0; - bug_ops.to_terminal_ours = 0; - bug_ops.to_terminal_info = 0; - bug_ops.to_kill = gr_kill; - bug_ops.to_load = bug_load; - bug_ops.to_lookup_symbol = 0; - bug_ops.to_create_inferior = gr_create_inferior; - bug_ops.to_post_startup_inferior = NULL; - bug_ops.to_acknowledge_created_inferior = NULL; - bug_ops.to_clone_and_follow_inferior = NULL; - bug_ops.to_post_follow_inferior_by_clone = NULL; - bug_ops.to_insert_fork_catchpoint = NULL; - bug_ops.to_remove_fork_catchpoint = NULL; - bug_ops.to_insert_vfork_catchpoint = NULL; - bug_ops.to_remove_vfork_catchpoint = NULL; - bug_ops.to_has_forked = NULL; - bug_ops.to_has_vforked = NULL; - bug_ops.to_can_follow_vfork_prior_to_exec = NULL; - bug_ops.to_post_follow_vfork = NULL; - bug_ops.to_insert_exec_catchpoint = NULL; - bug_ops.to_remove_exec_catchpoint = NULL; - bug_ops.to_has_execd = NULL; - bug_ops.to_reported_exec_events_per_exec_call = NULL; - bug_ops.to_has_exited = NULL; - bug_ops.to_mourn_inferior = gr_mourn; - bug_ops.to_can_run = 0; - bug_ops.to_notice_signals = 0; - bug_ops.to_thread_alive = 0; - bug_ops.to_stop = 0; - bug_ops.to_pid_to_exec_file = NULL; - bug_ops.to_stratum = process_stratum; - bug_ops.DONT_USE = 0; - bug_ops.to_has_all_memory = 1; - bug_ops.to_has_memory = 1; - bug_ops.to_has_stack = 1; - bug_ops.to_has_registers = 0; - bug_ops.to_has_execution = 0; - bug_ops.to_sections = 0; - bug_ops.to_sections_end = 0; - bug_ops.to_magic = OPS_MAGIC; /* Always the last thing */ -} /* init_bug_ops */ - -void -_initialize_remote_bug (void) -{ - init_bug_ops (); - add_target (&bug_ops); - - add_show_from_set - (add_set_cmd ("srec-bytes", class_support, var_uinteger, - (char *) &srec_bytes, - "\ -Set the number of bytes represented in each S-record.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("srec-max-retries", class_support, var_uinteger, - (char *) &srec_max_retries, - "\ -Set the number of retries for shipping S-records.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); - -#if 0 - /* This needs to set SREC_SIZE, not srec_frame which gets changed at the - end of a download. But do we need the option at all? */ - add_show_from_set - (add_set_cmd ("srec-frame", class_support, var_uinteger, - (char *) &srec_frame, - "\ -Set the number of bytes in an S-record frame.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); -#endif /* 0 */ - - add_show_from_set - (add_set_cmd ("srec-noise", class_support, var_zinteger, - (char *) &srec_noise, - "\ -Set number of S-record to send before deliberately flubbing a checksum.\n\ -Zero means flub none at all. This affects the communication protocol\n\ -with the remote target.", - &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("srec-sleep", class_support, var_zinteger, - (char *) &srec_sleep, - "\ -Set number of seconds to sleep after an S-record for a possible error message to arrive.\n\ -This affects the communication protocol with the remote target.", - &setlist), - &showlist); - - add_show_from_set - (add_set_cmd ("srec-echo-pace", class_support, var_boolean, - (char *) &srec_echo_pace, - "\ -Set echo-verification.\n\ -When on, use verification by echo when downloading S-records. This is\n\ -much slower, but generally more reliable.", - &setlist), - &showlist); -} +// OBSOLETE /* Remote debugging interface for Motorola's MVME187BUG monitor, an embedded +// OBSOLETE monitor for the m88k. +// OBSOLETE +// OBSOLETE Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +// OBSOLETE 2002 Free Software Foundation, Inc. +// OBSOLETE +// OBSOLETE Contributed by Cygnus Support. Written by K. Richard Pixley. +// OBSOLETE +// OBSOLETE This file is part of GDB. +// OBSOLETE +// OBSOLETE This program is free software; you can redistribute it and/or modify +// OBSOLETE it under the terms of the GNU General Public License as published by +// OBSOLETE the Free Software Foundation; either version 2 of the License, or +// OBSOLETE (at your option) any later version. +// OBSOLETE +// OBSOLETE This program is distributed in the hope that it will be useful, +// OBSOLETE but WITHOUT ANY WARRANTY; without even the implied warranty of +// OBSOLETE MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// OBSOLETE GNU General Public License for more details. +// OBSOLETE +// OBSOLETE You should have received a copy of the GNU General Public License +// OBSOLETE along with this program; if not, write to the Free Software +// OBSOLETE Foundation, Inc., 59 Temple Place - Suite 330, +// OBSOLETE Boston, MA 02111-1307, USA. */ +// OBSOLETE +// OBSOLETE #include "defs.h" +// OBSOLETE #include "inferior.h" +// OBSOLETE #include "gdb_string.h" +// OBSOLETE #include "regcache.h" +// OBSOLETE #include <ctype.h> +// OBSOLETE #include <fcntl.h> +// OBSOLETE #include <setjmp.h> +// OBSOLETE #include <errno.h> +// OBSOLETE +// OBSOLETE #include "terminal.h" +// OBSOLETE #include "gdbcore.h" +// OBSOLETE #include "gdbcmd.h" +// OBSOLETE +// OBSOLETE #include "serial.h" +// OBSOLETE #include "remote-utils.h" +// OBSOLETE +// OBSOLETE /* External data declarations */ +// OBSOLETE extern int stop_soon_quietly; /* for wait_for_inferior */ +// OBSOLETE +// OBSOLETE /* Forward data declarations */ +// OBSOLETE extern struct target_ops bug_ops; /* Forward declaration */ +// OBSOLETE +// OBSOLETE /* Forward function declarations */ +// OBSOLETE static int bug_clear_breakpoints (void); +// OBSOLETE +// OBSOLETE static int bug_read_memory (CORE_ADDR memaddr, +// OBSOLETE unsigned char *myaddr, int len); +// OBSOLETE +// OBSOLETE static int bug_write_memory (CORE_ADDR memaddr, +// OBSOLETE unsigned char *myaddr, int len); +// OBSOLETE +// OBSOLETE /* This variable is somewhat arbitrary. It's here so that it can be +// OBSOLETE set from within a running gdb. */ +// OBSOLETE +// OBSOLETE static int srec_max_retries = 3; +// OBSOLETE +// OBSOLETE /* Each S-record download to the target consists of an S0 header +// OBSOLETE record, some number of S3 data records, and one S7 termination +// OBSOLETE record. I call this download a "frame". Srec_frame says how many +// OBSOLETE bytes will be represented in each frame. */ +// OBSOLETE +// OBSOLETE #define SREC_SIZE 160 +// OBSOLETE static int srec_frame = SREC_SIZE; +// OBSOLETE +// OBSOLETE /* This variable determines how many bytes will be represented in each +// OBSOLETE S3 s-record. */ +// OBSOLETE +// OBSOLETE static int srec_bytes = 40; +// OBSOLETE +// OBSOLETE /* At one point it appeared to me as though the bug monitor could not +// OBSOLETE really be expected to receive two sequential characters at 9600 +// OBSOLETE baud reliably. Echo-pacing is an attempt to force data across the +// OBSOLETE line even in this condition. Specifically, in echo-pace mode, each +// OBSOLETE character is sent one at a time and we look for the echo before +// OBSOLETE sending the next. This is excruciatingly slow. */ +// OBSOLETE +// OBSOLETE static int srec_echo_pace = 0; +// OBSOLETE +// OBSOLETE /* How long to wait after an srec for a possible error message. +// OBSOLETE Similar to the above, I tried sleeping after sending each S3 record +// OBSOLETE in hopes that I might actually see error messages from the bug +// OBSOLETE monitor. This might actually work if we were to use sleep +// OBSOLETE intervals smaller than 1 second. */ +// OBSOLETE +// OBSOLETE static int srec_sleep = 0; +// OBSOLETE +// OBSOLETE /* Every srec_noise records, flub the checksum. This is a debugging +// OBSOLETE feature. Set the variable to something other than 1 in order to +// OBSOLETE inject *deliberate* checksum errors. One might do this if one +// OBSOLETE wanted to test error handling and recovery. */ +// OBSOLETE +// OBSOLETE static int srec_noise = 0; +// OBSOLETE +// OBSOLETE /* Called when SIGALRM signal sent due to alarm() timeout. */ +// OBSOLETE +// OBSOLETE /* Number of SIGTRAPs we need to simulate. That is, the next +// OBSOLETE NEED_ARTIFICIAL_TRAP calls to bug_wait should just return +// OBSOLETE SIGTRAP without actually waiting for anything. */ +// OBSOLETE +// OBSOLETE static int need_artificial_trap = 0; +// OBSOLETE +// OBSOLETE /* +// OBSOLETE * Download a file specified in 'args', to the bug. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE bug_load (char *args, int fromtty) +// OBSOLETE { +// OBSOLETE bfd *abfd; +// OBSOLETE asection *s; +// OBSOLETE char buffer[1024]; +// OBSOLETE +// OBSOLETE sr_check_open (); +// OBSOLETE +// OBSOLETE inferior_ptid = null_ptid; +// OBSOLETE abfd = bfd_openr (args, 0); +// OBSOLETE if (!abfd) +// OBSOLETE { +// OBSOLETE printf_filtered ("Unable to open file %s\n", args); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (bfd_check_format (abfd, bfd_object) == 0) +// OBSOLETE { +// OBSOLETE printf_filtered ("File is not an object file\n"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE s = abfd->sections; +// OBSOLETE while (s != (asection *) NULL) +// OBSOLETE { +// OBSOLETE srec_frame = SREC_SIZE; +// OBSOLETE if (s->flags & SEC_LOAD) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE char *buffer = xmalloc (srec_frame); +// OBSOLETE +// OBSOLETE printf_filtered ("%s\t: 0x%4lx .. 0x%4lx ", s->name, s->vma, s->vma + s->_raw_size); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE for (i = 0; i < s->_raw_size; i += srec_frame) +// OBSOLETE { +// OBSOLETE if (srec_frame > s->_raw_size - i) +// OBSOLETE srec_frame = s->_raw_size - i; +// OBSOLETE +// OBSOLETE bfd_get_section_contents (abfd, s, buffer, i, srec_frame); +// OBSOLETE bug_write_memory (s->vma + i, buffer, srec_frame); +// OBSOLETE printf_filtered ("*"); +// OBSOLETE gdb_flush (gdb_stdout); +// OBSOLETE } +// OBSOLETE printf_filtered ("\n"); +// OBSOLETE xfree (buffer); +// OBSOLETE } +// OBSOLETE s = s->next; +// OBSOLETE } +// OBSOLETE sprintf (buffer, "rs ip %lx", (unsigned long) abfd->start_address); +// OBSOLETE sr_write_cr (buffer); +// OBSOLETE gr_expect_prompt (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE static char * +// OBSOLETE get_word (char **p) +// OBSOLETE { +// OBSOLETE char *s = *p; +// OBSOLETE char *word; +// OBSOLETE char *copy; +// OBSOLETE size_t len; +// OBSOLETE +// OBSOLETE while (isspace (*s)) +// OBSOLETE s++; +// OBSOLETE +// OBSOLETE word = s; +// OBSOLETE +// OBSOLETE len = 0; +// OBSOLETE +// OBSOLETE while (*s && !isspace (*s)) +// OBSOLETE { +// OBSOLETE s++; +// OBSOLETE len++; +// OBSOLETE +// OBSOLETE } +// OBSOLETE copy = xmalloc (len + 1); +// OBSOLETE memcpy (copy, word, len); +// OBSOLETE copy[len] = 0; +// OBSOLETE *p = s; +// OBSOLETE return copy; +// OBSOLETE } +// OBSOLETE #endif +// OBSOLETE +// OBSOLETE static struct gr_settings bug_settings = +// OBSOLETE { +// OBSOLETE "Bug>", /* prompt */ +// OBSOLETE &bug_ops, /* ops */ +// OBSOLETE bug_clear_breakpoints, /* clear_all_breakpoints */ +// OBSOLETE gr_generic_checkin, /* checkin */ +// OBSOLETE }; +// OBSOLETE +// OBSOLETE static char *cpu_check_strings[] = +// OBSOLETE { +// OBSOLETE "=", +// OBSOLETE "Invalid Register", +// OBSOLETE }; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE bug_open (char *args, int from_tty) +// OBSOLETE { +// OBSOLETE if (args == NULL) +// OBSOLETE args = ""; +// OBSOLETE +// OBSOLETE gr_open (args, from_tty, &bug_settings); +// OBSOLETE /* decide *now* whether we are on an 88100 or an 88110 */ +// OBSOLETE sr_write_cr ("rs cr06"); +// OBSOLETE sr_expect ("rs cr06"); +// OBSOLETE +// OBSOLETE switch (gr_multi_scan (cpu_check_strings, 0)) +// OBSOLETE { +// OBSOLETE case 0: /* this is an m88100 */ +// OBSOLETE target_is_m88110 = 0; +// OBSOLETE break; +// OBSOLETE case 1: /* this is an m88110 */ +// OBSOLETE target_is_m88110 = 1; +// OBSOLETE break; +// OBSOLETE default: +// OBSOLETE internal_error (__FILE__, __LINE__, "failed internal consistency check"); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Tell the remote machine to resume. */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE bug_resume (ptid_t ptid, int step, enum target_signal sig) +// OBSOLETE { +// OBSOLETE if (step) +// OBSOLETE { +// OBSOLETE sr_write_cr ("t"); +// OBSOLETE +// OBSOLETE /* Force the next bug_wait to return a trap. Not doing anything +// OBSOLETE about I/O from the target means that the user has to type +// OBSOLETE "continue" to see any. FIXME, this should be fixed. */ +// OBSOLETE need_artificial_trap = 1; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE sr_write_cr ("g"); +// OBSOLETE +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Wait until the remote machine stops, then return, +// OBSOLETE storing status in STATUS just as `wait' would. */ +// OBSOLETE +// OBSOLETE static char *wait_strings[] = +// OBSOLETE { +// OBSOLETE "At Breakpoint", +// OBSOLETE "Exception: Data Access Fault (Local Bus Timeout)", +// OBSOLETE "\r8??\?-Bug>", /* The '\?' avoids creating a trigraph */ +// OBSOLETE "\r197-Bug>", +// OBSOLETE NULL, +// OBSOLETE }; +// OBSOLETE +// OBSOLETE ptid_t +// OBSOLETE bug_wait (ptid_t ptid, struct target_waitstatus *status) +// OBSOLETE { +// OBSOLETE int old_timeout = sr_get_timeout (); +// OBSOLETE int old_immediate_quit = immediate_quit; +// OBSOLETE +// OBSOLETE status->kind = TARGET_WAITKIND_EXITED; +// OBSOLETE status->value.integer = 0; +// OBSOLETE +// OBSOLETE /* read off leftovers from resume so that the rest can be passed +// OBSOLETE back out as stdout. */ +// OBSOLETE if (need_artificial_trap == 0) +// OBSOLETE { +// OBSOLETE sr_expect ("Effective address: "); +// OBSOLETE (void) sr_get_hex_word (); +// OBSOLETE sr_expect ("\r\n"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE sr_set_timeout (-1); /* Don't time out -- user program is running. */ +// OBSOLETE immediate_quit = 1; /* Helps ability to QUIT */ +// OBSOLETE +// OBSOLETE switch (gr_multi_scan (wait_strings, need_artificial_trap == 0)) +// OBSOLETE { +// OBSOLETE case 0: /* breakpoint case */ +// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; +// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; +// OBSOLETE /* user output from the target can be discarded here. (?) */ +// OBSOLETE gr_expect_prompt (); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 1: /* bus error */ +// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; +// OBSOLETE status->value.sig = TARGET_SIGNAL_BUS; +// OBSOLETE /* user output from the target can be discarded here. (?) */ +// OBSOLETE gr_expect_prompt (); +// OBSOLETE break; +// OBSOLETE +// OBSOLETE case 2: /* normal case */ +// OBSOLETE case 3: +// OBSOLETE if (need_artificial_trap != 0) +// OBSOLETE { +// OBSOLETE /* stepping */ +// OBSOLETE status->kind = TARGET_WAITKIND_STOPPED; +// OBSOLETE status->value.sig = TARGET_SIGNAL_TRAP; +// OBSOLETE need_artificial_trap--; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* exit case */ +// OBSOLETE status->kind = TARGET_WAITKIND_EXITED; +// OBSOLETE status->value.integer = 0; +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE case -1: /* trouble */ +// OBSOLETE default: +// OBSOLETE fprintf_filtered (gdb_stderr, +// OBSOLETE "Trouble reading target during wait\n"); +// OBSOLETE break; +// OBSOLETE } +// OBSOLETE +// OBSOLETE sr_set_timeout (old_timeout); +// OBSOLETE immediate_quit = old_immediate_quit; +// OBSOLETE return inferior_ptid; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Return the name of register number REGNO +// OBSOLETE in the form input and output by bug. +// OBSOLETE +// OBSOLETE Returns a pointer to a static buffer containing the answer. */ +// OBSOLETE static char * +// OBSOLETE get_reg_name (int regno) +// OBSOLETE { +// OBSOLETE static char *rn[] = +// OBSOLETE { +// OBSOLETE "r00", "r01", "r02", "r03", "r04", "r05", "r06", "r07", +// OBSOLETE "r08", "r09", "r10", "r11", "r12", "r13", "r14", "r15", +// OBSOLETE "r16", "r17", "r18", "r19", "r20", "r21", "r22", "r23", +// OBSOLETE "r24", "r25", "r26", "r27", "r28", "r29", "r30", "r31", +// OBSOLETE +// OBSOLETE /* these get confusing because we omit a few and switch some ordering around. */ +// OBSOLETE +// OBSOLETE "cr01", /* 32 = psr */ +// OBSOLETE "fcr62", /* 33 = fpsr */ +// OBSOLETE "fcr63", /* 34 = fpcr */ +// OBSOLETE "ip", /* this is something of a cheat. */ +// OBSOLETE /* 35 = sxip */ +// OBSOLETE "cr05", /* 36 = snip */ +// OBSOLETE "cr06", /* 37 = sfip */ +// OBSOLETE +// OBSOLETE "x00", "x01", "x02", "x03", "x04", "x05", "x06", "x07", +// OBSOLETE "x08", "x09", "x10", "x11", "x12", "x13", "x14", "x15", +// OBSOLETE "x16", "x17", "x18", "x19", "x20", "x21", "x22", "x23", +// OBSOLETE "x24", "x25", "x26", "x27", "x28", "x29", "x30", "x31", +// OBSOLETE }; +// OBSOLETE +// OBSOLETE return rn[regno]; +// OBSOLETE } +// OBSOLETE +// OBSOLETE #if 0 /* not currently used */ +// OBSOLETE /* Read from remote while the input matches STRING. Return zero on +// OBSOLETE success, -1 on failure. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE bug_scan (char *s) +// OBSOLETE { +// OBSOLETE int c; +// OBSOLETE +// OBSOLETE while (*s) +// OBSOLETE { +// OBSOLETE c = sr_readchar (); +// OBSOLETE if (c != *s++) +// OBSOLETE { +// OBSOLETE fflush (stdout); +// OBSOLETE printf ("\nNext character is '%c' - %d and s is \"%s\".\n", c, c, --s); +// OBSOLETE return (-1); +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE #endif /* never */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE bug_srec_write_cr (char *s) +// OBSOLETE { +// OBSOLETE char *p = s; +// OBSOLETE +// OBSOLETE if (srec_echo_pace) +// OBSOLETE for (p = s; *p; ++p) +// OBSOLETE { +// OBSOLETE if (sr_get_debug () > 0) +// OBSOLETE printf ("%c", *p); +// OBSOLETE +// OBSOLETE do +// OBSOLETE serial_write (sr_get_desc (), p, 1); +// OBSOLETE while (sr_pollchar () != *p); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE sr_write_cr (s); +// OBSOLETE /* return(bug_scan (s) || bug_scan ("\n")); */ +// OBSOLETE } +// OBSOLETE +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store register REGNO, or all if REGNO == -1. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE bug_fetch_register (int regno) +// OBSOLETE { +// OBSOLETE sr_check_open (); +// OBSOLETE +// OBSOLETE if (regno == -1) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE for (i = 0; i < NUM_REGS; ++i) +// OBSOLETE bug_fetch_register (i); +// OBSOLETE } +// OBSOLETE else if (target_is_m88110 && regno == SFIP_REGNUM) +// OBSOLETE { +// OBSOLETE /* m88110 has no sfip. */ +// OBSOLETE long l = 0; +// OBSOLETE supply_register (regno, (char *) &l); +// OBSOLETE } +// OBSOLETE else if (regno < XFP_REGNUM) +// OBSOLETE { +// OBSOLETE char buffer[MAX_REGISTER_RAW_SIZE]; +// OBSOLETE +// OBSOLETE sr_write ("rs ", 3); +// OBSOLETE sr_write_cr (get_reg_name (regno)); +// OBSOLETE sr_expect ("="); +// OBSOLETE store_unsigned_integer (buffer, REGISTER_RAW_SIZE (regno), +// OBSOLETE sr_get_hex_word ()); +// OBSOLETE gr_expect_prompt (); +// OBSOLETE supply_register (regno, buffer); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE /* Float register so we need to parse a strange data format. */ +// OBSOLETE long p; +// OBSOLETE unsigned char fpreg_buf[10]; +// OBSOLETE +// OBSOLETE sr_write ("rs ", 3); +// OBSOLETE sr_write (get_reg_name (regno), strlen (get_reg_name (regno))); +// OBSOLETE sr_write_cr (";d"); +// OBSOLETE sr_expect ("rs"); +// OBSOLETE sr_expect (get_reg_name (regno)); +// OBSOLETE sr_expect (";d"); +// OBSOLETE sr_expect ("="); +// OBSOLETE +// OBSOLETE /* sign */ +// OBSOLETE p = sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[0] = p << 7; +// OBSOLETE +// OBSOLETE /* exponent */ +// OBSOLETE sr_expect ("_"); +// OBSOLETE p = sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[0] += (p << 4); +// OBSOLETE fpreg_buf[0] += sr_get_hex_digit (1); +// OBSOLETE +// OBSOLETE fpreg_buf[1] = sr_get_hex_digit (1) << 4; +// OBSOLETE +// OBSOLETE /* fraction */ +// OBSOLETE sr_expect ("_"); +// OBSOLETE fpreg_buf[1] += sr_get_hex_digit (1); +// OBSOLETE +// OBSOLETE fpreg_buf[2] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[3] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[4] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[5] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[6] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[7] = (sr_get_hex_digit (1) << 4) + sr_get_hex_digit (1); +// OBSOLETE fpreg_buf[8] = 0; +// OBSOLETE fpreg_buf[9] = 0; +// OBSOLETE +// OBSOLETE gr_expect_prompt (); +// OBSOLETE supply_register (regno, fpreg_buf); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Store register REGNO, or all if REGNO == -1. */ +// OBSOLETE +// OBSOLETE static void +// OBSOLETE bug_store_register (int regno) +// OBSOLETE { +// OBSOLETE char buffer[1024]; +// OBSOLETE sr_check_open (); +// OBSOLETE +// OBSOLETE if (regno == -1) +// OBSOLETE { +// OBSOLETE int i; +// OBSOLETE +// OBSOLETE for (i = 0; i < NUM_REGS; ++i) +// OBSOLETE bug_store_register (i); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE char *regname; +// OBSOLETE +// OBSOLETE regname = get_reg_name (regno); +// OBSOLETE +// OBSOLETE if (target_is_m88110 && regno == SFIP_REGNUM) +// OBSOLETE return; +// OBSOLETE else if (regno < XFP_REGNUM) +// OBSOLETE sprintf (buffer, "rs %s %08lx", +// OBSOLETE regname, +// OBSOLETE (long) read_register (regno)); +// OBSOLETE else +// OBSOLETE { +// OBSOLETE unsigned char *fpreg_buf = +// OBSOLETE (unsigned char *) ®isters[REGISTER_BYTE (regno)]; +// OBSOLETE +// OBSOLETE sprintf (buffer, "rs %s %1x_%02x%1x_%1x%02x%02x%02x%02x%02x%02x;d", +// OBSOLETE regname, +// OBSOLETE /* sign */ +// OBSOLETE (fpreg_buf[0] >> 7) & 0xf, +// OBSOLETE /* exponent */ +// OBSOLETE fpreg_buf[0] & 0x7f, +// OBSOLETE (fpreg_buf[1] >> 8) & 0xf, +// OBSOLETE /* fraction */ +// OBSOLETE fpreg_buf[1] & 0xf, +// OBSOLETE fpreg_buf[2], +// OBSOLETE fpreg_buf[3], +// OBSOLETE fpreg_buf[4], +// OBSOLETE fpreg_buf[5], +// OBSOLETE fpreg_buf[6], +// OBSOLETE fpreg_buf[7]); +// OBSOLETE } +// OBSOLETE +// OBSOLETE sr_write_cr (buffer); +// OBSOLETE gr_expect_prompt (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Transfer LEN bytes between GDB address MYADDR and target address +// OBSOLETE MEMADDR. If WRITE is non-zero, transfer them to the target, +// OBSOLETE otherwise transfer them from the target. TARGET is unused. +// OBSOLETE +// OBSOLETE Returns the number of bytes transferred. */ +// OBSOLETE +// OBSOLETE int +// OBSOLETE bug_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len, int write, +// OBSOLETE struct mem_attrib *attrib, struct target_ops *target) +// OBSOLETE { +// OBSOLETE int res; +// OBSOLETE +// OBSOLETE if (len <= 0) +// OBSOLETE return 0; +// OBSOLETE +// OBSOLETE if (write) +// OBSOLETE res = bug_write_memory (memaddr, myaddr, len); +// OBSOLETE else +// OBSOLETE res = bug_read_memory (memaddr, myaddr, len); +// OBSOLETE +// OBSOLETE return res; +// OBSOLETE } +// OBSOLETE +// OBSOLETE static void +// OBSOLETE start_load (void) +// OBSOLETE { +// OBSOLETE char *command; +// OBSOLETE +// OBSOLETE command = (srec_echo_pace ? "lo 0 ;x" : "lo 0"); +// OBSOLETE +// OBSOLETE sr_write_cr (command); +// OBSOLETE sr_expect (command); +// OBSOLETE sr_expect ("\r\n"); +// OBSOLETE bug_srec_write_cr ("S0030000FC"); +// OBSOLETE return; +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* This is an extremely vulnerable and fragile function. I've made +// OBSOLETE considerable attempts to make this deterministic, but I've +// OBSOLETE certainly forgotten something. The trouble is that S-records are +// OBSOLETE only a partial file format, not a protocol. Worse, apparently the +// OBSOLETE m88k bug monitor does not run in real time while receiving +// OBSOLETE S-records. Hence, we must pay excruciating attention to when and +// OBSOLETE where error messages are returned, and what has actually been sent. +// OBSOLETE +// OBSOLETE Each call represents a chunk of memory to be sent to the target. +// OBSOLETE We break that chunk into an S0 header record, some number of S3 +// OBSOLETE data records each containing srec_bytes, and an S7 termination +// OBSOLETE record. */ +// OBSOLETE +// OBSOLETE static char *srecord_strings[] = +// OBSOLETE { +// OBSOLETE "S-RECORD", +// OBSOLETE "-Bug>", +// OBSOLETE NULL, +// OBSOLETE }; +// OBSOLETE +// OBSOLETE static int +// OBSOLETE bug_write_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) +// OBSOLETE { +// OBSOLETE int done; +// OBSOLETE int checksum; +// OBSOLETE int x; +// OBSOLETE int retries; +// OBSOLETE char *buffer = alloca ((srec_bytes + 8) << 1); +// OBSOLETE +// OBSOLETE retries = 0; +// OBSOLETE +// OBSOLETE do +// OBSOLETE { +// OBSOLETE done = 0; +// OBSOLETE +// OBSOLETE if (retries > srec_max_retries) +// OBSOLETE return (-1); +// OBSOLETE +// OBSOLETE if (retries > 0) +// OBSOLETE { +// OBSOLETE if (sr_get_debug () > 0) +// OBSOLETE printf ("\n<retrying...>\n"); +// OBSOLETE +// OBSOLETE /* This gr_expect_prompt call is extremely important. Without +// OBSOLETE it, we will tend to resend our packet so fast that it +// OBSOLETE will arrive before the bug monitor is ready to receive +// OBSOLETE it. This would lead to a very ugly resend loop. */ +// OBSOLETE +// OBSOLETE gr_expect_prompt (); +// OBSOLETE } +// OBSOLETE +// OBSOLETE start_load (); +// OBSOLETE +// OBSOLETE while (done < len) +// OBSOLETE { +// OBSOLETE int thisgo; +// OBSOLETE int idx; +// OBSOLETE char *buf = buffer; +// OBSOLETE CORE_ADDR address; +// OBSOLETE +// OBSOLETE checksum = 0; +// OBSOLETE thisgo = len - done; +// OBSOLETE if (thisgo > srec_bytes) +// OBSOLETE thisgo = srec_bytes; +// OBSOLETE +// OBSOLETE address = memaddr + done; +// OBSOLETE sprintf (buf, "S3%02X%08lX", thisgo + 4 + 1, (long) address); +// OBSOLETE buf += 12; +// OBSOLETE +// OBSOLETE checksum += (thisgo + 4 + 1 +// OBSOLETE + (address & 0xff) +// OBSOLETE + ((address >> 8) & 0xff) +// OBSOLETE + ((address >> 16) & 0xff) +// OBSOLETE + ((address >> 24) & 0xff)); +// OBSOLETE +// OBSOLETE for (idx = 0; idx < thisgo; idx++) +// OBSOLETE { +// OBSOLETE sprintf (buf, "%02X", myaddr[idx + done]); +// OBSOLETE checksum += myaddr[idx + done]; +// OBSOLETE buf += 2; +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (srec_noise > 0) +// OBSOLETE { +// OBSOLETE /* FIXME-NOW: insert a deliberate error every now and then. +// OBSOLETE This is intended for testing/debugging the error handling +// OBSOLETE stuff. */ +// OBSOLETE static int counter = 0; +// OBSOLETE if (++counter > srec_noise) +// OBSOLETE { +// OBSOLETE counter = 0; +// OBSOLETE ++checksum; +// OBSOLETE } +// OBSOLETE } +// OBSOLETE +// OBSOLETE sprintf (buf, "%02X", ~checksum & 0xff); +// OBSOLETE bug_srec_write_cr (buffer); +// OBSOLETE +// OBSOLETE if (srec_sleep != 0) +// OBSOLETE sleep (srec_sleep); +// OBSOLETE +// OBSOLETE /* This pollchar is probably redundant to the gr_multi_scan +// OBSOLETE below. Trouble is, we can't be sure when or where an +// OBSOLETE error message will appear. Apparently, when running at +// OBSOLETE full speed from a typical sun4, error messages tend to +// OBSOLETE appear to arrive only *after* the s7 record. */ +// OBSOLETE +// OBSOLETE if ((x = sr_pollchar ()) != 0) +// OBSOLETE { +// OBSOLETE if (sr_get_debug () > 0) +// OBSOLETE printf ("\n<retrying...>\n"); +// OBSOLETE +// OBSOLETE ++retries; +// OBSOLETE +// OBSOLETE /* flush any remaining input and verify that we are back +// OBSOLETE at the prompt level. */ +// OBSOLETE gr_expect_prompt (); +// OBSOLETE /* start all over again. */ +// OBSOLETE start_load (); +// OBSOLETE done = 0; +// OBSOLETE continue; +// OBSOLETE } +// OBSOLETE +// OBSOLETE done += thisgo; +// OBSOLETE } +// OBSOLETE +// OBSOLETE bug_srec_write_cr ("S7060000000000F9"); +// OBSOLETE ++retries; +// OBSOLETE +// OBSOLETE /* Having finished the load, we need to figure out whether we +// OBSOLETE had any errors. */ +// OBSOLETE } +// OBSOLETE while (gr_multi_scan (srecord_strings, 0) == 0);; +// OBSOLETE +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Copy LEN bytes of data from debugger memory at MYADDR +// OBSOLETE to inferior's memory at MEMADDR. Returns errno value. +// OBSOLETE * sb/sh instructions don't work on unaligned addresses, when TU=1. +// OBSOLETE */ +// OBSOLETE +// OBSOLETE /* Read LEN bytes from inferior memory at MEMADDR. Put the result +// OBSOLETE at debugger address MYADDR. Returns errno value. */ +// OBSOLETE static int +// OBSOLETE bug_read_memory (CORE_ADDR memaddr, unsigned char *myaddr, int len) +// OBSOLETE { +// OBSOLETE char request[100]; +// OBSOLETE char *buffer; +// OBSOLETE char *p; +// OBSOLETE char type; +// OBSOLETE char size; +// OBSOLETE unsigned char c; +// OBSOLETE unsigned int inaddr; +// OBSOLETE unsigned int checksum; +// OBSOLETE +// OBSOLETE sprintf (request, "du 0 %lx:&%d", (long) memaddr, len); +// OBSOLETE sr_write_cr (request); +// OBSOLETE +// OBSOLETE p = buffer = alloca (len); +// OBSOLETE +// OBSOLETE /* scan up through the header */ +// OBSOLETE sr_expect ("S0030000FC"); +// OBSOLETE +// OBSOLETE while (p < buffer + len) +// OBSOLETE { +// OBSOLETE /* scan off any white space. */ +// OBSOLETE while (sr_readchar () != 'S');; +// OBSOLETE +// OBSOLETE /* what kind of s-rec? */ +// OBSOLETE type = sr_readchar (); +// OBSOLETE +// OBSOLETE /* scan record size */ +// OBSOLETE sr_get_hex_byte (&size); +// OBSOLETE checksum = size; +// OBSOLETE --size; +// OBSOLETE inaddr = 0; +// OBSOLETE +// OBSOLETE switch (type) +// OBSOLETE { +// OBSOLETE case '7': +// OBSOLETE case '8': +// OBSOLETE case '9': +// OBSOLETE goto done; +// OBSOLETE +// OBSOLETE case '3': +// OBSOLETE sr_get_hex_byte (&c); +// OBSOLETE inaddr = (inaddr << 8) + c; +// OBSOLETE checksum += c; +// OBSOLETE --size; +// OBSOLETE /* intentional fall through */ +// OBSOLETE case '2': +// OBSOLETE sr_get_hex_byte (&c); +// OBSOLETE inaddr = (inaddr << 8) + c; +// OBSOLETE checksum += c; +// OBSOLETE --size; +// OBSOLETE /* intentional fall through */ +// OBSOLETE case '1': +// OBSOLETE sr_get_hex_byte (&c); +// OBSOLETE inaddr = (inaddr << 8) + c; +// OBSOLETE checksum += c; +// OBSOLETE --size; +// OBSOLETE sr_get_hex_byte (&c); +// OBSOLETE inaddr = (inaddr << 8) + c; +// OBSOLETE checksum += c; +// OBSOLETE --size; +// OBSOLETE break; +// OBSOLETE +// OBSOLETE default: +// OBSOLETE /* bonk */ +// OBSOLETE error ("reading s-records."); +// OBSOLETE } +// OBSOLETE +// OBSOLETE if (inaddr < memaddr +// OBSOLETE || (memaddr + len) < (inaddr + size)) +// OBSOLETE error ("srec out of memory range."); +// OBSOLETE +// OBSOLETE if (p != buffer + inaddr - memaddr) +// OBSOLETE error ("srec out of sequence."); +// OBSOLETE +// OBSOLETE for (; size; --size, ++p) +// OBSOLETE { +// OBSOLETE sr_get_hex_byte (p); +// OBSOLETE checksum += *p; +// OBSOLETE } +// OBSOLETE +// OBSOLETE sr_get_hex_byte (&c); +// OBSOLETE if (c != (~checksum & 0xff)) +// OBSOLETE error ("bad s-rec checksum"); +// OBSOLETE } +// OBSOLETE +// OBSOLETE done: +// OBSOLETE gr_expect_prompt (); +// OBSOLETE if (p != buffer + len) +// OBSOLETE return (1); +// OBSOLETE +// OBSOLETE memcpy (myaddr, buffer, len); +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE #define MAX_BREAKS 16 +// OBSOLETE static int num_brkpts = 0; +// OBSOLETE +// OBSOLETE /* Insert a breakpoint at ADDR. SAVE is normally the address of the +// OBSOLETE pattern buffer where the instruction that the breakpoint overwrites +// OBSOLETE is saved. It is unused here since the bug is responsible for +// OBSOLETE saving/restoring the original instruction. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE bug_insert_breakpoint (CORE_ADDR addr, char *save) +// OBSOLETE { +// OBSOLETE sr_check_open (); +// OBSOLETE +// OBSOLETE if (num_brkpts < MAX_BREAKS) +// OBSOLETE { +// OBSOLETE char buffer[100]; +// OBSOLETE +// OBSOLETE num_brkpts++; +// OBSOLETE sprintf (buffer, "br %lx", (long) addr); +// OBSOLETE sr_write_cr (buffer); +// OBSOLETE gr_expect_prompt (); +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE else +// OBSOLETE { +// OBSOLETE fprintf_filtered (gdb_stderr, +// OBSOLETE "Too many break points, break point not installed\n"); +// OBSOLETE return (1); +// OBSOLETE } +// OBSOLETE +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Remove a breakpoint at ADDR. SAVE is normally the previously +// OBSOLETE saved pattern, but is unused here since the bug is responsible +// OBSOLETE for saving/restoring instructions. */ +// OBSOLETE +// OBSOLETE static int +// OBSOLETE bug_remove_breakpoint (CORE_ADDR addr, char *save) +// OBSOLETE { +// OBSOLETE if (num_brkpts > 0) +// OBSOLETE { +// OBSOLETE char buffer[100]; +// OBSOLETE +// OBSOLETE num_brkpts--; +// OBSOLETE sprintf (buffer, "nobr %lx", (long) addr); +// OBSOLETE sr_write_cr (buffer); +// OBSOLETE gr_expect_prompt (); +// OBSOLETE +// OBSOLETE } +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE /* Clear the bugs notion of what the break points are */ +// OBSOLETE static int +// OBSOLETE bug_clear_breakpoints (void) +// OBSOLETE { +// OBSOLETE +// OBSOLETE if (sr_is_open ()) +// OBSOLETE { +// OBSOLETE sr_write_cr ("nobr"); +// OBSOLETE sr_expect ("nobr"); +// OBSOLETE gr_expect_prompt (); +// OBSOLETE } +// OBSOLETE num_brkpts = 0; +// OBSOLETE return (0); +// OBSOLETE } +// OBSOLETE +// OBSOLETE struct target_ops bug_ops; +// OBSOLETE +// OBSOLETE static void +// OBSOLETE init_bug_ops (void) +// OBSOLETE { +// OBSOLETE bug_ops.to_shortname = "bug"; +// OBSOLETE "Remote BUG monitor", +// OBSOLETE bug_ops.to_longname = "Use the mvme187 board running the BUG monitor connected by a serial line."; +// OBSOLETE bug_ops.to_doc = " "; +// OBSOLETE bug_ops.to_open = bug_open; +// OBSOLETE bug_ops.to_close = gr_close; +// OBSOLETE bug_ops.to_attach = 0; +// OBSOLETE bug_ops.to_post_attach = NULL; +// OBSOLETE bug_ops.to_require_attach = NULL; +// OBSOLETE bug_ops.to_detach = gr_detach; +// OBSOLETE bug_ops.to_require_detach = NULL; +// OBSOLETE bug_ops.to_resume = bug_resume; +// OBSOLETE bug_ops.to_wait = bug_wait; +// OBSOLETE bug_ops.to_post_wait = NULL; +// OBSOLETE bug_ops.to_fetch_registers = bug_fetch_register; +// OBSOLETE bug_ops.to_store_registers = bug_store_register; +// OBSOLETE bug_ops.to_prepare_to_store = gr_prepare_to_store; +// OBSOLETE bug_ops.to_xfer_memory = bug_xfer_memory; +// OBSOLETE bug_ops.to_files_info = gr_files_info; +// OBSOLETE bug_ops.to_insert_breakpoint = bug_insert_breakpoint; +// OBSOLETE bug_ops.to_remove_breakpoint = bug_remove_breakpoint; +// OBSOLETE bug_ops.to_terminal_init = 0; +// OBSOLETE bug_ops.to_terminal_inferior = 0; +// OBSOLETE bug_ops.to_terminal_ours_for_output = 0; +// OBSOLETE bug_ops.to_terminal_ours = 0; +// OBSOLETE bug_ops.to_terminal_info = 0; +// OBSOLETE bug_ops.to_kill = gr_kill; +// OBSOLETE bug_ops.to_load = bug_load; +// OBSOLETE bug_ops.to_lookup_symbol = 0; +// OBSOLETE bug_ops.to_create_inferior = gr_create_inferior; +// OBSOLETE bug_ops.to_post_startup_inferior = NULL; +// OBSOLETE bug_ops.to_acknowledge_created_inferior = NULL; +// OBSOLETE bug_ops.to_clone_and_follow_inferior = NULL; +// OBSOLETE bug_ops.to_post_follow_inferior_by_clone = NULL; +// OBSOLETE bug_ops.to_insert_fork_catchpoint = NULL; +// OBSOLETE bug_ops.to_remove_fork_catchpoint = NULL; +// OBSOLETE bug_ops.to_insert_vfork_catchpoint = NULL; +// OBSOLETE bug_ops.to_remove_vfork_catchpoint = NULL; +// OBSOLETE bug_ops.to_has_forked = NULL; +// OBSOLETE bug_ops.to_has_vforked = NULL; +// OBSOLETE bug_ops.to_can_follow_vfork_prior_to_exec = NULL; +// OBSOLETE bug_ops.to_post_follow_vfork = NULL; +// OBSOLETE bug_ops.to_insert_exec_catchpoint = NULL; +// OBSOLETE bug_ops.to_remove_exec_catchpoint = NULL; +// OBSOLETE bug_ops.to_has_execd = NULL; +// OBSOLETE bug_ops.to_reported_exec_events_per_exec_call = NULL; +// OBSOLETE bug_ops.to_has_exited = NULL; +// OBSOLETE bug_ops.to_mourn_inferior = gr_mourn; +// OBSOLETE bug_ops.to_can_run = 0; +// OBSOLETE bug_ops.to_notice_signals = 0; +// OBSOLETE bug_ops.to_thread_alive = 0; +// OBSOLETE bug_ops.to_stop = 0; +// OBSOLETE bug_ops.to_pid_to_exec_file = NULL; +// OBSOLETE bug_ops.to_stratum = process_stratum; +// OBSOLETE bug_ops.DONT_USE = 0; +// OBSOLETE bug_ops.to_has_all_memory = 1; +// OBSOLETE bug_ops.to_has_memory = 1; +// OBSOLETE bug_ops.to_has_stack = 1; +// OBSOLETE bug_ops.to_has_registers = 0; +// OBSOLETE bug_ops.to_has_execution = 0; +// OBSOLETE bug_ops.to_sections = 0; +// OBSOLETE bug_ops.to_sections_end = 0; +// OBSOLETE bug_ops.to_magic = OPS_MAGIC; /* Always the last thing */ +// OBSOLETE } /* init_bug_ops */ +// OBSOLETE +// OBSOLETE void +// OBSOLETE _initialize_remote_bug (void) +// OBSOLETE { +// OBSOLETE init_bug_ops (); +// OBSOLETE add_target (&bug_ops); +// OBSOLETE +// OBSOLETE add_show_from_set +// OBSOLETE (add_set_cmd ("srec-bytes", class_support, var_uinteger, +// OBSOLETE (char *) &srec_bytes, +// OBSOLETE "\ +// OBSOLETE Set the number of bytes represented in each S-record.\n\ +// OBSOLETE This affects the communication protocol with the remote target.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set +// OBSOLETE (add_set_cmd ("srec-max-retries", class_support, var_uinteger, +// OBSOLETE (char *) &srec_max_retries, +// OBSOLETE "\ +// OBSOLETE Set the number of retries for shipping S-records.\n\ +// OBSOLETE This affects the communication protocol with the remote target.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE #if 0 +// OBSOLETE /* This needs to set SREC_SIZE, not srec_frame which gets changed at the +// OBSOLETE end of a download. But do we need the option at all? */ +// OBSOLETE add_show_from_set +// OBSOLETE (add_set_cmd ("srec-frame", class_support, var_uinteger, +// OBSOLETE (char *) &srec_frame, +// OBSOLETE "\ +// OBSOLETE Set the number of bytes in an S-record frame.\n\ +// OBSOLETE This affects the communication protocol with the remote target.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE #endif /* 0 */ +// OBSOLETE +// OBSOLETE add_show_from_set +// OBSOLETE (add_set_cmd ("srec-noise", class_support, var_zinteger, +// OBSOLETE (char *) &srec_noise, +// OBSOLETE "\ +// OBSOLETE Set number of S-record to send before deliberately flubbing a checksum.\n\ +// OBSOLETE Zero means flub none at all. This affects the communication protocol\n\ +// OBSOLETE with the remote target.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set +// OBSOLETE (add_set_cmd ("srec-sleep", class_support, var_zinteger, +// OBSOLETE (char *) &srec_sleep, +// OBSOLETE "\ +// OBSOLETE Set number of seconds to sleep after an S-record for a possible error message to arrive.\n\ +// OBSOLETE This affects the communication protocol with the remote target.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE +// OBSOLETE add_show_from_set +// OBSOLETE (add_set_cmd ("srec-echo-pace", class_support, var_boolean, +// OBSOLETE (char *) &srec_echo_pace, +// OBSOLETE "\ +// OBSOLETE Set echo-verification.\n\ +// OBSOLETE When on, use verification by echo when downloading S-records. This is\n\ +// OBSOLETE much slower, but generally more reliable.", +// OBSOLETE &setlist), +// OBSOLETE &showlist); +// OBSOLETE } |