summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--testsuite/ChangeLog6
-rw-r--r--testsuite/systemtap.base/deref.exp10
-rw-r--r--testsuite/systemtap.base/deref.stp45
3 files changed, 61 insertions, 0 deletions
diff --git a/testsuite/ChangeLog b/testsuite/ChangeLog
index c047a26d..ed8ba350 100644
--- a/testsuite/ChangeLog
+++ b/testsuite/ChangeLog
@@ -1,3 +1,9 @@
+2006-12-18 Josh Stone <joshua.i.stone@intel.com>
+
+ * systemtap.base/deref.exp, systemtap.base/deref.exp: Add a test for
+ successfully dereferencing pointers of various sizes. This is known to
+ fail on x86 for 64-bit values -- PR 3079.
+
2006-12-18 David Smith <dsmith@redhat.com>
* systemtap.samples/pfaults.stp: Since PR 1132 has been fixed,
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)
+}
+