WIP: Make multi-session debugging sort of work

This passes the session id around everywhere and ensures that things
like buffer names are all unique.

We now have the _vimspector_session update to point to the active (or
last accessed tab). This feels fairly natural and mostly seems to work.

NOTE: in vscode there is no "multiple tabs" - they actually add the
subprocesses to the stack trace somehow and when you click on a frame in
that it switches to the session for that process. Each process PC is
visible in the editor. It's kind of confusing.

Things still broken:
 - vimspector_session_windows
 - breakpoints need to be project-wide
 - PC display (how to show "all" PCs, or just show the current one for
   the current tab ?)
 - it would be nice for the tterminal buffers to be visible on all tabs.
   not sure how to do that.
This commit is contained in:
Ben Jackson 2021-03-31 21:55:33 +01:00
commit 2f05a7f66a
16 changed files with 261 additions and 99 deletions

View file

@ -8,7 +8,26 @@
"type": "python",
"cwd": "${workspaceRoot}",
"program": "${file}",
"stopOnEntry": false,
"stopOnEntry": true,
"console": "integratedTerminal",
"subProcess": true
},
"breakpoints": {
"exception": {
"raised": "N",
"uncaught": "Y",
"userUnhandled": ""
}
}
},
"attach": {
"adapter": "multi-session",
"configuration": {
"request": "attach",
"type": "python",
"cwd": "${workspaceRoot}",
"program": "${file}",
"stopOnEntry": true,
"console": "integratedTerminal",
"subProcess": true
},

View file

@ -3,25 +3,16 @@ import multiprocessing as mp
def First():
for _ in range( 100 ):
print( "in first" )
for i in range( 10 ):
print( f"in first x {i}" )
time.sleep( 0.1 )
def Second():
for _ in range( 100 ):
print( "in second" )
time.sleep( 0.1 )
if __name__ == '__main__':
print( "main" )
p1 = mp.Process( target=First )
p1.start()
p1.join()
print( "main" )
p1 = mp.Process( target=First )
p2 = mp.Process( target=Second )
p1.start()
p2.start()
p1.join()
p2.join()
print( "Done" )
print( "Done" )