This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug translator/11366] New: @defined() and unoptimized stap -u don't work nicely together


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]