From d0e3a964d8e437d81754afd2c962cb672b3af07e Mon Sep 17 00:00:00 2001 From: "gergely.erdelyi" Date: Fri, 13 Jun 2008 20:29:05 +0000 Subject: [PATCH] idautils.py: Added Chunk() to list function chunks. Thanks to Ero Carrera for the patch. --- python/idautils.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/python/idautils.py b/python/idautils.py index 7555aab..60cdd71 100644 --- a/python/idautils.py +++ b/python/idautils.py @@ -172,6 +172,28 @@ def Functions(start, end): return funclist +def Chunks(start): + """ + Get a list of function chunks + + @param start: address of the function + + @return: list of funcion chunks (tuples of the form (start_ea, end_ea)) + belonging to the function + """ + function_chunks = [] + + func_iter = idaapi.func_tail_iterator_t( idaapi.get_func( start ) ) + status = func_iter.main() + + while status: + chunk = func_iter.chunk() + function_chunks.append((chunk.startEA, chunk.endEA)) + status = func_iter.next() + + return function_chunks + + def Segments(): """ Get list of segments (sections) in the binary image