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
29 """
30 This class is an information container for functions.
31 """
32
34 self.function_name = ""
35 self.has_dummy_name = False
36 self.function_address = 0
37 self.number_of_basic_blocks = 0
38 self.number_of_instructions = 0
39 self.number_of_xrefs_from = 0
40 self.number_of_xrefs_to = 0
41 self.call_contexts = []
42
44 """
45 Convenience function.
46 @return: a nice string representation for this object
47 """
48 return "0x%x %s [%d ins, %d blocks, %d calls, xrefs in/out: %d/%d]" % (self.function_address, \
49 self.function_name, self.number_of_instructions, self.number_of_basic_blocks, len(self.call_contexts), \
50 self.number_of_xrefs_to, self.number_of_xrefs_from)
51
53 """
54 Helper function, returning information about semantic tags in this function.
55 """
56 tagged_addresses = {}
57 for call_ctx in self.call_contexts:
58 if call_ctx.tag != "":
59 tagged_addresses[call_ctx.address_of_call] = call_ctx.tag
60 return tagged_addresses
61