Description of problem: when call task_pid() function in systemtap script,an semantic error happen: semantic error: type definition 'task_struct' not found: identifier '@cast' at /usr/share/systemtap/tapset/task.stp:62:12 source: return @cast(task, "task_struct", "kernel")->tgid ^ Pass 2: analysis failed. Try again with another '--vp 01' option. Version-Release number of selected component (if applicable): SystemTap translator/driver (version 0.9.7/0.141 non-git sources) How reproducible: 100% Steps to Reproduce: 1. 2. 3. Actual results: Expected results: Additional info:
require to have the kernel debuginfo package installed -- Fedora Bugzappers volunteer triage team https://fedoraproject.org/wiki/BugZappers
Could you give a full example? With the following version: $ stap -V SystemTap translator/driver (version 0.9.7/0.141 non-git sources) Copyright (C) 2005-2009 Red Hat, Inc. and others This is free software; see the source for copying conditions. $ rpm -q systemtap kernel kernel-debuginfo systemtap-0.9.7-5.el5 kernel-2.6.18-155.el5 kernel-debuginfo-2.6.18-155.el5 The following works fine for me: $ stap -e 'probe begin { printf("pid: %d\n", task_pid(task_current())); exit(); }' pid: 3190
Without kernel-debuginfo, @cast() can do the job, but only if one identifies the header file that declares the type. @cast(ptr,"task_struct","kernel<linux/sched.h>" Perhaps this change belongs to the tapset.
systemtap upstream commit 8aa140d includes the fix from comment #3.
An advisory has been issued which should help the problem described in this bug report. This report is therefore being closed with a resolution of ERRATA. For more information on therefore solution and/or where to find the updated files, please follow the link below. You may reopen this bug report if the solution does not work for you. http://rhn.redhat.com/errata/RHBA-2010-0308.html