Skip to content

ghauerberg/vim-jdb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 

Repository files navigation

vim-jdb

This is a fork of Dica-Developer/vim-jdb so checkout the main branch as well.

Its a JAVA debugger frontend plugin for VIM. It allows to debug a JAVA program via the JDB debugger. It allows remote debugging via attach parameter. It marks by vim-jdb setted breakpoints and shows the current file and line the debugger stays in.

It requires VIM >= 8.0 and VIM compiled with channel, signs and job support.

How to use

  1. start JAVA process with the following debug agent option, e.g. -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005'
  2. attach to the JAVA process from your VIM with VIM-JDB like :JDBAttach or by explicitly specifying host and port :JDBAttach localhost:5005
  3. now the JDB shell buffer should open and signal that it connected to the JAVA process
  4. open a JAVA file and go to the line in it where you want to set a breakpoint
  5. set a breakpoint on the current line in the current file by using the command :JDBBreakpointOnLine
  6. breakpoints are marked depending on your terminals and VIMs capabilities with a or x
  7. if your programm stops at the breakpoint this is marked with a ->
  8. use the command :JDBStepOver to execute to the next line
  9. with :JDBCommand you can send any JDB command to the JDB JAVA process, e.g. you want to see all locals do :JDBCommands locals
  10. with :JDBContinue you can resume the execution until the next breakpoint is hits
  11. with :JDBDebugProcess will (currently) pick the function name you are currently in if it is annontated with "@Test". It will then construct the the path to the class from the class name and package name in the file. finally it will start jdb like this e.g.: jdb -Dtest.single=functionmane org.junit.runner.JUnitCore yourpackage.classname for this to work properly you need to set the env var CLASSPATH with your projects dependencies. For me I use gradle for dev so have a task named "classpath" and can do this from with in gradle before starting. :let $CLASSPATH=system("gradle -q classpath") . ":build/classes/main:build/classes/test"

Commands

Command Description
JDBAttach attach to a running JVM with a debug listener on localhost:5005, can be overwritten by given host:port as an argument
JDBDetach detach the debugger UI from the application that is currently debugged
JDBBreakpointOnLine set a breakpoint on the current line
JDBClearBreakpointOnLine clear the breakpoint on the current line
JDBContinue continues the execution until the next breakpoint
JDBStepOver steps to the next line
JDBStepIn steps a level down the stack
JDBStepUp steps a level up in the stack
JDBStepI steps to the next instruction
JDBCommand send any JDB command to the application under debug
JDBDebugProcess While in a JUnit test this will start a debug process using junit -Dtest.single

Global variables

To specify the JDB command to use you can overwrite the following variable g:vimjdb_jdb_command. The default is jdb. For starting debug process for Unit tests you can override the following variables. g:vimjdb_unit_test_class by default it is set tp 'org.junit.runnint.JUnitCore'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Vim Script 100.0%