Skip to content

Commit 8e534be

Browse files
committed
Make step honor "set different" setting...
Go over "set different" RsT doc
1 parent 0686871 commit 8e534be

4 files changed

Lines changed: 25 additions & 27 deletions

File tree

command/set_sub/different.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,17 @@
2121
_Dbg_help_add_sub set different \
2222
'**set different** [**off**|**on**]
2323
24-
Set to stop at a different line
24+
Set consecutive stops must be on different file/line positions.
25+
If no argument is given, different is set "off".
26+
27+
One of the challenges of debugging is getting the granualarity of
28+
stepping comfortable. By setting different "on" you can set a more
29+
coarse-level of stepping which often still is small enough that you
30+
will not miss anything important.
31+
32+
Note that the **step** and **next** debugger commands have **+** and
33+
**-** suffixes if you wan to override this setting on a per-command
34+
basis.
2535
2636
See also:
2737
---------

command/step.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ _Dbg_do_step() {
9494
esac
9595

9696
if [[ $count == [0-9]* ]] ; then
97-
_Dbg_step_ignore=${count:-1}
97+
_Dbg_step_ignore=${count:-1}
9898
else
99-
_Dbg_errmsg "Argument ($count) should be a number or nothing."
100-
_Dbg_step_ignore=-1
101-
return 0
99+
_Dbg_errmsg "Argument ($count) should be a number or nothing."
100+
_Dbg_step_ignore=-1
101+
return 0
102102
fi
103103

104104
_Dbg_write_journal_eval "_Dbg_return_level=-1"

docs/commands/set/different.rst

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,12 @@ Set Different (consecutive stops on different file/line positions)
77
**set different** [ **on** | **off** ]
88

99
Set consecutive stops must be on different file/line positions.
10-
11-
By default, the debugger traces all events possible including line,
12-
exceptions, call and return events. Just this alone may mean that for
13-
any given source line several consecutive stops at a given line may
14-
occur. Independent of this, ksh allows one to put several commands in
15-
a single source line of code. When a programmer does this, it might be
16-
because the programmer thinks of the line as one unit.
10+
If no argument is given, different is set "off".
1711

1812
One of the challenges of debugging is getting the granualarity of
19-
stepping comfortable. Because of the above, stepping all events can
20-
often be too fine-grained and annoying. By setting different on you can
21-
set a more coarse-level of stepping which often still is small enough
22-
that you won't miss anything important.
13+
stepping comfortable. By setting different "on" you can set a more
14+
coarse-level of stepping which often still is small enough that you
15+
won't miss anything important.
2316

2417
Note that the `step` and `next` debugger commands have '+' and '-'
2518
suffixes if you wan to override this setting on a per-command basis.

lib/hook.sh

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,6 @@ function _Dbg_trap_handler {
8383
.sh.level > _Dbg_return_level) ))
8484
# echo "${#funcfiletrace[@]} vs $_Dbg_return_level ; $_Dbg_skipping_fn"
8585

86-
# if in step mode, decrement counter
87-
if ((_Dbg_step_ignore > 0)) ; then
88-
if ((! _Dbg_skipping_fn )) ; then
89-
((_Dbg_step_ignore--))
90-
_Dbg_write_journal "_Dbg_step_ignore=$_Dbg_step_ignore"
91-
# Can't return here because we may want to stop for another
92-
# reason.
93-
fi
94-
fi
95-
9686
if ((_Dbg_skip_ignore > 0)) ; then
9787
if ((! _Dbg_skipping_fn )) ; then
9888
((_Dbg_skip_ignore--))
@@ -126,7 +116,7 @@ function _Dbg_trap_handler {
126116
fi
127117

128118
# Check if step mode and number of steps to ignore.
129-
if ((_Dbg_step_ignore == 0 && ! _Dbg_skipping_fn )); then
119+
if ((_Dbg_step_ignore >= 0 && ! _Dbg_skipping_fn )); then
130120

131121
if ((_Dbg_step_force)) ; then
132122
typeset _Dbg_frame_previous_file="$_Dbg_frame_last_file"
@@ -137,6 +127,11 @@ function _Dbg_trap_handler {
137127
_Dbg_set_to_return_from_debugger 1
138128
return $_Dbg_rc
139129
fi
130+
fi
131+
((_Dbg_step_ignore--))
132+
_Dbg_write_journal "_Dbg_step_ignore=$_Dbg_step_ignore"
133+
if ((_Dbg_step_ignore > 0 )); then
134+
return $_Dbg_rc
140135
else
141136
_Dbg_frame_save_frames 1
142137
fi

0 commit comments

Comments
 (0)