From c0f562688ae877000f46058f748a8b986679863e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 9 Mar 2010 15:32:58 -0800 Subject: PR11360: Make @defined and -L play nice The constant-folding is now enabled for s.listing_mode_vars, despite all other optimizations being disabled. This is needed so we can prune any invalid branches that are gated by @defined. * elaborate.cxx (semantic_pass): Leave the optimization decision to the optimization passes themselves. (semantic_pass_optimize1): Predicate most optimizations, but enable the constant-folding for listing_mode_vars too. (semantic_pass_optimize2): Predicate all (1) optimizations. * testsuite/semok/defined_list_vars.stp: New test. --- testsuite/semok/defined_list_vars.stp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 testsuite/semok/defined_list_vars.stp (limited to 'testsuite') diff --git a/testsuite/semok/defined_list_vars.stp b/testsuite/semok/defined_list_vars.stp new file mode 100755 index 00000000..7f73ff05 --- /dev/null +++ b/testsuite/semok/defined_list_vars.stp @@ -0,0 +1,18 @@ +#! /bin/sh + +# PR11360 - Make sure that @defined and -L play well together. +# +# The test shouldn't be dependent on the implementation of syscall.poll, in +# case that evolves, so I'm recreating the problematic condition here. +# +# NB: This is abusing the fact that -l/-L work by wrapping the input string +# with "probe " and "{}" + +stap -L ' +my_syscall.poll = kernel.function("SyS_poll").call !, + kernel.function("sys_poll").call +{ + timeout = (@defined($timeout_msecs) ? $timeout_msecs : $timeout) +} +probe my_syscall.poll +' | grep " timeout:long" -- cgit