Vim cursor does not follow JDB debugger.
hsanson opened this issue · 4 comments
I am able to start JDB debugger, set breakpoints and use VBGstepOver, VBGcontinue but on every step the cursor never changes position and stays always in the current source position.
In the console I can see that jdb is getting the commands and debugging is going on but the cursor in the source buffer does not sync with what appears in the debugging buffer:
Breakpoint hit: "thread=main", com.kidint.app.MainActivity.selectDrawerItem(), line=258 bci=37
main[1] next
>
Step completed: "thread=main", com.kidint.app.MainActivity.selectDrawerItem(), line=259 bci=44
main[1] next
>
Step completed: "thread=main", com.kidint.app.MainActivity.selectDrawerItem(), line=261 bci=48
I expected vim to move the cursor to the same file/line the debugger is at the moment.
Looking at the code and adding some debugging output I think the issue is that the regexp in the vebbuger#jdb#_readWhere() method is wrong. Of all commands I have used while debugging no single ouput has matched that regular expression:
let l:matches=matchlist(a:line,'\v\s*\[(\d+)]\s*(\S+)\s*\(([^:]*):(\d*)\)')
this s an example of the output jdb gives:
Breakpoint hit: "thread=main", com.kidint.app.MainActivity.selectDrawerItem(), line=254 bci=31
main[1] next
>
Step completed: "thread=main", com.kidint.app.MainActivity.selectDrawerItem(), line=258 bci=37
Something is missing. When I run it I see in the console:
Breakpoint hit: "thread=main", Main.main(), line=7 bci=0
[1] Main.main (Main.java:7)
main[1] main[1] next
>
Step completed: "thread=main", Main.main(), line=8 bci=18
[1] Main.main (Main.java:8)
Notice the line "[1] Main.main (Main.java:8)
". That's what I'm trying to match, not the Step completed:...
line before it. For some odd reason your jdb
doesn't emit it.
This line is not emitted automatically - Vebugger sends the monitor where command
to jdb
so it'll emit it. The head of the console looks like this for me:
stop on Main.main
run Main 0
monitor where
Initializing jdb ...
How does it look for you? Do you have monitor where
written there?
Also - what happens when you run it manually? After starting the debugger try running the command:
:VBGrawWrite monitor where
After that, use :VBGstepOver
and see if the cursor moves.
Please ignore this issue, was totally my fault.
Long Explanation (Skip if busy):
I modified vebugger to allow attaching jdb to a running process via TCP. This is to allow me debug Android applications running on a device via vebugger. The problem was that my modification was not sending the "monitor where" command when starting jdb.
BTW: when is the PR to enable attaching to JDB via TCP going to be merged with master?
@kevinbrandon is working on PR #12 - you'll have to ask him. Though I guess it would be faster if I can get my lazy ass to start working on Vebugger 2.0.0...