From 710a2a45c4d3d8fa8d984c2371a0a1ae44d3fe93 Mon Sep 17 00:00:00 2001 From: Stan Cox Date: Thu, 21 Apr 2011 16:04:24 -0400 Subject: [PATCH] Add -DSTAP_SDT_ARG_CONSTRAINT * sdt.h (STAP_SDT_ARG_CONSTRAINT): Allow override of default nor constraint. * cxxclass.exp: Use it. --- NEWS | 5 +++++ includes/sys/sdt.h | 7 ++++++- testsuite/systemtap.base/cxxclass.exp | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 4b449d6e3..34c7fabbb 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,10 @@ * What's new in version 1.5 +- Compiler optimization may sometimes result in systemtap not being able to + access a user-space probe argument. Compiling the application with + -DSTAP_SDT_ARG_CONSTRAINT=nr will force the argument to be an immediate or + register value which should enable systemtap to access the argument. + - GNU Gettext has now been intergrated with systemtap. Our translation page can be found at http://www.transifex.net/projects/p/systemtap/ . "make update-po" will generate the necessary files to use translated diff --git a/includes/sys/sdt.h b/includes/sys/sdt.h index 101a6a7e2..f7e136039 100644 --- a/includes/sys/sdt.h +++ b/includes/sys/sdt.h @@ -45,9 +45,14 @@ # define _SDT_ASM_STRING_1(x) _SDT_ASM_1(.asciz #x) # define _SDT_ARGFMT(no) %n[_SDT_S##no]@_SDT_ARGTMPL(_SDT_A##no) +# ifndef STAP_SDT_ARG_CONSTRAINT +# define STAP_SDT_ARG_CONSTRAINT nor +# endif +# define _SDT_STRINGIFY(x) #x +# define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) # define _SDT_ARG(n, x) \ [_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \ - [_SDT_A##n] "nor" (_SDT_ARGVAL (x)) + [_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x)) #endif #define _SDT_ASM_STRING(x) _SDT_ASM_STRING_1(x) diff --git a/testsuite/systemtap.base/cxxclass.exp b/testsuite/systemtap.base/cxxclass.exp index 3b73c245c..c74d68030 100644 --- a/testsuite/systemtap.base/cxxclass.exp +++ b/testsuite/systemtap.base/cxxclass.exp @@ -14,6 +14,10 @@ set test_flags "additional_flags=-g" set test_flags "$test_flags additional_flags=-O2" set test_flags "$test_flags [sdt_includes]" set test_flags "$test_flags compiler=g++" +# ppc64 needs a more restrictive constraint for the probe args +if {[regexp "^(x86_64|i.86)$" $::tcl_platform(machine)] == 0} { +set test_flags "$test_flags additional_flags=-DSTAP_SDT_ARG_CONSTRAINT=nr" +} set res [target_compile $srcdir/$subdir/$test.cxx $test.exe executable "$test_flags"] if { $res != "" } { -- 2.43.5