GithubHelp home page GithubHelp logo

jdwp's Introduction

jdwp

Java Debug Wire Protocol

NPM version build status Test coverage David deps Known Vulnerabilities npm download

Install

$ npm i jdwp --save

Usage

launch the java project and connect to jvm

const { launcher } = require('jdwp')

const vm = await launcher.launch({
  mainClass: 'Test',
  vmArgs: [ '-Dfile.encoding=UTF-8', '-Xdebug', '-Xnoagent', '-Djava.compiler=NONE' ],
  classPaths: [ __dirname ],
});
vm.on('event', async ({ events }) => {
  console.log(events);
});
await vm.ready();
await vm.resume();

run the example demo

$ node example/index.js

Begin debug Test.java
-----------------------
1  public class Test {
2      public int plus(int a, int b) {
3      	int c = a + b;
4      	return c;
5      }
6
7      public static void main(String[] args) {
8      	Test test = new Test();
9      	int c = test.plus(1, 2);
10      	System.out.println(c);
11          System.out.println("Hello world");
12      }
13  }
14
-----------------------

suspend at breakpoint line:10
get local variable c = 3
set local variable c = 4
4
step => Test main() line:11 Test/Test.java
Hello world
step => Test main() line:12 Test/Test.java
step => java.lang.Thread exit() line:757 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:758 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:759 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:762 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:764 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:765 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:766 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:767 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:768 java/lang/Thread/Thread.java
step => java.lang.Thread exit() line:769 java/lang/Thread/Thread.java

Protocol

https://docs.oracle.com/javase/7/docs/platform/jpda/jdwp/jdwp-protocol.html

  • VirtualMachine Command Set (1)
    • Version (1)
    • ClassesBySignature (2)
    • AllClasses (3)
    • AllThreads (4)
    • TopLevelThreadGroups (5)
    • Dispose (6)
    • IDSizes (7)
    • Suspend (8)
    • Resume (9)
    • Exit (10)
    • CreateString (11)
    • Capabilities (12)
    • ClassPaths (13)
    • DisposeObjects (14)
    • HoldEvents (15)
    • ReleaseEvents (16)
    • CapabilitiesNew (17)
    • RedefineClasses (18)
    • SetDefaultStratum (19)
    • AllClassesWithGeneric (20)
    • InstanceCounts (21)
  • ReferenceType Command Set (2)
    • Signature (1)
    • ClassLoader (2)
    • Modifiers (3)
    • Fields (4)
    • Methods (5)
    • GetValues (6)
    • SourceFile (7)
    • NestedTypes (8)
    • Status (9)
    • Interfaces (10)
    • ClassObject (11)
    • SourceDebugExtension (12)
    • SignatureWithGeneric (13)
    • FieldsWithGeneric (14)
    • MethodsWithGeneric (15)
    • Instances (16)
    • ClassFileVersion (17)
    • ConstantPool (18)
  • ClassType Command Set (3)
    • Superclass (1)
    • SetValues (2)
    • InvokeMethod (3)
    • NewInstance (4)
  • ArrayType Command Set (4)
    • NewInstance (1)
  • InterfaceType Command Set (5)
  • Method Command Set (6)
    • LineTable (1)
    • VariableTable (2)
    • Bytecodes (3)
    • IsObsolete (4)
    • VariableTableWithGeneric (5)
  • Field Command Set (8)
  • ObjectReference Command Set (9)
    • ReferenceType (1)
    • GetValues (2)
    • SetValues (3)
    • MonitorInfo (5)
    • InvokeMethod (6)
    • DisableCollection (7)
    • EnableCollection (8)
    • IsCollected (9)
    • ReferringObjects (10)
  • StringReference Command Set (10)
    • Value (1)
  • ThreadReference Command Set (11)
    • Name (1)
    • Suspend (2)
    • Resume (3)
    • Status (4)
    • ThreadGroup (5)
    • Frames (6)
    • FrameCount (7)
    • OwnedMonitors (8)
    • CurrentContendedMonitor (9)
    • Stop (10)
    • Interrupt (11)
    • SuspendCount (12)
    • OwnedMonitorsStackDepthInfo (13)
    • ForceEarlyReturn (14)
  • ThreadGroupReference Command Set (12)
    • Name (1)
    • Parent (2)
    • Children (3)
  • ArrayReference Command Set (13)
    • Length (1)
    • GetValues (2)
    • SetValues (3)
  • ClassLoaderReference Command Set (14)
    • VisibleClasses (1)
  • EventRequest Command Set (15)
    • Set (1)
    • Clear (2)
    • ClearAllBreakpoints (3)
  • StackFrame Command Set (16)
    • GetValues (1)
    • SetValues (2)
    • ThisObject (3)
    • PopFrames (4)
  • ClassObjectReference Command Set (17)
    • ReflectedType (1)
  • Event Command Set (64)
    • Composite (100)

jdwp's People

Contributors

gxcsoccer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.