Before starting a debug session from vim you first need to do a couple things:
$ java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 \ -classpath ./bin org.test.debug.Main
--servernameargument (eclimd currently sends debugger updates to vim using vim's remote invocation support):
$ vim --servername debug ...
The server name you choose doesn't matter as long as you don't have another vim instance running with that same name.
Once you've got your java program running and vim started with a servername, you can then start your debug session using the :JavaDebugStart command. This command requires the hostname/IP and the port number on which the debug server is running.
:JavaDebugStart localhost 1044
To add a breakpoint, simply open the file, position the cursor on the desired
line and run the :JavaDebugBreakpointToggle command. If now breakpoint
exists, one will be created. If a breakpoint does exist, then
:JavaDebugBreakpointToggle will toggle whether that breakpoint is enabled or
not. If you'd like to delete the breakpoint on the current line instead of
disabling it, then run the toggle command with the
" create a breakpoint or toggle whether the current breakpoint is " enabled/disabled :JavaDebugBreakpointToggle " same as the above, but instead disabling an enabled breakpoint, " delete it instead. :JavaDebugBreakpointToggle!
To view a list of all your breakpoints you can use the
:JavaDebugBreakpointsList command, which by default will list all
breakpoints for the current file, or with the
! suffix, it will list all
breakpoints for the current project and all project dependencies.
This will open a new window which displays your breakpoints grouped by file or by project and file.
In addition to using the delete mapping provided in the
:JavaDebugBreakpointsList window, you can
also remove all breakpoints in the current file using the
:JavaDebugBreakpointRemove command, or with the
! suffix, you can remove
all breakpoints in the current project.
There are 3 ways to step through code using the :JavaDebugStep command and an action argument.
:JavaDebugStep over :JavaDebugStep into :JavaDebugStep return
When a debugging session is started, a status window is automatically opened at the bottom in a horizontal split window. It has 2 panes:
Debug Threads: The left pane shows active threads along with its stack frames.
Debug Variables: The right pane shows the variables available for the thread selected on the left pane. Variables can be seen only for suspended threads. If there are suspended threads, then one of them is automatically selected and its variables displayed.
If for some reason, the status window is not updated, or you accidentally closed it, you can manually refresh it by running :JavaDebugStatus command.
In addition to using the mappings provided in the :JavaDebugStatus threads window, you can also suspend and resume threads using the following commands:
To stop a debug session, you can use the :JavaDebugStop command.