winIDEA SDK
Loading...
Searching...
No Matches
test_get_source_location.py
# This script is licensed under BSD License, see file LICENSE.txt, or search for `License` in the SDK online help.
# (c) TASKING Germany GmbH, 2023
import isystem.connect as ic
winidea_id = ''
def test_getSourceLocation():
connMgr = ic.ConnectionMgr()
connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
addCtrl = ic.CAddressController(connMgr)
search_criteria = ic.CLineDescription(ic.CLineDescription.E_RESOURCE_FUNCTION,
"main",
0, # start at the beginning of a function
True, # perform search
0, # no limit
ic.CLineDescription.E_SEARCH_CODE,
ic.CLineDescription.E_MATCH_PLAIN,
"SoCInit", # search pattern
0) # lineOffset
line_location = addCtrl.getSourceLocation(search_criteria)
msg = f"Location of function call SoCInit(): "
msg += f"{line_location.getFileName()}::{line_location.getLineNumber()}'"
print(msg)
if __name__ == "__main__":
test_getSourceLocation()