* breakpoint.c (breakpoint_re_set): #ifdef GET_LONGJMP_TARGET
authorStu Grossman <grossman@cygnus>
Fri, 27 Oct 1995 17:48:36 +0000 (17:48 +0000)
committerStu Grossman <grossman@cygnus>
Fri, 27 Oct 1995 17:48:36 +0000 (17:48 +0000)
around calls to create_longjmp_breakpoint.  Why install the
breakpoints if we can't find the longjmp target?
* infrun.c (wait_for_inferior):  Cleanup comments near call test.
* remote-mips.c:  Fixed a bunch of prototypes to avoid char/int
complaint from picky compilers.  Add comment to mips_expect.
Replace all instances of sr_get_debug with remote_debug.
* (mips_readchar):  Don't jam init string to monitor.
mips_initialize() handles that.
* (mips_receive_header):  Print better message when we get too
much garbage.
* (mips_request):  Allow caller to pass in buff to allow them to
analyze the returned message.
* (mips_initialize):  Re-do initialization to try sending a BREAK,
a ^C, and then a download escape sequence.  Cleanup protocol
startup.  Eliminate sleeps.  Clear breakpoints (if using monitor
breakpoints).  Re-init frame.
* (mips_detach):  Close down target.
start-sanitize-gm
* (mips_resume):  Pass signal down to target.
* (mips_create_inferior):  Start target with TARGET_SIGNAL_PWR.
end-sanitize-gm
* (mips_wait):  Handle return status with registers, or breakpoint stuff.
* (mips_kill):  Add ^C handling.
* (mips_insert_breakpoint mips_remove_breakpoint):  Call new
breakpoint stuff if enabled.
* (calculate_mask remote_mips_set_watchpoint
remote_mips_remove_watchpoint remote_mips_stopped_by_watchpoint):
Hardware watchpoint/breakpoint stuff.
* (common_breakpoint):  Common code for new monitor breakpoint commands.
* (mips_load):  Don't use `prompt'.  It's a global variable.
* top.c (dont_repeat_command):  New command for use in
user-defined commands to suppress auto-repeat (by hittin return key).
start-sanitize-gm
* utils.c (request_quit):  Call target_kill here.  Good idea.
Needs a better implementation.
end-sanitize-gm
* valops.c:  Add start of auto function-call abandonment capability.

start-sanitize-gm
* c-exp.y:  Add code (currently disabled) to handle GM dynamic
structures (it conflicts with @!).
* eval.c (evaluate_subexp_standard):  ditto.
* expprint.c (print_subexp dump_expression):  ditto.
* expression.h (enum exp_opcode):  ditto.
* parse.c (length_of_subexp):  ditto.
* configure, configure.in:  Add mip*-*-magic* target.
* magic.c magic.h:  Special routines to handle GM stuff (like
stepping through dispatcher).
end-sanitize-gm

15 files changed:
gdb/.Sanitize
gdb/ChangeLog
gdb/breakpoint.c
gdb/c-exp.y
gdb/configure
gdb/configure.in
gdb/eval.c
gdb/expprint.c
gdb/expression.h
gdb/magic.c [new file with mode: 0644]
gdb/magic.h [new file with mode: 0644]
gdb/parse.c
gdb/remote-mips.c
gdb/top.c
gdb/utils.c

index b2c72a8..e34b586 100644 (file)
@@ -60,6 +60,20 @@ else
        fi
 fi
 
+gm_files="magic.c magic.h"
+
+if ( echo $* | grep keep\-gm > /dev/null ) ; then
+       keep_these_too="${gm_files} ${keep_these_too}"
+       if [ -n "${verbose}" ] ; then
+               echo Keeping ${gm_files}
+       fi
+else
+       lose_these_too="${gm_files} ${lose_these_too}"
+       if [ -n "${verbose}" ] ; then
+               echo Deleting ${gm_files}
+       fi
+fi
+
 # All files listed between the "Things-to-keep:" line and the
 # "Files-to-sed:" line will be kept.  All other files will be removed.
 # Directories listed in this section will have their own Sanitize
@@ -488,6 +502,33 @@ else
        done
 fi
 
+if ( echo $* | grep keep\-gm > /dev/null ) ; then
+       for i in * ; do
+               if test ! -d $i && (grep sanitize-gm $i > /dev/null) ; then
+                       if [ -n "${verbose}" ] ; then
+                               echo Keeping gm stuff in $i
+                       fi
+               fi
+       done
+else
+       for i in * ; do
+               if test ! -d $i && (grep sanitize-gm $i > /dev/null) ; then
+                       if [ -n "${verbose}" ] ; then
+                               echo Removing traces of \"gm\" from $i...
+                       fi
+                       cp $i new
+                       sed '/start\-sanitize\-gm/,/end-\sanitize\-gm/d' < $i > new
+                       if [ -n "${safe}" -a ! -f .Recover/$i ] ; then
+                               if [ -n "${verbose}" ] ; then
+                                       echo Caching $i in .Recover...
+                               fi
+                               mv $i .Recover
+                       fi
+                       mv new $i
+               fi
+       done
+fi
+
 for i in * ; do
        if test ! -d $i && (grep sanitize $i > /dev/null) ; then
                echo '***' Some mentions of Sanitize are still left in $i! 1>&2
index 8b8b6b0..3bd54c5 100644 (file)
@@ -1,3 +1,56 @@
+Fri Oct 27 09:54:07 1995  Stu Grossman  (grossman@cygnus.com)
+
+       * breakpoint.c (breakpoint_re_set):  #ifdef GET_LONGJMP_TARGET
+       around calls to create_longjmp_breakpoint.  Why install the
+       breakpoints if we can't find the longjmp target?
+       * infrun.c (wait_for_inferior):  Cleanup comments near call test.
+       * remote-mips.c:  Fixed a bunch of prototypes to avoid char/int
+       complaint from picky compilers.  Add comment to mips_expect.
+       Replace all instances of sr_get_debug with remote_debug.
+       * (mips_readchar):  Don't jam init string to monitor.
+       mips_initialize() handles that.
+       * (mips_receive_header):  Print better message when we get too
+       much garbage.
+       * (mips_request):  Allow caller to pass in buff to allow them to
+       analyze the returned message.
+       * (mips_initialize):  Re-do initialization to try sending a BREAK,
+       a ^C, and then a download escape sequence.  Cleanup protocol
+       startup.  Eliminate sleeps.  Clear breakpoints (if using monitor
+       breakpoints).  Re-init frame.
+       * (mips_detach):  Close down target.
+start-sanitize-gm
+       * (mips_resume):  Pass signal down to target.
+       * (mips_create_inferior):  Start target with TARGET_SIGNAL_PWR.
+end-sanitize-gm
+       * (mips_wait):  Handle return status with registers, or breakpoint stuff.
+       * (mips_kill):  Add ^C handling.
+       * (mips_insert_breakpoint mips_remove_breakpoint):  Call new
+       breakpoint stuff if enabled.
+       * (calculate_mask remote_mips_set_watchpoint
+       remote_mips_remove_watchpoint remote_mips_stopped_by_watchpoint):
+       Hardware watchpoint/breakpoint stuff.
+       * (common_breakpoint):  Common code for new monitor breakpoint commands.
+       * (mips_load):  Don't use `prompt'.  It's a global variable.
+       * top.c (dont_repeat_command):  New command for use in
+       user-defined commands to suppress auto-repeat (by hittin return key).
+start-sanitize-gm
+       * utils.c (request_quit):  Call target_kill here.  Good idea.
+       Needs a better implementation.
+end-sanitize-gm
+       * valops.c:  Add start of auto function-call abandonment capability.
+
+start-sanitize-gm
+       * c-exp.y:  Add code (currently disabled) to handle GM dynamic
+       structures (it conflicts with @!).
+       * eval.c (evaluate_subexp_standard):  ditto.
+       * expprint.c (print_subexp dump_expression):  ditto.
+       * expression.h (enum exp_opcode):  ditto.
+       * parse.c (length_of_subexp):  ditto.
+       * configure, configure.in:  Add mip*-*-magic* target.
+       * magic.c magic.h:  Special routines to handle GM stuff (like
+       stepping through dispatcher).
+end-sanitize-gm
+
 Thu Oct 26 22:02:27 1995  Stan Shebs  <shebs@andros.cygnus.com>
 
        * mpw-config.in: Add support for PowerMac host, add beginnings
index 0b388ad..aebc62a 100644 (file)
@@ -16,7 +16,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include <ctype.h>
@@ -28,7 +28,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "gdbcore.h"
 #include "gdbcmd.h"
 #include "value.h"
-#include "ctype.h"
 #include "command.h"
 #include "inferior.h"
 #include "thread.h"
@@ -1953,7 +1952,7 @@ set_raw_breakpoint (sal)
 }
 
 static void
-create_longjmp_breakpoint(func_name)
+create_longjmp_breakpoint (func_name)
      char *func_name;
 {
   struct symtab_and_line sal;
@@ -1976,7 +1975,7 @@ create_longjmp_breakpoint(func_name)
   sal.symtab = NULL;
   sal.line = 0;
 
-  b = set_raw_breakpoint(sal);
+  b = set_raw_breakpoint (sal);
   if (!b) return;
 
   b->type = func_name != NULL ? bp_longjmp : bp_longjmp_resume;
@@ -3420,10 +3419,12 @@ breakpoint_re_set ()
   set_language (save_language);
   input_radix = save_input_radix;
 
-  create_longjmp_breakpoint("longjmp");
-  create_longjmp_breakpoint("_longjmp");
-  create_longjmp_breakpoint("siglongjmp");
-  create_longjmp_breakpoint(NULL);
+#ifdef GET_LONGJMP_TARGET
+  create_longjmp_breakpoint ("longjmp");
+  create_longjmp_breakpoint ("_longjmp");
+  create_longjmp_breakpoint ("siglongjmp");
+  create_longjmp_breakpoint (NULL);
+#endif
 
 #if 0
   /* Took this out (temporaliy at least), since it produces an extra 
index eae0794..21096e0 100644 (file)
@@ -294,6 +294,15 @@ exp        :       exp '.' name
                          write_exp_elt_opcode (STRUCTOP_STRUCT); }
        ;
 
+/* start-sanitize-gm
+Need to find a better way to do this...
+exp    :       exp '@' name
+                       { write_exp_elt_opcode (STRUCTOP_FIELD);
+                         write_exp_string ($3);
+                         write_exp_elt_opcode (STRUCTOP_FIELD);
+                       }
+ end-sanitize-gm */
+
 exp    :       exp '.' qualified_name
                        { /* exp.type::name becomes exp.*(&type::name) */
                          /* Note: this doesn't work if name is a
index 6be8cf9..78491b1 100755 (executable)
@@ -1,7 +1,7 @@
 #! /bin/sh
 
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.4 
+# Generated automatically using autoconf version 2.4.2 
 # Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
 #
 # This configure script is free software; the Free Software Foundation
@@ -39,6 +39,18 @@ target=NONE
 verbose=
 x_includes=NONE
 x_libraries=NONE
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datadir='${prefix}/share'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+libdir='${exec_prefix}/lib'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+infodir='${prefix}/info'
+mandir='${prefix}/man'
 
 # Initialize some other variables.
 subdirs=
@@ -63,9 +75,14 @@ do
 
   case "$ac_option" in
 
-  -build | --build | --buil | --bui | --bu | --b)
+  -bindir | --bindir | --bindi | --bind | --bin | --bi)
+    ac_prev=bindir ;;
+  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+    bindir="$ac_optarg" ;;
+
+  -build | --build | --buil | --bui | --bu)
     ac_prev=build ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*)
+  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
     build="$ac_optarg" ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
@@ -75,6 +92,12 @@ do
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
     cache_file="$ac_optarg" ;;
 
+  -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
+    ac_prev=datadir ;;
+  -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
+  | --da=*)
+    datadir="$ac_optarg" ;;
+
   -disable-* | --disable-*)
     ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
     # Reject names that are not valid shell variable names.
@@ -125,12 +148,26 @@ Configuration:
 Directory and file names:
   --prefix=PREFIX         install architecture-independent files in PREFIX
                           [$ac_default_prefix]
-  --exec-prefix=PREFIX    install architecture-dependent files in PREFIX
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
                           [same as prefix]
+  --bindir=DIR            user executables in DIR [EPREFIX/bin]
+  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
+  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
+  --datadir=DIR           read-only architecture-independent data in DIR [PREFIX/share]
+  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
+  --sharedstatedir=DIR    modifiable architecture-independent data in DIR [PREFIX/com]
+  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
+  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
+  --includedir=DIR        C header files in DIR [PREFIX/include]
+  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
+  --infodir=DIR           info documentation in DIR [PREFIX/info]
+  --mandir=DIR            man documentation in DIR [PREFIX/man]
   --srcdir=DIR            find the sources in DIR [configure dir or ..]
   --program-prefix=PREFIX prepend PREFIX to installed program names
   --program-suffix=SUFFIX append SUFFIX to installed program names
   --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+EOF
+    cat << EOF
 Host type:
   --build=BUILD           configure for building on BUILD [BUILD=HOST]
   --host=HOST             configure for HOST [guessed]
@@ -151,6 +188,44 @@ EOF
   -host=* | --host=* | --hos=* | --ho=*)
     host="$ac_optarg" ;;
 
+  -includedir | --includedir | --includedi | --included | --include \
+  | --includ | --inclu | --incl | --inc)
+    ac_prev=includedir ;;
+  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+  | --includ=* | --inclu=* | --incl=* | --inc=*)
+    includedir="$ac_optarg" ;;
+
+  -infodir | --infodir | --infodi | --infod | --info | --inf)
+    ac_prev=infodir ;;
+  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+    infodir="$ac_optarg" ;;
+
+  -libdir | --libdir | --libdi | --libd)
+    ac_prev=libdir ;;
+  -libdir=* | --libdir=* | --libdi=* | --libd=*)
+    libdir="$ac_optarg" ;;
+
+  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+  | --libexe | --libex | --libe)
+    ac_prev=libexecdir ;;
+  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+  | --libexe=* | --libex=* | --libe=*)
+    libexecdir="$ac_optarg" ;;
+
+  -localstatedir | --localstatedir | --localstatedi | --localstated \
+  | --localstate | --localstat | --localsta | --localst \
+  | --locals | --local | --loca | --loc | --lo)
+    ac_prev=localstatedir ;;
+  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+  | --localstate=* | --localstat=* | --localsta=* | --localst=* \
+  | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
+    localstatedir="$ac_optarg" ;;
+
+  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+    ac_prev=mandir ;;
+  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+    mandir="$ac_optarg" ;;
+
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
     with_fp=no ;;
@@ -163,6 +238,15 @@ EOF
   | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
     no_recursion=yes ;;
 
+  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+  | --oldin | --oldi | --old | --ol | --o)
+    ac_prev=oldincludedir ;;
+  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+    oldincludedir="$ac_optarg" ;;
+
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
@@ -203,6 +287,23 @@ EOF
   | -silent | --silent | --silen | --sile | --sil)
     silent=yes ;;
 
+  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+    ac_prev=sbindir ;;
+  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+  | --sbi=* | --sb=*)
+    sbindir="$ac_optarg" ;;
+
+  -sharedstatedir | --sharedstatedir | --sharedstatedi \
+  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+  | --sharedst | --shareds | --shared | --share | --shar \
+  | --sha | --sh)
+    ac_prev=sharedstatedir ;;
+  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+  | --sha=* | --sh=*)
+    sharedstatedir="$ac_optarg" ;;
+
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
@@ -213,6 +314,13 @@ EOF
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
     srcdir="$ac_optarg" ;;
 
+  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+  | --syscon | --sysco | --sysc | --sys | --sy)
+    ac_prev=sysconfdir ;;
+  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+    sysconfdir="$ac_optarg" ;;
+
   -target | --target | --targe | --targ | --tar | --ta | --t)
     ac_prev=target ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
@@ -222,7 +330,7 @@ EOF
     verbose=yes ;;
 
   -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.4"
+    echo "configure generated by autoconf version 2.4.2"
     exit 0 ;;
 
   -with-* | --with-*)
@@ -387,9 +495,12 @@ fi
 
 ac_ext=c
 # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
-ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
+ac_cpp='echo $CPP $CPPFLAGS 1>&5;
+$CPP $CPPFLAGS'
+ac_compile='echo ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5;
+${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5 2>&5'
+ac_link='echo ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5;
+${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5 2>&5'
 
 if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
   # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
@@ -416,7 +527,7 @@ else
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  for ac_dir in cc; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_prog_CC="gcc"
@@ -450,6 +561,7 @@ else
   ac_cv_prog_gcc=no
 fi
 fi
+
 echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 if test $ac_cv_prog_gcc = yes; then
   GCC=yes
@@ -467,7 +579,8 @@ fi
 rm -f conftest*
 
 fi
-    echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
+
+echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6
     if test $ac_cv_prog_gcc_g = yes; then
       CFLAGS="-g -O"
     else
@@ -494,7 +607,7 @@ else
   # On the NeXT, cc -E runs the code through the compiler's parser,
   # not just through cpp.
   cat > conftest.$ac_ext <<EOF
-#line 498 "configure"
+#line 611 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
@@ -508,7 +621,7 @@ else
   rm -rf conftest*
   CPP="${CC-cc} -E -traditional-cpp"
   cat > conftest.$ac_ext <<EOF
-#line 512 "configure"
+#line 625 "configure"
 #include "confdefs.h"
 #include <assert.h>
 Syntax Error
@@ -535,7 +648,7 @@ echo "$ac_t""$CPP" 1>&6
 
 echo $ac_n "checking for AIX""... $ac_c" 1>&6
 cat > conftest.$ac_ext <<EOF
-#line 539 "configure"
+#line 652 "configure"
 #include "confdefs.h"
 #ifdef _AIX
   yes
@@ -562,7 +675,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 566 "configure"
+#line 679 "configure"
 #include "confdefs.h"
 #include <minix/config.h>
 EOF
@@ -680,10 +793,17 @@ else
     esac
   done
   IFS="$ac_save_ifs"
-  # As a last resort, use the slow shell script.
-  test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh"
+
 fi
-  INSTALL="$ac_cv_path_install"
+  if test "${ac_cv_path_install+set}" = set; then
+    INSTALL="$ac_cv_path_install"
+  else
+    # As a last resort, use the slow shell script.  We don't cache a
+    # path for INSTALL within a source directory, because that will
+    # break other packages using the cache if that directory is
+    # removed, or if the path is relative.
+    INSTALL="$ac_install_sh"
+  fi
 fi
 echo "$ac_t""$INSTALL" 1>&6
 
@@ -703,7 +823,7 @@ else
   ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
 else
   IFS="${IFS=  }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-  for ac_dir in $PATH; do
+  for ac_dir in :; do
     test -z "$ac_dir" && ac_dir=.
     if test -f $ac_dir/$ac_word; then
       ac_cv_prog_RANLIB="ranlib"
@@ -887,7 +1007,7 @@ else
   ac_cv_c_cross=yes
 else
 cat > conftest.$ac_ext <<EOF
-#line 891 "configure"
+#line 1011 "configure"
 #include "confdefs.h"
 main(){return(0);}
 EOF
@@ -900,15 +1020,16 @@ fi
 fi
 rm -fr conftest*
 fi
-cross_compiling=$ac_cv_c_cross
+
 echo "$ac_t""$ac_cv_c_cross" 1>&6
+cross_compiling=$ac_cv_c_cross
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 912 "configure"
+#line 1033 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -930,7 +1051,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 934 "configure"
+#line 1055 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -948,7 +1069,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 952 "configure"
+#line 1073 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -969,7 +1090,7 @@ if test "$cross_compiling" = yes; then
   ac_cv_header_stdc=no
 else
 cat > conftest.$ac_ext <<EOF
-#line 973 "configure"
+#line 1094 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -990,6 +1111,7 @@ fi
 rm -fr conftest*
 fi
 fi
+
 echo "$ac_t""$ac_cv_header_stdc" 1>&6
 if test $ac_cv_header_stdc = yes; then
   cat >> confdefs.h <<\EOF
@@ -1006,7 +1128,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1010 "configure"
+#line 1132 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
@@ -1024,7 +1146,7 @@ rm -f conftest*
 fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'`
+    ac_tr_hdr=HAVE_`echo $ac_hdr | tr 'abcdedfghijklmnopqrstuvwxyz./\055' 'ABCDEDFGHIJKLMNOPQRSTUVWXYZ___'`
   cat >> confdefs.h <<EOF
 #define $ac_tr_hdr 1
 EOF
@@ -1039,7 +1161,7 @@ if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1043 "configure"
+#line 1165 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -1080,6 +1202,7 @@ fi
 rm -f conftest*
 
 fi
+
 echo "$ac_t""$ac_cv_header_stat_broken" 1>&6
 if test $ac_cv_header_stat_broken = yes; then
   cat >> confdefs.h <<\EOF
@@ -1097,7 +1220,7 @@ else
   ac_cv_func_mmap=no
 else
 cat > conftest.$ac_ext <<EOF
-#line 1101 "configure"
+#line 1224 "configure"
 #include "confdefs.h"
 
 /* Thanks to Mike Haertel and Jim Avera for this test. */
@@ -1181,6 +1304,7 @@ fi
 fi
 rm -fr conftest*
 fi
+
 echo "$ac_t""$ac_cv_func_mmap" 1>&6
 if test $ac_cv_func_mmap = yes; then
   cat >> confdefs.h <<\EOF
@@ -1195,8 +1319,8 @@ ENABLE_CLIBS=
 ENABLE_OBS=
 
 # Check whether --enable-netrom or --disable-netrom was given.
-enableval="$enable_netrom"
-if test -n "$enableval"; then
+if test "${enable_netrom+set}" = set; then
+  enableval="$enable_netrom"
   case "${enableval}" in
 yes)   enable_netrom=yes ;;
 no)    enable_netrom=no ;;
@@ -1213,8 +1337,8 @@ fi
 ENABLE_GDBTK=
 
 # Check whether --enable-gdbtk or --disable-gdbtk was given.
-enableval="$enable_gdbtk"
-if test -n "$enableval"; then
+if test "${enable_gdbtk+set}" = set; then
+  enableval="$enable_gdbtk"
   case "${enableval}" in
 yes)   enable_gdbtk=yes ;;
 no)    enable_gdbtk=no  ;;
@@ -1231,8 +1355,8 @@ if test "${enable_gdbtk}" = "yes"; then
 echo $ac_n "checking for X""... $ac_c" 1>&6
 
 # Check whether --with-x or --without-x was given.
-withval="$with_x"
-if test -n "$withval"; then
+if test "${with_x+set}" = set; then
+  withval="$with_x"
   :
 fi
 
@@ -1285,7 +1409,7 @@ test -z "$x_direct_test_library" && x_direct_test_library=Xt
 test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
 test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
 cat > conftest.$ac_ext <<EOF
-#line 1289 "configure"
+#line 1413 "configure"
 #include "confdefs.h"
 #include <$x_direct_test_include>
 EOF
@@ -1348,7 +1472,7 @@ rm -f conftest*
 ac_save_LIBS="$LIBS"
 LIBS="-l$x_direct_test_library $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1352 "configure"
+#line 1476 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1460,13 +1584,14 @@ else
   # libraries we check for below, so use a different variable.
   #  --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
   echo $ac_n "checking for -lICE""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_ICE'+set}'`\" = set"; then
+ac_lib_var=`echo ICE | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lICE  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1470 "configure"
+#line 1595 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1476,16 +1601,16 @@ IceConnectionNumber()
 EOF
 if eval $ac_link; then
   rm -rf conftest*
-  eval "ac_cv_lib_ICE=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
-  eval "ac_cv_lib_ICE=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'ICE`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
 else
@@ -1503,13 +1628,14 @@ fi
     # libraries were built with DECnet support.  And karl@cs.umb.edu says
     # the Alpha needs dnet_stub (dnet does not exist).
     echo $ac_n "checking for -ldnet""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_dnet'+set}'`\" = set"; then
+ac_lib_var=`echo dnet | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1513 "configure"
+#line 1639 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1519,16 +1645,16 @@ dnet_ntoa()
 EOF
 if eval $ac_link; then
   rm -rf conftest*
-  eval "ac_cv_lib_dnet=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
-  eval "ac_cv_lib_dnet=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'dnet`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
 else
@@ -1537,13 +1663,14 @@ fi
 
     if test $ac_cv_lib_dnet = no; then
       echo $ac_n "checking for -ldnet_stub""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_dnet_stub'+set}'`\" = set"; then
+ac_lib_var=`echo dnet_stub | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-ldnet_stub  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1547 "configure"
+#line 1674 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1553,16 +1680,16 @@ dnet_ntoa()
 EOF
 if eval $ac_link; then
   rm -rf conftest*
-  eval "ac_cv_lib_dnet_stub=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
-  eval "ac_cv_lib_dnet_stub=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'dnet_stub`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
 else
@@ -1576,13 +1703,14 @@ fi
     # Not sure which flavor of 386 UNIX this is, but it seems harmless to
     # check for it.
     echo $ac_n "checking for -lnsl""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_nsl'+set}'`\" = set"; then
+ac_lib_var=`echo nsl | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lnsl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1586 "configure"
+#line 1714 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1592,16 +1720,16 @@ t_accept()
 EOF
 if eval $ac_link; then
   rm -rf conftest*
-  eval "ac_cv_lib_nsl=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
-  eval "ac_cv_lib_nsl=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'nsl`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
 else
@@ -1614,13 +1742,14 @@ fi
     # But -lsocket is broken on IRIX, according to simon@lia.di.epfl.ch.
     if test "`(uname) 2>/dev/null`" != IRIX; then
       echo $ac_n "checking for -lsocket""... $ac_c" 1>&6
-if eval "test \"`echo '$''{'ac_cv_lib_socket'+set}'`\" = set"; then
+ac_lib_var=`echo socket | tr '+./' 'p__'`
+if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   ac_save_LIBS="$LIBS"
 LIBS="-lsocket  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 1624 "configure"
+#line 1753 "configure"
 #include "confdefs.h"
 
 int main() { return 0; }
@@ -1630,16 +1759,16 @@ socket()
 EOF
 if eval $ac_link; then
   rm -rf conftest*
-  eval "ac_cv_lib_socket=yes"
+  eval "ac_cv_lib_$ac_lib_var=yes"
 else
   rm -rf conftest*
-  eval "ac_cv_lib_socket=no"
+  eval "ac_cv_lib_$ac_lib_var=no"
 fi
 rm -f conftest*
 LIBS="$ac_save_LIBS"
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'socket`\" = yes"; then
+if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   X_EXTRA_LIBS="$X_EXTRA_LIBS -lsocket"
 else
@@ -1677,7 +1806,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1681 "configure"
+#line 1810 "configure"
 #include "confdefs.h"
 #include <tk.h>
 EOF
@@ -1779,7 +1908,7 @@ if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 1783 "configure"
+#line 1912 "configure"
 #include "confdefs.h"
 #include <tclInt.h>
 EOF
@@ -2207,6 +2336,9 @@ mips64*el-*-elf*) gdb_target=idtl64 ;;
 mips64*-*-elf*)                gdb_target=idt64 ;;
 mips*el-*-ecoff*)      gdb_target=idtl ;;
 mips*-*-ecoff*)                gdb_target=idt ;;
+# start-sanitize-gm
+mips*-*-magic*)                gdb_target=magic ;;
+# end-sanitize-gm
 mips*el-*-elf*)                gdb_target=idtl ;;
 mips*-*-elf*)          gdb_target=idt ;;
 mips*-little-*)                gdb_target=littlemips ;;
@@ -2435,7 +2567,7 @@ do
     echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
     exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
   -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.4"
+    echo "$CONFIG_STATUS generated by autoconf version 2.4.2"
     exit 0 ;;
   -help | --help | --hel | --he | --h)
     echo "\$ac_cs_usage"; exit 0 ;;
@@ -2462,6 +2594,18 @@ s%@LIBS@%$LIBS%g
 s%@exec_prefix@%$exec_prefix%g
 s%@prefix@%$prefix%g
 s%@program_transform_name@%$program_transform_name%g
+s%@bindir@%$bindir%g
+s%@sbindir@%$sbindir%g
+s%@libexecdir@%$libexecdir%g
+s%@datadir@%$datadir%g
+s%@sysconfdir@%$sysconfdir%g
+s%@sharedstatedir@%$sharedstatedir%g
+s%@localstatedir@%$localstatedir%g
+s%@libdir@%$libdir%g
+s%@includedir@%$includedir%g
+s%@oldincludedir@%$oldincludedir%g
+s%@infodir@%$infodir%g
+s%@mandir@%$mandir%g
 s%@CC@%$CC%g
 s%@CPP@%$CPP%g
 s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
index fbe72df..38114d1 100644 (file)
@@ -417,6 +417,9 @@ mips64*el-*-elf*)   gdb_target=idtl64 ;;
 mips64*-*-elf*)                gdb_target=idt64 ;;
 mips*el-*-ecoff*)      gdb_target=idtl ;;
 mips*-*-ecoff*)                gdb_target=idt ;;
+# start-sanitize-gm
+mips*-*-magic*)                gdb_target=magic ;;
+# end-sanitize-gm
 mips*el-*-elf*)                gdb_target=idtl ;;
 mips*-*-elf*)          gdb_target=idt ;;
 mips*-little-*)                gdb_target=littlemips ;;
index 9bc898c..0e24041 100644 (file)
@@ -29,6 +29,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 #include "demangle.h"
 #include "language.h"  /* For CAST_IS_CONVERSION */
 #include "f-lang.h"    /* for array bound stuff */
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+#include "magic.h"
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
 
 /* Prototypes for local functions. */
 
@@ -839,6 +844,36 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
                                   NULL, "structure pointer");
        }
 
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+    case STRUCTOP_FIELD:
+      tem = longest_to_int (exp->elts[pc + 1].longconst);
+      (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
+      arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+      if (noside == EVAL_SKIP)
+       goto nosideret;
+      {
+       CORE_ADDR object = value_as_long (arg1);
+       struct type *type = type_of_object (object);
+
+       if (noside == EVAL_AVOID_SIDE_EFFECTS)
+         return value_zero (lookup_struct_elt_type (type,
+                                                    &exp->elts[pc + 2].string,
+                                                    0),
+                            lval_memory);
+       else
+         {
+           value_ptr temp = value_from_longest (builtin_type_unsigned_long,
+                                                baseptr_of_object (value_as_long(arg1)));
+
+           VALUE_TYPE (temp) = type;
+           return value_struct_elt (&temp, NULL, &exp->elts[pc + 2].string,
+                                    NULL, "structure pointer");
+         }
+      }
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
+
     case STRUCTOP_MEMBER:
       arg1 = evaluate_subexp_for_address (exp, pos, noside);
       goto handle_pointer_to_member;
@@ -1259,8 +1294,6 @@ evaluate_subexp_standard (expect_type, exp, pos, noside)
        error ("Non-integral right operand for \"@\" operator.");
       if (noside == EVAL_AVOID_SIDE_EFFECTS)
        {
-         if (VALUE_REPEATED (arg1))
-           error ("Cannot create artificial arrays of artificial arrays.");
          return allocate_repeat_value (VALUE_TYPE (arg1),
                                        longest_to_int (value_as_long (arg2)));
        }
index 7eda097..4effea2 100644 (file)
@@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "symtab.h"
@@ -30,9 +30,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 static void
 print_subexp PARAMS ((struct expression *, int *, GDB_FILE *, enum precedence));
 
-static void
-print_simple_m2_func PARAMS ((char *, struct expression *, int *, GDB_FILE *));
-
 void
 print_expression (exp, stream)
      struct expression *exp;
@@ -153,6 +150,13 @@ print_subexp (exp, pos, stream, prec)
       fputs_filtered (")", stream);
       return;
 
+    case OP_NAME:
+    case OP_EXPRSTRING:
+      nargs = longest_to_int (exp -> elts[pc + 1].longconst);
+      (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
+      fputs_filtered (&exp->elts[pc + 2].string, stream);
+      return;
+
     case OP_STRING:
       nargs = longest_to_int (exp -> elts[pc + 1].longconst);
       (*pos) += 3 + BYTES_TO_EXP_ELEM (nargs + 1);
@@ -163,8 +167,11 @@ print_subexp (exp, pos, stream, prec)
       return;
 
     case OP_BITSTRING:
-      error ("support for OP_BITSTRING unimplemented");
-      break;
+      nargs = longest_to_int (exp -> elts[pc + 1].longconst);
+      (*pos)
+       += 3 + BYTES_TO_EXP_ELEM ((nargs + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
+      fprintf (stream, "B'<unimplemented>'");
+      return;
 
     case OP_ARRAY:
       (*pos) += 3;
@@ -266,6 +273,16 @@ print_subexp (exp, pos, stream, prec)
        fputs_filtered (")", stream);
       return;
 
+    case TERNOP_SLICE:
+    case TERNOP_SLICE_COUNT:
+      print_subexp (exp, pos, stream, PREC_SUFFIX);
+      fputs_filtered ("(", stream);
+      print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
+      fputs_filtered (opcode == TERNOP_SLICE ? " : " : " UP ", stream);
+      print_subexp (exp, pos, stream, PREC_ABOVE_COMMA);
+      fputs_filtered (")", stream);
+      return;
+
     case STRUCTOP_STRUCT:
       tem = longest_to_int (exp->elts[pc + 1].longconst);
       (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
@@ -283,6 +300,19 @@ print_subexp (exp, pos, stream, prec)
       fputs_filtered (&exp->elts[pc + 2].string, stream);
       return;
 
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+    case STRUCTOP_FIELD:
+      tem = longest_to_int (exp->elts[pc + 1].longconst);
+      (*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
+      print_subexp (exp, pos, stream, PREC_SUFFIX);
+      fputs_filtered ("@", stream);
+      fputs_filtered (&exp->elts[pc + 2].string, stream);
+      return;
+
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
+
     case BINOP_SUBSCRIPT:
       print_subexp (exp, pos, stream, PREC_SUFFIX);
       fputs_filtered ("[", stream);
@@ -386,46 +416,6 @@ print_subexp (exp, pos, stream, prec)
       print_subexp(exp,pos,stream,PREC_PREFIX);
       fprintf_unfiltered(stream,")");
       return;
-
-    case UNOP_CAP:
-      print_simple_m2_func("CAP",exp,pos,stream);
-      return;
-
-    case UNOP_CHR:
-      print_simple_m2_func("CHR",exp,pos,stream);
-      return;
-
-    case UNOP_ORD:
-      print_simple_m2_func("ORD",exp,pos,stream);
-      return;
-      
-    case UNOP_ABS:
-      print_simple_m2_func("ABS",exp,pos,stream);
-      return;
-
-    case UNOP_FLOAT:
-      print_simple_m2_func("FLOAT",exp,pos,stream);
-      return;
-
-    case UNOP_HIGH:
-      print_simple_m2_func("HIGH",exp,pos,stream);
-      return;
-
-    case UNOP_MAX:
-      print_simple_m2_func("MAX",exp,pos,stream);
-      return;
-
-    case UNOP_MIN:
-      print_simple_m2_func("MIN",exp,pos,stream);
-      return;
-
-    case UNOP_ODD:
-      print_simple_m2_func("ODD",exp,pos,stream);
-      return;
-
-    case UNOP_TRUNC:
-      print_simple_m2_func("TRUNC",exp,pos,stream);
-      return;
       
     case BINOP_INCL:
     case BINOP_EXCL:
@@ -450,6 +440,7 @@ print_subexp (exp, pos, stream, prec)
        error ("Invalid expression");
    }
 
+  /* Note that PREC_BUILTIN will always emit parentheses. */
   if ((int) myprec < (int) prec)
     fputs_filtered ("(", stream);
   if ((int) opcode > (int) BINOP_END)
@@ -464,7 +455,11 @@ print_subexp (exp, pos, stream, prec)
        {
          /* Unary prefix operator.  */
          fputs_filtered (op_str, stream);
+         if (myprec == PREC_BUILTIN_FUNCTION)
+           fputs_filtered ("(", stream);
          print_subexp (exp, pos, stream, PREC_PREFIX);
+         if (myprec == PREC_BUILTIN_FUNCTION)
+           fputs_filtered (")", stream);
        }
     }
   else
@@ -493,23 +488,6 @@ print_subexp (exp, pos, stream, prec)
     fputs_filtered (")", stream);
 }
 
-/* Print out something of the form <s>(<arg>).
-   This is used to print out some builtin Modula-2
-   functions.
-   FIXME:  There is probably some way to get the precedence
-   rules to do this (print a unary operand with parens around it).  */
-static void
-print_simple_m2_func(s,exp,pos,stream)
-   char *s;
-   register struct expression *exp;
-   register int *pos;
-   GDB_FILE *stream;
-{
-   fprintf_unfiltered(stream,"%s(",s);
-   print_subexp(exp,pos,stream,PREC_PREFIX);
-   fprintf_unfiltered(stream,")");
-}
-   
 /* Return the operator corresponding to opcode OP as
    a string.   NULL indicates that the opcode was not found in the
    current language table.  */
@@ -596,6 +574,8 @@ dump_expression (exp, stream, note)
          case BINOP_CONCAT: opcode_name = "BINOP_CONCAT"; break;
          case BINOP_END: opcode_name = "BINOP_END"; break;
          case TERNOP_COND: opcode_name = "TERNOP_COND"; break;
+         case TERNOP_SLICE: opcode_name = "TERNOP_SLICE"; break;
+         case TERNOP_SLICE_COUNT: opcode_name = "TERNOP_SLICE_COUNT"; break;
          case OP_LONG: opcode_name = "OP_LONG"; break;
          case OP_DOUBLE: opcode_name = "OP_DOUBLE"; break;
          case OP_VAR_VALUE: opcode_name = "OP_VAR_VALUE"; break;
@@ -618,6 +598,9 @@ dump_expression (exp, stream, note)
          case UNOP_PREDECREMENT: opcode_name = "UNOP_PREDECREMENT"; break;
          case UNOP_POSTDECREMENT: opcode_name = "UNOP_POSTDECREMENT"; break;
          case UNOP_SIZEOF: opcode_name = "UNOP_SIZEOF"; break;
+         case UNOP_LOWER: opcode_name = "UNOP_LOWER"; break;
+         case UNOP_UPPER: opcode_name = "UNOP_UPPER"; break;
+         case UNOP_LENGTH: opcode_name = "UNOP_LENGTH"; break;
          case UNOP_PLUS: opcode_name = "UNOP_PLUS"; break;
          case UNOP_CAP: opcode_name = "UNOP_CAP"; break;
          case UNOP_CHR: opcode_name = "UNOP_CHR"; break;
@@ -633,6 +616,11 @@ dump_expression (exp, stream, note)
          case OP_M2_STRING: opcode_name = "OP_M2_STRING"; break;
          case STRUCTOP_STRUCT: opcode_name = "STRUCTOP_STRUCT"; break;
          case STRUCTOP_PTR: opcode_name = "STRUCTOP_PTR"; break;
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
++        case STRUCTOP_FIELD: opcode_name = "STRUCTOP_FIELD"; break;
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
          case OP_THIS: opcode_name = "OP_THIS"; break;
          case OP_SCOPE: opcode_name = "OP_SCOPE"; break;
          case OP_TYPE: opcode_name = "OP_TYPE"; break;
index cac4dad..9561b1c 100644 (file)
@@ -15,7 +15,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #if !defined (EXPRESSION_H)
 #define EXPRESSION_H 1
@@ -247,6 +247,9 @@ enum exp_opcode
   UNOP_ODD,
   UNOP_TRUNC,
 
+  /* Chill builtin functions. */
+  UNOP_LOWER, UNOP_UPPER, UNOP_LENGTH,
+
   OP_BOOL,             /* Modula-2 builtin BOOLEAN type */
   OP_M2_STRING,                /* Modula-2 string constants */
 
@@ -264,6 +267,14 @@ enum exp_opcode
   STRUCTOP_STRUCT,
   STRUCTOP_PTR,
 
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+  /* STRUCTOP_FIELD is for handling field access for Magic Cap dynamic objects.
+   */
+  STRUCTOP_FIELD,
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
+
   /* C++ */
   /* OP_THIS is just a placeholder for the class instance variable.
      It just comes in a tight (OP_THIS, OP_THIS) pair.  */
@@ -287,7 +298,13 @@ enum exp_opcode
   /* OP_TYPE is for parsing types, and used with the "ptype" command
      so we can look up types that are qualified by scope, either with
      the GDB "::" operator, or the Modula-2 '.' operator. */
-  OP_TYPE
+  OP_TYPE,
+
+  /* An un-looked-up identifier. */
+  OP_NAME,
+
+  /* An unparsed expression.  Used for Scheme (for now at least) */
+  OP_EXPRSTRING
 };
 
 union exp_element
@@ -319,8 +336,6 @@ struct expression
 #define BYTES_TO_EXP_ELEM(bytes) \
     (((bytes) + sizeof (union exp_element) - 1) / sizeof (union exp_element))
 
-#include "value.h"
-
 /* From parse.c */
 
 extern struct expression *parse_expression PARAMS ((char *));
@@ -354,9 +369,6 @@ enum noside
 extern struct value* evaluate_subexp_standard
 PARAMS ((struct type *, struct expression *, int*, enum noside));
 
-extern value_ptr evaluate_subexp_with_coercion PARAMS ((struct expression *,
-                                                       int *, enum noside));
-
 /* From expprint.c */
 
 extern void print_expression PARAMS ((struct expression *, GDB_FILE *));
diff --git a/gdb/magic.c b/gdb/magic.c
new file mode 100644 (file)
index 0000000..6576e23
--- /dev/null
@@ -0,0 +1,420 @@
+#include "defs.h"
+#include "gdbcmd.h"
+#include "symtab.h"
+#include "value.h"
+#include <ctype.h>
+#include <string.h>
+#ifdef DYNAMIC_COMMAND_SUPPORT
+#include <dlfcn.h>
+#endif
+
+typedef unsigned long ulong;
+
+#ifdef DYNAMIC_COMMAND_SUPPORT
+static void
+dlopen_command PARAMS ((char *, int));
+#endif
+
+#ifdef DYNAMIC_COMMAND_SUPPORT
+/* ARGSUSED */
+static void
+dlopen_command (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+       char *p;
+       void *hdl;
+       void (*sym)();
+
+       if (arg == 0) {
+               error ("No arguments specified.");
+               return;
+       }
+       p = arg;
+       while(*p != ' ' && *p != '\0')
+               p++;
+       if (*p != ' ') {
+               error ("Not enough arguments.");
+               return;
+       }
+    *p++ = '\0';
+
+       hdl = dlopen(arg, RTLD_NOW);
+       if (hdl == NULL) {
+               fprintf(stderr, "%s: %s\n", arg, dlerror());
+               return;
+       }
+       sym = dlsym(hdl, p);
+
+       if (sym == NULL) {
+               fprintf(stderr, "%s: %s\n", p, dlerror());
+               return;
+       }
+
+       sym();
+}
+#endif
+
+static void
+local_shell_escape (char *arg)
+{
+#ifdef CANT_FORK
+  /* FIXME: what about errors (I don't know how GO32 system() handles
+     them)?  */
+  system (arg);
+#else /* Can fork.  */
+  int rc, status, pid;
+  char *p, *user_shell;
+
+  if ((user_shell = (char *) getenv ("SHELL")) == NULL)
+    user_shell = "/bin/sh";
+
+  /* Get the name of the shell for arg0 */
+  if ((p = strrchr (user_shell, '/')) == NULL)
+    p = user_shell;
+  else
+    p++;                       /* Get past '/' */
+
+  if ((pid = fork()) == 0)
+    {
+      if (!arg)
+       execl (user_shell, p, 0);
+      else
+       execl (user_shell, p, "-c", arg, 0);
+
+      fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
+                         safe_strerror (errno));
+      gdb_flush (gdb_stderr);
+      _exit (0177);
+    }
+
+  if (pid != -1)
+    while ((rc = wait (&status)) != pid && rc != -1)
+      ;
+  else
+    error ("Fork failed");
+#endif /* Can fork.  */
+}
+
+static void
+GetClassName(long objectID, char* name)
+{
+  register value_ptr val;
+  register struct symbol *sym;
+  struct minimal_symbol *msymbol;
+  struct type *type;
+  value_ptr blocklen;
+  LONGEST maddr;
+
+  /* Find the address of RemoteGetClassName in the inferior.  */
+
+  sym = lookup_symbol ("RemoteGetClassName", 0, VAR_NAMESPACE, 0, NULL);
+  if (sym != NULL)
+    {
+      if (SYMBOL_CLASS (sym) != LOC_BLOCK)
+       {
+         error ("\"RemoteGetClassName\" exists in this program but is not a function.");
+       }
+      val = value_of_variable (sym, NULL);
+    }
+  else
+    {
+      msymbol = lookup_minimal_symbol ("RemoteGetClassName", "", (struct objfile *) NULL);
+      if (msymbol != NULL)
+       {
+         type = lookup_pointer_type (builtin_type_char);
+         type = lookup_function_type (type);
+         type = lookup_pointer_type (type);
+         maddr = (LONGEST) SYMBOL_VALUE_ADDRESS (msymbol);
+         val = value_from_longest (type, maddr);
+       }
+      else
+       {
+         error ("evaluation of this expression requires the program to have a function \"RemoteGetClassName\".");
+       }
+    }
+
+  blocklen = value_from_longest (builtin_type_int, (LONGEST) objectID);
+  val = call_function_by_hand (val, 1, &blocklen);
+  if (value_logical_not (val))
+    {
+      error ("Could not get class name.");
+    }
+       read_memory(value_as_pointer(val), name, 32);
+       
+}
+
+static CORE_ADDR
+GetBasePtr(long objectID)
+{
+  register value_ptr val;
+  register struct symbol *sym;
+  struct minimal_symbol *msymbol;
+  struct type *type;
+  value_ptr blocklen;
+  LONGEST maddr;
+
+  /* Find the address of RemoteGetBasePtr in the inferior.  */
+
+  sym = lookup_symbol ("RemoteGetBasePtr", 0, VAR_NAMESPACE, 0, NULL);
+  if (sym != NULL)
+    {
+      if (SYMBOL_CLASS (sym) != LOC_BLOCK)
+       {
+         error ("\"RemoteGetBasePtr\" exists in this program but is not a function.");
+       }
+      val = value_of_variable (sym, NULL);
+    }
+  else
+    {
+      msymbol = lookup_minimal_symbol ("RemoteGetBasePtr", "",  (struct objfile *) NULL);
+      if (msymbol != NULL)
+       {
+         type = lookup_pointer_type (builtin_type_char);
+         type = lookup_function_type (type);
+         type = lookup_pointer_type (type);
+         maddr = (LONGEST) SYMBOL_VALUE_ADDRESS (msymbol);
+         val = value_from_longest (type, maddr);
+       }
+      else
+       {
+         error ("evaluation of this expression requires the program to have a function \"RemoteGetBasePtr\".");
+       }
+    }
+
+  blocklen = value_from_longest (builtin_type_int, (LONGEST) objectID);
+  val = call_function_by_hand (val, 1, &blocklen);
+  if (value_logical_not (val))
+    {
+      error ("Could not get base pointer to object.");
+    }
+       return value_as_pointer(val);
+}
+
+static void
+dump_extra_data(CORE_ADDR addr, ulong length)
+{
+       ulong buf[5], chunk, i;
+       char *p;
+
+       while (length > 3) {
+               chunk = (length > 16) ? 16 : length;
+
+               memset(buf, 0, 5*sizeof(long));
+               read_memory(addr, &buf, chunk);
+               fprintf(gdb_stdout, "%08lx %08lx %08lx %08lx | ", buf[0], 
+                       buf[1], buf[2], buf[3]);
+               for (i = 0, p = (char*)buf; i < chunk; i++, p++) {
+                       if (!isprint(*p))
+                               *p = '.';
+               }
+               fprintf(gdb_stdout, "%s |\n", buf);
+               addr += chunk;
+               length -= chunk;
+       }
+}
+
+struct type *type_of_object(CORE_ADDR object)
+{
+       char className[32], classAllFieldsName[128];
+       struct type *type = NULL;
+       GetClassName(object, className);
+       sprintf(classAllFieldsName, "%s_AllFields", className);
+
+       type = lookup_typename(classAllFieldsName, (struct block *)NULL, 0);
+       return lookup_pointer_type(type);
+}
+
+CORE_ADDR baseptr_of_object(ulong object)
+{
+       return GetBasePtr(object) + 12;
+}
+
+/* ARGSUSED */
+static void
+print_object (arg, dump)
+     char *arg;
+        int dump;
+{
+       CORE_ADDR addr;
+       ulong object, objectLength, typeLength = 0;
+       char className[32], classAllFieldsName[128];
+       struct type* type = NULL;
+
+       object = parse_and_eval_address(arg);
+
+       GetClassName(object, className);
+       sprintf(classAllFieldsName, "%s_AllFields", className);
+
+       type = lookup_typename(classAllFieldsName, (struct block *)NULL, 0);
+       typeLength = TYPE_LENGTH(type);
+       addr = GetBasePtr(object);
+       read_memory(addr, &objectLength, 4);
+       objectLength -= 12;
+       addr += 12;
+       if (TYPE_CODE(type) != TYPE_CODE_UNDEF && !(TYPE_FLAGS(type)&TYPE_FLAG_STUB)) {
+               if (dump) {
+                       value_ptr valptr = value_at_lazy(type, addr);
+                       int histindex = record_latest_value(valptr);
+                       printf_filtered("Object 0x%08lx at address 0x%08lx of class %s\n", 
+                                       object, addr, className);
+                       if (histindex >= 0) printf_filtered ("$%d = ", histindex);
+                       value_print(valptr, gdb_stdout, 0, Val_prettyprint);
+                       objectLength -= typeLength;
+                       addr += typeLength;
+                       printf_filtered("\n");
+                       dump_extra_data(addr, objectLength);
+                       printf_filtered("\n");
+               } else {
+                       value_ptr valptr = value_from_longest(lookup_pointer_type(type), addr);
+                       int histindex = record_latest_value(valptr);
+                       if (histindex >= 0) printf_filtered ("$%d = ", histindex);
+                       value_print(valptr, gdb_stdout, 0, Val_prettyprint);
+                       printf_filtered("\n");
+               }
+       }
+}
+
+/* ARGSUSED */
+static void
+dobj_command (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+       print_object(arg, 1);
+}
+
+/* ARGSUSED */
+static void
+pobj_command (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+       print_object(arg, 0);
+}
+
+/* ARGSUSED */
+static void
+getint_command (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+       char shellCommand[128];
+       
+       sprintf(shellCommand, "getint %s", arg);
+       local_shell_escape(shellCommand);
+}
+
+/* ARGSUSED */
+static void
+getindexical_command (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+       char shellCommand[128];
+
+       sprintf(shellCommand, "getindexical %s", arg);
+       local_shell_escape(shellCommand);
+}
+
+/* ARGSUSED */
+static void
+exc_command (arg, from_tty)
+     char *arg;
+     int from_tty;
+{
+       char shellCommand[128];
+       ulong exception;
+       
+       sprintf(shellCommand, "getexc %s", arg);
+       local_shell_escape(shellCommand);
+}
+
+static CORE_ADDR dispatch_method_addr = -1, dispatch_inherited_addr = -1, dispatch_delegated_addr = -1, dispatch_intrinsic_addr = -1;
+CORE_ADDR do_dispatch_method_addr = -1, do_dispatch_intrinsic_addr = -1;
+
+static CORE_ADDR
+lookup_address(const char *name)
+{
+  struct symbol *sym = lookup_symbol(name, NULL, VAR_NAMESPACE, NULL, NULL);
+  if (sym)
+    return BLOCK_START(SYMBOL_BLOCK_VALUE(sym));
+  else
+    {
+/*      printf("Couldn't find %s!\n", name); */
+      return -1;
+    }
+}
+
+void
+init_magic()
+{
+  dispatch_method_addr = lookup_address("__DispatchMethod");
+  dispatch_inherited_addr = lookup_address("__DispatchInherited");
+  dispatch_delegated_addr = lookup_address("__DispatchDelegated");
+  dispatch_intrinsic_addr = lookup_address("__DispatchIntrinsic");
+  do_dispatch_method_addr = lookup_address("__DoTheDispatch");
+  do_dispatch_intrinsic_addr = lookup_address("__DoDispatchIntrinsic");
+} 
+
+int
+is_dispatch(CORE_ADDR pc)
+{
+  return (pc == dispatch_method_addr) || (pc == dispatch_inherited_addr) || (pc == dispatch_delegated_addr);
+}
+
+int
+is_dispatch_intrinsic(CORE_ADDR pc)
+{
+  return pc == dispatch_intrinsic_addr;
+}
+
+/* If we are stopped at one of the entry points to the dispatcher, we want to continue until just
+   before we jump to the implementation.  If we are at that point, we want to continue until we
+   actually get to the implementation.  Likewise for the intrinsic dispatcher
+   */
+CORE_ADDR 
+deal_with_dispatch(CORE_ADDR stop_pc)
+{
+  if (is_dispatch(stop_pc))
+    return do_dispatch_method_addr;
+  else if (is_dispatch_intrinsic(stop_pc))
+    return do_dispatch_intrinsic_addr;
+  else if (stop_pc == do_dispatch_method_addr)
+    /* This assumes that we branch through t6 */
+    return read_register(14);
+  else if (stop_pc == do_dispatch_intrinsic_addr)
+    /* This assumes that we branch through t0 */
+    return read_register(8);
+  else
+    return 0;
+}
+
+void
+magic_create_inferior_hook()
+{
+       struct symbol *sym = lookup_symbol("gHandleError", NULL, VAR_NAMESPACE, NULL, NULL);
+       if (sym)
+               {
+                       CORE_ADDR addr = SYMBOL_VALUE(sym);
+                       unsigned long errorDebugger = 2;
+                       target_write_memory(addr, &errorDebugger, 4);
+               }
+
+       init_magic ();
+}
+
+
+_initialize_magic ()
+{
+       add_com ("dobj", class_support, dobj_command, "Display Object Contents");
+       add_com ("pobj", class_support, pobj_command, "Print object base pointer");
+       add_com ("getint", class_support, getint_command, "Convert intrinsic name to number or vice versa.");
+       add_com ("getindexical", class_support, getindexical_command, "Convert indexical name to number or vice versa.");
+       add_com ("exc", class_support, exc_command, "Convert exception name to number or vice versa.");
+
+#ifdef DYNAMIC_COMMAND_SUPPORT
+  add_com ("dlopen", class_support, dlopen_command,
+          "Load the dynamic library specified and execute the specified symbol");
+#endif
+}
diff --git a/gdb/magic.h b/gdb/magic.h
new file mode 100644 (file)
index 0000000..7ff366c
--- /dev/null
@@ -0,0 +1,6 @@
+/* magic.h - Interface to the General Magic debugger extras */
+
+extern void init_magic();
+extern CORE_ADDR deal_with_dispatch(CORE_ADDR pc);
+extern struct type *type_of_object(CORE_ADDR object);
+extern CORE_ADDR baseptr_of_object(CORE_ADDR object);
index 7bbe0a8..f22814b 100644 (file)
@@ -599,6 +599,11 @@ length_of_subexp (expr, endpos)
     case OP_LABELED:
     case STRUCTOP_STRUCT:
     case STRUCTOP_PTR:
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+    case STRUCTOP_FIELD:
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
       args = 1;
       /* fall through */
     case OP_M2_STRING:
index fde8f23..7514aa9 100644 (file)
@@ -61,8 +61,9 @@ static void mips_send_packet PARAMS ((const char *s, int get_ack));
 static int mips_receive_packet PARAMS ((char *buff, int throw_error,
                                        int timeout));
 
-static int mips_request PARAMS ((char cmd, unsigned int addr,
-                                unsigned int data, int *perr, int timeout));
+static int mips_request PARAMS ((int cmd, unsigned int addr,
+                                unsigned int data, int *perr, int timeout,
+                                char *buff));
 
 static void mips_initialize PARAMS ((void));
 
@@ -102,9 +103,11 @@ static void mips_mourn_inferior PARAMS ((void));
 
 static void mips_load PARAMS ((char *file, int from_tty));
 
-static int mips_make_srec PARAMS ((char *buffer, char type, CORE_ADDR memaddr,
+static int mips_make_srec PARAMS ((char *buffer, int type, CORE_ADDR memaddr,
                                   unsigned char *myaddr, int len));
 
+static int common_breakpoint PARAMS ((int cmd, CORE_ADDR addr, CORE_ADDR mask,
+                                     char *flags));
 /* A forward declaration.  */
 extern struct target_ops mips_ops;
 \f
@@ -274,6 +277,23 @@ static int mips_need_reply = 0;
 /* Handle used to access serial I/O stream.  */
 static serial_t mips_desc;
 
+/* Counts the number of times the user tried to interrupt the target (usually
+   via ^C.  */
+static int interrupt_count;
+
+/* If non-zero, means that the target is running. */
+static int mips_wait_flag = 0;
+
+/* If non-zero, monitor supports breakpoint commands. */
+static monitor_supports_breakpoints = 0;
+
+/* Data cache header.  */
+
+static DCACHE *mips_dcache;
+
+/* Non-zero means that we've just hit a read or write watchpoint */
+static int hit_watchpoint;
+
 /* Handle low-level error that we can't recover from.  Note that just
    error()ing out from target_wait or some such low-level place will cause
    all hell to break loose--the rest of GDB will tend to get left in an
@@ -305,6 +325,7 @@ mips_error (va_alist)
   vfprintf_filtered (gdb_stderr, string, args);
   fprintf_filtered (gdb_stderr, "\n");
   va_end (args);
+  gdb_flush (gdb_stderr);
 
   /* Clean up in such a way that mips_close won't try to talk to the
      board (it almost surely won't work since we weren't able to talk to
@@ -318,6 +339,9 @@ mips_error (va_alist)
   return_to_top_level (RETURN_ERROR);
 }
 
+/* Wait until STRING shows up in mips_desc.  Returns 1 if successful, else 0 if
+   timed out.  */
+
 int
 mips_expect (string)
      char *string;
@@ -398,7 +422,7 @@ mips_readchar (timeout)
     mips_error ("End of file from remote");
   if (ch == SERIAL_ERROR)
     mips_error ("Error reading from remote: %s", safe_strerror (errno));
-  if (sr_get_debug () > 1)
+  if (remote_debug > 1)
     {
       /* Don't use _filtered; we can't deal with a QUIT out of
         target_wait, and I think this might be called from there.  */
@@ -417,12 +441,10 @@ mips_readchar (timeout)
       && state == (sizeof(nextstate) / sizeof(char))
       && ! mips_initializing)
     {
-      if (sr_get_debug () > 0)
+      if (remote_debug > 0)
        /* Don't use _filtered; we can't deal with a QUIT out of
           target_wait, and I think this might be called from there.  */
        printf_unfiltered ("Reinitializing MIPS debugging mode\n");
-      SERIAL_WRITE (mips_desc, "\015db tty0\015", sizeof "\015db tty0\015" - 1);
-      sleep (1);
 
       mips_need_reply = 0;
       mips_initialize ();
@@ -474,7 +496,7 @@ mips_receive_header (hdr, pgarbage, ch, timeout)
                 what the program is outputting, if the debugging is
                 being done on the console port.  Don't use _filtered;
                 we can't deal with a QUIT out of target_wait.  */
-             if (! mips_initializing || sr_get_debug () > 0)
+             if (! mips_initializing || remote_debug > 0)
                {
                  if (ch < 0x20 && ch != '\n')
                    {
@@ -488,7 +510,8 @@ mips_receive_header (hdr, pgarbage, ch, timeout)
 
              ++*pgarbage;
              if (*pgarbage > mips_syn_garbage)
-               mips_error ("Remote debugging protocol failure");
+               mips_error ("Debug protocol failure:  more than %d characters before a sync.", 
+                           mips_syn_garbage);
            }
        }
 
@@ -612,7 +635,7 @@ mips_send_packet (s, get_ack)
       int garbage;
       int ch;
 
-      if (sr_get_debug () > 0)
+      if (remote_debug > 0)
        {
          /* Don't use _filtered; we can't deal with a QUIT out of
             target_wait, and I think this might be called from there.  */
@@ -673,7 +696,7 @@ mips_send_packet (s, get_ack)
              != TRLR_GET_CKSUM (trlr))
            continue;
 
-         if (sr_get_debug () > 0)
+         if (remote_debug > 0)
            {
              hdr[HDR_LENGTH] = '\0';
              trlr[TRLR_LENGTH] = '\0';
@@ -746,7 +769,7 @@ mips_receive_packet (buff, throw_error, timeout)
        {
          /* Don't use _filtered; we can't deal with a QUIT out of
             target_wait, and I think this might be called from there.  */
-         if (sr_get_debug () > 0)
+         if (remote_debug > 0)
            printf_unfiltered ("Ignoring unexpected ACK\n");
          continue;
        }
@@ -756,7 +779,7 @@ mips_receive_packet (buff, throw_error, timeout)
        {
          /* Don't use _filtered; we can't deal with a QUIT out of
             target_wait, and I think this might be called from there.  */
-         if (sr_get_debug () > 0)
+         if (remote_debug > 0)
            printf_unfiltered ("Ignoring sequence number %d (want %d)\n",
                             HDR_GET_SEQ (hdr), mips_receive_seq);
          continue;
@@ -788,7 +811,7 @@ mips_receive_packet (buff, throw_error, timeout)
        {
          /* Don't use _filtered; we can't deal with a QUIT out of
             target_wait, and I think this might be called from there.  */
-         if (sr_get_debug () > 0)
+         if (remote_debug > 0)
            printf_unfiltered ("Got new SYN after %d chars (wanted %d)\n",
                             i, len);
          continue;
@@ -806,7 +829,7 @@ mips_receive_packet (buff, throw_error, timeout)
        {
          /* Don't use _filtered; we can't deal with a QUIT out of
             target_wait, and I think this might be called from there.  */
-         if (sr_get_debug () > 0)
+         if (remote_debug > 0)
            printf_unfiltered ("Got SYN when wanted trailer\n");
          continue;
        }
@@ -814,7 +837,7 @@ mips_receive_packet (buff, throw_error, timeout)
       if (mips_cksum (hdr, buff, len) == TRLR_GET_CKSUM (trlr))
        break;
 
-      if (sr_get_debug () > 0)
+      if (remote_debug > 0)
        /* Don't use _filtered; we can't deal with a QUIT out of
           target_wait, and I think this might be called from there.  */
        printf_unfiltered ("Bad checksum; data %d, trailer %d\n",
@@ -834,7 +857,7 @@ mips_receive_packet (buff, throw_error, timeout)
       ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum);
       ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum);
 
-      if (sr_get_debug () > 0)
+      if (remote_debug > 0)
        {
          ack[HDR_LENGTH + TRLR_LENGTH] = '\0';
          /* Don't use _filtered; we can't deal with a QUIT out of
@@ -852,7 +875,7 @@ mips_receive_packet (buff, throw_error, timeout)
        }
     }
 
-  if (sr_get_debug () > 0)
+  if (remote_debug > 0)
     {
       buff[len] = '\0';
       /* Don't use _filtered; we can't deal with a QUIT out of
@@ -874,7 +897,7 @@ mips_receive_packet (buff, throw_error, timeout)
   ack[HDR_LENGTH + TRLR_INDX_CSUM2] = TRLR_SET_CSUM2 (cksum);
   ack[HDR_LENGTH + TRLR_INDX_CSUM3] = TRLR_SET_CSUM3 (cksum);
 
-  if (sr_get_debug () > 0)
+  if (remote_debug > 0)
     {
       ack[HDR_LENGTH + TRLR_LENGTH] = '\0';
       /* Don't use _filtered; we can't deal with a QUIT out of
@@ -920,20 +943,24 @@ mips_receive_packet (buff, throw_error, timeout)
    target board reports.  */
 
 static int
-mips_request (cmd, addr, data, perr, timeout)
-     char cmd;
+mips_request (cmd, addr, data, perr, timeout, buff)
+     int cmd;
      unsigned int addr;
      unsigned int data;
      int *perr;
      int timeout;
+     char *buff;
 {
-  char buff[DATA_MAXLEN + 1];
+  char myBuff[DATA_MAXLEN + 1];
   int len;
   int rpid;
   char rcmd;
   int rerrflg;
   int rresponse;
 
+  if (buff == (char *) NULL)
+    buff = myBuff;
+
   if (cmd != '\0')
     {
       if (mips_need_reply)
@@ -989,7 +1016,7 @@ mips_initialize_cleanups (arg)
 static void
 mips_initialize ()
 {
-  char cr;
+  char cr, cc;
   char buff[DATA_MAXLEN + 1];
   int err;
   struct cleanup *old_cleanups = make_cleanup (mips_initialize_cleanups, NULL);
@@ -1003,6 +1030,7 @@ mips_initialize ()
       return;
     }
 
+  mips_wait_flag = 0;
   mips_initializing = 1;
 
   mips_send_seq = 0;
@@ -1011,47 +1039,72 @@ mips_initialize ()
   if (mips_receive_packet (buff, 0, 3) < 0)
     {
       char cc;
-      int i;
+      int i, j;
       char srec[10];
 
       /* We did not receive the packet we expected; try resetting the
         board and trying again.  */
 
-      /* We are possibly in binary download mode, having aborted in the middle
-        of an S-record.  ^C won't work because of binary mode.  The only
-        reliable way out is to send enough termination packets (8 bytes) to
-        fill up and then overflow the largest size S-record (255 bytes in this
-        case).  This amounts to 256/8 + 1.  */
-
-      mips_make_srec (srec, '7', 0, NULL, 0);
+      /* Force the system into the IDT monitor.  After this we *should* be at
+        the <IDT> prompt.  */
 
-      for (i = 1; i <= 33; i++)
+      for (j = 1; j <= 4; j++)
        {
-         SERIAL_WRITE (mips_desc, srec, 8);
+         switch (j)
+           {
+           case 1:             /* First, try sending a break */
+             SERIAL_SEND_BREAK (mips_desc);
+             break;
+           case 2:             /* Then, try a ^C */
+             SERIAL_WRITE (mips_desc, "\003", 1); /* Send a ^C to wake up the monitor */
+             break;
+           case 3:             /* Then, try escaping from download */
+             /* We are possibly in binary download mode, having aborted in the middle
+                of an S-record.  ^C won't work because of binary mode.  The only
+                reliable way out is to send enough termination packets (8 bytes) to
+                fill up and then overflow the largest size S-record (255 bytes in this
+                case).  This amounts to 256/8 + 1 packets.  */
+
+             mips_make_srec (srec, '7', 0, NULL, 0);
 
-         if (SERIAL_READCHAR (mips_desc, 0) >= 0)
-           break;              /* Break immediatly if we get something from
+             for (i = 1; i <= 33; i++)
+               {
+                 SERIAL_WRITE (mips_desc, srec, 8);
+
+                 if (SERIAL_READCHAR (mips_desc, 0) >= 0)
+                   break;      /* Break immediatly if we get something from
                                   the board. */
+               }
+             break;
+           case 4:
+             mips_error ("Failed to initialize.");
+           }
+         if (mips_expect ("\015\012<IDT>"))
+           break;
        }
 
-      printf_filtered ("Failed to initialize; trying to reset board\n");
-      cc = '\003';
-      SERIAL_WRITE (mips_desc, &cc, 1);
-      sleep (2);
-      SERIAL_WRITE (mips_desc, "\015db tty0\015", sizeof "\015db tty0\015" - 1);
-      sleep (1);
-      cr = '\015';
-      SERIAL_WRITE (mips_desc, &cr, 1);
+      SERIAL_WRITE (mips_desc, "db tty0\015", sizeof "db tty0\015" - 1);
+      mips_expect ("db tty0\015\012"); /* Eat the echo */
+
+      SERIAL_WRITE (mips_desc, "\015", sizeof "\015" - 1);
 
-      mips_receive_packet (buff, 1, 3);
+      if (mips_receive_packet (buff, 1, 3) < 0)
+       mips_error ("Failed to initialize (didn't receive packet).");
     }
 
+  if (common_breakpoint ('b', -1, 0, NULL)) /* Clear all breakpoints */
+    monitor_supports_breakpoints = 0; /* Failed, don't use it anymore */
+  else
+    monitor_supports_breakpoints = 1;
+
   do_cleanups (old_cleanups);
 
   /* If this doesn't call error, we have connected; we don't care if
      the request itself succeeds or fails.  */
   mips_request ('r', (unsigned int) 0, (unsigned int) 0, &err,
-               mips_receive_wait);
+               mips_receive_wait, NULL);
+  set_current_frame (create_new_frame (read_fp (), read_pc ()));
+  select_frame (get_current_frame (), 0);
 }
 
 /* Open a connection to the remote board.  */
@@ -1132,7 +1185,7 @@ mips_close (quitting)
 
       /* Get the board out of remote debugging mode.  */
       mips_request ('x', (unsigned int) 0, (unsigned int) 0, &err,
-                   mips_receive_wait);
+                   mips_receive_wait, NULL);
 
       SERIAL_CLOSE (mips_desc);
     }
@@ -1149,6 +1202,9 @@ mips_detach (args, from_tty)
     error ("Argument given to \"detach\" when remotely debugging.");
 
   pop_target ();
+
+  mips_close (1);
+
   if (from_tty)
     printf_unfiltered ("Ending remote MIPS debugging.\n");
 }
@@ -1161,16 +1217,21 @@ mips_resume (pid, step, siggnal)
      int pid, step;
      enum target_signal siggnal;
 {
+
+/* start-sanitize-gm */
+#ifndef GENERAL_MAGIC_HACKS
   if (siggnal != TARGET_SIGNAL_0)
     warning
       ("Can't send signals to a remote system.  Try `handle %s ignore'.",
        target_signal_to_name (siggnal));
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
 
   mips_request (step ? 's' : 'c',
                (unsigned int) 1,
-               (unsigned int) 0,
+               (unsigned int) siggnal,
                (int *) NULL,
-               mips_receive_wait);
+               mips_receive_wait, NULL);
 }
 
 /* Return the signal corresponding to SIG, where SIG is the number which
@@ -1202,6 +1263,13 @@ mips_wait (pid, status)
 {
   int rstatus;
   int err;
+  char buff[DATA_MAXLEN];
+  int rpc, rfp, rsp;
+  char flags[20];
+  int nfields;
+
+  interrupt_count = 0;
+  hit_watchpoint = 0;
 
   /* If we have not sent a single step or continue command, then the
      board is waiting for us to do something.  Return a status
@@ -1214,10 +1282,46 @@ mips_wait (pid, status)
     }
 
   /* No timeout; we sit here as long as the program continues to execute.  */
-  rstatus = mips_request ('\0', (unsigned int) 0, (unsigned int) 0, &err, -1);
+  mips_wait_flag = 1;
+  rstatus = mips_request ('\000', (unsigned int) 0, (unsigned int) 0, &err, -1,
+                         buff);
+  mips_wait_flag = 0;
   if (err)
     mips_error ("Remote failure: %s", safe_strerror (errno));
 
+  nfields = sscanf (buff, "0x%*x %*c 0x%*x 0x%*x 0x%x 0x%x 0x%x 0x%*x %s",
+                   &rpc, &rfp, &rsp, flags);
+
+  /* See if we got back extended status.  If so, pick out the pc, fp, sp, etc... */
+
+  if (nfields == 7 || nfields == 9) 
+    {
+      char buf[MAX_REGISTER_RAW_SIZE];
+
+      store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rpc);
+      supply_register (PC_REGNUM, buf);
+
+      store_unsigned_integer (buf, REGISTER_RAW_SIZE (PC_REGNUM), rfp);
+      supply_register (30, buf); /* This register they are avoiding and so it is unnamed */
+
+      store_unsigned_integer (buf, REGISTER_RAW_SIZE (SP_REGNUM), rsp);
+      supply_register (SP_REGNUM, buf);
+
+      store_unsigned_integer (buf, REGISTER_RAW_SIZE (FP_REGNUM), 0);
+      supply_register (FP_REGNUM, buf);
+
+      if (nfields == 9)
+       {
+         int i;
+
+         for (i = 0; i <= 2; i++)
+           if (flags[i] == 'r' || flags[i] == 'w')
+             hit_watchpoint = 1;
+           else if (flags[i] == '\000')
+             break;
+       }
+    }
+
   /* Translate a MIPS waitstatus.  We use constants here rather than WTERMSIG
      and so on, because the constants we want here are determined by the
      MIPS protocol and have nothing to do with what host we are running on.  */
@@ -1297,7 +1401,7 @@ mips_fetch_registers (regno)
   else
     {
       val = mips_request ('r', (unsigned int) mips_map_regno (regno),
-                         (unsigned int) 0, &err, mips_receive_wait);
+                         (unsigned int) 0, &err, mips_receive_wait, NULL);
       if (err)
        mips_error ("Can't read register %d: %s", regno,
                    safe_strerror (errno));
@@ -1338,7 +1442,7 @@ mips_store_registers (regno)
 
   mips_request ('R', (unsigned int) mips_map_regno (regno),
                (unsigned int) read_register (regno),
-               &err, mips_receive_wait);
+               &err, mips_receive_wait, NULL);
   if (err)
     mips_error ("Can't write register %d: %s", regno, safe_strerror (errno));
 }
@@ -1353,12 +1457,12 @@ mips_fetch_word (addr)
   int err;
 
   val = mips_request ('d', (unsigned int) addr, (unsigned int) 0, &err,
-                     mips_receive_wait);
+                     mips_receive_wait, NULL);
   if (err)
     {
       /* Data space failed; try instruction space.  */
       val = mips_request ('i', (unsigned int) addr, (unsigned int) 0, &err,
-                         mips_receive_wait);
+                         mips_receive_wait, NULL);
       if (err)
        mips_error ("Can't read address 0x%x: %s", addr, safe_strerror (errno));
     }
@@ -1380,13 +1484,13 @@ mips_store_word (addr, val, old_contents)
 
   oldcontents = mips_request ('D', (unsigned int) addr, (unsigned int) val,
                              &err,
-                             mips_receive_wait);
+                             mips_receive_wait, NULL);
   if (err)
     {
       /* Data space failed; try instruction space.  */
       oldcontents = mips_request ('I', (unsigned int) addr,
                                  (unsigned int) val, &err,
-                                 mips_receive_wait);
+                                 mips_receive_wait, NULL);
       if (err)
        return errno;
     }
@@ -1496,6 +1600,41 @@ mips_files_info (ignore)
 static void
 mips_kill ()
 {
+  if (!mips_wait_flag)
+    return;
+
+  interrupt_count++;
+
+  if (interrupt_count >= 2)
+    {
+      interrupt_count = 0;
+
+      target_terminal_ours ();
+
+      if (query ("Interrupted while waiting for the program.\n\
+Give up (and stop debugging it)? "))
+       {
+         /* Clean up in such a way that mips_close won't try to talk to the
+            board (it almost surely won't work since we weren't able to talk to
+            it).  */
+         mips_wait_flag = 0;
+         mips_is_open = 0;
+         SERIAL_CLOSE (mips_desc);
+
+         printf_unfiltered ("Ending remote MIPS debugging.\n");
+         target_mourn_inferior ();
+
+         return_to_top_level (RETURN_QUIT);
+       }
+
+      target_terminal_inferior ();
+    }
+
+  if (remote_debug > 0)
+    printf_unfiltered ("Sending break\n");
+
+  SERIAL_SEND_BREAK (mips_desc);
+
 #if 0
   if (mips_is_open)
     {
@@ -1537,7 +1676,16 @@ Can't pass arguments to remote MIPS board; arguments ignored.");
 
   /* FIXME: Should we set inferior_pid here?  */
 
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+  magic_create_inferior_hook ();
+  proceed (entry_pt, TARGET_SIGNAL_PWR, 0);
+#else
+/* end-sanitize-gm */
   proceed (entry_pt, TARGET_SIGNAL_DEFAULT, 0);
+/* start-sanitize-gm */
+#endif
+/* end-sanitize-gm */
 }
 
 /* Clean up after a process.  Actually nothing to do.  */
@@ -1573,6 +1721,9 @@ mips_insert_breakpoint (addr, contents_cache)
 {
   int status;
 
+  if (monitor_supports_breakpoints)
+    return common_breakpoint ('B', addr, 0x3, "f");
+
   return mips_store_word (addr, BREAK_INSN, contents_cache);
 }
 
@@ -1581,9 +1732,146 @@ mips_remove_breakpoint (addr, contents_cache)
      CORE_ADDR addr;
      char *contents_cache;
 {
+  if (monitor_supports_breakpoints)
+    return common_breakpoint ('b', addr, 0, NULL);
+
   return target_write_memory (addr, contents_cache, BREAK_INSN_SIZE);
 }
 
+/* Compute a don't care mask for the region bounding ADDR and ADDR + LEN - 1.
+   This is used for memory ref breakpoints.  */
+
+static unsigned long
+calculate_mask (addr, len)
+     CORE_ADDR addr;
+     int len;
+{
+  unsigned long mask;
+  int i;
+
+  mask = addr ^ (addr + len - 1);
+
+  for (i = 32; i >= 0; i--)
+    if (mask == 0)
+      break;
+    else
+      mask >>= 1;
+
+  mask = (unsigned long) 0xffffffff >> i;
+
+  return mask;
+}
+
+/* Set a data watchpoint.  ADDR and LEN should be obvious.  TYPE is either 1
+   for a read watchpoint, or 2 for a read/write watchpoint. */
+
+int
+remote_mips_set_watchpoint (addr, len, type)
+     CORE_ADDR addr;
+     int len;
+     int type;
+{
+  CORE_ADDR first_addr;
+  unsigned long mask;
+  char *flags;
+
+  mask = calculate_mask (addr, len);
+
+  first_addr = addr & ~mask;
+
+  switch (type)
+    {
+    case 0:                    /* write */
+      flags = "w";
+      break;
+    case 1:                    /* read */
+      flags = "r";
+      break;
+    case 2:                    /* read/write */
+      flags = "rw";
+      break;
+    default:
+      abort ();
+    }
+
+  if (common_breakpoint ('B', first_addr, mask, flags))
+    return -1;
+
+  return 0;
+}
+
+int
+remote_mips_remove_watchpoint (addr, len, type)
+     CORE_ADDR addr;
+     int len;
+     int type;
+{
+  CORE_ADDR first_addr;
+  unsigned long mask;
+
+  mask = calculate_mask (addr, len);
+
+  first_addr = addr & ~mask;
+
+  if (common_breakpoint ('b', first_addr, 0, NULL))
+    return -1;
+
+  return 0;
+}
+
+int
+remote_mips_stopped_by_watchpoint ()
+{
+  return hit_watchpoint;
+}
+
+/* This routine generates the a breakpoint command of the form:
+
+   0x0 <CMD> <ADDR> <MASK> <FLAGS>
+
+   Where <CMD> is one of: `B' to set, or `b' to clear a breakpoint.  <ADDR> is
+   the address of the breakpoint.  <MASK> is a don't care mask for addresses.
+   <FLAGS> is any combination of `r', `w', or `f' for read/write/or fetch.  */
+
+static int
+common_breakpoint (cmd, addr, mask, flags)
+     int cmd;
+     CORE_ADDR addr;
+     CORE_ADDR mask;
+     char *flags;
+{
+  int len;
+  char buf[DATA_MAXLEN + 1];
+  char rcmd;
+  int rpid, rerrflg, rresponse;
+  int nfields;
+
+  if (flags)
+    sprintf (buf, "0x0 %c 0x%x 0x%x %s", cmd, addr, mask, flags);
+  else
+    sprintf (buf, "0x0 %c 0x%x", cmd, addr);
+
+  mips_send_packet (buf, 1);
+
+  len = mips_receive_packet (buf, 1, mips_receive_wait);
+
+  nfields = sscanf (buf, "0x%x %c 0x%x 0x%x", &rpid, &rcmd, &rerrflg, &rresponse);
+
+  if (nfields != 4
+      || rcmd != cmd)
+    mips_error ("common_breakpoint: Bad response from remote board: %s", buf);
+
+  if (rerrflg != 0)
+    {
+      if (rerrflg != EINVAL)
+       fprintf_unfiltered (stderr, "common_breakpoint (0x%x):  Got error: 0x%x\n",
+                           addr, rresponse);
+      return 1;
+    }
+
+  return 0;
+}
+\f
 static void
 send_srec (srec, len, addr)
      char *srec;
@@ -1740,7 +2028,7 @@ mips_load_srec (args)
 static int
 mips_make_srec (buf, type, memaddr, myaddr, len)
      char *buf;
-     char type;
+     int type;
      CORE_ADDR memaddr;
      unsigned char *myaddr;
      int len;
@@ -1782,14 +2070,13 @@ mips_load (file, from_tty)
     int  from_tty;
 {
   int err;
-  static char prompt[] = TARGET_MONITOR_PROMPT;
 
   /* Get the board out of remote debugging mode.  */
 
   mips_request ('x', (unsigned int) 0, (unsigned int) 0, &err,
-               mips_receive_wait);
+               mips_receive_wait, NULL);
 
-  if (!mips_expect ("\015\012") || !mips_expect (prompt))
+  if (!mips_expect ("\015\012") || !mips_expect (TARGET_MONITOR_PROMPT))
     error ("mips_load:  Couldn't get into monitor mode.");
 
   mips_load_srec (file);
index 612c2a1..ea6541a 100644 (file)
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -3033,6 +3033,15 @@ echo_command (text, from_tty)
   gdb_flush (gdb_stdout);
 }
 
+/* ARGSUSED */
+static void
+dont_repeat_command (ignored, from_tty)
+     char *ignored;
+     int from_tty;
+{
+  *line = 0;           /* Can't call dont_repeat here because we're not
+                          necessarily reading from stdin.  */
+}
 \f
 #ifdef TARGET_BYTE_ORDER_SELECTABLE
 
@@ -3467,6 +3476,9 @@ when gdb is started.", &cmdlist);
   add_com_alias ("q", "quit", class_support, 1);
   add_com_alias ("h", "help", class_support, 1);
 
+  add_com ("dont-repeat", class_support, dont_repeat_command, "Don't repeat this command.\n\
+Primarily used inside of user-defined commands that should not be repeated when\n\
+hitting return.");
 
   c = add_set_cmd ("verbose", class_support, var_boolean, (char *)&info_verbose,
                   "Set ",
index 98872b9..8bd01f8 100644 (file)
@@ -602,6 +602,12 @@ request_quit (signo)
      about USG defines and stuff like that.  */
   signal (signo, request_quit);
 
+/* start-sanitize-gm */
+#ifdef GENERAL_MAGIC_HACKS
+  target_kill ();
+#endif /* GENERAL_MAGIC_HACKS */
+/* end-sanitize-gm */
+
 #ifdef REQUEST_QUIT
   REQUEST_QUIT;
 #else
@@ -1508,7 +1514,7 @@ vfprintf_maybe_filtered (stream, format, args, filter)
 void
 vfprintf_filtered (stream, format, args)
      FILE *stream;
-     char *format;
+     const char *format;
      va_list args;
 {
   vfprintf_maybe_filtered (stream, format, args, 1);
@@ -1517,7 +1523,7 @@ vfprintf_filtered (stream, format, args)
 void
 vfprintf_unfiltered (stream, format, args)
      FILE *stream;
-     char *format;
+     const char *format;
      va_list args;
 {
   char *linebuffer;
@@ -1536,7 +1542,7 @@ vfprintf_unfiltered (stream, format, args)
 
 void
 vprintf_filtered (format, args)
-     char *format;
+     const char *format;
      va_list args;
 {
   vfprintf_maybe_filtered (gdb_stdout, format, args, 1);
@@ -1544,7 +1550,7 @@ vprintf_filtered (format, args)
 
 void
 vprintf_unfiltered (format, args)
-     char *format;
+     const char *format;
      va_list args;
 {
   vfprintf_unfiltered (gdb_stdout, format, args);
@@ -1553,7 +1559,7 @@ vprintf_unfiltered (format, args)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-fprintf_filtered (FILE *stream, char *format, ...)
+fprintf_filtered (FILE *stream, const char *format, ...)
 #else
 fprintf_filtered (va_alist)
      va_dcl
@@ -1577,7 +1583,7 @@ fprintf_filtered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-fprintf_unfiltered (FILE *stream, char *format, ...)
+fprintf_unfiltered (FILE *stream, const char *format, ...)
 #else
 fprintf_unfiltered (va_alist)
      va_dcl
@@ -1604,7 +1610,7 @@ fprintf_unfiltered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-fprintfi_filtered (int spaces, FILE *stream, char *format, ...)
+fprintfi_filtered (int spaces, FILE *stream, const char *format, ...)
 #else
 fprintfi_filtered (va_alist)
      va_dcl
@@ -1633,7 +1639,7 @@ fprintfi_filtered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-printf_filtered (char *format, ...)
+printf_filtered (const char *format, ...)
 #else
 printf_filtered (va_alist)
      va_dcl
@@ -1656,7 +1662,7 @@ printf_filtered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-printf_unfiltered (char *format, ...)
+printf_unfiltered (const char *format, ...)
 #else
 printf_unfiltered (va_alist)
      va_dcl
@@ -1681,7 +1687,7 @@ printf_unfiltered (va_alist)
 /* VARARGS */
 void
 #ifdef ANSI_PROTOTYPES
-printfi_filtered (int spaces, char *format, ...)
+printfi_filtered (int spaces, const char *format, ...)
 #else
 printfi_filtered (va_alist)
      va_dcl
@@ -1710,14 +1716,14 @@ printfi_filtered (va_alist)
 
 void
 puts_filtered (string)
-     char *string;
+     const char *string;
 {
   fputs_filtered (string, gdb_stdout);
 }
 
 void
 puts_unfiltered (string)
-     char *string;
+     const char *string;
 {
   fputs_unfiltered (string, gdb_stdout);
 }