<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -98,20 +98,9 @@ Like next, this can done with or without support from zsh, albeit
 faster with help from zsh. Changing scope when changing frames however
 has to be done with zsh support. 
 
-3.d) Information persisting when a subshell is left
+3.d) Setting $0
 
-One of the challenges of POSIX shells is to be able to pass
-information back from a subshell or nested shell back to a
-parent. bashdb uses a journal file for this and tests SHLVL and
-BASH_SUBSHELL; zshdb lacks the latter. BASH_SUBSHELL is probably a
-simple thing to add though.
-
-Adding breakpoints and debugger settings will make this problem more
-apparent.
-
-3.e) Setting $0
-
-3.f) lots of other stuff including...
+3.e) lots of other stuff including...
 
   display expressions, signal handling, invoking the debugger directly
   from a script, command history, command completion.</diff>
      <filename>README</filename>
    </modified>
    <modified>
      <diff>@@ -58,16 +58,16 @@ _Dbg_do_run() {
     _Dbg_msg &quot;Restarting with: $exec_cmd&quot;
   fi
 
-#   # If we are in a subshell we need to get out of those levels
-#   # first before we restart. The strategy is to write into persistent
-#   # storage the restart command, and issue a &quot;quit.&quot; The quit should
-#   # discover the restart at the last minute and issue the restart.
-#   if (( SH_SUBSHELL &gt; 0 )) ; then 
-#     _Dbg_msg &quot;Note you are in a subshell. We will need to leave that first.&quot;
-#     _Dbg_write_journal &quot;BASHDB_RESTART_COMMAND=\&quot;$exec_cmd\&quot;&quot;
-#     _Dbg_do_quit 0
-#   fi
-#   _Dbg_save_state
+  # If we are in a subshell we need to get out of those levels
+  # first before we restart. The strategy is to write into persistent
+  # storage the restart command, and issue a &quot;quit.&quot; The quit should
+  # discover the restart at the last minute and issue the restart.
+  if (( ZSH_SUBSHELL &gt; 0 )) ; then 
+    _Dbg_msg &quot;Note you are in a subshell. We will need to leave that first.&quot;
+    ## _Dbg_write_journal &quot;BASHDB_RESTART_COMMAND=\&quot;$exec_cmd\&quot;&quot;
+    _Dbg_do_quit 0
+  fi
+  _Dbg_save_state
 
   builtin cd $_Dbg_init_cwd
 </diff>
      <filename>command/run.sh</filename>
    </modified>
    <modified>
      <diff>@@ -48,7 +48,7 @@ typeset -i _Dbg_annotate=0
 typeset -i _Dbg_linetrace=0
 
 # Debugger command file
-typeset o_cmdfile='' o_nx='' o_basename=''
+typeset o_cmdfile='' o_nx='' o_basename='' o_quiet=''
 
 local temp
 zparseopts -D --                        \</diff>
      <filename>dbg-opts.sh</filename>
    </modified>
    <modified>
      <diff>@@ -26,12 +26,17 @@
 # file: either in lib or (less good) command.
 
 # Are we using a debugger-enabled shell? If not let's stop right here.
-typeset -fuz is-at-least  # Same as &quot;functions -u -z&quot; but better documented.
-if ! is-at-least 4.3.6-dev-0 ; then
-  print &quot;Sorry, your $_Dbg_shell_name just isn't modern enough.&quot; 2&gt;&amp;1
-  print &quot;We need 4.3.6-dev-0 or greater.&quot; 2&gt;&amp;1
-  exit 30
-fi
+typeset old_setopt=&quot;$-&quot;
+
+# is-at-least messes up in some situations so we have to not use it for now.
+# typeset -fuz is-at-least  # Same as &quot;functions -u -z&quot; but better documented.
+# if ! is-at-least 4.3.6-dev-0 ; then
+#   print &quot;Sorry, your $_Dbg_shell_name just isn't modern enough.&quot; 2&gt;&amp;1
+#   print &quot;We need 4.3.6-dev-0 or greater.&quot; 2&gt;&amp;1
+#   exit 30
+# fi
+# is-at-least does an emulate -L zsh
+# emulate -L ksh
 
 [[ -z $_Dbg_release ]] || return
 typeset -r _Dbg_release='0.01git'</diff>
      <filename>dbg-pre.sh</filename>
    </modified>
    <modified>
      <diff>@@ -18,6 +18,21 @@
 typeset -a _Dbg_yn
 _Dbg_yn=(&quot;n&quot; &quot;y&quot;)         
 
+# Return $2 copies of $1. If successful, $? is 0 and the return value
+# is in result.  Otherwise $? is 1 and result ''
+function _Dbg_copies { 
+    result=''
+    (( $# &lt; 2 )) &amp;&amp; return 1
+    typeset -r string=&quot;$1&quot;
+    typeset -i count=$2 || return 2;
+    (( count &gt; 0 )) || return 3
+    result=$(builtin printf &quot;%${count}s&quot; ' ')
+    typeset cmd
+    cmd=&quot;result=\${result// /$string}&quot;
+    eval $cmd
+    return 0
+}
+
 # Add escapes to a string $1 so that when it is read back using
 # eval echo &quot;$1&quot; it is the same as echo $1.
 function _Dbg_esc_dq {</diff>
      <filename>lib/fns.sh</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,8 @@ function _Dbg_debug_trap_handler {
     _Dbg_old_set_opts=$-
     # Turn off line and variable trace listing.
     set +x +v +u +e
+    setopt localtraps
+    trap 'print ERROR AT: ${funcfiletrace[@]}' ERR
 
     typeset -i _Dbg_debugged_exit_code=$1
     shift</diff>
      <filename>lib/hook.sh</filename>
    </modified>
    <modified>
      <diff>@@ -52,10 +52,10 @@ _Dbg_write_journal_avar() {
 # Append a command into journal file. But we only need to do
 # if we are in a subshell.
 _Dbg_write_journal() {
-#   if (( $BASH_SUBSHELL != 0 )) ; then
-#     echo &quot;$@&quot; &gt;&gt; ${_Dbg_journal} 2&gt;/dev/null
-#   fi
-  # return $?
+  if (( ZSH_SUBSHELL != 0 )) ; then
+    echo &quot;$@&quot; &gt;&gt; ${_Dbg_journal} 2&gt;/dev/null
+  fi
+  return $?
 }
 
 # Remove all journal files.</diff>
      <filename>lib/journal.sh</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,7 @@
 # Are we inside the middle of a &quot;skip&quot; command?
 typeset -i  _Dbg_inside_skip=0
 
-typeset _Dbg_prompt_str=&quot;$_Dbg_debugger_name&lt;1&gt; &quot;
+typeset _Dbg_prompt_str='$_Dbg_debugger_name${_Dbg_less}1${_Dbg_greater} '
 
 # The canonical name of last command run.
 typeset _Dbg_last_cmd=''
@@ -57,7 +57,19 @@ function _Dbg_process_commands {
   # Loop over all pending open input file descriptors
   while (( ${#_Dbg_fd[@]} &gt; 0 )) ; do
 
-    typeset _Dbg_prompt=&quot;$_Dbg_prompt_str&quot;
+    # Set up prompt to show shell and subshell levels.
+    typeset _Dbg_greater='&gt;'
+    typeset _Dbg_less='&lt;'
+    typeset result  # Used by copies to return a value.
+
+    if _Dbg_copies ')' $ZSH_SUBSHELL ; then
+	_Dbg_greater=&quot;${result}${_Dbg_greater}&quot;
+	_Dbg_less=&quot;${_Dbg_less}${result//)/(}&quot;
+    fi
+
+
+    typeset _Dbg_prompt
+    eval &quot;_Dbg_prompt=$_Dbg_prompt_str&quot;
     # _Dbg_preloop
     typeset _Dbg_cmd 
     typeset args</diff>
      <filename>lib/processor.sh</filename>
    </modified>
    <modified>
      <diff>@@ -278,7 +278,7 @@ debugger: Allow debugging the debugger is off.
 force: Show stepping forces a new line is off.
 listsize: Number of source lines zshdb will list by default is 10.
 prompt:   zshdb's prompt is:
-       &quot;zshdb&lt;1&gt; &quot;.
+       &quot;$_Dbg_debugger_name${_Dbg_less}1${_Dbg_greater} &quot;.
 trace-commands: State of command tracing is on.
 +#### and show...
 +show args</diff>
      <filename>test/data/setshow.right</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,4 @@
 TESTS = \
-	lopts.tests        \
-	sopts.tests        \
 	test-bug-args      \
 	test-bugIFS        \
 	test-bug-errexit   \
@@ -21,7 +19,8 @@ TESTS_ENVIRONMENT = \
   builddir=&quot;$(abs_builddir)&quot;
 
 EXTRA_DIST = $(TESTS) $(check_DATA) \
-	check-common.sh.in
-
+	check-common.sh.in \
+	lopts.tests        \
+	sopts.tests
 
 </diff>
      <filename>test/integration/Makefile.am</filename>
    </modified>
    <modified>
      <diff>@@ -64,7 +64,7 @@ for shunit_const_ in ${shunit_constants_}; do
       *) shunit_ro_opts_='-g' ;;  # declare readonly constants globally
     esac
   fi
-  readonly ${shunit_ro_opts_} ${shunit_const_}
+  # readonly ${shunit_ro_opts_} ${shunit_const_}
 done
 unset shunit_const_ shunit_constants_ shunit_ro_opts_
 </diff>
      <filename>test/unit/shunit2</filename>
    </modified>
    <modified>
      <diff>@@ -62,6 +62,7 @@ abs_top_srcdir=@abs_top_srcdir@
 abs_top_srcdir=${abs_top_srcdir%%/}/
 
 _Dbg_libdir=$abs_top_srcdir
+set -- -q  # Don't need to show banner
 . $abs_top_srcdir/dbg-pre.sh
 . $abs_top_srcdir/lib/filecache.sh
 . $abs_top_srcdir/lib/file.sh</diff>
      <filename>test/unit/test-file.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -11,7 +11,8 @@ test_readin()
     typeset filename
     _Dbg_readin ${srcdir}/shunit2
     assertEquals '0' $?
-    typeset file2=$(_Dbg_is_file ${srcdir}/shunit2)
+    typeset file2
+    file2=$(_Dbg_is_file ${srcdir}/shunit2)
     assertEquals '0' $?
     assertNotEquals '' &quot;$file2&quot;
 }
@@ -27,6 +28,7 @@ abs_top_srcdir=@abs_top_srcdir@
 abs_top_srcdir=${abs_top_srcdir%%/}/
 
 _Dbg_libdir=$abs_top_srcdir
+set -- -q  # Don't need to show banner
 . $abs_top_srcdir/dbg-pre.sh
 . $abs_top_srcdir/lib/filecache.sh
 . $abs_top_srcdir/lib/file.sh</diff>
      <filename>test/unit/test-filecache.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,25 @@
 #!@SH_PROG@
 # -*- shell-script -*-
 
+test_copies()
+{
+    typeset result='bogus'
+
+#     _Dbg_copies 'a' 'b'
+#     assertFalse '_Dbg_copies &quot;a&quot; &quot;b&quot; should fail' &quot;$?&quot;
+
+    _Dbg_copies 'a' -1
+    assertFalse '_Dbg_copies &quot;a&quot; -1 should fail' &quot;$?&quot;
+
+    _Dbg_copies 'a' 3
+    assertTrue '_Dbg_copies &quot;a&quot; 3 should succeed' &quot;$?&quot;
+    assertEquals 'aaa' &quot;$result&quot;
+
+    _Dbg_copies ' ab' 4
+    assertTrue '_Dbg_copies &quot; ab&quot; 4 should succeed' &quot;$?&quot;
+    assertEquals ' ab ab ab ab' &quot;$result&quot;
+}
+
 # Test _Dbg_eqs_dq
 test_esc_dq_function()
 {</diff>
      <filename>test/unit/test-fns.sh.in</filename>
    </modified>
    <modified>
      <diff>@@ -6,7 +6,7 @@ fooffdafsd
 y='
 abc def'
 x=($y)  # get different results if unsetopt shwordsplit
-echo another line
+( echo another line )
 foo() {
   echo calling bar 10
   bar 10</diff>
      <filename>testing.sh</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>72e45614bebc50dd22c0dd1ddfbda0a6ab93b96b</id>
    </parent>
  </parents>
  <author>
    <name>R. Bernstein</name>
    <email>rocky@gnu.org</email>
  </author>
  <url>http://github.com/rocky/zshdb/commit/4dbddd2d8b5bbba44be0d8ebfaab7a935527e228</url>
  <id>4dbddd2d8b5bbba44be0d8ebfaab7a935527e228</id>
  <committed-date>2008-09-05T18:44:41-07:00</committed-date>
  <authored-date>2008-09-05T18:44:41-07:00</authored-date>
  <message>Use ZSH subshell in journaling and the prompt display.</message>
  <tree>df3319b2fff12a50931ceeab46d27e103d7c58fe</tree>
  <committer>
    <name>R. Bernstein</name>
    <email>rocky@gnu.org</email>
  </committer>
</commit>
