winIDEA SDK
test_set_bp.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2# (c) TASKING Germany GmbH, 2023
3#
4# This Python script sets breakpoints by different methods:
5# directly by symbol name, by file name and line number,
6# and by specific memory address. Additionally, it sets a conditional
7# breakpoint based on a variable value within the function context.
8
9import isystem.connect as ic
10
11
12winidea_id = ''
13
14
15def test_setBP():
16 connMgr = ic.ConnectionMgr()
17 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
18
19 bpCtrl = ic.CBreakpointController(connMgr)
20 bpCtrl.setBP("main")
21 print("BP at function 'main' is set (via symbol name).")
22
23 bpCtrl.setBP(14, "src/main.cpp")
24 print("BP at 'main_loop_counter' is set (via file name and line number).")
25
26 # for STM32 use:
27 bpCtrl.setBP(0, 0x08001F98)
28 # for TC399 use:
29 # bpCtrl.setBP(0, 0xA0080ED8)
30 print("BP at function 'main' is set (via memory area and address).")
31
32 bpCtrl.setBP("get_random", 0, "main_loop_counter==42")
33 print("BP with condition at function 'get_random' is set.")
34
35
36if __name__ == "__main__":
37 test_setBP()