赛灵思系统调试器命令行接口 (XSDB) 可用于调试已在目标上运行的程序(例如,从闪存启动)。连接到目标,并为目标上运行的程序设置符号文件。此方法也可用于调试从闪存启动的 Linux 内核。为了达成最佳结果,目标上运行的代码应使用调试信息进行编译。
以下是调试已在目标上运行的程序的示例。为便于演示,在此示例会话前,程序已停止于 main()
。
# Connect to the hw_server
xsdb% conn -url TCP:xhdbfarmc7:3121
tcfchan#0
xsdb% Info: Arm Cortex-A9 MPCore #0 (target 2) Stopped at 0x1005a4 (Hardware Breakpoint)
xsdb% Info: Arm Cortex-A9 MPCore #1 (target 3) Stopped at 0xfffffe18 (Suspended)
# Select the target on which the program is running and specify the symbol file using the
# memmap command
xsdb% targets 2
xsdb% memmap -file dhrystone/Debug/dhrystone.elf
# When the symbol file is specified, the debugger maps the code on the target to the symbol
# file. bt command can be used to see the back trace. Further debug is possible, as shown in
# the first example
xsdb% bt
0 0x1005a4 main(): ../src/dhry_1.c, line 79
1 0x1022d8 _start()+88
2 unknown-pc