diff options
Diffstat (limited to 'testsuite/systemtap.base')
-rw-r--r-- | testsuite/systemtap.base/deref.exp | 10 | ||||
-rw-r--r-- | testsuite/systemtap.base/deref.stp | 45 |
2 files changed, 55 insertions, 0 deletions
diff --git a/testsuite/systemtap.base/deref.exp b/testsuite/systemtap.base/deref.exp new file mode 100644 index 00000000..0a44bfac --- /dev/null +++ b/testsuite/systemtap.base/deref.exp @@ -0,0 +1,10 @@ +# Check that the deref mechanisms work correctly. + +load_lib "stap_run.exp" + +set test "deref" + +# PR 3079: deref macro cannot read 64-bit values on 32-bit x86 +setup_kfail i?86-*-* 3079 + +stap_run $srcdir/$subdir/$test.stp no_load $all_pass_string -g diff --git a/testsuite/systemtap.base/deref.stp b/testsuite/systemtap.base/deref.stp new file mode 100644 index 00000000..6fb59f2c --- /dev/null +++ b/testsuite/systemtap.base/deref.stp @@ -0,0 +1,45 @@ +/* + * deref.stp + * + * Check that the deref mechanisms work correctly. + */ + +probe begin { log("systemtap starting probe") } +probe end { log("systemtap ending probe") } + + +function call_deref:long(val:long) %{ + if ((uint64_t)THIS->val < 0x100ULL) { + uint8_t local8 = (uint8_t)THIS->val; + THIS->__retvalue = (uint8_t)deref(sizeof(local8), &local8); + } else if ((uint64_t)THIS->val < 0x10000ULL) { + uint16_t local16 = (uint16_t)THIS->val; + THIS->__retvalue = (uint16_t)deref(sizeof(local16), &local16); + } else if ((uint64_t)THIS->val < 0x100000000ULL) { + uint32_t local32 = (uint32_t)THIS->val; + THIS->__retvalue = (uint32_t)deref(sizeof(local32), &local32); + } else { + uint64_t local64 = (uint64_t)THIS->val; + THIS->__retvalue = (uint64_t)deref(sizeof(local64), &local64); + } + if (0) { +deref_fault: + CONTEXT->last_error = "pointer dereference error"; + } +%} + +function check_deref(val) { + deref = call_deref(val) + if (deref == val) + log("systemtap test success") + else + printf("systemtap test failure - %#x != %#x\n", deref, val) +} + +probe end(1) { + check_deref(0xDEADBEEFBAADF00D) + check_deref(0xDEADBEEF) + check_deref(0xBEEF) + check_deref(0x42) +} + |