# HG changeset patch # User Andrew John Hughes # Date 1471226481 -3600 # Node ID 5f02205c65fb9191d9862b3538cd910806109b4f # Parent ced27e54d17c9f6a40c95cc87dce545da16cecf9 PR3092: SystemTap is heavily confused by multiple JDKs 2016-07-17 Andrew John Hughes PR3092: SystemTap is heavily confused by multiple JDKs * AUTHORS: Added Felix Lu. * NEWS: Updated. 2016-07-13 Felix Lu PR3092: SystemTap is heavily confused by multiple JDKs * tapset/hotspot.stp.in, * tapset/jstack.stp.in: Use the new private keyword in SystemTap >= 3.0 to resolve global variable name collision and function overloading to select the correct jstack_call at runtime. diff -r ced27e54d17c -r 5f02205c65fb AUTHORS --- a/AUTHORS Wed Aug 17 03:22:59 2016 +0100 +++ b/AUTHORS Mon Aug 15 03:01:21 2016 +0100 @@ -26,6 +26,7 @@ Matthias Klose Francis Kung Denis Lila +Felix Lu DJ Lucas Omair Majid Casey Marshall diff -r ced27e54d17c -r 5f02205c65fb ChangeLog --- a/ChangeLog Wed Aug 17 03:22:59 2016 +0100 +++ b/ChangeLog Mon Aug 15 03:01:21 2016 +0100 @@ -1,3 +1,21 @@ +2016-07-17 Andrew John Hughes + + PR3092: SystemTap is heavily confused + by multiple JDKs + * AUTHORS: Added Felix Lu. + * NEWS: Updated. + +2016-07-13 Felix Lu + + PR3092: SystemTap is heavily confused + by multiple JDKs + * tapset/hotspot.stp.in, + * tapset/jstack.stp.in: + Use the new private keyword in SystemTap + >= 3.0 to resolve global variable name + collision and function overloading + to select the correct jstack_call at runtime. + 2016-08-15 Andrew John Hughes * Makefile.am: diff -r ced27e54d17c -r 5f02205c65fb NEWS --- a/NEWS Wed Aug 17 03:22:59 2016 +0100 +++ b/NEWS Mon Aug 15 03:01:21 2016 +0100 @@ -25,6 +25,7 @@ - PR2961: Latest security update broke bundled LCMS2 build - PR2962: System default check doesn't match all GNU/Linux systems - PR2969: ENABLE_SYSTEM_LCMS is not defined if ENABLE_LCMS2 is not set + - PR3092: SystemTap is heavily confused by multiple JDKs - PR3137: GTKLookAndFeel does not honor gtk-alternative-button-order New in release 1.13.11 (2016-05-05): diff -r ced27e54d17c -r 5f02205c65fb tapset/hotspot.stp.in --- a/tapset/hotspot.stp.in Wed Aug 17 03:22:59 2016 +0100 +++ b/tapset/hotspot.stp.in Mon Aug 15 03:01:21 2016 +0100 @@ -141,7 +141,8 @@ Triggers at the end of the virtual machine initialization. Has no arguments. */ -probe hotspot.vm_init_end = +probe hotspot_vm_init_end = hotspot.vm_init_end6 {} +probe hotspot.vm_init_end6 = process("@ABS_CLIENT_LIBJVM_SO@").mark("vm__init__end"), process("@ABS_SERVER_LIBJVM_SO@").mark("vm__init__end") { diff -r ced27e54d17c -r 5f02205c65fb tapset/jstack.stp.in --- a/tapset/jstack.stp.in Wed Aug 17 03:22:59 2016 +0100 +++ b/tapset/jstack.stp.in Mon Aug 15 03:01:21 2016 +0100 @@ -45,27 +45,33 @@ semantic error: failed to retrieve location attribute for local */ -global Universe_methodKlassObj; -global Universe_collectedHeap; -global HeapWordSize; -global CodeCache_heap; -global NarrowOopStruct; +/* Resolve multiple installed java versions conflict. */ +@define _private %( %( systemtap_v >= "3.0" %? private %) %) +@define _check_match %( + %( systemtap_v >= "3.0" %? if (pp() !~ "@prefix@") next %) +%) + +@_private global Universe_methodKlassObj; +@_private global Universe_collectedHeap; +@_private global HeapWordSize; +@_private global CodeCache_heap; +@_private global NarrowOopStruct; -global sp_register; -global fp_register; -global pc_register; -global ptr_size; -global ptr_mask; +@_private global sp_register; +@_private global fp_register; +@_private global pc_register; +@_private global ptr_size; +@_private global ptr_mask; -global constantPoolOopDesc_size; -global HeapBlock_Header_size; -global oopDesc_size; +@_private global constantPoolOopDesc_size; +@_private global HeapBlock_Header_size; +@_private global oopDesc_size; -global vm_inited; +@_private global vm_inited; /* We need to collect some global symbol addresses that cannot be resolved in a bare function and vm_init_end seems a good place to use. */ -probe hotspot.vm_init_end +probe hotspot.vm_init_end6 { // The parent/type oop for a methodOop. Universe_methodKlassObj[pid()] = %( systemtap_v >= "1.8" @@ -157,6 +163,8 @@ function jstack:string() { + @_check_match + // java backtraces can be a lot bigger, but we risk going over MAXACTION. // 32 frames only gives us ~32 actions per frame (with MAXACTION == 1024). max_depth = 32; @@ -166,6 +174,8 @@ function jstack_n:string(max_depth:long) { + @_check_match + // Whether to log the method signatures. log_sig = 0; @@ -180,6 +190,8 @@ function print_jstack() { + @_check_match + // java backtraces can be a lot bigger, but we risk going over MAXACTION. // 32 frames only gives us ~32 actions per frame (with MAXACTION == 1024). max_depth = 32; @@ -189,6 +201,8 @@ function print_jstack_n:string(max_depth:long) { + @_check_match + // Whether to log the method signatures. log_sig = 0; @@ -203,6 +217,8 @@ function jstack_full:string() { + @_check_match + // java backtraces can be a lot bigger, but we risk going over MAXACTION. // 32 frames only gives us ~32 actions per frame (with MAXACTION == 1024). max_depth = 32; @@ -212,6 +228,8 @@ function jstack_full_n:string(max_depth:long) { + @_check_match + // Whether to log the method signatures. log_sig = 1; @@ -226,6 +244,8 @@ function print_jstack_full() { + @_check_match + // java backtraces can be a lot bigger, but we risk going over MAXACTION. // 32 frames only gives us ~32 actions per frame (with MAXACTION == 1024). max_depth = 32; @@ -235,6 +255,8 @@ function print_jstack_full_n:string(max_depth:long) { + @_check_match + // Whether to log the method signatures. log_sig = 1; @@ -250,6 +272,8 @@ function jstack_call:string(max_depth:long, log_sig:long, log_native:long, print_frames:long) { + @_check_match + if (! vm_inited[pid()]) { frame = "";