-
-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow **count** to "skip" command...
Some minor doc fixes
- Loading branch information
Showing
13 changed files
with
108 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# -*- shell-script -*- | ||
# stepping.cmd - gdb-like "step" and "skip" debugger commands | ||
# | ||
# Copyright (C) 2008, 2010, 2016-2017 Rocky Bernstein [email protected] | ||
# Copyright (C) 2008, 2010, 2016-2017, 2019 Rocky Bernstein [email protected] | ||
# | ||
# This program is free software; you can redistribute it and/or | ||
# modify it under the terms of the GNU General Public License as | ||
|
@@ -18,9 +18,6 @@ | |
# the Free Software Foundation, 59 Temple Place, Suite 330, Boston, | ||
# MA 02111 USA. | ||
|
||
# Number of statements to skip before entering the debugger if greater than 0 | ||
typeset -i _Dbg_skip_ignore=0 | ||
|
||
# 1 if we need to ensure we stop on a different line? | ||
typeset -i _Dbg_step_force=0 | ||
|
||
|
@@ -30,53 +27,8 @@ typeset -i _Dbg_return_level=-1 | |
# The default behavior of step_force. | ||
typeset -i _Dbg_set_different=0 | ||
|
||
_Dbg_help_add skip \ | ||
"**skip** [*count*] | ||
Skip (don't run) the next *count* command(s). | ||
If *count* is given, stepping occurs that many times before | ||
stopping. Otherwise *count* is one. *count* can be an arithmetic | ||
expression. | ||
See also: | ||
--------- | ||
**next** and **step**. | ||
" | ||
|
||
_Dbg_do_skip() { | ||
_Dbg_do_skip_internal $@ && return 2 | ||
} | ||
|
||
# Return 0 if we should skip. Nonzero if there was an error. | ||
# $1 is an optional additional count. | ||
_Dbg_do_skip_internal() { | ||
|
||
_Dbg_not_running && return 1 | ||
|
||
_Dbg_last_cmd='skip' | ||
typeset count=${1:-1} | ||
|
||
if [[ $count == [0-9]* ]] ; then | ||
_Dbg_skip_ignore=${count:-1} | ||
((_Dbg_skip_ignore--)) # Remove one from the skip caused by this return | ||
else | ||
_Dbg_errmsg "Argument ($count) should be a number or nothing." | ||
_Dbg_skip_ignore=0 | ||
return 3 | ||
fi | ||
# We're cool. Do the skip. | ||
_Dbg_write_journal "_Dbg_skip_ignore=$_Dbg_skip_ignore" | ||
|
||
# Set to do a stepping stop after skipping | ||
_Dbg_step_ignore=0 | ||
_Dbg_write_journal "_Dbg_step_ignore=$_Dbg_step_ignore" | ||
return 0 | ||
} | ||
|
||
_Dbg_help_add 'step' \ | ||
"**step** *count* | ||
"**step** [*count*] | ||
Single step a statement *count* times. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,16 @@ | ||
set trace-commands on | ||
# Make sure autostep is off for next text | ||
# Make sure autostep is off for tests | ||
set force on | ||
# Test that skip skips multiple statements | ||
n | ||
x x | ||
skip fdafsdg | ||
skip | ||
where 1 | ||
x x | ||
n | ||
skip 2 | ||
x x | ||
n | ||
skip 1+2 | ||
c | ||
quit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,37 @@ | ||
(stepping.sh:3): | ||
for ((i=0; i<3; i++)) do print 1st loop $i done | ||
+# Make sure autostep is off for next text | ||
(skip.sh:3): | ||
x=1 | ||
+# Make sure autostep is off for tests | ||
+set force on | ||
Show stepping forces a new line is on. | ||
+# Test that skip skips multiple statements | ||
+n | ||
(skip.sh:4): | ||
x=2 | ||
+x x | ||
typeset -g x=1 | ||
+skip fdafsdg | ||
** 'skip' argument (fdafsdg) should be a number or nothing. | ||
+skip | ||
(stepping.sh:4): | ||
for ((i=0; i<3; i++)) do print 2nd loop $i done | ||
+where 1 | ||
->0 in file `stepping.sh' at line 4 | ||
(skip.sh:6): | ||
x=4 | ||
+x x | ||
typeset -g x=1 | ||
+n | ||
(skip.sh:7): | ||
x=5 | ||
+skip 2 | ||
(skip.sh:10): | ||
x=8 | ||
+x x | ||
typeset -g x=4 | ||
+n | ||
(skip.sh:11): | ||
x=9 | ||
+skip 1+2 | ||
(skip.sh:15): | ||
echo $x | ||
+c | ||
8 | ||
Program terminated. Type 's' or 'R' to restart. | ||
+quit | ||
zshdb: That's all, folks... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,20 @@ | ||
set trace-commands on | ||
# Make sure autostep is off for next text | ||
# Make sure autostep is off for tests | ||
set force off | ||
show force | ||
# Test that step+ skips multiple statements | ||
step+ | ||
set force on | ||
set force on | ||
show force | ||
# Same thing - skip loop | ||
step | ||
step | ||
# Override force | ||
step- | ||
s- | ||
# A null command should use the last step | ||
|
||
step | ||
step | ||
# Try a null command the other way | ||
s+ | ||
|
||
quit | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ | |
/Makefile.in | ||
/hanoi.sh | ||
/restart.sh | ||
/skip.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!@SH_PROG@ | ||
# For testing skip | ||
x=1 | ||
x=2 | ||
x=3 | ||
x=4 | ||
x=5 | ||
x=6 | ||
x=7 | ||
x=8 | ||
x=9 | ||
x=10 | ||
x=11 | ||
x=12 | ||
echo $x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters