blob: 6fb59f2c23a20b78d21c1e40e12ad1992fc5259c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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)
}
|