diff options
author | Roland Senn <rsx@bluewin.ch> | 2021-01-16 17:31:45 +0100 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2021-03-10 16:59:05 -0500 |
commit | fcfc66e59c81277c1f7c079ad4e0ccd9a69e1fb6 (patch) | |
tree | 378b6b8bebea928fe5fafad2dcf7920253ecbaeb /rts/Interpreter.c | |
parent | 115cd3c85a8c38f1fe2a10d4ee515f92c96dd5a2 (diff) | |
download | haskell-fcfc66e59c81277c1f7c079ad4e0ccd9a69e1fb6.tar.gz |
Ignore breakpoint for a specified number of iterations. (#19157)
* Implement new debugger command `:ignore` to set an `ignore count`
for a specified breakpoint.
* Allow new optional parameter on `:continue` command to set an
`ignore count` for the current breakpoint.
* In the Interpreter replace the current `Word8` BreakArray with
an `Int` array.
* Change semantics of values in `BreakArray` to:
n < 0 : Breakpoint is disabled.
n == 0 : Breakpoint is enabled.
n > 0 : Breakpoint is enabled, but ignore next `n` iterations.
* Rewrite `:enable`/`:disable` processing as a special case of `:ignore`.
* Remove references to `BreakArray` from `ghc/UI.hs`.
Diffstat (limited to 'rts/Interpreter.c')
-rw-r--r-- | rts/Interpreter.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/rts/Interpreter.c b/rts/Interpreter.c index cdfd7684ed..6929aec5fd 100644 --- a/rts/Interpreter.c +++ b/rts/Interpreter.c @@ -1068,11 +1068,14 @@ run_BCO: // stop the current thread if either the // "rts_stop_next_breakpoint" flag is true OR if the - // breakpoint flag for this particular expression is - // true - if (rts_stop_next_breakpoint == true || - ((StgWord8*)breakPoints->payload)[arg2_array_index] - == true) + // ignore count for this particular breakpoint is zero + StgInt ignore_count = ((StgInt*)breakPoints->payload)[arg2_array_index]; + if (rts_stop_next_breakpoint == false && ignore_count > 0) + { + // decrement and write back ignore count + ((StgInt*)breakPoints->payload)[arg2_array_index] = --ignore_count; + } + else if (rts_stop_next_breakpoint == true || ignore_count == 0) { // make sure we don't automatically stop at the // next breakpoint |