changeset 2684:f1c944013b65

PR3825: SystemTap is heavily confused by multiple JDKs 2021-02-21 Andrew John Hughes <gnu.andrew@redhat.com> PR3825: SystemTap is heavily confused by multiple JDKs * tapset/hotspot.stp.in, * tapset/jstack.stp.in: Update unique suffix to match JDK version ('end11' instead of 'end8') 2016-07-17 Andrew John Hughes <gnu.andrew@redhat.com> PR3825: SystemTap is heavily confused by multiple JDKs * AUTHORS: Added Felix Lu. * NEWS: Updated. 2016-07-13 Felix Lu <flu@redhat.com> PR3825: 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 Mon, 22 Feb 2021 00:08:41 +0000
parents 0023f45be371
children 526d974bb37a
files AUTHORS ChangeLog NEWS tapset/hotspot.stp.in tapset/jstack.stp.in
diffstat 5 files changed, 67 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/AUTHORS	Sat Jan 16 23:56:33 2021 +0000
+++ b/AUTHORS	Mon Feb 22 00:08:41 2021 +0000
@@ -22,6 +22,7 @@
 Radim Kolar <hsn@sanatana.filez.com>
 Matthias Klose <doko@ubuntu.com>
 Francis Kung <fkung@redhat.com>
+Felix Lu <flu@redhat.com>
 DJ Lucas <dj@linuxfromscratch.org>
 Omair Majid <omajid@redhat.com>
 Casey Marshall <csm@gnu.org>
--- a/ChangeLog	Sat Jan 16 23:56:33 2021 +0000
+++ b/ChangeLog	Mon Feb 22 00:08:41 2021 +0000
@@ -1,3 +1,30 @@
+2021-02-21  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	PR3825: SystemTap is heavily confused
+	by multiple JDKs
+	* tapset/hotspot.stp.in,
+	* tapset/jstack.stp.in:
+	Update unique suffix to match JDK
+	version ('end11' instead of 'end8')
+
+2016-07-17  Andrew John Hughes  <gnu.andrew@redhat.com>
+
+	PR3825: SystemTap is heavily confused
+	by multiple JDKs
+	* AUTHORS: Added Felix Lu.
+	* NEWS: Updated.
+
+2016-07-13  Felix Lu  <flu@redhat.com>
+
+	PR3825: 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.
+
 2021-01-16  Andrew John Hughes  <gnu_andrew@member.fsf.org>
 
 	PR3818: Update elliptic curve patch to
--- a/NEWS	Sat Jan 16 23:56:33 2021 +0000
+++ b/NEWS	Mon Feb 22 00:08:41 2021 +0000
@@ -12,6 +12,9 @@
 
 New in release 6.0.0 (2019-XX-XX):
 
+* Bug fixes
+  - PR3825: SystemTap is heavily confused by multiple JDKs
+
 New in release 5.0.0 (2019-XX-XX):
 
 New in release 4.0.0 (2017-XX-XX):
--- a/tapset/hotspot.stp.in	Sat Jan 16 23:56:33 2021 +0000
+++ b/tapset/hotspot.stp.in	Mon Feb 22 00:08:41 2021 +0000
@@ -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_end11 {}
+probe hotspot.vm_init_end11 =
   process("@ABS_CLIENT_LIBJVM_SO@").mark("vm__init__end"),
   process("@ABS_SERVER_LIBJVM_SO@").mark("vm__init__end")
 {
--- a/tapset/jstack.stp.in	Sat Jan 16 23:56:33 2021 +0000
+++ b/tapset/jstack.stp.in	Mon Feb 22 00:08:41 2021 +0000
@@ -45,22 +45,28 @@
  semantic error: failed to retrieve location attribute for local
 */
 
-global CodeCache_heap;
+/* 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 CodeCache_heap;
 
-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 constantPool_size;
-global HeapBlock_Header_size;
+@_private global constantPool_size;
+@_private global HeapBlock_Header_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_end11
 {
   /**
    * The CodeCache class contains the static CodeHeap _heap that
@@ -116,6 +122,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;
@@ -125,6 +133,8 @@
 
 function jstack_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 0;
 
@@ -139,6 +149,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;
@@ -148,6 +160,8 @@
 
 function print_jstack_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 0;
 
@@ -162,6 +176,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;
@@ -171,6 +187,8 @@
 
 function jstack_full_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 1;
 
@@ -185,6 +203,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;
@@ -194,6 +214,8 @@
 
 function print_jstack_full_n:string(max_depth:long)
 {
+  @_check_match
+
   // Whether to log the method signatures.
   log_sig = 1;
 
@@ -209,6 +231,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>";