Commit | Line | Data |
---|---|---|
a50481e7 | 1 | #!/usr/bin/env python3 |
9926ec7f | 2 | from ctftestsuite.stress import MetadataTest |
a50481e7 | 3 | |
a50481e7 | 4 | |
9926ec7f PP |
5 | class Test(MetadataTest): |
6 | what = '{size} callsites' | |
a50481e7 | 7 | |
9926ec7f PP |
8 | def write_metadata(self, f): |
9 | p1 = \ | |
10 | '''/* CTF 1.8 */ | |
a50481e7 | 11 | |
9926ec7f PP |
12 | typealias integer { size = 8; align = 8; signed = false; base = 10; } := uint8_t; |
13 | typealias integer { size = 32; align = 8; signed = false; base = hex; } := uint32_t; | |
a50481e7 | 14 | |
9926ec7f PP |
15 | trace { |
16 | major = 0; | |
17 | minor = 0; | |
18 | uuid = "2a6422d0-6cee-11e0-8c08-cb07d7b3a564"; | |
19 | byte_order = le; | |
20 | packet.header := struct { | |
21 | uint32_t magic; | |
22 | uint8_t uuid[16]; | |
23 | }; | |
24 | }; | |
a50481e7 | 25 | |
9926ec7f PP |
26 | event { |
27 | name = myevent; | |
28 | }; | |
a50481e7 | 29 | |
9926ec7f | 30 | ''' |
a50481e7 | 31 | |
9926ec7f PP |
32 | callsite_fmt = \ |
33 | '''callsite {{ | |
34 | name = "myevent"; | |
35 | func = "myfunc{i}"; | |
36 | file = "myfile{i}"; | |
37 | line = {i}; | |
38 | ip = 0x{i}; | |
39 | }}; | |
a50481e7 | 40 | |
9926ec7f | 41 | ''' |
a50481e7 | 42 | |
9926ec7f | 43 | f.write(p1) |
a50481e7 | 44 | |
9926ec7f PP |
45 | for i in range(self.size): |
46 | callsite = callsite_fmt.format(i=i) | |
47 | f.write(callsite) | |
a50481e7 | 48 | |
a50481e7 | 49 | |
9926ec7f PP |
50 | if __name__ == '__main__': |
51 | test = Test() | |
52 | test.main() |