summaryrefslogtreecommitdiffstats
path: root/testsuite/systemtap.maps/ii.stp
blob: a83ae8ce078020f4dbc40cd3b758d0f7e8098327 (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
46
47
48
49
50
51
52
53
54
55
56
57
58
#test of int maps containing ints

global foo

probe begin {
	for (i=0;i<11;i++)
		foo[i] = i*i 	

	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	# delete out of the middle
	foo[5] = 0
	printf("\n")
	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	# delete first entry
	foo[1] = 0
	# and last entry
	foo[10] = 0
	printf("\n")
	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	# change a couple
	foo[9] = -81
	foo[4] = -foo[4]
	foo[3] *= 100
	printf("\n")
	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	# delete one
	foo[4] = 0
	printf("\n")
	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	# delete all
	for (i=0;i<11;i++)
		foo[i] = 0 	
	printf("\n")
	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	# load it again
	for (i=0;i<11;i++)
		foo[i] = i*i 	
	for (i=0;i<11;i++)
		foo[i] += foo[i-1]
	printf("\n")
	foreach (i in foo)
	 	printf("foo[%d] = %d\n", i, foo[i])

	exit()
}