* [Bug translator/11366] New: @defined() and unoptimized stap -u don't work nicely together
@ 2010-03-10 13:59 mjw at redhat dot com
2010-03-10 14:57 ` [Bug translator/11366] " mjw at redhat dot com
0 siblings, 1 reply; 2+ messages in thread
From: mjw at redhat dot com @ 2010-03-10 13:59 UTC (permalink / raw)
To: systemtap
When using stap -u and @defined() together to select whether or not to use a
$variable, as is often done in the testsuite, the ?: operator doesn't prune away
the not defined branch, leading to chaos.
Example:
$ cat t.stp
function get_info:long(t:long)
{
i = (@defined(@cast(t, "task_struct", "kernel<linux/sched.h>")->thread_info)
? @cast(t, "task_struct", "kernel<linux/sched.h>")->thread_info
: @cast(t, "task_struct", "kernel<linux/sched.h>")->stack);
return i;
}
probe begin
{
t = task_current();
printf("0x%x = 0x%x\n", t, get_info(t));
exit();
}
$ stap t.stp
0xffff8801b5341760 = 0xffff8801459dc000
but...
$ stap -u t.stp
semantic error: unable to find member 'thread_info' for struct task_struct
(alternatives: state stack usage flags ptrace lock_depth prio static_prio
normal_prio rt_priority sched_class se rt preempt_notifiers fpu_counter
btrace_seq policy cpus_allowed sched_info tasks pushable_tasks mm active_mm
exit_state exit_code exit_signal pdeath_signal personality did_exec in_execve
in_iowait sched_reset_on_fork pid tgid stack_canary real_parent parent children
sibling group_leader ptraced ptrace_entry bts pids thread_group vfork_done
set_child_tid clear_child_tid utime stime utimescaled stimescaled gtime
prev_utime prev_stime nvcsw nivcsw start_time real_start_time min_flt maj_flt
cputime_expires cpu_timers real_cred cred cred_guard_mutex
replacement_session_keyring comm link_count total_link_count sysvsem
last_switch_count thread fs files nsproxy signal sighand blocked real_blocked
saved_sigmask pending sas_ss_sp sas_ss_size notifier notifier_data notifier_mask
audit_context loginuid sessionid seccomp utrace utrace_flags parent_exec_id
self_exec_id alloc_lock irqaction pi_lock pi_waiters pi_blocked_on journal_info
bio_list bio_tail reclaim_state backing_dev_info io_context ptrace_message
last_siginfo ioac acct_rss_mem1 acct_vm_mem1 acct_timexpd mems_allowed
cpuset_mem_spread_rotor cgroups cg_list robust_list compat_robust_list
pi_state_list pi_state_cache perf_event_ctxp perf_event_mutex perf_event_list
mempolicy il_next fs_excl rcu splice_pipe delays dirties latency_record_count
latency_record timer_slack_ns default_timer_slack_ns scm_work_list
curr_ret_stack ret_stack ftrace_timestamp trace_overrun tracing_graph_pause
trace trace_recursion stack_start): operator '->' at t.stp:4:58
source: ? @cast(t, "task_struct",
"kernel<linux/sched.h>")->thread_info
^
semantic error: unable to find member 'thread_info' for struct task_struct
(alternatives: state stack usage flags ptrace lock_depth prio static_prio
normal_prio rt_priority sched_class se rt preempt_notifiers fpu_counter
btrace_seq policy cpus_allowed sched_info tasks pushable_tasks mm active_mm
exit_state exit_code exit_signal pdeath_signal personality did_exec in_execve
in_iowait sched_reset_on_fork pid tgid stack_canary real_parent parent children
sibling group_leader ptraced ptrace_entry bts pids thread_group vfork_done
set_child_tid clear_child_tid utime stime utimescaled stimescaled gtime
prev_utime prev_stime nvcsw nivcsw start_time real_start_time min_flt maj_flt
cputime_expires cpu_timers real_cred cred cred_guard_mutex
replacement_session_keyring comm link_count total_link_count sysvsem
last_switch_count thread fs files nsproxy signal sighand blocked real_blocked
saved_sigmask pending sas_ss_sp sas_ss_size notifier notifier_data notifier_mask
audit_context loginuid sessionid seccomp utrace utrace_flags parent_exec_id
self_exec_id alloc_lock irqaction pi_lock pi_waiters pi_blocked_on journal_info
bio_list bio_tail reclaim_state backing_dev_info io_context ptrace_message
last_siginfo ioac acct_rss_mem1 acct_vm_mem1 acct_timexpd mems_allowed
cpuset_mem_spread_rotor cgroups cg_list robust_list compat_robust_list
pi_state_list pi_state_cache perf_event_ctxp perf_event_mutex perf_event_list
mempolicy il_next fs_excl rcu splice_pipe delays dirties latency_record_count
latency_record timer_slack_ns default_timer_slack_ns scm_work_list
curr_ret_stack ret_stack ftrace_timestamp trace_overrun tracing_graph_pause
trace trace_recursion stack_start): operator '->' at
/home/mark/systemtap/tapset/task.stp:246:55
source: : @cast(task, "task_struct", "kernel<linux/sched.h>")->thread_info;
^
Pass 2: analysis failed. Try again with another '--vp 01' option.
--
Summary: @defined() and unoptimized stap -u don't work nicely
together
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
AssignedTo: systemtap at sources dot redhat dot com
ReportedBy: mjw at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=11366
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug translator/11366] @defined() and unoptimized stap -u don't work nicely together
2010-03-10 13:59 [Bug translator/11366] New: @defined() and unoptimized stap -u don't work nicely together mjw at redhat dot com
@ 2010-03-10 14:57 ` mjw at redhat dot com
0 siblings, 0 replies; 2+ messages in thread
From: mjw at redhat dot com @ 2010-03-10 14:57 UTC (permalink / raw)
To: systemtap
------- Additional Comments From mjw at redhat dot com 2010-03-10 14:56 -------
Testing patch:
diff --git a/elaborate.cxx b/elaborate.cxx
index 07a2ed6..11d6142 100644
--- a/elaborate.cxx
+++ b/elaborate.cxx
@@ -3674,8 +3674,9 @@ semantic_pass_optimize1 (systemtap_session& s)
// For listing mode, we need const-folding regardless of optimization so
// that @defined expressions can be properly resolved. PR11360
- if (!s.unoptimized || s.listing_mode_vars)
- semantic_pass_const_fold (s, relaxed_p);
+ // We also want it in case variables are used in if/case expressions,
+ // so enable always. PR11366
+ semantic_pass_const_fold (s, relaxed_p);
iterations ++;
}
--
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|systemtap at sources dot |mjw at redhat dot com
|redhat dot com |
Status|NEW |ASSIGNED
http://sourceware.org/bugzilla/show_bug.cgi?id=11366
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-03-10 14:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-10 13:59 [Bug translator/11366] New: @defined() and unoptimized stap -u don't work nicely together mjw at redhat dot com
2010-03-10 14:57 ` [Bug translator/11366] " mjw at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).