Visual studio code vscode Cortex调试发生stm32l0异常

Visual studio code vscode Cortex调试发生stm32l0异常,visual-studio-code,cortex-m,Visual Studio Code,Cortex M,我想使用VSCode Cortex Debug来调试stm32l071项目。 首先,我用STM32cubeMX构建了一个简单的项目。 我发现异常发生在调试的第一行(重置处理程序)。 如果偏移起始地址,程序似乎会崩溃 我通过在system_stm32l0xx.c中修改ld文件的FLASH原点和VECT_TAB_偏移量来偏移程序的起始地址,似乎程序计数器在第一行之后变得奇怪,无法运行到main。但是如果我尝试使用OpenOCD和gdb命令行,程序可以运行到main并且工作良好。另外,如果我不偏移地址

我想使用VSCode Cortex Debug来调试stm32l071项目。 首先,我用STM32cubeMX构建了一个简单的项目。 我发现异常发生在调试的第一行(重置处理程序)。 如果偏移起始地址,程序似乎会崩溃

我通过在system_stm32l0xx.c中修改ld文件的FLASH原点和VECT_TAB_偏移量来偏移程序的起始地址,似乎程序计数器在第一行之后变得奇怪,无法运行到main。但是如果我尝试使用OpenOCD和gdb命令行,程序可以运行到main并且工作良好。另外,如果我不偏移地址,在异常后程序仍然可以正常工作

我的launch.json如下

{
    "showDevDebugOutput": true,
    "cwd": "D:\\Tools\\openocd",
    "executable": "${workspaceRoot}/Debug/2460P_testST.elf",
    "name": "Debug STM32",
    "request": "launch",
    "type": "cortex-debug",
    "servertype": "openocd",
    "device": "STM32L071CB",
    "configFiles": [
        "interface/stlink.cfg",
        "target/stm32l0.cfg"
    ]
}
Reading symbols from 'C:\Users\Daniel2.chen\STM32CubeIDE\workspace_1.6.1\2460P_testST/Debug/2460P_testST.elf'
Finished reading symbols
Please check OUTPUT tab (Adapter Output) for output from openocd.exe
Launching server: "openocd.exe" "-c" "gdb_port 50000" "-s" "D:\Tools\openocd" "-f" "interface/stlink.cfg" "-f" "target/stm32l0.cfg"
Launching GDB: "arm-none-eabi-gdb.exe" "-q" "--interpreter=mi2"
1-gdb-set target-async on
2-interpreter-exec console "source c:/Users/Daniel2.chen/.vscode/extensions/marus25.cortex-debug-0.3.12/support/gdbsupport.init"
3-target-select extended-remote localhost:50000
4-interpreter-exec console "monitor reset halt"
5-target-download
6-interpreter-exec console "monitor reset halt"
7-enable-pretty-printing
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-added","output":[["id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reading symbols from C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST/Debug/2460P_testST.elf...\n"}]}
Reading symbols from C:\Users\Daniel2.chen\STM32CubeIDE\workspace_1.6.1\2460P_testST/Debug/2460P_testST.elf...
GDB -> App: {"token":1,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":2,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-started","output":[["id","i1"],["pid","42000"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-created","output":[["id","1"],["group-id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reset_Handler () at ../Core/Startup/startup_stm32l071cbtx.s:52\n"}]}
Reset_Handler () at ../Core/Startup/startup_stm32l071cbtx.s:52
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"52\t   ldr   r0, =_estack\n"}]}
52     ldr   r0, =_estack
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["frame",[["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["thread-id","1"],["stopped-threads","all"]]}]}
Not implemented stop reason (assuming exception): undefined
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"connected","results":[]}}
8-thread-list-ids
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000\n"}]}
xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000
GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
9-thread-list-ids
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["address","0x08000fc4"],["load-size","26596"],["transfer-rate","34384"],["write-rate","3324"]]}}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000\n"}]}
xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000
GDB -> App: {"token":6,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":7,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
10-break-insert "c:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Src\\main.c:97"
GDB -> App: {"token":8,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
GDB -> App: {"token":9,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
11-thread-info 1
12-thread-info 1
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Note: automatically using hardware breakpoints for read-only addresses.\n"}]}
Note: automatically using hardware breakpoints for read-only addresses.
GDB -> App: {"token":10,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","1"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x08000502"],["func","main"],["file","../Core/Src/main.c"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Src\\main.c"],["line","97"],["thread-groups",["i1"]],["times","0"],["original-location","c:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Src\\main.c:97"]]]]}}
GDB -> App: {"token":11,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
GDB -> App: {"token":12,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
13-stack-info-depth --thread 1 10000
GDB -> App: {"token":13,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
14-stack-list-frames --thread 1 0 0
GDB -> App: {"token":14,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
15-stack-info-depth --thread 1 10000
16-thread-list-ids
17-data-list-register-names
GDB -> App: {"token":15,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
18-stack-list-frames --thread 1 0 0
GDB -> App: {"token":16,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
19-thread-info 1
GDB -> App: {"token":17,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["register-names",["r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12","sp","lr","pc","","","","","","","","","","xPSR","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","msp","psp","primask","basepri","faultmask","control"]]]}}
GDB -> App: {"token":18,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
GDB -> App: {"token":19,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
20-data-list-register-values N
GDB -> App: {"token":20,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["register-values",[[["number","0"],["value","-1"]],[["number","1"],["value","-1"]],[["number","2"],["value","-1"]],[["number","3"],["value","-1"]],[["number","4"],["value","-1"]],[["number","5"],["value","-1"]],[["number","6"],["value","-1"]],[["number","7"],["value","-1"]],[["number","8"],["value","-1"]],[["number","9"],["value","-1"]],[["number","10"],["value","-1"]],[["number","11"],["value","-1"]],[["number","12"],["value","-1"]],[["number","13"],["value","0x20005000"]],[["number","14"],["value","-1"]],[["number","15"],["value","0x8000fc4 <Reset_Handler>"]],[["number","25"],["value","-251658240"]],[["number","91"],["value","0x20005000"]],[["number","92"],["value","0xfffffffc"]],[["number","93"],["value","0"]],[["number","94"],["value","0"]],[["number","95"],["value","0"]],[["number","96"],["value","0"]]]]]}}
21-stack-info-depth --thread 1 10000
GDB -> App: {"token":21,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
22-stack-list-frames --thread 1 0 0
23-thread-list-ids
GDB -> App: {"token":22,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
GDB -> App: {"token":23,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
24-thread-info 1
GDB -> App: {"token":24,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
25-stack-info-depth --thread 1 10000
GDB -> App: {"token":25,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
26-stack-list-frames --thread 1 0 0
GDB -> App: {"token":26,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
27-stack-list-variables --thread 1 --frame 0 --simple-values
GDB -> App: {"token":27,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["variables",[]]]}}
以下是我的开发环境
PC:Windows 10
OpenOCD:0.11
VSCode:1.55.2
Cortex调试:0.3.12
ST Link v2

也许调试控制台可以提供帮助,发布如下

{
    "showDevDebugOutput": true,
    "cwd": "D:\\Tools\\openocd",
    "executable": "${workspaceRoot}/Debug/2460P_testST.elf",
    "name": "Debug STM32",
    "request": "launch",
    "type": "cortex-debug",
    "servertype": "openocd",
    "device": "STM32L071CB",
    "configFiles": [
        "interface/stlink.cfg",
        "target/stm32l0.cfg"
    ]
}
Reading symbols from 'C:\Users\Daniel2.chen\STM32CubeIDE\workspace_1.6.1\2460P_testST/Debug/2460P_testST.elf'
Finished reading symbols
Please check OUTPUT tab (Adapter Output) for output from openocd.exe
Launching server: "openocd.exe" "-c" "gdb_port 50000" "-s" "D:\Tools\openocd" "-f" "interface/stlink.cfg" "-f" "target/stm32l0.cfg"
Launching GDB: "arm-none-eabi-gdb.exe" "-q" "--interpreter=mi2"
1-gdb-set target-async on
2-interpreter-exec console "source c:/Users/Daniel2.chen/.vscode/extensions/marus25.cortex-debug-0.3.12/support/gdbsupport.init"
3-target-select extended-remote localhost:50000
4-interpreter-exec console "monitor reset halt"
5-target-download
6-interpreter-exec console "monitor reset halt"
7-enable-pretty-printing
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-added","output":[["id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reading symbols from C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST/Debug/2460P_testST.elf...\n"}]}
Reading symbols from C:\Users\Daniel2.chen\STM32CubeIDE\workspace_1.6.1\2460P_testST/Debug/2460P_testST.elf...
GDB -> App: {"token":1,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":2,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-started","output":[["id","i1"],["pid","42000"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-created","output":[["id","1"],["group-id","i1"]]}]}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Reset_Handler () at ../Core/Startup/startup_stm32l071cbtx.s:52\n"}]}
Reset_Handler () at ../Core/Startup/startup_stm32l071cbtx.s:52
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"52\t   ldr   r0, =_estack\n"}]}
52     ldr   r0, =_estack
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["frame",[["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["thread-id","1"],["stopped-threads","all"]]}]}
Not implemented stop reason (assuming exception): undefined
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"connected","results":[]}}
8-thread-list-ids
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000\n"}]}
xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000
GDB -> App: {"token":4,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
9-thread-list-ids
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[{"isStream":false,"type":"status","asyncClass":"download","output":[]}]}
GDB -> App: {"token":5,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["address","0x08000fc4"],["load-size","26596"],["transfer-rate","34384"],["write-rate","3324"]]}}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"Unable to match requested speed 300 kHz, using 240 kHz\n"}]}
Unable to match requested speed 300 kHz, using 240 kHz
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"target halted due to debug-request, current mode: Thread \n"}]}
target halted due to debug-request, current mode: Thread
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"target","content":"xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000\n"}]}
xPSR: 0xf1000000 pc: 0x08000fc4 msp: 0x20005000
GDB -> App: {"token":6,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":7,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
10-break-insert "c:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Src\\main.c:97"
GDB -> App: {"token":8,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
GDB -> App: {"token":9,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
11-thread-info 1
12-thread-info 1
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"Note: automatically using hardware breakpoints for read-only addresses.\n"}]}
Note: automatically using hardware breakpoints for read-only addresses.
GDB -> App: {"token":10,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["bkpt",[["number","1"],["type","breakpoint"],["disp","keep"],["enabled","y"],["addr","0x08000502"],["func","main"],["file","../Core/Src/main.c"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Src\\main.c"],["line","97"],["thread-groups",["i1"]],["times","0"],["original-location","c:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Src\\main.c:97"]]]]}}
GDB -> App: {"token":11,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
GDB -> App: {"token":12,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
13-stack-info-depth --thread 1 10000
GDB -> App: {"token":13,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
14-stack-list-frames --thread 1 0 0
GDB -> App: {"token":14,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
15-stack-info-depth --thread 1 10000
16-thread-list-ids
17-data-list-register-names
GDB -> App: {"token":15,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
18-stack-list-frames --thread 1 0 0
GDB -> App: {"token":16,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
19-thread-info 1
GDB -> App: {"token":17,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["register-names",["r0","r1","r2","r3","r4","r5","r6","r7","r8","r9","r10","r11","r12","sp","lr","pc","","","","","","","","","","xPSR","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","msp","psp","primask","basepri","faultmask","control"]]]}}
GDB -> App: {"token":18,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
GDB -> App: {"token":19,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
20-data-list-register-values N
GDB -> App: {"token":20,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["register-values",[[["number","0"],["value","-1"]],[["number","1"],["value","-1"]],[["number","2"],["value","-1"]],[["number","3"],["value","-1"]],[["number","4"],["value","-1"]],[["number","5"],["value","-1"]],[["number","6"],["value","-1"]],[["number","7"],["value","-1"]],[["number","8"],["value","-1"]],[["number","9"],["value","-1"]],[["number","10"],["value","-1"]],[["number","11"],["value","-1"]],[["number","12"],["value","-1"]],[["number","13"],["value","0x20005000"]],[["number","14"],["value","-1"]],[["number","15"],["value","0x8000fc4 <Reset_Handler>"]],[["number","25"],["value","-251658240"]],[["number","91"],["value","0x20005000"]],[["number","92"],["value","0xfffffffc"]],[["number","93"],["value","0"]],[["number","94"],["value","0"]],[["number","95"],["value","0"]],[["number","96"],["value","0"]]]]]}}
21-stack-info-depth --thread 1 10000
GDB -> App: {"token":21,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
22-stack-list-frames --thread 1 0 0
23-thread-list-ids
GDB -> App: {"token":22,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
GDB -> App: {"token":23,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["thread-ids",[["thread-id","1"]]],["current-thread-id","1"],["number-of-threads","1"]]}}
24-thread-info 1
GDB -> App: {"token":24,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Remote target"],["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["args",[]],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]],["state","stopped"]]]]]}}
25-stack-info-depth --thread 1 10000
GDB -> App: {"token":25,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["depth","1"]]}}
26-stack-list-frames --thread 1 0 0
GDB -> App: {"token":26,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["stack",[["frame",[["level","0"],["addr","0x08000fc4"],["func","Reset_Handler"],["file","../Core/Startup/startup_stm32l071cbtx.s"],["fullname","C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace_1.6.1\\2460P_testST\\Core\\Startup\\startup_stm32l071cbtx.s"],["line","52"],["arch","armv6s-m"]]]]]]}}
27-stack-list-variables --thread 1 --frame 0 --simple-values
GDB -> App: {"token":27,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["variables",[]]]}}
从'C:\Users\Daniel2.chen\STM32CubeIDE\workspace\u 1.6.1\2460P\u testST/Debug/2460P\u testST.elf'读取符号
看完符号
请检查输出选项卡(适配器输出)以获取openocd.exe的输出
启动服务器:“openocd.exe”“-c”“gdb_端口50000”“-s”“D:\Tools\openocd”“-f”“interface/stlink.cfg”“-f”“target/stm32l0.cfg”
启动GDB:“arm none eabi GDB.exe”“-q”“--解释器=mi2”
1-gdb-在上设置目标异步
2-解释器-exec控制台“源代码c:/Users/Daniel2.chen/.vscode/extensions/marus25.cortex-debug-0.3.12/support/gdbsupport.init”
3-target-select扩展远程本地主机:50000
4-解释器-exec控制台“监视器复位暂停”
5-target-download
6-解释器-exec控制台“监视器复位暂停”
7-enable-pretty-printing
GDB->App:{“OutOfBanderRecord”:[{“isStream”:false,“type”:“notify”,“asyncClass”:“thread group added”,“output”:[[“id”,“i1”]]}]}
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“键入”:“控制台”,“内容”:“从C:\\Users\\Daniel2.chen\\STM32CubeIDE\\workspace\u 1.6.1\\2460P\u testST/Debug/2460P\u testST.elf读取符号…\n”}
正在从C:\Users\Daniel2.chen\STM32CubeIDE\workspace\u 1.6.1\2460P\u testST/Debug/2460P\u testST.elf读取符号。。。
GDB->App:{“token”:1,“OutOfBanderRecord”:[],“resultRecords”:{“resultClass”:“done”,“results”:[]}
GDB->App:{“token”:2,“OutOfBanderRecord”:[],“resultRecords”:{“resultClass”:“done”,“results”:[]}
GDB->App:{“OutOfBanderRecord”:[{“isStream”:false,“type”:“notify”,“asyncClass”:“线程组已启动”,“output”:[[“id”,“i1”],[“pid”,“42000”]}]
GDB->App:{“OutofBanderRecord”:[{“isStream”:false,“type”:“notify”,“asyncClass”:“thread created”,“output”:[[“id”,“1”],[“group id”,“i1”]}]}
GDB->App:{“OutOfBanderRecord”:[{“isStream”:true,“type”:“console”,“content”:“Reset_Handler(),位于../Core/Startup/Startup_stm32l071cbtx.s:52\n”}]
在../Core/Startup/Startup\u stm32l071cbtx.s:52处重置\u处理程序()
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“type”:“console”,“content”:“52\t ldr r0,=\u estack\n”}]}
52 ldr r0,=\u estack
GDB->应用程序:{“OutOfBanderRecord”:[{“isStream”:false,“type”:“exec”,“asyncClass”:“stopped”,“output”:[[“frame”、[[“addr”、“0x08000fc4”]、[“func”、“Reset\u Handler”]、[“args”、[“file”、“./Core/Startup/Startup\u stm32l071cbtx.s”]、[“全名”,“C:\\Users\\Daniel2.chen\\32cubeide\\workspace\u 1.6.1\\2460P\u testST\\Core\\Startup\\Startup\stmu\stm321cbtx”[],“52”]、[“arch”、“armv6s-m”]]、[“线程id”、“1”]、[“停止的线程”、“所有”]}
未实现停止原因(假设异常):未定义
GDB->App:{“token”:3,“OutOfBanderRecord”:[],“resultRecords”:{“resultClass”:“connected”,“results”:[]}
8线程列表ID
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“type”:“target”,“content”:“无法匹配请求的速度300 kHz,使用240 kHz\n”}]}
无法匹配请求的速度300 kHz,使用240 kHz
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“type”:“target”,“content”:“无法匹配请求的速度300 kHz,使用240 kHz\n”}]}
无法匹配请求的速度300 kHz,使用240 kHz
GDB->App:{“OutOfBanderRecord”:[{“isStream”:true,“type”:“target”,“content”:“target由于调试请求而暂停,当前模式:Thread\n”}]}
由于调试请求,目标已暂停,当前模式:线程
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“type”:“target”,“content”:“xPSR:0xf1000000 pc:0x08000fc4 msp:0x2000000\n”}]}
xPSR:0xf1000000 pc:0x08000fc4 msp:0x2000000
GDB->App:{“token”:4,“OutOfBanderRecord”:[],“resultRecords”:{“resultClass”:“done”,“results”:[]}
9线程列表ID
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->App:{“token”:5,“OutOfBanderRecord”:[{“isStream”:false,“type”:“status”,“asyncClass”:“download”,“output”:[]}
GDB->应用程序:{“令牌”:5,“OutofBanderRecord”:[],“resultRecords”:{“resultClass”:“完成”,“结果”:[“地址”,“0x08000fc4”],[“加载大小”,“26596”],[“传输速率”,“34384”],[“写入速率”,“3324”]}
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“type”:“target”,“content”:“无法匹配请求的速度300 kHz,使用240 kHz\n”}]}
无法匹配请求的速度300 kHz,使用240 kHz
GDB->App:{“OutofBanderRecord”:[{“isStream”:true,“type”:“target”,“content”:“无法匹配请求的速度300 kHz,使用240 kHz\n”}]}
无法匹配请求的速度300 kHz,使用240 kHz
GDB->App:{“OutofBanderRecord”:[{“isStre”