把riscv32-unknown-elf-gdb.exe升级为9.1的版本后:
用Cortex-Debug1.10.0,能进入Debug模式,但是单步调试时,程序执行异常(有时会往前或往后走多步)。log显示“riscv32-unknown-elf--nm.exe ENOENT”的问题依然存在。
Launch.json:
“
{
"version": "0.2.0",
"configurations": [
{
"cwd": "${workspaceRoot}",
"executable": "build\Debug\test2.elf",
"name": "cortex",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"configFiles": [
"./tools/jtag/im100-builtin.cfg"
],
"searchDir": [],
"runToEntryPoint": "main",
"showDevDebugOutput": "raw",
"toolchainPrefix": "riscv32-unknown-elf-",
"svdFile": "${workspaceFolder}/STM32F412.svd",
}
]
}
”
Log:
“
Cortex-Debug: VSCode debugger extension version 1.10.0 git(cf1c296). Usage info: https://github.com/Marus/cortex-debug#usage
Reading symbols from c:/Users/xxx/AppData/Local/LocalPackage/toolchain/riscv32-unknown-elf--objdump.exe --syms -C -h -w D:/ide/eideExt/test2/build/Debug/test2.elf
Reading symbols from c:/users/xxx/appdata/local/localpackage/toolchain/riscv32-unknown-elf--nm.exe --defined-only -S -l -C -p D:/ide/eideExt/test2/build/Debug/test2.elf
Launching GDB: "c:\Users\xxx\AppData\Local\LocalPackage\toolchain\bin\riscv32-unknown-elf-gdb.exe" -q --interpreter=mi2
1-gdb-version
Error: c:/users/xxx/appdata/local/localpackage/toolchain/riscv32-unknown-elf--nm.exe failed! statics/global/functions may not be properly classified: Error: spawn c:/users/xxx/appdata/local/localpackage/toolchain/riscv32-unknown-elf--nm.exe ENOENT
Expecting nm
next to objdump
. If that is not the problem please report this.
Error: objdump failed! statics/globals/functions may not be properly classified: Error: spawn c:/Users/xxx/AppData/Local/LocalPackage/toolchain/riscv32-unknown-elf--objdump.exe ENOENT ENOENT means program not found. If that is not the issue, please report this problem.Launching gdb-server: openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "D:\ide\eideExt\test2" -f "c:/Users/xxx/.vscode/extensions/marus25.cortex-debug-1.10.0/support/openocd-helpers.tcl" -f ./tools/jtag/im100-builtin.cfg
Please check TERMINAL tab (gdb-server) for output from openocd.exe
Finished reading symbols from objdump: Time: 37 ms
Finished reading symbols from nm: Time: 35 ms
c:\Users\xxx\AppData\Local\LocalPackage\toolchain\bin\riscv32-unknown-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.
-> =thread-group-added,id="i1"
-> ~"GNU gdb (PULP) 9.1\n"
-> ~"Copyright (C) 2020 Free Software Foundation, Inc.\n"
-> ~"License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law."
-> ~"\nType \"show copying\" and \"show warranty\" for details.\n"
-> ~"This GDB was configured as \"--host=x86_64-w64-mingw32 --target=riscv32-unknown-elf\".\n"
-> ~"Type \"show configuration\" for configuration details.\n"
-> ~"For bug reporting instructions, please see:\n"
-> ~"http://www.gnu.org/software/gdb/bugs/.\n"
-> ~"Find the GDB manual and other documentation resources online at:\n http://www.gnu.org/software/gdb/documentation/."
-> ~"\n\n"
-> ~"For help, type \"help\".\n"
-> ~"Type \"apropos word\" to search for commands related to \"word\".\n"
-> 1done
2-gdb-set mi-async on
-> 2done
3-interpreter-exec console "set print demangle on"
-> 3done
4-interpreter-exec console "set print asm-demangle on"
-> =cmd-param-changed,param="print asm-demangle",value="on"
-> 4done
5-enable-pretty-printing
-> 5done
6-interpreter-exec console "source c:/Users/xxx/.vscode/extensions/marus25.cortex-debug-1.10.0/support/gdbsupport.init"
-> 6done
7-interpreter-exec console "source c:/Users/xxx/.vscode/extensions/marus25.cortex-debug-1.10.0/support/gdb-swo.init"
-> =cmd-param-changed,param="language",value="c"
-> =cmd-param-changed,param="language",value="auto"
-> 7done
8-file-exec-and-symbols "D:/ide/eideExt/test2/build/Debug/test2.elf"
-> 8done
9-target-select extended-remote localhost:50000
-> =thread-group-started,id="i1",pid="42000"
-> =thread-created,id="1",group-id="i1"
-> ~"0x0b0b6150 in ?? ()\n"
0x0b0b6150 in ?? ()
-> *stopped,frame={addr="0x0b0b6150",func="??",args=[],arch="riscv:rv32"},thread-id="1",stopped-threads="all"
mi2.status = stopped
Program stopped, probably due to a reset and/or halt issued by debugger
-> 9connected
10-interpreter-exec console "monitor reset halt"
-> @"JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)\n"
JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)
-> @"JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)\n"
JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
-> 10done
11-target-download
-> 11+download,{section=".data_tiny_fc",section-size="940",total-size="418306"}
-> 11+download,{section=".data_tiny_fc",section-sent="940",section-size="940",total-sent="940",total-size="418306"}
-> 11+download,{section=".init_array",section-size="40",total-size="418306"}
-> 11+download,{section=".fini_array",section-size="12",total-size="418306"}
-> 11+download,{section=".rodata",section-size="372",total-size="418306"}
-> 11+download,{section=".data",section-size="236",total-size="418306"}
-> 11+download,{section=".vectors",section-size="160",total-size="418306"}
-> 11+download,{section=".text",section-size="24420",total-size="418306"}
-> 11+download,{section=".text",section-sent="24420",section-size="24420",total-sent="26180",total-size="418306"}
-> 11+download,{section=".l2_data",section-size="360",total-size="418306"}
-> 11+download,{section=".l2_data",section-sent="360",section-size="360",total-sent="26540",total-size="418306"}
-> 11+download,{section=".data_tiny_l1",section-size="16",total-size="418306"}
-> 11done,address="0x1c008880",load-size="26556",transfer-rate="104392",write-rate="2655"
12-interpreter-exec console "monitor reset halt"
-> @"JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)\n"
JTAG tap: riscv.unknown0 tap/device found: 0x10102001 (mfg: 0x000 (<invalid>), part: 0x0102, ver: 0x1)
-> @"JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)\n"
JTAG tap: riscv.cpu tap/device found: 0x249511c3 (mfg: 0x0e1 (Wintec Industries), part: 0x4951, ver: 0x2)
-> 12done
13-break-insert "d:\ide\eideExt\test2\hello\hello.c:24"
-> 13done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x1c00e72e",func="main",file="./hello/hello.c",fullname="d:\ide\eideExt\test2\hello\hello.c",line="24",thread-groups=["i1"],times="0",original-location="d:\ide\eideExt\test2\hello\hello.c:24"}
Returning dummy thread-id to workaround VSCode issue with pause button not working
Returning dummy thread-id to workaround VSCode issue with pause button not working
14-data-read-memory-bytes "0x40012000" 80
Returning dummy stack frame to workaround VSCode issue with pause button not working: {"threadId":1,"startFrame":0,"levels":20}
-> 14done,memory=[{begin="0x40012000",offset="0x00000000",end="0x40012050",contents="e5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdabae5ccdaba"}]
15-data-list-register-names
-> 15done,register-names=["zero","ra","sp","gp","tp","t0","t1","t2","fp","s1","a0","a1","a2","a3","a4","a5","a6","a7","s2","s3","s4","s5","s6","s7","s8","s9","s10","s11","t3","t4","t5",...
...
”
Screen:
看起来和编译有关系。
我的Build配置:
Global Options:
C/C++ Compiler:
Assembler:
Linker: