summaryrefslogtreecommitdiffstats
path: root/tapset
diff options
context:
space:
mode:
authorfche <fche>2006-04-25 17:40:53 +0000
committerfche <fche>2006-04-25 17:40:53 +0000
commit1b07c728305a32a8d1fa1bb5da9d428e34dddf4e (patch)
treef86471e86673dbd7ce49f755f7d980aec43a5a58 /tapset
parentfe7e582fac54df14452fa017529bf642f2047e5f (diff)
downloadsystemtap-steved-1b07c728305a32a8d1fa1bb5da9d428e34dddf4e.tar.gz
systemtap-steved-1b07c728305a32a8d1fa1bb5da9d428e34dddf4e.tar.xz
systemtap-steved-1b07c728305a32a8d1fa1bb5da9d428e34dddf4e.zip
2006-04-25 Frank Ch. Eigler <fche@elastic.org>
PR 2427. * staptree.cxx (varuse_collecting_visitor::visit_embeddedcode): Support /* pure */ declaration. Stop using __tvar_ naming hack. (v_c_u::visit_print_format): Mark sprint and sprintf as side-effect-free. (deep_copy_visitor::visit_print_format): Propagate raw_components. * stap.1.in: Document declaration. * elaborate.cxx (semantic_pass_opt2): Verbose message tweak. (dead_stmtexpr_remover): Extend for more aggressive optimization. * tapsets.cxx (dwarf,mark_var_expanding_copy_visotor): Add /* pure */ declaration to rvalue expansions. * tapset/*.stp: Added /* pure */ declarations to many functions. * testsuite/parseok/unparsers.stp: Propagate guru mode flag. * testsuite/buildok/twentyfour.stp: New test.
Diffstat (limited to 'tapset')
-rw-r--r--tapset/aux_syscalls.stp36
-rw-r--r--tapset/context.stp34
-rw-r--r--tapset/conversions.stp8
-rw-r--r--tapset/endian.stp14
-rw-r--r--tapset/errno.stp4
-rw-r--r--tapset/return.stp2
-rw-r--r--tapset/string.stp6
-rw-r--r--tapset/timestamp.stp8
8 files changed, 56 insertions, 56 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp
index 37e9ddf9..b1e2c446 100644
--- a/tapset/aux_syscalls.stp
+++ b/tapset/aux_syscalls.stp
@@ -3,7 +3,7 @@
# copy and decode it and return a string.
#
function _struct_timeval_u:string(uaddr:long)
-%{
+%{ /* pure */
struct timeval tv;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -18,7 +18,7 @@ function _struct_timeval_u:string(uaddr:long)
%}
function _struct_timeval:string(addr:long)
-%{
+%{ /* pure */
struct timeval *tv;
char *ptr = (char *)(unsigned long)THIS->addr;
@@ -31,7 +31,7 @@ function _struct_timeval:string(addr:long)
%}
function _struct_timezone_u:string(uaddr:long)
-%{
+%{ /* pure */
struct timezone tz;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -46,7 +46,7 @@ function _struct_timezone_u:string(uaddr:long)
%}
function _struct_timespec_u:string(uaddr:long)
-%{
+%{ /* pure */
struct timespec ts;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -62,7 +62,7 @@ function _struct_timespec_u:string(uaddr:long)
%}
function _struct_timespec:string(addr:long)
-%{
+%{ /* pure */
struct timespec *ts;
char *ptr = (char *)(unsigned long)THIS->addr;
@@ -76,7 +76,7 @@ function _struct_timespec:string(addr:long)
%}
function _struct_itimerspec_u:string(uaddr:long)
-%{
+%{ /* pure */
struct itimerspec its;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -93,7 +93,7 @@ function _struct_itimerspec_u:string(uaddr:long)
%}
function _struct_itimerval_u:string(uaddr:long)
-%{
+%{ /* pure */
struct itimerval itv;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -110,7 +110,7 @@ function _struct_itimerval_u:string(uaddr:long)
%}
function _struct_itimerval:string(addr:long)
-%{
+%{ /* pure */
struct itimerval *itv;
char *ptr = (char *)(unsigned long)THIS->addr;
@@ -196,7 +196,7 @@ void _stp_sockaddr_str(char *str, const int strlen, char *buf, int len)
%}
function _struct_sockaddr_u:string(uaddr:long, len:long)
-%{
+%{ /* pure */
char *ptr = (char *)(unsigned long)THIS->uaddr;
if (ptr == NULL)
strlcpy (THIS->__retvalue, "NULL", MAXSTRINGLEN);
@@ -211,7 +211,7 @@ function _struct_sockaddr_u:string(uaddr:long, len:long)
%}
function _signal_name:string(sig:long)
-%{
+%{ /* pure */
int sig = THIS->sig;
char *res = 0;
@@ -308,7 +308,7 @@ function _signal_name:string(sig:long)
%}
function _struct_rlimit_u:string(uaddr:long)
-%{
+%{ /* pure */
struct rlimit rl;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -324,7 +324,7 @@ function _struct_rlimit_u:string(uaddr:long)
%}
function _fildes_u:string (uaddr:long)
-%{
+%{ /* pure */
int fd[2];
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -339,7 +339,7 @@ function _fildes_u:string (uaddr:long)
%}
function _fd_set_u:string(uaddr:long)
-%{
+%{ /* pure */
fd_set fdset;
char *ptr = (char *)(unsigned long)THIS->uaddr;
@@ -355,7 +355,7 @@ function _fd_set_u:string(uaddr:long)
function _semctl_cmd:string(cmd:long)
-%{
+%{ /* pure */
int cmd = THIS->cmd;
char *res = 0;
@@ -407,7 +407,7 @@ function _semctl_cmd:string(cmd:long)
%}
function __sem_flags:string(semflg:long)
-%{
+%{ /* pure */
long semflg = THIS->semflg;
char *str = THIS->__retvalue;
@@ -420,7 +420,7 @@ function __sem_flags:string(semflg:long)
%}
function __fork_flags:string(flags:long)
-%{
+%{ /* pure */
long flags = THIS->flags;
char *str = THIS->__retvalue;
if (flags & CLONE_FS)
@@ -456,7 +456,7 @@ function __fork_flags:string(flags:long)
/* This function copies an argv from userspace. */
function __get_argv:string(a:long)
-%{
+%{ /* pure */
char __user *__user *argv = (char __user *__user *)(long)THIS->a;
char __user *vstr;
int space, rc, len = MAXSTRINGLEN;
@@ -518,7 +518,7 @@ function __get_argv:string(a:long)
* the string it points to. Should be rarely necessary.
*/
function __string:string (a:long)
-%{
+%{ /* pure */
char *str =(char *)(long)THIS->a;
strlcpy(THIS->__retvalue, str, MAXSTRINGLEN);
%}
diff --git a/tapset/context.stp b/tapset/context.stp
index a93b36b3..221c853b 100644
--- a/tapset/context.stp
+++ b/tapset/context.stp
@@ -18,7 +18,7 @@ function print_backtrace () %{
}
%}
-function backtrace:string () %{
+function backtrace:string () %{ /* pure */
if (CONTEXT->regs) {
/* XXX: this won't be necessary when runtime and translator */
/* agree on what a string is. */
@@ -29,47 +29,47 @@ function backtrace:string () %{
strlcpy (THIS->__retvalue, "", MAXSTRINGLEN);
%}
-function execname:string () %{
+function execname:string () %{ /* pure */
strlcpy (THIS->__retvalue, current->comm, MAXSTRINGLEN);
%}
-function pid:long () %{
+function pid:long () %{ /* pure */
THIS->__retvalue = current->tgid;
%}
-function tid:long () %{
+function tid:long () %{ /* pure */
THIS->__retvalue = current->pid;
%}
-function ppid:long () %{
+function ppid:long () %{ /* pure */
THIS->__retvalue = current->parent->tgid;
%}
-function pexecname:string () %{
+function pexecname:string () %{ /* pure */
strlcpy (THIS->__retvalue, current->parent->comm, MAXSTRINGLEN);
%}
-function gid:long () %{
+function gid:long () %{ /* pure */
THIS->__retvalue = current->gid;
%}
-function egid:long () %{
+function egid:long () %{ /* pure */
THIS->__retvalue = current->egid;
%}
-function uid:long () %{
+function uid:long () %{ /* pure */
THIS->__retvalue = current->uid;
%}
-function euid:long () %{
+function euid:long () %{ /* pure */
THIS->__retvalue = current->euid;
%}
-function cpuid:long () %{
+function cpuid:long () %{ /* pure */
THIS->__retvalue = current->thread_info->cpu;
%}
-function cpu:long () %{
+function cpu:long () %{ /* pure */
THIS->__retvalue = current->thread_info->cpu; /* smp_processor_id()? */
%}
@@ -84,11 +84,11 @@ function print_stack(stk:string) %{
}
%}
-function pp:string () %{
+function pp:string () %{ /* pure */
strlcpy (THIS->__retvalue, CONTEXT->probe_point, MAXSTRINGLEN);
%}
-function probefunc:string () %{
+function probefunc:string () %{ /* pure */
char *start = strstr(CONTEXT->probe_point, "function(\"");
if (start) {
char *ptr = start+10;
@@ -100,7 +100,7 @@ function probefunc:string () %{
}
%}
-function is_return:long () %{
+function is_return:long () %{ /* pure */
char *ptr = strrchr(CONTEXT->probe_point, '.');
if (ptr) {
if (strcmp(ptr+1,"return") == 0)
@@ -108,11 +108,11 @@ function is_return:long () %{
}
%}
-function target:long () %{
+function target:long () %{ /* pure */
THIS->__retvalue = _stp_target;
%}
-function returnval:long () %{
+function returnval:long () %{ /* pure */
if (CONTEXT->regs) {
#if defined (__i386__)
THIS->__retvalue = CONTEXT->regs->eax;
diff --git a/tapset/conversions.stp b/tapset/conversions.stp
index b05d7a8e..7a664a58 100644
--- a/tapset/conversions.stp
+++ b/tapset/conversions.stp
@@ -6,15 +6,15 @@
// Public License (GPL); either version 2, or (at your option) any
// later version.
-function hexstring:string (num:long) %{
+function hexstring:string (num:long) %{ /* pure */
snprintf (THIS->__retvalue, MAXSTRINGLEN, "0x%llx", (long long) THIS->num);
%}
-function string:string (num:long) %{
+function string:string (num:long) %{ /* pure */
snprintf (THIS->__retvalue, MAXSTRINGLEN, "%lld", (long long) THIS->num);
%}
-function kernel_string:string (addr:long) %{
+function kernel_string:string (addr:long) %{ /* pure */
char *destination = THIS->__retvalue;
deref_string (destination, THIS->addr, MAXSTRINGLEN);
goto success;
@@ -30,7 +30,7 @@ success: ;
# NB: accessing user space is hazardous from certain kernel contexts.
# Errors should be returned when this is detected.
-function user_string:string (addr:long) %{
+function user_string:string (addr:long) %{ /* pure */
long rc = _stp_strncpy_from_user (THIS->__retvalue,
(const char __user*) (uintptr_t) THIS->addr,
MAXSTRINGLEN);
diff --git a/tapset/endian.stp b/tapset/endian.stp
index ddcc2546..fc2c8937 100644
--- a/tapset/endian.stp
+++ b/tapset/endian.stp
@@ -2,30 +2,30 @@
# val: 0 - native (default)
# 1 - little endian
# 2 - big endian
-function set_endian:long (val:long) %{
+function set_endian:long (val:long) %{ /* pure */
_stp_endian = THIS->val;
%}
-function big_endian2:long (val:long) %{
+function big_endian2:long (val:long) %{ /* pure */
THIS->__retvalue = cpu_to_be16(THIS->val);
%}
-function big_endian4:long (val:long) %{
+function big_endian4:long (val:long) %{ /* pure */
THIS->__retvalue = cpu_to_be32(THIS->val);
%}
-function big_endian8:long (val:long) %{
+function big_endian8:long (val:long) %{ /* pure */
THIS->__retvalue = cpu_to_be64(THIS->val);
%}
-function little_endian2:long (val:long) %{
+function little_endian2:long (val:long) %{ /* pure */
THIS->__retvalue = cpu_to_le16(THIS->val);
%}
-function little_endian4:long (val:long) %{
+function little_endian4:long (val:long) %{ /* pure */
THIS->__retvalue = cpu_to_le32(THIS->val);
%}
-function little_endian8:long (val:long) %{
+function little_endian8:long (val:long) %{ /* pure */
THIS->__retvalue = cpu_to_le64(THIS->val);
%}
diff --git a/tapset/errno.stp b/tapset/errno.stp
index d3ab90e3..10c4532e 100644
--- a/tapset/errno.stp
+++ b/tapset/errno.stp
@@ -343,7 +343,7 @@ const char * const errlist[] = {
const int Maxerrno = sizeof(errlist)/sizeof(char *);
%}
-function errno_str:string (err:long) %{
+function errno_str:string (err:long) %{ /* pure */
long e = THIS->err;
if (e < 0 && e > -Maxerrno && errlist[-e])
strlcpy (THIS->__retvalue, errlist[-e], MAXSTRINGLEN);
@@ -352,7 +352,7 @@ function errno_str:string (err:long) %{
%}
/* for syscall tapset. set returnp = 1 for decimal, 2 for hex */
-function returnstr:string (returnp:long) %{
+function returnstr:string (returnp:long) %{ /* pure */
long ret;
if (CONTEXT->regs) {
diff --git a/tapset/return.stp b/tapset/return.stp
index 8f13e08a..98ff8a73 100644
--- a/tapset/return.stp
+++ b/tapset/return.stp
@@ -1,4 +1,4 @@
-function retval:long() %{
+function retval:long() %{ /* pure */
if (CONTEXT->regs) {
#if defined (__i386__)
THIS->__retvalue = CONTEXT->regs->eax;
diff --git a/tapset/string.stp b/tapset/string.stp
index 249ff831..19b8f81f 100644
--- a/tapset/string.stp
+++ b/tapset/string.stp
@@ -8,7 +8,7 @@
* @param s string
* @return Returns the length of the string.
*/
-function strlen:long(s:string) %{
+function strlen:long(s:string) %{ /* pure */
THIS->__retvalue=strlen(THIS->s);
%}
@@ -17,7 +17,7 @@ function strlen:long(s:string) %{
* @param str string
* @return Returns the length of the string.
*/
-function substr:string(str:string,start:long,stop:long) %{
+function substr:string(str:string,start:long,stop:long) %{ /* pure */
int len=strlen(THIS->str);
if(THIS->start<0 || THIS->stop<0 ||
THIS->start>len || THIS->stop>len ||
@@ -39,7 +39,7 @@ function substr:string(str:string,start:long,stop:long) %{
* @param s2 string
* @return Returns 1 if s2 is in s1.
*/
-function isinstr:long(s1:string,s2:string) %{
+function isinstr:long(s1:string,s2:string) %{ /* pure */
if(strstr(THIS->s1,THIS->s2)!=NULL)
THIS->__retvalue = 1;
else
diff --git a/tapset/timestamp.stp b/tapset/timestamp.stp
index ee9478cb..67e2e73a 100644
--- a/tapset/timestamp.stp
+++ b/tapset/timestamp.stp
@@ -13,28 +13,28 @@
// return processor cycle counter (if any)
-function get_cycles:long () %{
+function get_cycles:long () %{ /* pure */
cycles_t c = get_cycles();
THIS->__retvalue = (int64_t) c;
%}
// return in microseconds since epoch
-function gettimeofday_us:long () %{
+function gettimeofday_us:long () %{ /* pure */
struct timeval tm;
do_gettimeofday (& tm);
THIS->__retvalue = (tm.tv_sec * 1000000ULL) + (tm.tv_usec);
%}
// return in milliseconds since epoch
-function gettimeofday_ms:long () %{
+function gettimeofday_ms:long () %{ /* pure */
struct timeval tm;
do_gettimeofday (& tm);
THIS->__retvalue = (tm.tv_sec * 1000ULL) + (tm.tv_usec / 1000);
%}
// return in seconds since epoch
-function gettimeofday_s:long () %{
+function gettimeofday_s:long () %{ /* pure */
struct timeval tm;
do_gettimeofday (& tm);
THIS->__retvalue = tm.tv_sec;