Package IDAscope :: Package idascope :: Package core :: Package structures :: Module FunctionContext
[hide private]
[frames] | no frames]

Source Code for Module IDAscope.idascope.core.structures.FunctionContext

 1  #!/usr/bin/python 
 2  ######################################################################## 
 3  # Copyright (c) 2012 
 4  # Daniel Plohmann <daniel.plohmann<at>gmail<dot>com> 
 5  # Alexander Hanel <alexander.hanel<at>gmail<dot>com> 
 6  # All rights reserved. 
 7  ######################################################################## 
 8  # 
 9  #  This file is part of IDAscope 
10  # 
11  #  IDAscope is free software: you can redistribute it and/or modify it 
12  #  under the terms of the GNU General Public License as published by 
13  #  the Free Software Foundation, either version 3 of the License, or 
14  #  (at your option) any later version. 
15  # 
16  #  This program is distributed in the hope that it will be useful, but 
17  #  WITHOUT ANY WARRANTY; without even the implied warranty of 
18  #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
19  #  General Public License for more details. 
20  # 
21  #  You should have received a copy of the GNU General Public License 
22  #  along with this program.  If not, see 
23  #  <http://www.gnu.org/licenses/>. 
24  # 
25  ######################################################################## 
26   
27   
28 -class FunctionContext():
29 """ 30 This class is an information container for functions. 31 """ 32
33 - def __init__(self):
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
43 - def __str__(self):
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