mirror of
https://github.com/idapython/src
synced 2026-06-08 14:47:00 +00:00
42 lines
998 B
Python
42 lines
998 B
Python
from __future__ import print_function
|
|
#
|
|
# Reference Lister
|
|
#
|
|
# List all functions and all references to them in the current section.
|
|
#
|
|
# Implemented using direct IDA Plugin API calls
|
|
#
|
|
from idaapi import *
|
|
|
|
def main():
|
|
# Get current ea
|
|
ea = get_screen_ea()
|
|
|
|
# Get segment class
|
|
seg = getseg(ea)
|
|
|
|
# Loop from segment start to end
|
|
func_ea = seg.startEA
|
|
|
|
# Get a function at the start of the segment (if any)
|
|
func = get_func(func_ea)
|
|
if func is None:
|
|
# No function there, try to get the next one
|
|
func = get_next_func(func_ea)
|
|
|
|
seg_end = seg.end_ea
|
|
while func is not None and func.start_ea < seg_end:
|
|
funcea = func.start_ea
|
|
print("Function %s at 0x%x" % (get_func_name(funcea), funcea))
|
|
|
|
ref = get_first_cref_to(funcea)
|
|
|
|
while ref != BADADDR:
|
|
print(" called from %s(0x%x)" % (get_func_name(ref), ref))
|
|
ref = get_next_cref_to(funcea, ref)
|
|
|
|
func = get_next_func(funcea)
|
|
|
|
|
|
main()
|