jdi

Java: Method hooking & Finding object instances

邮差的信 提交于 2019-12-22 00:29:25
问题 Situation Hi, I have 2 problems. The situation is that I'm writing a Java API for Windows that also provides tools for injecting code into a process and then manipulate the target. I have already implemented the injection-part , for example injecting a jar into another jar. At this point my jar gets called (while the target already is at runtime) and starts in a complete static context . Goals & problems From here I have two goals: I'd like to interact with the targets objects , thus I need

JDI, Java Byte code instrumentation and Java agents (JWDP, JVMTI)

一笑奈何 提交于 2019-12-11 04:38:17
问题 I am new in the realm of debuggers, instrumentation and JVMTI. So I have few questions about them. What is the difference between JDI(java debugger interface), JWDP, javaagent and native agent(JVMTI). and where does the java instrumentation API fit in picture. I am using JDI to intercept exceptions in target java application. but I found out that JDI is not good enough if we talk about how it impacts the performance of target app. I read that most good applications does this with combining

How do you set a breakpoint before executing

北慕城南 提交于 2019-12-08 06:13:21
问题 I would like to set a breakpoint in an application before it starts to run, so that I can make sure the application does not pass the breakpoint on startup. In order to set a breakpoint you need to do something like: EventRequestManager reqMan = vm.eventRequestManager(); BreakpointRequest bpReq = reqMan.createBreakpointRequest(locationForBreakpoint); bpReq.enable(); In order to get the Location for the breakpoint, you can do something like: Method method = location.method(); List<Location>

Java Access to Local Variable Names

久未见 提交于 2019-12-07 08:41:09
问题 I'm currently writing a program in which I would like to access the variable names of local variables during execution of a program and pass them off externally. I'm aware that Java will dump local variable names during compilation unless compiled in debug mode. After looking around some, it seems that JDI/JPDA is the way to go for this kind of work. Assuming ref refers to a ThreadReference , the following is what I have thus far: ref.suspend(); StackFrame currentFrame = ref.frame(0); List

How do you set a breakpoint before executing

依然范特西╮ 提交于 2019-12-06 17:28:08
I would like to set a breakpoint in an application before it starts to run, so that I can make sure the application does not pass the breakpoint on startup. In order to set a breakpoint you need to do something like: EventRequestManager reqMan = vm.eventRequestManager(); BreakpointRequest bpReq = reqMan.createBreakpointRequest(locationForBreakpoint); bpReq.enable(); In order to get the Location for the breakpoint, you can do something like: Method method = location.method(); List<Location> locations = method.locationsOfLine(55); Location locationForBreakpoint = locations.get(0); In order to

How to import and use com.sun.jdi.VirtualMachine

拜拜、爱过 提交于 2019-12-05 11:49:47
问题 I found some classes designed for debugging in package com.sun.jdi like VirtualMachine, but I can't use this because package seems not exist in Sun JDK7. How to use this package? BTW. lib/sa-jdi.jar isn't the same I want 回答1: According to this page, the VirtualMachine class that you linked to is part of the tools.jar file which is only distributed in a JDK (not a JRE). It says ... " Update Note 2: The Attach API is in tools.jar, so you will need to add /lib/tools.jar in your CLASSPATH to

Java: Method hooking & Finding object instances

家住魔仙堡 提交于 2019-12-04 19:20:23
Situation Hi, I have 2 problems. The situation is that I'm writing a Java API for Windows that also provides tools for injecting code into a process and then manipulate the target. I have already implemented the injection-part , for example injecting a jar into another jar. At this point my jar gets called (while the target already is at runtime) and starts in a complete static context . Goals & problems From here I have two goals: I'd like to interact with the targets objects , thus I need references . For many objects this is already possible because they provide static access to their

How to import and use com.sun.jdi.VirtualMachine

孤者浪人 提交于 2019-11-30 18:02:12
I found some classes designed for debugging in package com.sun.jdi like VirtualMachine , but I can't use this because package seems not exist in Sun JDK7. How to use this package? BTW. lib/sa-jdi.jar isn't the same I want According to this page , the VirtualMachine class that you linked to is part of the tools.jar file which is only distributed in a JDK (not a JRE). It says ... " Update Note 2: The Attach API is in tools.jar, so you will need to add /lib/tools.jar in your CLASSPATH to compile and run the example on JDK 6." ... and the same advice would apply on (at least) JDK 7 as well. 来源: