changeset 2892:2141e7831540

PR3091: SystemTap is heavily confused by multiple JDKs 2016-07-20 Andrew John Hughes <gnu.andrew@redhat.com> PR3091: SystemTap is heavily confused by multiple JDKs * AUTHORS: Added Felix Lu. * NEWS: Updated. 2016-07-13 Felix Lu <flu@redhat.com> PR3091: 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.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Fri, 29 Jul 2016 04:11:18 +0100
parents 7f2aabb014c8
children 937c6c005478
files AUTHORS ChangeLog NEWS tapset/hotspot.stp.in tapset/jstack.stp.in
diffstat 5 files changed, 61 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Thu Jul 28 03:55:52 2016 +0100
+++ b/AUTHORS	Fri Jul 29 04:11:18 2016 +0100
@@ -25,6 +25,7 @@
 Matthias Klose <doko@ubuntu.com>
 Francis Kung <fkung@redhat.com>
 Trustin Lee <http://t.motd.kr>
+Felix Lu <flu@redhat.com>
 DJ Lucas <dj@linuxfromscratch.org>
 Omair Majid <omajid@redhat.com>
 Casey Marshall <csm@gnu.org>
--- a/ChangeLog	Thu Jul 28 03:55:52 2016 +0100
+++ b/ChangeLog	Fri Jul 29 04:11:18 2016 +0100
@@ -1,3 +1,21 @@
+2016-07-20  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	PR3091: SystemTap is heavily confused
+	by multiple JDKs
+	* AUTHORS: Added Felix Lu.
+	* NEWS: Updated.
+
+2016-07-13  Felix Lu  <flu@redhat.com>
+
+	PR3091: 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-04-23  Andrew John Hughes  <gnu_andrew@member.fsf.org>
 
 	PR2900: Don't use WithSeed versions of NSS
--- a/NEWS	Thu Jul 28 03:55:52 2016 +0100
+++ b/NEWS	Fri Jul 29 04:11:18 2016 +0100
@@ -96,6 +96,7 @@
 * Bug fixes
   - PR2799, RH1195203: Files are missing from resources.jar
   - PR2900: Don't use WithSeed versions of NSS functions as they don't fully process the seed
+  - PR3091: SystemTap is heavily confused by multiple JDKs
   - PR3102: Extend 8022594 to AixPollPort
   - PR3111: Provide option to disable SystemTap tests
   - PR3115: Add check for elliptic curve cryptography implementation
--- a/tapset/hotspot.stp.in	Thu Jul 28 03:55:52 2016 +0100
+++ b/tapset/hotspot.stp.in	Fri Jul 29 04:11:18 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_end7 {}
+probe hotspot.vm_init_end7 =
   process("@ABS_CLIENT_LIBJVM_SO@").mark("vm__init__end"),
   process("@ABS_SERVER_LIBJVM_SO@").mark("vm__init__end")
 {
--- a/tapset/jstack.stp.in	Thu Jul 28 03:55:52 2016 +0100
+++ b/tapset/jstack.stp.in	Fri Jul 29 04:11:18 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_end7
 {
   // The parent/type oop for a methodOop.
   Universe_methodKlassObj[pid()] = %( systemtap_v >= "1.8"
@@ -159,6 +165,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;
@@ -168,6 +176,8 @@
 
 function jstack_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 0;
 
@@ -182,6 +192,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;
@@ -191,6 +203,8 @@
 
 function print_jstack_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 0;
 
@@ -205,6 +219,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;
@@ -214,6 +230,8 @@
 
 function jstack_full_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 1;
 
@@ -228,6 +246,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;
@@ -237,6 +257,8 @@
 
 function print_jstack_full_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 1;
 
@@ -252,6 +274,8 @@
 function jstack_call:string(max_depth:long, log_sig:long, log_native:long,
                             print_frames:long)
 {
+  @_check_match
+
   if (! vm_inited[pid()])
     {
       frame = "<vm-not-inited>";