Add "run to cursor" support

We add a 'temporary' option to line breakpionts and try and clear any
temporary breakpionts on the line we end up stopping on. This might not
be art, but _probably_ works in almost all cases that matter.

it's a bit hacky the way we have to push the reason around, but we don't
know where we stopped until we actually get the stack trace response and
SetCurrentFrame

Move temporary breakpionts to match server response

Also delete any existing ones when adding a new one and add tests for
run-to-cursor.

Only continue after we successfully set the breakpoints. This makes it
work in go
This commit is contained in:
Ben Jackson 2020-10-13 22:43:52 +01:00
commit 80985148e7
18 changed files with 693 additions and 205 deletions

View file

@ -108,6 +108,7 @@ And a couple of brief demos:
- breakpoints (function, line and exception breakpoints)
- conditional breakpoints (function, line)
- step in/out/over/up, stop, restart
- run to cursor
- launch and attach
- remote launch, remote attach
- locals and globals display
@ -552,6 +553,7 @@ features to set your own mappings. To that end, Vimspector defines the following
* `<Plug>VimspectorStepOver`
* `<Plug>VimspectorStepInto`
* `<Plug>VimspectorStepOut`
* `<Plug>VimspectorRunToCursor`
These map roughly 1-1 with the API functions below.
@ -612,6 +614,7 @@ let g:vimspector_enable_mappings = 'HUMAN'
| `F9` | Toggle line breakpoint on the current line. | `vimspector#ToggleBreakpoint()` |
| `<leader>F9` | Toggle conditional line breakpoint on the current line. | `vimspector#ToggleBreakpoint( { trigger expr, hit count expr } )` |
| `F8` | Add a function breakpoint for the expression under cursor | `vimspector#AddFunctionBreakpoint( '<cexpr>' )` |
| `<leader>F8` | Run to Cursor | `vimspector#RunToCursor()` |
| `F10` | Step Over | `vimspector#StepOver()` |
| `F11` | Step Into | `vimspector#StepInto()` |
| `F12` | Step out of current function scope | `vimspector#StepOut()` |
@ -710,6 +713,12 @@ You can configure your choices in the `.vimspector.json`. See
* Use `vimspector#ClearBreakpoints()`
to clear all breakpoints including the memory of exception breakpoint choices.
### Run to Cursor
* Use `vimspector#RunToCursor` or `<leader><F8>`: this creates a temporary
breakpoint on the current line, then continues execution, clearing the
breakpiont when it is hit.
## Stepping
* Step in/out, finish, continue, pause etc. using the WinBar, or mappings.