diff options
author | David Smith <dsmith@redhat.com> | 2009-04-17 09:26:08 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-04-17 09:26:08 -0500 |
commit | ee0dfa16f900396f4fd89d4d765e877daa8a2c19 (patch) | |
tree | ca88b3e711cb235554c77d204d44cb7b529e3710 /tapset/utrace.stp | |
parent | 7843fe51d664fc94d8808b3e4c4a6bccb0c481c3 (diff) | |
download | systemtap-steved-ee0dfa16f900396f4fd89d4d765e877daa8a2c19.tar.gz systemtap-steved-ee0dfa16f900396f4fd89d4d765e877daa8a2c19.tar.xz systemtap-steved-ee0dfa16f900396f4fd89d4d765e877daa8a2c19.zip |
Avoid sign extension in syscall return values.
2009-04-17 David Smith <dsmith@redhat.com>
* tapset/utrace.stp: Cast the return value of
syscall_get_return_value() to an unsigned long to avoid sign
extension.
Diffstat (limited to 'tapset/utrace.stp')
-rw-r--r-- | tapset/utrace.stp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/tapset/utrace.stp b/tapset/utrace.stp index 00f427e6..0d26ed5f 100644 --- a/tapset/utrace.stp +++ b/tapset/utrace.stp @@ -1,20 +1,26 @@ /* utrace-only subset of register accessors */ - %{ #include "syscall.h" %} -function _utrace_syscall_nr:long () %{ - THIS->__retvalue = syscall_get_nr(current, CONTEXT->regs); /* pure */ +function _utrace_syscall_nr:long () %{ /* pure */ + THIS->__retvalue = syscall_get_nr(current, CONTEXT->regs); %} -function _utrace_syscall_arg:long (n:long) %{ - unsigned long arg = 0; /* pure */ - syscall_get_arguments(current, CONTEXT->regs, (int)THIS->n, 1, &arg); - THIS->__retvalue = arg; +function _utrace_syscall_arg:long (n:long) %{ /* pure */ + unsigned long arg = 0; + syscall_get_arguments(current, CONTEXT->regs, (int)THIS->n, 1, &arg); + THIS->__retvalue = arg; %} -function _utrace_syscall_return:long () %{ - THIS->__retvalue = syscall_get_return_value(current, CONTEXT->regs); /* pure */ +function _utrace_syscall_return:long () %{ /* pure */ + /* + * Here's the reason for the "unsigned long" cast. Since all + * values inside systemtap are 64-bit numbers, return values were + * getting sign extended. This caused return values to not match + * up with the same values passes as arguments. + */ + THIS->__retvalue = (unsigned long)syscall_get_return_value(current, + CONTEXT->regs); %} |