9
1 Title New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

Embed Size (px)

Citation preview

Page 1: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

1 Title

New debug/profile features in J2SE 6

Ivan Popov, May, 2006

Intel Corporation

Page 2: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

2 Title

New features in J2SE 6 (JSR-270, core/debug)

Access to heap contents (JDI, JDWP)

rewritten JVMTI functions and callbacks for heap iteration new JDI and JDWP functions for finding objects in heap

Attach-on-demand (JVMTI, java.lang.instrument)

new entry points for dynamically loaded JVMTI and Java agents no spec for dynamic loading mechanism (implementation dependent)

Multiple simultaneous agents (JVMTI, java.lang.instrument)

defined algorithm of sequential classfile transformation introduced transformation capable/incapable agents new function RetransformClasses() in addition to RedefineClasses() support for instrumenting native calls by providing Java wrappers

Several other changes in JVMTI, JDI, JDWP

Getting monitor info for stack frames, access to constant pool, etc. JVMDI and JVMPI are removed

Page 3: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

3 Title

Access to heap content

JVMTI new set of heap iteration functions and callbacks

similar functionality but new design old functions are still in JVMTI spec (marked version 1.0)

JDI/JDWP Get all objects of a given class

Get all objects which refer to a given object

Page 4: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

4 Title

Attach-on-demand

JVMTI: new entry point for dynamically loaded JVMTI agents

Agent_OnAttach() vs. Agent_OnLoad() java.lang.instrument:

new entry point for dynamically loaded Java agents

agentmain() vs. premain()

Problems: no spec for algorithm of dynamic agent loading – it is implementation

specific

no particular support for detach-on-demand

Page 5: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

5 Title

Multiple simultaneous agents (bytecode instrumentation)

JVMTI: described support for multiple classfile transformations

introduced classfile retransformation algorithm for new transformation capable agents

supports classfile redefinition algorithm for old transformation incapable agents

clarified semantics of RedefineClasses(), RetransformClasses(), CLASS_FILE_LOAD_HOOK for agents of both kinds

the whole algorithm is quite sophisticated

java.lang.instrument: similar features for Java agents

Page 6: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

6 Title

New features in J2SE 6 (JSR-270, core/debug)

Access to heap contents (JDI, JDWP)

rewritten JVMTI functions and callbacks for heap iteration new JDI and JDWP functions for finding objects in heap

Attach-on-demand (JVMTI, java.lang.instrument)

new entry points for dynamically loaded JVMTI and Java agents no spec for dynamic loading mechanism (implementation dependent)

Multiple simultaneous agents (JVMTI, java.lang.instrument)

defined algorithm of sequential classfile transformation introduced transformation capable/incapable agents new function RetransformClasses() in addition to RedefineClasses() support for instrumenting native calls by providing Java wrappers

Several other changes in JVMTI, JDI, JDWP

Getting monitor info for stack frames, access to constant pool, etc. JVMDI and JVMPI are removed

Page 7: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

7 Title

Instrumenting native calls

JVMTI: replacing native methods with Java wrappers

adding prefixes for renaming original native methods

managing prefixes for single and multiple agents

clarified algorithm for binding native methods using prefixes

the overall algorithm is quite sophisticated

Page 8: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

8 Title

Other spec changes

JVMTI, JDWP, JDI: Get locked monitors for frames

new functions return association between frames and locked monitors support for monitor events on JDI/JDWP level

Access to constant pool

get classfile major/minor version get constant pool bytes

Checking unmodifiable classes

new function checks if class bytecode can be modified Force early method return

new function to force method to return with given value new METHOD_EXIT_WITH_RETURN_VALUE event in JDI/JDWP

Page 9: Title 1 New debug/profile features in J2SE 6 Ivan Popov, May, 2006 Intel Corporation

9 Title

Other spec changes (cont.)

JVMTI: modification of class path for both bootstrap and system loaders:

AddToSystemClassLoaderSearch vs. AddToBootstrapClassLoaderSearch

JDI/JDWP: source file filter for CLASS_PREPARE events

new JDI connector ProcessAttach uses PID for attaching to process

eliminates knowing port number for attaching connection transport is determined dynamically and reported as “local” no details of the algorithm