BSD 4_3 development
authorCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 7 Mar 1985 10:27:11 +0000 (02:27 -0800)
committerCSRG <csrg@ucbvax.Berkeley.EDU>
Thu, 7 Mar 1985 10:27:11 +0000 (02:27 -0800)
Work on file usr/src/ucb/dbx/tests/noenv.c
Work on file usr/src/ucb/dbx/tests/check
Work on file usr/src/ucb/dbx/tests/Makefile
Work on file usr/src/ucb/dbx/tests/mod/imports.mod
Work on file usr/src/ucb/dbx/tests/mod/records.mod
Work on file usr/src/ucb/dbx/tests/runtest
Work on file usr/src/ucb/dbx/tests/mod/sets.mod
Work on file usr/src/ucb/dbx/tests/mod/variants.mod
Work on file usr/src/ucb/dbx/tests/mod/imported.mod
Work on file usr/src/ucb/dbx/tests/mod/arrays.mod
Work on file usr/src/ucb/dbx/tests/mod/stkcmds.mod
Work on file usr/src/ucb/dbx/tests/mod/nested.mod
Work on file usr/src/ucb/dbx/tests/mod/imptypes.mod
Work on file usr/src/ucb/dbx/tests/mod/jsb.mod
Work on file usr/src/ucb/dbx/tests/mod/procvars.mod
Work on file usr/src/ucb/dbx/tests/mod/recur.mod
Work on file usr/src/ucb/dbx/tests/mod/files.mod
Work on file usr/src/ucb/dbx/tests/mod/bitfields.mod
Work on file usr/src/ucb/dbx/tests/mod/assign.mod
Work on file usr/src/ucb/dbx/tests/mod/call.mod
Work on file usr/src/ucb/dbx/tests/mod/reals.mod
Work on file usr/src/ucb/dbx/tests/mod/proftrace.mod
Work on file usr/src/ucb/dbx/tests/mod/opaque.mod
Work on file usr/src/ucb/dbx/tests/mod/dynarrays.mod
Work on file usr/src/ucb/dbx/tests/mod/exp.mod
Work on file usr/src/ucb/dbx/tests/mod/arrayrec.mod
Work on file usr/src/ucb/dbx/tests/mod/trace.mod
Work on file usr/src/ucb/dbx/tests/mod/multirefs.mod
Work on file usr/src/ucb/dbx/tests/mod/imp1.mod
Work on file usr/src/ucb/dbx/tests/mod/const.mod
Work on file usr/src/ucb/dbx/tests/mod/imp2.mod
Work on file usr/src/ucb/dbx/tests/mod/ptrarray.mod
Work on file usr/src/ucb/dbx/tests/mod/Makefile
Work on file usr/src/ucb/dbx/tests/cc/bitfields.c
Work on file usr/src/ucb/dbx/tests/cc/enum.c
Work on file usr/src/ucb/dbx/tests/mod/bool.mod
Work on file usr/src/ucb/dbx/tests/cc/same.c
Work on file usr/src/ucb/dbx/tests/cc/struct.c
Work on file usr/src/ucb/dbx/tests/cc/float.c
Work on file usr/src/ucb/dbx/tests/cc/reg.c
Work on file usr/src/ucb/dbx/tests/cc/own.c
Work on file usr/src/ucb/dbx/tests/cc/user.c
Work on file usr/src/ucb/dbx/tests/cc/sleep.c
Work on file usr/src/ucb/dbx/tests/cc/nested.c
Work on file usr/src/ucb/dbx/tests/cc/call.c
Work on file usr/src/ucb/dbx/tests/cc/signal.c
Work on file usr/src/ucb/dbx/tests/cc/stkcmds.c
Work on file usr/src/ucb/dbx/tests/cc/environ.c
Work on file usr/src/ucb/dbx/tests/cc/arrays.c
Work on file usr/src/ucb/dbx/tests/cc/strings.c
Work on file usr/src/ucb/dbx/tests/cc/args.c
Work on file usr/src/ucb/dbx/tests/cc/m1.c
Work on file usr/src/ucb/dbx/tests/cc/m2.c
Work on file usr/src/ucb/dbx/tests/cc/dump.c
Work on file usr/src/ucb/dbx/tests/cc/gprof.c
Work on file usr/src/ucb/dbx/tests/cc/loophole.c
Work on file usr/src/ucb/dbx/tests/cc/Makefile
Work on file usr/src/ucb/dbx/tests/cc/ushort.c
Work on file usr/src/ucb/dbx/tests/cc/arrays.in
Work on file usr/src/ucb/dbx/tests/cc/aliases.in
Work on file usr/src/ucb/dbx/tests/cc/args.in
Work on file usr/src/ucb/dbx/tests/cc/enum.in
Work on file usr/src/ucb/dbx/tests/cc/float.in
Work on file usr/src/ucb/dbx/tests/cc/dump.in
Work on file usr/src/ucb/dbx/tests/cc/environ.in
Work on file usr/src/ucb/dbx/tests/cc/bitfields.in
Work on file usr/src/ucb/dbx/tests/cc/call.in
Work on file usr/src/ucb/dbx/tests/cc/gprof.in
Work on file usr/src/ucb/dbx/tests/cc/own.in
Work on file usr/src/ucb/dbx/tests/cc/loophole.in
Work on file usr/src/ucb/dbx/tests/cc/nested.in
Work on file usr/src/ucb/dbx/tests/cc/reg.in
Work on file usr/src/ucb/dbx/tests/cc/signal.in
Work on file usr/src/ucb/dbx/tests/cc/strings.in
Work on file usr/src/ucb/dbx/tests/cc/sleep.in
Work on file usr/src/ucb/dbx/tests/cc/stkcmds.in
Work on file usr/src/ucb/dbx/tests/cc/struct.in
Work on file usr/src/ucb/dbx/tests/cc/same.in
Work on file usr/src/ucb/dbx/tests/cc/user.in
Work on file usr/src/ucb/dbx/tests/cc/args.out
Work on file usr/src/ucb/dbx/tests/cc/aliases.out
Work on file usr/src/ucb/dbx/tests/cc/arrays.out
Work on file usr/src/ucb/dbx/tests/cc/bitfields.out
Work on file usr/src/ucb/dbx/tests/cc/ushort.in
Work on file usr/src/ucb/dbx/tests/cc/dump.out
Work on file usr/src/ucb/dbx/tests/cc/call.out
Work on file usr/src/ucb/dbx/tests/cc/enum.out
Work on file usr/src/ucb/dbx/tests/cc/float.out
Work on file usr/src/ucb/dbx/tests/cc/own.out
Work on file usr/src/ucb/dbx/tests/cc/nested.out
Work on file usr/src/ucb/dbx/tests/cc/same.out
Work on file usr/src/ucb/dbx/tests/cc/loophole.out
Work on file usr/src/ucb/dbx/tests/cc/reg.out
Work on file usr/src/ucb/dbx/tests/cc/sleep.out
Work on file usr/src/ucb/dbx/tests/cc/strings.out
Work on file usr/src/ucb/dbx/tests/cc/stkcmds.out
Work on file usr/src/ucb/dbx/tests/cc/signal.out
Work on file usr/src/ucb/dbx/tests/cc/user.out
Work on file usr/src/ucb/dbx/tests/cc/args.cmd
Work on file usr/src/ucb/dbx/tests/cc/ushort.out
Work on file usr/src/ucb/dbx/tests/cc/struct.out

Synthesized-from: CSRG/cd1/4.3

101 files changed:
usr/src/ucb/dbx/tests/Makefile [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/Makefile [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/aliases.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/aliases.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/args.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/args.cmd [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/args.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/args.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/arrays.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/arrays.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/arrays.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/bitfields.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/bitfields.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/bitfields.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/call.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/call.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/call.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/dump.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/dump.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/dump.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/enum.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/enum.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/enum.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/environ.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/environ.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/float.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/float.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/float.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/gprof.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/gprof.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/loophole.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/loophole.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/loophole.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/m1.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/m2.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/nested.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/nested.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/nested.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/own.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/own.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/own.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/reg.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/reg.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/reg.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/same.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/same.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/same.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/signal.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/signal.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/signal.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/sleep.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/sleep.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/sleep.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/stkcmds.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/stkcmds.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/stkcmds.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/strings.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/strings.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/strings.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/struct.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/struct.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/struct.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/user.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/user.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/user.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/ushort.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/ushort.in [new file with mode: 0644]
usr/src/ucb/dbx/tests/cc/ushort.out [new file with mode: 0644]
usr/src/ucb/dbx/tests/check [new file with mode: 0755]
usr/src/ucb/dbx/tests/mod/Makefile [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/arrayrec.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/arrays.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/assign.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/bitfields.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/bool.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/call.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/const.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/dynarrays.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/exp.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/files.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/imp1.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/imp2.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/imported.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/imports.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/imptypes.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/jsb.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/multirefs.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/nested.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/opaque.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/procvars.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/proftrace.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/ptrarray.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/reals.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/records.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/recur.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/sets.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/stkcmds.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/trace.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/mod/variants.mod [new file with mode: 0644]
usr/src/ucb/dbx/tests/noenv.c [new file with mode: 0644]
usr/src/ucb/dbx/tests/runtest [new file with mode: 0755]

diff --git a/usr/src/ucb/dbx/tests/Makefile b/usr/src/ucb/dbx/tests/Makefile
new file mode 100644 (file)
index 0000000..e3bce94
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# Makefile for testing dbx.
+#
+
+TESTDBX = ../../tdbx
+
+passed:
+#      @chdir mod; make TESTDBX=${TESTDBX}
+       @chdir cc; make TESTDBX=${TESTDBX}
+#      @chdir pc; make TESTDBX=${TESTDBX}
+#      @chdir f77; make TESTDBX=${TESTDBX}
+       @echo ""
+       @echo "passed tests"
diff --git a/usr/src/ucb/dbx/tests/cc/Makefile b/usr/src/ucb/dbx/tests/cc/Makefile
new file mode 100644 (file)
index 0000000..a6a6763
--- /dev/null
@@ -0,0 +1,94 @@
+#
+# Makefile for testing dbx.
+#
+
+.SUFFIXES:
+
+.SUFFIXES: .c .h .s .o .x .t .in .tst .out
+
+#
+# Suffix conventions:
+#
+#      .c      C source module
+#      .h      C definitions file
+#      .s      assembly code file
+#      .o      object file
+#      .x      executable file
+#      .t      dummy file represented last time tested
+#      .in     input for testing
+#      .tst    test output
+#      .out    expected output
+#
+
+CC = cc
+
+TESTDBX = ../../tdbx
+TESTS = \
+    aliases.t args.t arrays.t bitfields.t call.t dump.t enum.t float.t \
+    loophole.t nested.t own.t reg.t \
+    same.t signal.t sleep.t stkcmds.t strings.t struct.t user.t ushort.t
+
+.c.x:
+       ${CC} -g $*.c -o $*.x
+
+.c.o:
+       ${CC} -c -g $*.c
+
+.in.tst:
+       @rm -f $*.tst
+       ../runtest ${TESTDBX} $* > $*.tst
+
+.x.t:
+       @echo "    $*"
+       @rm -f tmp
+       @../runtest ${TESTDBX} $* > tmp
+       @../check tmp $*.out
+       @rm -f tmp
+       @rm -f $*.t
+       @touch $*.t
+
+passed: beforemsg ${TESTS}
+       @echo "passed C tests"
+
+beforemsg:
+       @echo ""
+       @echo "C tests:"
+
+strings.x: strings.c
+       cc -g -R strings.c -o strings.x
+
+aliases.t: aliases.x ${TESTDBX}
+args.t: args.x ${TESTDBX}
+arrays.t: arrays.x ${TESTDBX}
+bitfields.t: bitfields.x ${TESTDBX}
+call.t: call.x ${TESTDBX}
+dump.t: dump.x ${TESTDBX}
+enum.t: enum.x ${TESTDBX}
+float.t: float.x ${TESTDBX}
+loophole.t: loophole.x ${TESTDBX}
+nested.t: nested.x ${TESTDBX}
+own.t: own.x ${TESTDBX}
+reg.t: reg.x ${TESTDBX}
+same.t: same.x ${TESTDBX}
+signal.t: signal.x ${TESTDBX}
+sleep.t: sleep.x ${TESTDBX}
+stkcmds.t: stkcmds.x ${TESTDBX}
+struct.t: struct.x ${TESTDBX}
+user.t: user.x ${TESTDBX}
+ushort.t: ushort.x ${TESTDBX}
+
+strings.t: strings.x strings.core ${TESTDBX}
+       @echo "    $*"
+       @rm -f tmp
+       @${TESTDBX} $*.x $*.core < $*.in | tail +3 > tmp
+       @../check tmp $*.out
+       @rm -f tmp
+       @rm -f $*.t
+       @touch $*.t
+
+strings.core:
+       -csh -f -c "limit coredumpsize 6m >& /dev/null; strings.x"
+       mv core strings.core
+
+aliases.x: arrays.x
+       ln -s arrays.x aliases.x
diff --git a/usr/src/ucb/dbx/tests/cc/aliases.in b/usr/src/ucb/dbx/tests/cc/aliases.in
new file mode 100644 (file)
index 0000000..0527d05
--- /dev/null
@@ -0,0 +1,6 @@
+alias break(x) "stop at x"
+alias
+break(12)
+run
+unalias break
+break(12)
diff --git a/usr/src/ucb/dbx/tests/cc/aliases.out b/usr/src/ucb/dbx/tests/cc/aliases.out
new file mode 100644 (file)
index 0000000..a7aa74f
--- /dev/null
@@ -0,0 +1,21 @@
+reading symbolic information ...
+break(x)       stop at x
+t      where
+j      status
+st     stop
+s      step
+r      run
+q      quit
+p      print
+n      next
+l      list
+e      edit
+h      help
+d      delete
+c      cont
+[1] stop at 12
+[1] stopped in p at line 12
+   12   }
+break(12)
+^ unrecognized command
+
diff --git a/usr/src/ucb/dbx/tests/cc/args.c b/usr/src/ucb/dbx/tests/cc/args.c
new file mode 100644 (file)
index 0000000..7b76fd5
--- /dev/null
@@ -0,0 +1,9 @@
+/*
+ * Test of passing and accessing the command line arguments through dbx.
+ */
+
+main (argc, argv)
+int argc;
+char *argv[];
+{
+}
diff --git a/usr/src/ucb/dbx/tests/cc/args.cmd b/usr/src/ucb/dbx/tests/cc/args.cmd
new file mode 100644 (file)
index 0000000..0db1cdf
--- /dev/null
@@ -0,0 +1 @@
+     run -n -o testld -e start -x -T 80000000 locore.o af.o if.o raw_cb.o raw_usrreq.o route.o if_ether.o if_loop.o in.o in_pcb.o in_proto.o ip_icmp.o ip_input.o ip_output.o raw_ip.o tcp_debug.o tcp_input.o tcp_output.o tcp_subr.o tcp_timer.o tcp_usrreq.o udp_usrreq.o pup.o pup_proto.o raw_pup.o init_main.o init_sysent.o kern_acct.o kern_clock.o kern_descrip.o kern_exec.o kern_exit.o kern_fork.o kern_mman.o kern_proc.o kern_prot.o kern_resource.o kern_sig.o kern_subr.o kern_synch.o kern_time.o kern_xxx.o quota_kern.o quota_subr.o quota_sys.o quota_ufs.o subr_prf.o subr_rmap.o subr_xxx.o sys_generic.o sys_inode.o sys_process.o sys_socket.o tty.o tty_conf.o tty_pty.o tty_subr.o tty_tty.o ufs_alloc.o ufs_bio.o ufs_bmap.o ufs_dsort.o ufs_fio.o ufs_inode.o ufs_mount.o ufs_nami.o ufs_subr.o ufs_syscalls.o ufs_tables.o ufs_xxx.o uipc_domain.o uipc_mbuf.o uipc_pipe.o uipc_proto.o uipc_socket.o uipc_socket2.o uipc_syscalls.o uipc_usrreq.o vm_drum.o vm_mem.o vm_mon.o vm_page.o vm_proc.o vm_pt.o vm_sched.o vm_subr.o vm_sw.o vm_swap.o vm_swp.o vm_text.o autoconf.o clock.o conf.o cons.o cpudata.o dkbad.o flp.o in_cksum.o machdep.o mem.o pup_cksum.o sys_machdep.o trap.o tu.o udiv.o ufs_machdep.o urem.o vm_machdep.o if_ec.o if_uba.o dmf.o idc.o uba.o vs.o vers.o ioconf.o param.o swapvmunix.o
diff --git a/usr/src/ucb/dbx/tests/cc/args.in b/usr/src/ucb/dbx/tests/cc/args.in
new file mode 100644 (file)
index 0000000..5d1886c
--- /dev/null
@@ -0,0 +1,6 @@
+stop in main
+source args.cmd
+print argc
+print argv[95]
+print argv[96]
+print argv[97]
diff --git a/usr/src/ucb/dbx/tests/cc/args.out b/usr/src/ucb/dbx/tests/cc/args.out
new file mode 100644 (file)
index 0000000..e931221
--- /dev/null
@@ -0,0 +1,9 @@
+reading symbolic information ...
+[1] stop in main
+[1] stopped in main at 0x4e
+0000004e  brb  51
+127 
+"vm_sw.o" 
+"vm_swap.o" 
+"vm_swp.o" 
+
diff --git a/usr/src/ucb/dbx/tests/cc/arrays.c b/usr/src/ucb/dbx/tests/cc/arrays.c
new file mode 100644 (file)
index 0000000..d49a504
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Test of debugging arrays in C.
+ */
+
+int a[10], *b;
+
+p (i, a, j)
+int i, a[], j;
+{
+    a[3] = i;
+    a[4] = j;
+}
+
+main ()
+{
+    int i;
+
+    b = a;
+    for (i = 0; i < 10; i++) {
+       a[i] = i;
+    }
+    p(4, a, 5);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/arrays.in b/usr/src/ucb/dbx/tests/cc/arrays.in
new file mode 100644 (file)
index 0000000..a36dcb5
--- /dev/null
@@ -0,0 +1,8 @@
+whatis p.a
+stop at 10
+run
+print arrays.a
+step
+print a[3], a[4], a[5]
+step
+print arrays.a
diff --git a/usr/src/ucb/dbx/tests/cc/arrays.out b/usr/src/ucb/dbx/tests/cc/arrays.out
new file mode 100644 (file)
index 0000000..8908521
--- /dev/null
@@ -0,0 +1,13 @@
+reading symbolic information ...
+int *a;
+[1] stop at 10
+[1] stopped in p at line 10
+   10       a[3] = i;
+(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) 
+stopped in p at line 11
+   11       a[4] = j;
+4 4 5 
+stopped in p at line 12
+   12   }
+(0, 1, 2, 4, 5, 5, 6, 7, 8, 9) 
+
diff --git a/usr/src/ucb/dbx/tests/cc/bitfields.c b/usr/src/ucb/dbx/tests/cc/bitfields.c
new file mode 100644 (file)
index 0000000..efb0a6f
--- /dev/null
@@ -0,0 +1,50 @@
+typedef unsigned int uint;
+
+struct dot {
+    uint  cost          :24;
+    uint  type          : 3;
+    uint  dirToCenter   : 3;
+    uint  pad           : 1;
+    uint  pin           : 1;
+    uint  traceback     : 3;
+    uint  traceforward   : 3;
+    uint  expanded      : 1;
+    uint  underDir      : 3;
+    uint  underOffset   : 4;
+    uint  start                 : 1;
+    uint  target        : 1;
+    uint  owner                 : 6;
+    uint  segment       : 7;
+    uint  intrinsicCost  : 3;
+};
+
+main()
+{
+    struct dot junk;
+
+    junk.owner = 63;
+    junk.segment = 1;
+    junk.intrinsicCost = 1;
+
+    printf("owner = %d, segment = %d, intrinsicCost = %d\n",
+       junk.owner, junk.segment, junk.intrinsicCost);
+    printf("done\n");
+    oldmain();
+}
+
+oldmain()
+{
+    struct {
+       int first;
+       int second;
+       int a : 8;
+       int b : 8;
+       int c;
+    } x;
+
+    x.first = 0;
+    x.second = 0;
+    x.a = 2;
+    x.b = 10;
+    x.c = 1;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/bitfields.in b/usr/src/ucb/dbx/tests/cc/bitfields.in
new file mode 100644 (file)
index 0000000..114d5d4
--- /dev/null
@@ -0,0 +1,12 @@
+whatis x
+whatis x.a
+stop at 31
+run
+print junk
+print junk.owner, junk.segment, junk.intrinsicCost
+stop at 50
+cont
+print x
+print x.a
+print x.b
+print x.c
diff --git a/usr/src/ucb/dbx/tests/cc/bitfields.out b/usr/src/ucb/dbx/tests/cc/bitfields.out
new file mode 100644 (file)
index 0000000..a1f1cf9
--- /dev/null
@@ -0,0 +1,22 @@
+reading symbolic information ...
+struct {
+    int first;
+    int second;
+    int a : 8;
+    int b : 8;
+    int c;
+} x;
+int a : 8;
+[1] stop at 31
+[1] stopped in main at line 31
+   31       printf("done\n");
+(cost = 0, type = 0, dirToCenter = 0, pad = 0, pin = 0, traceback = 0, traceforward = 0, expanded = 0, underDir = 0, underOffset = 0, start = 0, target = 0, owner = 63, segment = 1, intrinsicCost = 1) 
+63 1 1 
+[3] stop at 50
+[3] stopped in oldmain at line 50
+   50   }
+(first = 0, second = 0, a = 2, b = 10, c = 1) 
+2 
+10 
+1 
+
diff --git a/usr/src/ucb/dbx/tests/cc/call.c b/usr/src/ucb/dbx/tests/cc/call.c
new file mode 100644 (file)
index 0000000..451d73e
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Test program for dbx call command.
+ */
+
+int global;
+
+main (argc, argv)
+int argc;
+char *argv[];
+{
+    int main_local;
+
+    global = 2;
+    main_local = 19;
+    p1();
+    p2(main_local);
+    p3("test");
+}
+
+p1 ()
+{
+    printf("in p1\n");
+    global = 4;
+}
+
+p2 (from_main)
+int from_main;
+{
+    printf("in p2(%d)\n", from_main);
+    global = 9;
+}
+
+p3 (s)
+char s[];
+{
+    printf("in p3(%s)\n", s);
+    global = 10;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/call.in b/usr/src/ucb/dbx/tests/cc/call.in
new file mode 100644 (file)
index 0000000..d7dec05
--- /dev/null
@@ -0,0 +1,16 @@
+call printf("starting")
+stop at 15
+run
+call p1()
+call p2(3)
+call p3("blah")
+call printf("main_local = %d", main_local)
+print main_local
+call call
+call call()
+call p1(3)
+call p2("blah")
+stop in p3
+call p3("blah")
+cont
+where
diff --git a/usr/src/ucb/dbx/tests/cc/call.out b/usr/src/ucb/dbx/tests/cc/call.out
new file mode 100644 (file)
index 0000000..68ff2c9
--- /dev/null
@@ -0,0 +1,31 @@
+reading symbolic information ...
+starting
+printf returns successfully
+[2] stop at 15
+[2] stopped in main at line 15
+   15       p1();
+in p1
+
+p1 returns successfully
+in p2(3)
+
+p2 returns successfully
+in p3(blah)
+
+p3 returns successfully
+main_local = 19
+printf returns successfully
+19 
+call call
+         ^ syntax error
+"call" not call-able
+too many parameters in call to p1
+type mismatch for from_main in call to p2
+[8] stop in p3
+[8] stopped in p3 at line 36
+   36       printf("in p3(%s)\n", s);
+in p3(blah)
+
+p3 returns successfully
+main(argc = 1, argv = 0x7fffebe8, 0x7fffebf0), line 15 in "call.c"
+
diff --git a/usr/src/ucb/dbx/tests/cc/dump.c b/usr/src/ucb/dbx/tests/cc/dump.c
new file mode 100644 (file)
index 0000000..16f3821
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Test of nested blocks.
+ */
+int i;
+
+main ()
+{
+    i = 3;
+    sub();
+}
+
+sub ()
+{
+    int i, j;
+
+    for (i = 1; i <= 10; i++) {
+       int j;
+
+       j = j + i;
+    }
+    j = 0;
+    for (i = 11; i <= 20; i++) {
+       j = j + i;
+    }
+}
+
+after ()
+{
+    int a;
+
+    a = 3;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/dump.in b/usr/src/ucb/dbx/tests/cc/dump.in
new file mode 100644 (file)
index 0000000..da7be07
--- /dev/null
@@ -0,0 +1,11 @@
+stop at 20
+run
+where
+print "-----"
+dump
+print "-----"
+dump sub
+print "-----"
+dump main
+print "-----"
+dump .
diff --git a/usr/src/ucb/dbx/tests/cc/dump.out b/usr/src/ucb/dbx/tests/cc/dump.out
new file mode 100644 (file)
index 0000000..e56597f
--- /dev/null
@@ -0,0 +1,34 @@
+reading symbolic information ...
+[1] stop at 20
+[1] stopped in $b1 at line 20
+   20          j = j + i;
+$b1, line 20 in "dump.c"
+sub(), line 20 in "dump.c"
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 10 in "dump.c"
+----- 
+$b1, line 20 in "dump.c"
+j = 0
+----- 
+sub(), line 20 in "dump.c"
+i = 1
+j = 0
+----- 
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 10 in "dump.c"
+----- 
+$b1, line 20 in "dump.c"
+j = 0
+
+sub(), line 20 in "dump.c"
+i = 1
+j = 0
+
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 10 in "dump.c"
+
+in "":
+errno = 0
+_dbargs = 0
+mcount = 5
+environ = 2147478512
+dump.i = 3
+
+
diff --git a/usr/src/ucb/dbx/tests/cc/enum.c b/usr/src/ucb/dbx/tests/cc/enum.c
new file mode 100644 (file)
index 0000000..e957b7b
--- /dev/null
@@ -0,0 +1,15 @@
+typedef enum { RED, GREEN, BLUE } Color;
+
+main()
+{
+    Color c;
+
+    c = BLUE;
+    f(RED);
+}
+
+f(c)
+Color c;
+{
+    printf("c = %d\n", c);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/enum.in b/usr/src/ucb/dbx/tests/cc/enum.in
new file mode 100644 (file)
index 0000000..50a581e
--- /dev/null
@@ -0,0 +1,8 @@
+whatis Color
+whatis main.c
+stop in f
+run
+where
+print c
+print main.c
+quit
diff --git a/usr/src/ucb/dbx/tests/cc/enum.out b/usr/src/ucb/dbx/tests/cc/enum.out
new file mode 100644 (file)
index 0000000..5c2670f
--- /dev/null
@@ -0,0 +1,10 @@
+reading symbolic information ...
+typedef enum { RED, GREEN, BLUE } Color;
+Color c;
+[1] stop in f
+[1] stopped in f at line 14
+   14       printf("c = %d\n", c);
+f(c = RED), line 14 in "enum.c"
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 8 in "enum.c"
+RED 
+BLUE 
diff --git a/usr/src/ucb/dbx/tests/cc/environ.c b/usr/src/ucb/dbx/tests/cc/environ.c
new file mode 100644 (file)
index 0000000..2550c63
--- /dev/null
@@ -0,0 +1,4 @@
+main (argc, argv)
+{
+    printf("argc = %d\n", argc);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/environ.in b/usr/src/ucb/dbx/tests/cc/environ.in
new file mode 100644 (file)
index 0000000..431e231
--- /dev/null
@@ -0,0 +1,4 @@
+print environ
+print environ[1]
+print environ[1][1]
+&environ/10X
diff --git a/usr/src/ucb/dbx/tests/cc/float.c b/usr/src/ucb/dbx/tests/cc/float.c
new file mode 100644 (file)
index 0000000..a869824
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Test of floats and doubles.
+ */
+
+double f(x)
+double x;
+{
+    return 3.14*x;
+}
+
+main()
+{
+    double x;
+    float y;
+
+    y = 3.0;
+    x = f(y);
+    return 0;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/float.in b/usr/src/ucb/dbx/tests/cc/float.in
new file mode 100644 (file)
index 0000000..68e48c5
--- /dev/null
@@ -0,0 +1,11 @@
+stop in main
+run
+step
+step
+print y
+print y + 2
+print 3.5*y
+stop in f
+cont
+where
+cont
diff --git a/usr/src/ucb/dbx/tests/cc/float.out b/usr/src/ucb/dbx/tests/cc/float.out
new file mode 100644 (file)
index 0000000..204cd16
--- /dev/null
@@ -0,0 +1,19 @@
+reading symbolic information ...
+[1] stop in main
+[1] stopped in main at line 16
+   16       y = 3.0;
+stopped in main at line 16
+   16       y = 3.0;
+stopped in main at line 17
+   17       x = f(y);
+3.0 
+5.0 
+10.5 
+[3] stop in f
+[3] stopped in f at 0x4e
+0000004e  brb  5b
+f(x = 3.0) at 0x4e
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 17 in "float.c"
+
+execution completed
+
diff --git a/usr/src/ucb/dbx/tests/cc/gprof.c b/usr/src/ucb/dbx/tests/cc/gprof.c
new file mode 100644 (file)
index 0000000..d49a504
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Test of debugging arrays in C.
+ */
+
+int a[10], *b;
+
+p (i, a, j)
+int i, a[], j;
+{
+    a[3] = i;
+    a[4] = j;
+}
+
+main ()
+{
+    int i;
+
+    b = a;
+    for (i = 0; i < 10; i++) {
+       a[i] = i;
+    }
+    p(4, a, 5);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/gprof.in b/usr/src/ucb/dbx/tests/cc/gprof.in
new file mode 100644 (file)
index 0000000..1030272
--- /dev/null
@@ -0,0 +1,4 @@
+stop in main
+stepi
+stepi
+stepi
diff --git a/usr/src/ucb/dbx/tests/cc/loophole.c b/usr/src/ucb/dbx/tests/cc/loophole.c
new file mode 100644 (file)
index 0000000..d84b76e
--- /dev/null
@@ -0,0 +1,14 @@
+typedef struct proc *proc_p;
+
+struct proc {
+    int a;
+    int b;
+};
+
+main ()
+{
+    struct proc p;
+
+    p.a = 3;
+    p.b = 4;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/loophole.in b/usr/src/ucb/dbx/tests/cc/loophole.in
new file mode 100644 (file)
index 0000000..76b21a2
--- /dev/null
@@ -0,0 +1,15 @@
+print int('c')
+print 'c' \ int
+print char(99)
+print 99 \ char
+stop at 14
+run
+print &p
+print 0x7fffebb4 \ proc_p ^
+print *(0x7fffebb4 \ proc_p)
+print *proc_p(0x7fffebb4)
+print 0x7fffebb4 \ &$$proc ^
+print *(0x7fffebb4 \ &$$proc)
+print *&$$proc(0x7fffebb4)
+print proc_p(0x7fffebb4).b
+print &p.b
diff --git a/usr/src/ucb/dbx/tests/cc/loophole.out b/usr/src/ucb/dbx/tests/cc/loophole.out
new file mode 100644 (file)
index 0000000..1a4b069
--- /dev/null
@@ -0,0 +1,18 @@
+reading symbolic information ...
+99 
+99 
+'c' 
+'c' 
+[1] stop at 14
+[1] stopped in main at line 14
+   14   }
+0x7fffebb4 
+(a = 3, b = 4) 
+(a = 3, b = 4) 
+(a = 3, b = 4) 
+(a = 3, b = 4) 
+(a = 3, b = 4) 
+(a = 3, b = 4) 
+4 
+0x7fffebb8 
+
diff --git a/usr/src/ucb/dbx/tests/cc/m1.c b/usr/src/ucb/dbx/tests/cc/m1.c
new file mode 100644 (file)
index 0000000..f16ce51
--- /dev/null
@@ -0,0 +1,19 @@
+/*
+ * Test of dynamic name resolution.
+ */
+
+main ()
+{
+    int i;
+
+    i = 2;
+    p(3);
+}
+
+p (j)
+int j;
+{
+    int k;
+
+    k = j;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/m2.c b/usr/src/ucb/dbx/tests/cc/m2.c
new file mode 100644 (file)
index 0000000..7fb2f44
--- /dev/null
@@ -0,0 +1,5 @@
+static int i, j;
+
+q ()
+{
+}
diff --git a/usr/src/ucb/dbx/tests/cc/nested.c b/usr/src/ucb/dbx/tests/cc/nested.c
new file mode 100644 (file)
index 0000000..16f3821
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Test of nested blocks.
+ */
+int i;
+
+main ()
+{
+    i = 3;
+    sub();
+}
+
+sub ()
+{
+    int i, j;
+
+    for (i = 1; i <= 10; i++) {
+       int j;
+
+       j = j + i;
+    }
+    j = 0;
+    for (i = 11; i <= 20; i++) {
+       j = j + i;
+    }
+}
+
+after ()
+{
+    int a;
+
+    a = 3;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/nested.in b/usr/src/ucb/dbx/tests/cc/nested.in
new file mode 100644 (file)
index 0000000..5fe10f3
--- /dev/null
@@ -0,0 +1,10 @@
+stop at 20
+run
+where
+print sub.i, sub.j
+delete 1
+stop at 24
+cont
+where
+print sub.i, sub.j
+print nested.i
diff --git a/usr/src/ucb/dbx/tests/cc/nested.out b/usr/src/ucb/dbx/tests/cc/nested.out
new file mode 100644 (file)
index 0000000..9a0fd45
--- /dev/null
@@ -0,0 +1,16 @@
+reading symbolic information ...
+[1] stop at 20
+[1] stopped in $b1 at line 20
+   20          j = j + i;
+$b1, line 20 in "nested.c"
+sub(), line 20 in "nested.c"
+main(0x1, 0x7fffebe4, 0x7fffebec), line 10 in "nested.c"
+1 0 
+[3] stop at 24
+[3] stopped in sub at line 24
+   24          j = j + i;
+sub(), line 24 in "nested.c"
+main(0x1, 0x7fffebe4, 0x7fffebec), line 10 in "nested.c"
+11 0 
+3 
+
diff --git a/usr/src/ucb/dbx/tests/cc/own.c b/usr/src/ucb/dbx/tests/cc/own.c
new file mode 100644 (file)
index 0000000..78ab448
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Test of static variables.
+ */
+static int ownx;
+
+main()
+{
+    ownx = 2;
+    f(3);
+    f(4);
+    return(0);
+}
+
+static int owny;
+
+f(x)
+int x;
+{
+    static int ownx;
+
+    ownx = x;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/own.in b/usr/src/ucb/dbx/tests/cc/own.in
new file mode 100644 (file)
index 0000000..d9d9106
--- /dev/null
@@ -0,0 +1,15 @@
+whatis own.ownx
+whereis owny
+stop in f
+run
+where
+print own.ownx, ownx
+step
+step
+print own.ownx, ownx
+cont
+step
+step
+where
+print own.ownx, ownx
+cont
diff --git a/usr/src/ucb/dbx/tests/cc/own.out b/usr/src/ucb/dbx/tests/cc/own.out
new file mode 100644 (file)
index 0000000..808c7f1
--- /dev/null
@@ -0,0 +1,26 @@
+reading symbolic information ...
+int ownx;
+own.owny
+[1] stop in f
+[1] stopped in f at line 22
+   22       ownx = x;
+f(x = 3), line 22 in "own.c"
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 10 in "own.c"
+2 0 
+stopped in f at line 22
+   22       ownx = x;
+stopped in f at line 23
+   23   }
+2 3 
+[1] stopped in f at line 22
+   22       ownx = x;
+stopped in f at line 22
+   22       ownx = x;
+stopped in f at line 23
+   23   }
+f(x = 4), line 23 in "own.c"
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 11 in "own.c"
+2 4 
+
+execution completed
+
diff --git a/usr/src/ucb/dbx/tests/cc/reg.c b/usr/src/ucb/dbx/tests/cc/reg.c
new file mode 100644 (file)
index 0000000..4126a63
--- /dev/null
@@ -0,0 +1,30 @@
+struct blah {
+    int x;
+    int y;
+};
+
+main ()
+{
+    register int i;
+    register struct blah *p;
+    register char *s;
+    struct blah b;
+    int j;
+
+    s = "this is a test";
+    s += 5;
+    j = 0;
+    p = &b;
+    p->x = 3;
+    p->y = 4;
+    for (i = 0; i < 2; i++) {
+       j = i;
+       put(i);
+    }
+}
+
+static put(i)
+register int i;
+{
+    printf("%d ", i);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/reg.in b/usr/src/ucb/dbx/tests/cc/reg.in
new file mode 100644 (file)
index 0000000..2d4a357
--- /dev/null
@@ -0,0 +1,7 @@
+stop in put
+run
+where
+print main.i, *(main.p), main.s
+cont
+where
+cont
diff --git a/usr/src/ucb/dbx/tests/cc/reg.out b/usr/src/ucb/dbx/tests/cc/reg.out
new file mode 100644 (file)
index 0000000..00d5613
--- /dev/null
@@ -0,0 +1,14 @@
+reading symbolic information ...
+[1] stop in put
+[1] stopped in put at line 29
+   29       printf("%d ", i);
+put(i = 0), line 29 in "reg.c"
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 22 in "reg.c"
+0 (x = 3, y = 4) "is a test" 
+[1] stopped in put at line 29
+   29       printf("%d ", i);
+put(i = 1), line 29 in "reg.c"
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 22 in "reg.c"
+0 1 
+execution completed
+
diff --git a/usr/src/ucb/dbx/tests/cc/same.c b/usr/src/ucb/dbx/tests/cc/same.c
new file mode 100644 (file)
index 0000000..c01e7f5
--- /dev/null
@@ -0,0 +1,17 @@
+/*
+ * The purpose of this test case is to make sure that dbx interprets
+ * the command "stop in same" at the top level to mean stop in the
+ * routine same.  Originally, dbx complained since "same" in the initial
+ * context refers to the module named "same" (since this file is "same.c").
+ */
+
+same ()
+{
+    printf("same function and module names\n");
+}
+
+main ()
+{
+    same();
+    exit(0);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/same.in b/usr/src/ucb/dbx/tests/cc/same.in
new file mode 100644 (file)
index 0000000..76fdf27
--- /dev/null
@@ -0,0 +1,4 @@
+whatis same
+stop in same
+run
+where
diff --git a/usr/src/ucb/dbx/tests/cc/same.out b/usr/src/ucb/dbx/tests/cc/same.out
new file mode 100644 (file)
index 0000000..752b3fe
--- /dev/null
@@ -0,0 +1,8 @@
+reading symbolic information ...
+source file "same.c"
+[1] stop in same.same
+[1] stopped in same.same at 0x4e
+0000004e  brb  5e
+same.same() at 0x4e
+main(0x1, 0x7fffebe8, 0x7fffebf0), line 15 in "same.c"
+
diff --git a/usr/src/ucb/dbx/tests/cc/signal.c b/usr/src/ucb/dbx/tests/cc/signal.c
new file mode 100644 (file)
index 0000000..4fda2a4
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Test of tracebacks from signal handlers.
+ */
+
+#include <stdio.h>
+#include <signal.h>
+
+int catch(), secondcatch();
+
+main()
+{
+    signal(SIGQUIT, catch);
+    kill(getpid(), SIGQUIT);
+    printf("back in main\n");
+}
+
+catch()
+{
+    printf("in catch\n");
+    sigsetmask(0);
+    signal(SIGQUIT, secondcatch);
+    kill(getpid(), SIGQUIT);
+    printf("back in catch\n");
+}
+
+secondcatch()
+{
+    printf("in secondcatch\n");
+}
diff --git a/usr/src/ucb/dbx/tests/cc/signal.in b/usr/src/ucb/dbx/tests/cc/signal.in
new file mode 100644 (file)
index 0000000..e195bbf
--- /dev/null
@@ -0,0 +1,19 @@
+run
+cont
+cont
+ignore quit
+run
+stop in catch
+run
+step
+stop in secondcatch
+cont
+cont
+ignore
+catch quit
+run
+cont
+cont
+cont
+cont
+quit
diff --git a/usr/src/ucb/dbx/tests/cc/signal.out b/usr/src/ucb/dbx/tests/cc/signal.out
new file mode 100644 (file)
index 0000000..396c87f
--- /dev/null
@@ -0,0 +1,50 @@
+reading symbolic information ...
+
+quit in kill at 0xfc
+000000fc  bcs  f0
+
+quit in kill at 0xfc
+000000fc  bcs  f0
+in catch
+in secondcatch
+back in catch
+back in main
+
+execution completed
+in catch
+in secondcatch
+back in catch
+back in main
+
+execution completed
+[3] stop in catch
+[3] stopped in catch at line 19
+   19       printf("in catch\n");
+stopped in catch at line 19
+   19       printf("in catch\n");
+[5] stop in secondcatch
+[5] stopped in secondcatch at line 28
+   28       printf("in secondcatch\n");
+in catch
+in secondcatch
+back in catch
+back in main
+
+execution completed
+HUP QUIT KILL ALRM TSTP CONT CHLD
+
+quit in kill at 0xfc
+000000fc  bcs  f0
+[3] stopped in catch at line 19
+   19       printf("in catch\n");
+
+quit in kill at 0xfc
+000000fc  bcs  f0
+[5] stopped in secondcatch at line 28
+   28       printf("in secondcatch\n");
+in catch
+in secondcatch
+back in catch
+back in main
+
+execution completed
diff --git a/usr/src/ucb/dbx/tests/cc/sleep.c b/usr/src/ucb/dbx/tests/cc/sleep.c
new file mode 100644 (file)
index 0000000..a3dfe22
--- /dev/null
@@ -0,0 +1,16 @@
+#include <stdio.h>
+
+main ()
+{
+    char token[80];
+
+    printf("about to sleep");
+    fflush(stdout);
+    sleep(2);
+    endnot();
+}
+
+endnot()
+{
+    printf("done\n");
+}
diff --git a/usr/src/ucb/dbx/tests/cc/sleep.in b/usr/src/ucb/dbx/tests/cc/sleep.in
new file mode 100644 (file)
index 0000000..f5bdd21
--- /dev/null
@@ -0,0 +1 @@
+run
diff --git a/usr/src/ucb/dbx/tests/cc/sleep.out b/usr/src/ucb/dbx/tests/cc/sleep.out
new file mode 100644 (file)
index 0000000..0956084
--- /dev/null
@@ -0,0 +1,5 @@
+reading symbolic information ...
+about to sleepdone
+
+execution completed
+
diff --git a/usr/src/ucb/dbx/tests/cc/stkcmds.c b/usr/src/ucb/dbx/tests/cc/stkcmds.c
new file mode 100644 (file)
index 0000000..9c779bb
--- /dev/null
@@ -0,0 +1,20 @@
+
+int i;
+
+p2 (i) int i;
+{
+    if (i < 5) {
+       p2(i+1);
+    }
+}
+
+p1 (i) int i;
+{
+    p2(i+1);
+}
+
+main ()
+{
+    i = 0;
+    p1(i+1);
+}
diff --git a/usr/src/ucb/dbx/tests/cc/stkcmds.in b/usr/src/ucb/dbx/tests/cc/stkcmds.in
new file mode 100644 (file)
index 0000000..54f36fb
--- /dev/null
@@ -0,0 +1,35 @@
+stop in p2
+run
+cont
+where
+func
+print i
+up
+func
+print i
+up
+func
+print i
+up
+func
+print i
+up
+func
+up
+down
+func
+down
+func
+down
+func
+down
+func
+down
+return
+func; return
+func; return
+func; return
+func; return
+func; return
+func; return
+func; return
diff --git a/usr/src/ucb/dbx/tests/cc/stkcmds.out b/usr/src/ucb/dbx/tests/cc/stkcmds.out
new file mode 100644 (file)
index 0000000..0970367
--- /dev/null
@@ -0,0 +1,57 @@
+reading symbolic information ...
+[1] stop in p2
+[1] stopped in p2 at 0x4e
+0000004e  brb  65
+[1] stopped in p2 at 0x4e
+0000004e  brb  65
+p2(i = 3) at 0x4e
+p2(i = 2), line 7 in "stkcmds.c"
+p1(i = 1), line 13 in "stkcmds.c"
+main(0x1, 0x7fffebe4, 0x7fffebec), line 19 in "stkcmds.c"
+p2
+3 
+p2(i = 2), line 7 in "stkcmds.c"
+p2
+2 
+p1(i = 1), line 13 in "stkcmds.c"
+p1
+1 
+main(0x1, 0x7fffebe4, 0x7fffebec), line 19 in "stkcmds.c"
+main
+0 
+.() at 0x36
+.
+not that many levels
+main(0x1, 0x7fffebe4, 0x7fffebec), line 19 in "stkcmds.c"
+main
+p1(i = 1), line 13 in "stkcmds.c"
+p1
+p2(i = 2), line 7 in "stkcmds.c"
+p2
+p2(i = 3) at 0x4e
+p2
+not that many levels
+[1] stopped in p2 at 0x4e
+0000004e  brb  65
+p2
+[1] stopped in p2 at 0x4e
+0000004e  brb  65
+p2
+stopped in p2 at line 9
+    9   }
+p2
+stopped in p2 at line 9
+    9   }
+p2
+stopped in p2 at line 9
+    9   }
+p2
+stopped in p2 at line 9
+    9   }
+p2
+stopped in p1 at line 14
+   14   }
+p1
+stopped in main at line 20
+   20   }
+
diff --git a/usr/src/ucb/dbx/tests/cc/strings.c b/usr/src/ucb/dbx/tests/cc/strings.c
new file mode 100644 (file)
index 0000000..c22842f
--- /dev/null
@@ -0,0 +1,16 @@
+/*
+ * Test of displaying strings compiled into the text segment via -R.
+ */
+
+char str[] = "this is a test";
+
+main ()
+{
+    f("parameter test");
+}
+
+f (s)
+char *s;
+{
+    abort();
+}
diff --git a/usr/src/ucb/dbx/tests/cc/strings.in b/usr/src/ucb/dbx/tests/cc/strings.in
new file mode 100644 (file)
index 0000000..67d552a
--- /dev/null
@@ -0,0 +1,2 @@
+where
+print str
diff --git a/usr/src/ucb/dbx/tests/cc/strings.out b/usr/src/ucb/dbx/tests/cc/strings.out
new file mode 100644 (file)
index 0000000..f59c7e6
--- /dev/null
@@ -0,0 +1,7 @@
+reading symbolic information ...
+[using memory image in strings.core]
+abort() at 0xc3
+f(s = "parameter test"), line 15 in "strings.c"
+main(0x1, 0x7fffe994, 0x7fffe99c), line 9 in "strings.c"
+"this is a test" 
+
diff --git a/usr/src/ucb/dbx/tests/cc/struct.c b/usr/src/ucb/dbx/tests/cc/struct.c
new file mode 100644 (file)
index 0000000..d999526
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ * Test for C structures.
+ */
+
+/*
+ * A simple nested structure.
+ */
+
+struct simple {
+    int a;
+    char b;
+    double c;
+    struct {
+       int a;
+       char b;
+       double c;
+    } d;
+    int e;
+    char f;
+    double g;
+} simple;
+
+/*
+ * Mutually recursive structures, using typedefs.
+ */
+
+typedef struct first *First;
+typedef struct second *Second;
+
+struct second {
+    int b;
+    char c;
+};
+
+struct first {
+    int a;
+    Second p;
+};
+
+UseRecurStructs()
+{
+    struct first b, *p;
+    struct second list;
+
+    p = &b;
+    b.a = 3;
+    b.p = &list;
+    b.p->b = 4;
+    b.p->c = 'c';
+}
+
+/*
+ * Functions returning structures.
+ */
+
+struct simple f(x)
+int x;
+{
+    struct simple s;
+
+    s.a = x;
+    s.g = 3.14;
+    return s;
+}
+
+main()
+{
+    struct simple x;
+    struct simple *y;
+
+    UseRecurStructs();
+    x = f(3);
+    y = &x;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/struct.in b/usr/src/ucb/dbx/tests/cc/struct.in
new file mode 100644 (file)
index 0000000..24c27e1
--- /dev/null
@@ -0,0 +1,29 @@
+whatis simple
+whatis $$simple
+whatis First
+whatis Second
+whatis $$first
+whatis $$second
+stop in UseRecurStructs
+run
+step
+step
+step
+step
+step
+print b
+print b.p
+print *(b.p)
+print b.p.b
+print b.p.c
+stop in f
+cont
+where
+step
+step
+step
+step
+step
+step
+print y
+print *y
diff --git a/usr/src/ucb/dbx/tests/cc/struct.out b/usr/src/ucb/dbx/tests/cc/struct.out
new file mode 100644 (file)
index 0000000..f3cf7fa
--- /dev/null
@@ -0,0 +1,63 @@
+reading symbolic information ...
+struct simple simple;
+struct simple {
+    int a;
+    char b;
+    double c;
+    struct {
+        int a;
+        char b;
+        double c;
+    } d;
+    int e;
+    char f;
+    double g;
+};
+typedef struct first *First;
+typedef struct second *Second;
+struct first {
+    int a;
+    struct second *p;
+};
+struct second {
+    int b;
+    char c;
+};
+[1] stop in UseRecurStructs
+[1] stopped in UseRecurStructs at 0x4e
+0000004e  brb  72
+stopped in UseRecurStructs at line 45
+   45       p = &b;
+stopped in UseRecurStructs at line 46
+   46       b.a = 3;
+stopped in UseRecurStructs at line 47
+   47       b.p = &list;
+stopped in UseRecurStructs at line 48
+   48       b.p->b = 4;
+stopped in UseRecurStructs at line 49
+   49       b.p->c = 'c';
+(a = 3, p = 0x7fffeb5c) 
+0x7fffeb5c 
+(b = 4, c = '\0') 
+4 
+'\0' 
+[3] stop in f
+[3] stopped in f at line 61
+   61       s.a = x;
+f(x = 3), line 61 in "struct.c"
+main(0x1, 0x7fffebe4, 0x7fffebec), line 72 in "struct.c"
+stopped in f at line 61
+   61       s.a = x;
+stopped in f at line 62
+   62       s.g = 3.14;
+stopped in f at line 63
+   63       return s;
+stopped in f at line 64
+   64   }
+stopped in main at line 73
+   73       y = &x;
+stopped in main at line 74
+   74   }
+0x7fffeb8c 
+(a = 3, b = '\0', c = 0.0, d = (a = 0, b = '\0', c = 0.0), e = 4, f = 'c', g = 3.14) 
+
diff --git a/usr/src/ucb/dbx/tests/cc/user.c b/usr/src/ucb/dbx/tests/cc/user.c
new file mode 100644 (file)
index 0000000..fe9963e
--- /dev/null
@@ -0,0 +1,12 @@
+/*
+ * The user structure is a good test of the general symbol processing
+ * abilities of dbx.
+ */
+
+#include <sys/param.h>
+#include <sys/dir.h>
+#include <sys/user.h>
+
+main ()
+{
+}
diff --git a/usr/src/ucb/dbx/tests/cc/user.in b/usr/src/ucb/dbx/tests/cc/user.in
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/usr/src/ucb/dbx/tests/cc/user.out b/usr/src/ucb/dbx/tests/cc/user.out
new file mode 100644 (file)
index 0000000..a799550
--- /dev/null
@@ -0,0 +1,2 @@
+reading symbolic information ...
+
diff --git a/usr/src/ucb/dbx/tests/cc/ushort.c b/usr/src/ucb/dbx/tests/cc/ushort.c
new file mode 100644 (file)
index 0000000..95c17ec
--- /dev/null
@@ -0,0 +1,10 @@
+struct {
+    int a;
+    unsigned short s;
+    int b;
+} u;
+
+main ()
+{
+    u.s = 0xffff;
+}
diff --git a/usr/src/ucb/dbx/tests/cc/ushort.in b/usr/src/ucb/dbx/tests/cc/ushort.in
new file mode 100644 (file)
index 0000000..aa6a101
--- /dev/null
@@ -0,0 +1,4 @@
+stop at 10
+run
+print u
+print u.s
diff --git a/usr/src/ucb/dbx/tests/cc/ushort.out b/usr/src/ucb/dbx/tests/cc/ushort.out
new file mode 100644 (file)
index 0000000..cfcb2c6
--- /dev/null
@@ -0,0 +1,7 @@
+reading symbolic information ...
+[1] stop at 10
+[1] stopped in main at line 10
+   10   }
+(a = 0, s = 65535, b = 0) 
+65535 
+
diff --git a/usr/src/ucb/dbx/tests/check b/usr/src/ucb/dbx/tests/check
new file mode 100755 (executable)
index 0000000..0c53a43
--- /dev/null
@@ -0,0 +1,20 @@
+#! /bin/csh -f
+
+#
+# check <test output> <expected output>
+#
+# Check to see if test output matches expected output.
+# If not, run diff and ask if differences are "ok".  If so,
+# install new output as expected output.
+#
+
+cmp -s $1 $2
+if ($status != 0) then
+    diff $1 $2
+    echo -n "ok? "
+    if ($< != y) then
+       exit 1
+    endif
+    mv $1 $2
+endif
+exit 0
diff --git a/usr/src/ucb/dbx/tests/mod/Makefile b/usr/src/ucb/dbx/tests/mod/Makefile
new file mode 100644 (file)
index 0000000..3c661d1
--- /dev/null
@@ -0,0 +1,119 @@
+#
+# Makefile for testing dbx.
+#
+
+.SUFFIXES:
+
+.SUFFIXES: .mod .def .pcd .s .o .x .t .in .tst .out
+
+MOD = mod
+TESTDBX = ../../tdbx
+TESTS = \
+    arrayrec.t arrays.t assign.t bool.t bitfields.t \
+    call.t const.t dynarrays.t \
+    imports.t jsb.t multirefs.t nested.t opaque.t \
+    procvars.t proftrace.t ptrarray.t \
+    reals.t records.t recur.t \
+    sets.t stkcmds.t trace.t
+
+PROGS = \
+    arrayrec.x arrays.x assign.x bool.x bitfields.x \
+    call.x const.x dynarrays.x \
+    imports.x jsb.x multirefs.x nested.x opaque.x \
+    procvars.x proftrace.x ptrarray.x \
+    reals.x records.x recur.x \
+    sets.x stkcmds.x trace.x
+
+#
+# Suffix conventions:
+#
+#      .mod    Modula-2 source
+#      .def    Modula-2 definitions file
+#      .pcd    P-code intermediate source
+#      .s      assembly code file
+#      .o      object file
+#      .x      executable file
+#      .t      dummy file represented last time tested
+#      .in     input for testing
+#      .tst    test output
+#      .out    expected output
+#
+
+.mod.x:
+       ${MOD} -g $*.mod -o tmp
+       mv tmp $*.x
+
+.mod.o:
+       @echo "compiling $*.mod"
+       @${MOD} -c -g $*.mod
+
+.in.tst:
+       @rm -f $*.tst
+       ../runtest ${TESTDBX} $* > $*.tst
+
+.x.t:
+       @echo "    $*"
+       @rm -f tmp
+       @../runtest ${TESTDBX} $* > tmp
+       @../check tmp $*.out
+       @rm -f tmp
+       @rm -f $*.t
+       @touch $*.t
+
+passed: ${PROGS} beforemsg ${TESTS}
+       @echo "passed Modula-2 tests"
+
+beforemsg:
+       @echo ""
+       @echo "Modula-2 tests:"
+
+IMPORTSOBJ = imports.o imported.o imptypes.o
+
+imports.x: ${IMPORTSOBJ}
+       @echo "linking imports.x"
+       @${MOD} -g ${IMPORTSOBJ} -o tmp
+       @mv tmp imports.x
+
+jsb.x: jsb.mod
+       ${MOD} -O -g jsb.mod -o tmp
+       mv tmp jsb.x
+
+opaque.x: opaque.o imptypes.o
+       @echo "linking opaque.x"
+       @${MOD} -g opaque.o imptypes.o -o tmp
+       @mv tmp opaque.x
+
+proftrace.x: proftrace.mod
+       ${MOD} -pg -g proftrace.mod -o tmp
+       mv tmp proftrace.x
+
+MULTIOBJ = multirefs.o imp1.o imp2.o exp.o
+
+multirefs.x: ${MULTIOBJ}
+       @echo "linking multirefs.x"
+       @${MOD} -g ${MULTIOBJ} -o tmp
+       @mv tmp multirefs.x
+
+arrayrec.t: arrayrec.x ${TESTDBX}
+arrays.t: arrays.x ${TESTDBX}
+assign.t: assign.x ${TESTDBX}
+bool.t: bool.x ${TESTDBX}
+bitfields.t: bitfields.x ${TESTDBX}
+const.t: call.x ${TESTDBX}
+call.t: call.x ${TESTDBX}
+const.t: const.x ${TESTDBX}
+dynarrays.t: dynarrays.x ${TESTDBX}
+jsb.t: jsb.x ${TESTDBX}
+imports.t: imports.x ${TESTDBX}
+multirefs.t: multirefs.x ${TESTDBX}
+nested.t: nested.x ${TESTDBX}
+opaque.t: opaque.x ${TESTDBX}
+procvars.t: procvars.x ${TESTDBX}
+proftrace.t: proftrace.x ${TESTDBX}
+ptrarray.t: ptrarray.x ${TESTDBX}
+reals.t: reals.x ${TESTDBX}
+records.t: records.x ${TESTDBX}
+recur.t: recur.x ${TESTDBX}
+sets.t: sets.x ${TESTDBX}
+stkcmds.t: stkcmds.x ${TESTDBX}
+trace.t: trace.x ${TESTDBX}
diff --git a/usr/src/ucb/dbx/tests/mod/arrayrec.mod b/usr/src/ucb/dbx/tests/mod/arrayrec.mod
new file mode 100644 (file)
index 0000000..6735d71
--- /dev/null
@@ -0,0 +1,29 @@
+(*
+ * Test of arrays of records.
+ *)
+
+module main;
+type
+    Rec = record
+       charValue : char;
+       intValue : integer;
+       subrange : [0..1000];
+       realValue : real;
+    end;
+    Arr = array [1..10] of Rec;
+var
+    a : Arr;
+begin
+    a[1].charValue := 'c';
+    a[1].intValue := 3;
+    a[1].subrange := 10;
+    a[1].realValue := 3.4;
+    a[2].charValue := 'd';
+    a[2].intValue := 4;
+    a[2].subrange := 11;
+    a[2].realValue := 4.5;
+    a[3].charValue := 'e';
+    a[3].intValue := 5;
+    a[3].subrange := 12;
+    a[3].realValue := 5.6;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/arrays.mod b/usr/src/ucb/dbx/tests/mod/arrays.mod
new file mode 100644 (file)
index 0000000..55ceab1
--- /dev/null
@@ -0,0 +1,23 @@
+module main;
+type
+    Color = (RED, BLUE, GREEN);
+var
+    a : array [1..10] of integer;
+    i : integer;
+    b : array Color of integer;
+    c : Color;
+
+procedure p (i : integer; var a : array of integer; j : integer);
+begin
+    a[3] := i;
+    a[4] := j;
+end p;
+
+begin
+    for i := 1 to 10 do
+       a[i] := i;
+    end;
+    p(4, a, 5);
+    b[BLUE] := 3;
+    c := RED;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/assign.mod b/usr/src/ucb/dbx/tests/mod/assign.mod
new file mode 100644 (file)
index 0000000..4622733
--- /dev/null
@@ -0,0 +1,7 @@
+module main;
+from io import Writef, output;
+var a : array[1..100] of char;
+begin
+    a := "blah";
+    Writef(output, "%s", a);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/bitfields.mod b/usr/src/ucb/dbx/tests/mod/bitfields.mod
new file mode 100644 (file)
index 0000000..9be18d9
--- /dev/null
@@ -0,0 +1,55 @@
+module main;
+
+import io;
+
+type
+    uint = @align 1 cardinal;
+    dotrecord = record
+       cost : @size 24 uint;
+       dtype : @size 3 uint;
+       dirToCenter : @size 3 uint;
+       pad : @size 1 uint;
+       pin : @size 1 uint;
+       traceback : @size 3 uint;
+       traceforward : @size 3 uint;
+       expanded : @size 1 uint;
+       underDir : @size 3 uint;
+       underOffset : @size 4 uint;
+       start : @size 1 uint;
+       target : @size 1 uint;
+       owner : @size 6 uint;
+       segment : @size 7 uint;
+       intrinsicCost : @size 3 uint;
+    end;
+
+procedure p1 ();
+var junk : dotrecord;
+begin
+    junk.owner := 63;
+    junk.segment := 1;
+    junk.intrinsicCost := 1;
+    io.Writef(io.output, "owner = %d, segment = %d, intrinsicCost = %d\n",
+       junk.owner, junk.segment, junk.intrinsicCost);
+    p2();
+end p1;
+
+procedure p2 ();
+var x : record
+       first : integer;
+       second : integer;
+       a : @size 8 @align 1 integer;
+       b : @size 8 @align 1 integer;
+       c : integer;
+    end;
+begin
+    x.first := 0;
+    x.second := 0;
+    x.a := 2;
+    x.b := 10;
+    x.c := 1;
+    io.Writef(io.output, "done\n");
+end p2;
+
+begin
+    p1();
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/bool.mod b/usr/src/ucb/dbx/tests/mod/bool.mod
new file mode 100644 (file)
index 0000000..f61c880
--- /dev/null
@@ -0,0 +1,6 @@
+module main;
+var b : boolean;
+begin
+    b := true;
+    b := false;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/call.mod b/usr/src/ucb/dbx/tests/mod/call.mod
new file mode 100644 (file)
index 0000000..27faea3
--- /dev/null
@@ -0,0 +1,41 @@
+(*
+ * Test program for dbx call command.
+ *)
+
+module main;
+from io import writef, output;
+
+var global : integer;
+
+procedure startup ;
+var
+    mainlocal : integer;
+begin
+    global := 2;
+    mainlocal := 19;
+    p1();
+    p2(mainlocal);
+    p3("test", 3);
+end startup;
+
+procedure p1 ();
+begin
+    writef(output, "in p1\n");
+    global := 4;
+end p1;
+
+procedure p2 (frommain : integer);
+begin
+    writef(output, "in p2(%d)\n", frommain);
+    global := 9;
+end p2;
+
+procedure p3 (s : array of char; i : integer);
+begin
+    writef(output, "in p3(%s, %d)\n", s, i);
+    global := 10;
+end p3;
+
+begin
+    startup;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/const.mod b/usr/src/ucb/dbx/tests/mod/const.mod
new file mode 100644 (file)
index 0000000..2294b13
--- /dev/null
@@ -0,0 +1,21 @@
+module main;
+const
+    PI = 3.14159;
+    N = 10;
+    MESSAGE = "this is a test";
+    CH = 'x';
+    S = {1, 3, 5};
+    B = true;
+type
+    Color = (RED, BLUE, GREEN);
+procedure p ();
+const
+    R = RED;
+type
+    T = integer;
+var i : integer;
+begin
+end p;
+
+begin
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/dynarrays.mod b/usr/src/ucb/dbx/tests/mod/dynarrays.mod
new file mode 100644 (file)
index 0000000..2495e18
--- /dev/null
@@ -0,0 +1,22 @@
+module main;
+type
+    Color = (RED, BLUE, GREEN);
+var
+    a : dynarray of array of integer;
+    i, j : integer;
+
+procedure p (i : integer; var a : array of array of integer; j : integer);
+begin
+    a[3, 1] := i;
+    a[4, 2] := j;
+end p;
+
+begin
+    new(a, 10, 5);
+    for i := 0 to 9 do
+       for j := 0 to 4 do
+           a^[i, j] := i;
+       end;
+    end;
+    p(4, a^, 5);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/exp.mod b/usr/src/ucb/dbx/tests/mod/exp.mod
new file mode 100644 (file)
index 0000000..35e9e5b
--- /dev/null
@@ -0,0 +1,3 @@
+implementation module exp;
+type T = integer;
+end exp.
diff --git a/usr/src/ucb/dbx/tests/mod/files.mod b/usr/src/ucb/dbx/tests/mod/files.mod
new file mode 100644 (file)
index 0000000..024a6a2
--- /dev/null
@@ -0,0 +1,16 @@
+module main;
+import io;
+
+var globalf : io.File;
+
+procedure p (var f : io.File);
+begin
+    f := io.terminal;
+    io.Writef(f, 'this is a test');
+    io.Writef(f, '\n');
+end p;
+
+begin
+    globalf := io.terminal;
+    p(io.output);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/imp1.mod b/usr/src/ucb/dbx/tests/mod/imp1.mod
new file mode 100644 (file)
index 0000000..f0a9c70
--- /dev/null
@@ -0,0 +1,5 @@
+implementation module imp1;
+
+from exp import T, v;
+
+end imp1.
diff --git a/usr/src/ucb/dbx/tests/mod/imp2.mod b/usr/src/ucb/dbx/tests/mod/imp2.mod
new file mode 100644 (file)
index 0000000..a4ab221
--- /dev/null
@@ -0,0 +1,6 @@
+
+implementation module imp2;
+
+from exp import T, v;
+
+end imp2.
diff --git a/usr/src/ucb/dbx/tests/mod/imported.mod b/usr/src/ucb/dbx/tests/mod/imported.mod
new file mode 100644 (file)
index 0000000..516e344
--- /dev/null
@@ -0,0 +1,13 @@
+implementation module imported;
+
+type
+    OT = integer;
+var
+    p : OT;
+
+procedure Blah;
+begin
+    p := 3;
+end Blah;
+
+end imported.
diff --git a/usr/src/ucb/dbx/tests/mod/imports.mod b/usr/src/ucb/dbx/tests/mod/imports.mod
new file mode 100644 (file)
index 0000000..df509a4
--- /dev/null
@@ -0,0 +1,17 @@
+module main;
+from imptypes import RT;
+import imported;
+type
+    RT = pointer to record
+       i, j : integer;
+    end;
+var
+    p : imported.T;
+    q : imported.OT;
+    r : RT;
+begin
+    new(r);
+    r^.i := 3;
+    r^.j := 4;
+    imported.Blah;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/imptypes.mod b/usr/src/ucb/dbx/tests/mod/imptypes.mod
new file mode 100644 (file)
index 0000000..692fbf0
--- /dev/null
@@ -0,0 +1,2 @@
+implementation module imptypes;
+end imptypes.
diff --git a/usr/src/ucb/dbx/tests/mod/jsb.mod b/usr/src/ucb/dbx/tests/mod/jsb.mod
new file mode 100644 (file)
index 0000000..d85e3bd
--- /dev/null
@@ -0,0 +1,16 @@
+module main;
+
+from io import Writef, output;
+
+var global : integer;
+
+procedure p (i : integer; s : array of char; j : integer);
+begin
+    Writef(output, "in p(%d, %s, %d)\n", i, s, j);
+    global := 10;
+end p;
+
+begin
+    global := 3;
+    p(3, "blah", 4);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/multirefs.mod b/usr/src/ucb/dbx/tests/mod/multirefs.mod
new file mode 100644 (file)
index 0000000..44b3ea3
--- /dev/null
@@ -0,0 +1,6 @@
+module main;
+var v : integer;
+begin
+    v := 3;
+    v := 4;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/nested.mod b/usr/src/ucb/dbx/tests/mod/nested.mod
new file mode 100644 (file)
index 0000000..07f8120
--- /dev/null
@@ -0,0 +1,30 @@
+(*
+ * Test of nested procedures and modules.
+ *)
+
+module main;
+var
+    i, k : integer;
+
+procedure p (var i : integer);
+var
+    j, k : integer;
+
+    procedure nestedp (var j : integer);
+    var
+       i : integer;
+    begin
+       i := j + 2;
+       j := i;
+    end nestedp;
+
+begin
+    j := i + 1;
+    nestedp(j);
+    i := j;
+end p;
+
+begin
+    i := 3;
+    p(i);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/opaque.mod b/usr/src/ucb/dbx/tests/mod/opaque.mod
new file mode 100644 (file)
index 0000000..f5720c7
--- /dev/null
@@ -0,0 +1,23 @@
+(*
+ * Test of dealing with an opaque type that is never defined.
+ *)
+
+module main;
+
+from imptypes import RT;
+from io import Writef, output;
+
+type
+    T = record
+       a : integer;
+       b : RT;
+       c : integer;
+    end;
+
+var r : T;
+
+begin
+    r.a := 3;
+    r.c := 4;
+    Writef(output, "this is a test\n");
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/procvars.mod b/usr/src/ucb/dbx/tests/mod/procvars.mod
new file mode 100644 (file)
index 0000000..1855153
--- /dev/null
@@ -0,0 +1,24 @@
+(*
+ * Test of procedure variables.
+ *)
+
+module main;
+
+procedure p (var i : integer);
+begin
+    i := 3;
+end p;
+
+procedure q ;
+var
+    t : procedure(var integer);
+    j : integer;
+begin
+    t := p;
+    t(j);
+    j := j + 1;
+end q;
+
+begin
+    q;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/proftrace.mod b/usr/src/ucb/dbx/tests/mod/proftrace.mod
new file mode 100644 (file)
index 0000000..15580be
--- /dev/null
@@ -0,0 +1,23 @@
+module main;
+type
+    Color = (RED, BLUE, GREEN);
+var
+    a : array [1..10] of integer;
+    i : integer;
+    b : array Color of integer;
+    c : Color;
+
+procedure p (i : integer; var a : array of integer; j : integer);
+begin
+    a[3] := i;
+    a[4] := j;
+end p;
+
+begin
+    for i := 1 to 2 do
+       a[i] := i;
+    end;
+    p(4, a, 5);
+    b[BLUE] := 3;
+    c := RED;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/ptrarray.mod b/usr/src/ucb/dbx/tests/mod/ptrarray.mod
new file mode 100644 (file)
index 0000000..5f0585f
--- /dev/null
@@ -0,0 +1,9 @@
+module main;
+var p : pointer to array [1..10] of integer;
+    i : integer;
+begin
+    new(p);
+    for i := 1 to 10 do
+       p^[i] := i;
+    end;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/reals.mod b/usr/src/ucb/dbx/tests/mod/reals.mod
new file mode 100644 (file)
index 0000000..e762436
--- /dev/null
@@ -0,0 +1,18 @@
+(*
+ * Test of reals and longreals.
+ *)
+
+module main;
+var
+    x : longreal;
+    y : real;
+
+procedure f (x : real) : longreal;
+begin
+    return longfloat(3.14*x);
+end f;
+
+begin
+    y := 3.0;
+    x := f(y);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/records.mod b/usr/src/ucb/dbx/tests/mod/records.mod
new file mode 100644 (file)
index 0000000..bf1f5f1
--- /dev/null
@@ -0,0 +1,16 @@
+module main;
+type
+    Rec = record
+       charValue : char;
+       intValue : integer;
+       subrange : [0..1000];
+       realValue : real;
+    end;
+var
+    r : Rec;
+begin
+    r.charValue := 'c';
+    r.intValue := 3;
+    r.subrange := 10;
+    r.realValue := 3.4;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/recur.mod b/usr/src/ucb/dbx/tests/mod/recur.mod
new file mode 100644 (file)
index 0000000..d4bc2ce
--- /dev/null
@@ -0,0 +1,16 @@
+module main;
+
+from io import Writef, output;
+
+procedure r (n : integer);
+begin
+    Writef(output, "blah\n");
+    if n > 0 then
+       r(n - 1);
+       Writef(output, "blah2\n");
+    end;
+end r;
+
+begin
+    r(5);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/sets.mod b/usr/src/ucb/dbx/tests/mod/sets.mod
new file mode 100644 (file)
index 0000000..23454f0
--- /dev/null
@@ -0,0 +1,18 @@
+module sets;
+type
+    Color = (RED, BLUE, GREEN);
+    ColorSet = set of Color;
+var
+    s : ColorSet;
+
+procedure p (var s : ColorSet);
+begin
+    s := ColorSet{RED, BLUE};
+end p;
+
+begin
+    p(s);
+    if BLUE in s then
+       s := s - ColorSet{BLUE};
+    end;
+end sets.
diff --git a/usr/src/ucb/dbx/tests/mod/stkcmds.mod b/usr/src/ucb/dbx/tests/mod/stkcmds.mod
new file mode 100644 (file)
index 0000000..54f1247
--- /dev/null
@@ -0,0 +1,20 @@
+module main;
+var
+    i : integer;
+
+procedure p2 (i : integer);
+begin
+    if i < 5 then
+       p2(i+1);
+    end;
+end p2;
+
+procedure p1 (i : integer);
+begin
+    p2(i+1);
+end p1;
+
+begin
+    i := 0;
+    p1(i+1);
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/trace.mod b/usr/src/ucb/dbx/tests/mod/trace.mod
new file mode 100644 (file)
index 0000000..15580be
--- /dev/null
@@ -0,0 +1,23 @@
+module main;
+type
+    Color = (RED, BLUE, GREEN);
+var
+    a : array [1..10] of integer;
+    i : integer;
+    b : array Color of integer;
+    c : Color;
+
+procedure p (i : integer; var a : array of integer; j : integer);
+begin
+    a[3] := i;
+    a[4] := j;
+end p;
+
+begin
+    for i := 1 to 2 do
+       a[i] := i;
+    end;
+    p(4, a, 5);
+    b[BLUE] := 3;
+    c := RED;
+end main.
diff --git a/usr/src/ucb/dbx/tests/mod/variants.mod b/usr/src/ucb/dbx/tests/mod/variants.mod
new file mode 100644 (file)
index 0000000..08030bc
--- /dev/null
@@ -0,0 +1,23 @@
+module main;
+type
+    ElementType = (CHAR, INT, REAL);
+    VR = record
+       case tag : ElementType of
+           CHAR:
+               charValue : char;|
+           INT:
+               intValue : integer;|
+           REAL:
+               realValue : real;
+       end;
+    end;
+var
+    vr : VR;
+begin
+    vr.tag := CHAR;
+    vr.charValue := 'c';
+    vr.tag := INT;
+    vr.intValue := 3;
+    vr.tag := REAL;
+    vr.realValue := 3.4;
+end main.
diff --git a/usr/src/ucb/dbx/tests/noenv.c b/usr/src/ucb/dbx/tests/noenv.c
new file mode 100644 (file)
index 0000000..21c2629
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Exec a program with no environment.
+ */
+
+#include <stdio.h>
+
+extern int errno;
+extern char *getenv(), *index();
+
+main (argc, argv)
+int argc;
+char *argv[];
+{
+    execvep(argv[1], &argv[1], 0);
+    printf("exec failed, errno %d\n", errno);
+}
+
+execvep (name, argv, envp)
+char *name, *argv[], *envp[];
+{
+    char *path;
+    register char *cp;
+    char fullname[1000];
+
+    path = getenv("PATH");
+    if (path == NULL) {
+       path = "";
+       cp = NULL;
+    } else {
+       cp = index(path, ':');
+    }
+    for (;;) {
+       if (cp != NULL) {
+           *cp = '\0';
+       }
+       sprintf(fullname, "%s/%s", path, name);
+       execve(fullname, argv, envp);
+       if (cp != NULL) {
+           path = cp + 1;
+           cp = index(path, ':');
+       } else {
+           break;
+       }
+    }
+    return -1;
+}
diff --git a/usr/src/ucb/dbx/tests/runtest b/usr/src/ucb/dbx/tests/runtest
new file mode 100755 (executable)
index 0000000..9ffc959
--- /dev/null
@@ -0,0 +1,16 @@
+#! /bin/csh -f
+
+#
+# runtest <dbx> <testname>
+#
+# Run dbx (with no environment so that stack addresses
+# have consistent values).
+#
+# The first three lines of dbx output are ignored because
+# they contain version specific information.
+#
+# This program is assumed to be running from within
+# one of the language-specific test subdirectories.
+#
+
+../noenv $1 $2.x < $2.in |& tail +3