Closed lee8871 closed 1 year ago
Works fine for me with v1.12.0. This is not particularly a feature of this extension. The GUI is controlled by VSCode and they have a setting (that is passed to us) that controls viewing source code. Verify it is enabled for your Workspace and/or User. Also check for the Folder to make sure it is not being overridden. Use the Settings Gui to make sure
FYI: NOTHING changed between 1.6.0 and 1.12.0 for disassembly. We have not touched our code.
You can also set your launch.json as follows to see actual requests from VSCode.
"showDevDebugOutput": "vscode"
I have checked this setting is enabled. Strangely source code is showed only here: And other source code is no.
When using different versions of extension, there are indeed differences in phenomenon. I think it may be necessary to add GDB configuration or modify GCC compilation options. The source code should have been written to elf and successfully parsed by GDB. Because breakpoints is working well.
Or could this be an adaptation issue between GDB and Cortex debug? I am using risc-v gcc:https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack
The following is the output of the debug console:
This information is used to adjust bounds only when normal disassembly fails.
================================================================================
Using following memory regions for disassembly
================================================================================
Size VMA Beg VMA End LMA Beg LMA End Attributes
================================================================================
e4008000 00000000 e4008000 -------- -------- flash blocksize 0x400 nocache
1bff8000 e4008000 00000000 -------- -------- rw nocache
------------------------------------------------------------------------------
00000038 00000000 00000038 -------- -------- (.init) contents alloc load readonly code
00000108 00000038 00000140 -------- -------- (.vector) contents alloc load readonly code
000033c8 00000140 00003508 -------- -------- (.text) contents alloc load readonly code
00000000 00003508 00003508 -------- -------- (.fini) contents alloc load code
000000fc 20000000 200000fc 00003508 00003604 (.data) contents alloc load data
00000074 200000fc 20000170 00003604 00003678 (.bss) alloc
00000000 20000170 20000170 00003678 00003678 (.noinit) alloc
00000800 20002000 20002800 -------- -------- (.stack) alloc
================================================================================
Debug-36: Dequeuing...
Debug: Gdb command: -data-disassemble -s 0x00000140 -e 0x000002f4 -- 5 436 bytes (memset)
Suppressing output for '54-data-disassemble -s 0x00000140 -e 0x000002f4 -- 5'
Debug: Gdb command: -data-disassemble -s 0x000002f4 -e 0x00002962 -- 5 9838 bytes (rs485::init())
Suppressing output for '55-data-disassemble -s 0x000002f4 -e 0x00002962 -- 5'
Debug: data-disassemble -s 0x00000140 -e 0x000002f4 -- 5 => Found 154 instructions. 0 with source code, 154 without
From client: disassemble({"memoryReference":"0x00001346","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true})
Debug-37: Enqueuing {"command":"disassemble","arguments":{"memoryReference":"0x00001346","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true},"type":"request","seq":37}
Debug-37: ******** Waiting for previous request to complete
Debug: data-disassemble -s 0x000002f4 -e 0x00002962 -- 5 => Found 3562 instructions. 0 with source code, 3562 without
Debug-36: Elapsed time for Disassembly Request: 4979 ms
To client: {"seq":0,"type":"response","request_seq":36,"command":"disassemble","success":true,"body":{"instructions":[{"address":"0x00001120","pvtAddress":4384,"instruction":"2d83 srli\ta4,a4,0xb","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"2d 83","instructionBytes":"<RCC_GetClocksFreq+138>"},{"address":"0x00001122","pvtAddress":4386,"instruction":"1d8b andi\ta4,a4,7","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"1d 8b","instructionBytes":"<RCC_GetClocksFreq+140>"},{"address":"0x00001124","pvtAddress":4388,"instruction":"ba96 add\ta3,a3,a4","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"ba 96","instructionBytes":"<RCC_GetClocksFreq+142>"},{"address":"0x00001126","pvtAddress":4390,"instruction":"03c70600 lbu\ta4,0(a3)","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"03 c7 06 00","instructionBytes":"<RCC_GetClocksFreq+144>"},{"address":"0x0000112a","pvtAddress":4394,"instruction":"97f6ff1f auipc\ta3,0x1ffff","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"97 f6 ff 1f","instructionBytes":"<RCC_GetClocksFreq+148>"},{"address":"0x0000112e","pvtAddress":4398,"instruction":"9386a6f7 addi\ta3,a3,-134 # 0x200000a4 <ADCPrescTable>","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":[...]
Debug-37: Dequeuing...
Debug-37: Elapsed time for Disassembly Request: 004 ms
To client: {"seq":0,"type":"response","request_seq":37,"command":"disassemble","success":true,"body":{"instructions":[{"address":"0x00001120","pvtAddress":4384,"instruction":"2d83 srli\ta4,a4,0xb","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"2d 83","instructionBytes":"<RCC_GetClocksFreq+138>"},{"address":"0x00001122","pvtAddress":4386,"instruction":"1d8b andi\ta4,a4,7","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"1d 8b","instructionBytes":"<RCC_GetClocksFreq+140>"},{"address":"0x00001124","pvtAddress":4388,"instruction":"ba96 add\ta3,a3,a4","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"ba 96","instructionBytes":"<RCC_GetClocksFreq+142>"},{"address":"0x00001126","pvtAddress":4390,"instruction":"03c70600 lbu\ta4,0(a3)","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"03 c7 06 00","instructionBytes":"<RCC_GetClocksFreq+144>"},{"address":"0x0000112a","pvtAddress":4394,"instruction":"97f6ff1f auipc\ta3,0x1ffff","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"97 f6 ff 1f","instructionBytes":"<RCC_GetClocksFreq+148>"},{"address":"0x0000112e","pvtAddress":4398,"instruction":"9386a6f7 addi\ta3,a3,-134 # 0x200000a4 <ADCPrescTable>","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":[...]
ALL DEBUG CONSOLE:
Cortex-Debug: VSCode debugger extension version 1.12.0 git(d7a405a). Usage info: https://github.com/Marus/cortex-debug#usage
"configuration": {
"name": "UsbToAmmc6",
"type": "cortex-debug",
"cwd": "D:\\SRB2\\cmake_ws",
"executable": "D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf",
"device": "ch32v203",
"request": "launch",
"runToEntryPoint": "main",
"servertype": "openocd",
"armToolchainPath": "C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin",
"toolchainPrefix": "riscv-none-elf",
"svdFile": "C:/MounRiver/MounRiver_Studio/template/wizard/WCH/RISC-V/CH32V203/NoneOS/CH32V203xx.svd",
"configFiles": [
"C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg"
],
"showDevDebugOutput": "raw",
"__configurationTarget": 6,
"gdbServerConsolePort": 55878,
"pvtAvoidPorts": [],
"chainedConfigurations": {
"enabled": false
},
"debuggerArgs": [],
"swoConfig": {
"enabled": false,
"decoders": [],
"cpuFrequency": 0,
"swoFrequency": 0,
"source": "probe"
},
"rttConfig": {
"enabled": false,
"decoders": []
},
"graphConfig": [],
"preLaunchCommands": [],
"postLaunchCommands": [],
"preAttachCommands": [],
"postAttachCommands": [],
"preRestartCommands": [],
"postRestartCommands": [],
"preResetCommands": [],
"postResetCommands": [],
"searchDir": [],
"toolchainPath": "C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin",
"extensionPath": "c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0",
"registerUseNaturalFormat": true,
"variableUseNaturalFormat": true,
"pvtVersion": "1.12.0",
"__sessionId": "f897430a-2f22-4c66-a7a8-cf5a85026455"
}
Reading symbols from C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin/riscv-none-elf-objdump.exe --syms -C -h -w D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf
Reading symbols from c:/tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin/riscv-none-elf-nm.exe --defined-only -S -l -C -p D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf
Launching GDB: "C:\\Tool\\xpack-riscv-none-elf-gcc-12.2.0-3\\bin\\riscv-none-elf-gdb.exe" -q --interpreter=mi2
1-gdb-version
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code","adapterID":"cortex-debug","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en","supportsProgressReporting":true,"supportsInvalidatedEvent":true,"supportsMemoryReferences":true,"supportsArgsCanBeInterpretedByShell":true,"supportsMemoryEvent":true,"supportsStartDebuggingRequest":true})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsHitConditionalBreakpoints":true,"supportsConfigurationDoneRequest":true,"supportsConditionalBreakpoints":true,"supportsLogPoints":true,"supportsFunctionBreakpoints":true,"supportsEvaluateForHovers":true,"supportsSetVariable":true,"supportsRestartRequest":true,"supportsGotoTargetsRequest":true,"supportSuspendDebuggee":true,"supportTerminateDebuggee":true,"supportsDataBreakpoints":true,"supportsDisassembleRequest":true,"supportsSteppingGranularity":true,"supportsInstructionBreakpoints":true,"supportsReadMemoryRequest":true,"supportsWriteMemoryRequest":true}}
From client: launch({"name":"UsbToAmmc6","type":"cortex-debug","cwd":"D:\\SRB2\\cmake_ws","executable":"D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf","device":"ch32v203","request":"launch","runToEntryPoint":"main","servertype":"openocd","armToolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","toolchainPrefix":"riscv-none-elf","svdFile":"C:/MounRiver/MounRiver_Studio/template/wizard/WCH/RISC-V/CH32V203/NoneOS/CH32V203xx.svd","configFiles":["C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg"],"showDevDebugOutput":"vscode","__configurationTarget":6,"gdbServerConsolePort":55878,"pvtAvoidPorts":[],"chainedConfigurations":{"enabled":false},"debuggerArgs":[],"swoConfig":{"enabled":false,"decoders":[],"cpuFrequency":0,"swoFrequency":0,"source":"probe"},"rttConfig":{"enabled":false,"decoders":[]},"graphConfig":[],"preLaunchCommands":[],"postLaunchCommands":[],"preAttachCommands":[],"postAttachCommands":[],"preRestartCommands":[],"postRestartCommands":[],"preResetCommands":[],"postResetCommands":[],"searchDir":[],"toolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","extensionPath":"c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0","registerUseNaturalFormat":true,"variableUseNaturalFormat":true,"pvtVersion":"1.12.0","__sessionId":"f897430a-2f22-4c66-a7a8-cf5a85026455"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stdout","output":"Cortex-Debug: VSCode debugger extension version 1.12.0 git(d7a405a). Usage info: https://github.com/Marus/cortex-debug#usage"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"\"configuration\": {\n \"name\": \"UsbToAmmc6\",\n \"type\": \"cortex-debug\",\n \"cwd\": \"D:\\\\SRB2\\\\cmake_ws\",\n \"executable\": \"D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf\",\n \"device\": \"ch32v203\",\n \"request\": \"launch\",\n \"runToEntryPoint\": \"main\",\n \"servertype\": \"openocd\",\n \"armToolchainPath\": \"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin\",\n \"toolchainPrefix\": \"riscv-none-elf\",\n \"svdFile\": \"C:/MounRiver/MounRiver_Studio/template/wizard/WCH/RISC-V/CH32V203/NoneOS/CH32V203xx.svd\",\n \"configFiles\": [\n \"C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg\"\n ],\n \"showDevDebugOutput\": \"raw\",\n \"__configurationTarget\": 6,\n \"gdbServerConsolePort\": 55878,\n \"pvtAvoidPorts\": [],\n \"chainedConfigurations\": {\n \"enabled\": false\n },\n \"debuggerArgs\": [],\n \"swoConfig\": {\n \"enabled\": false,\n \"decoders\": [],\n \"cpuFrequency\": 0,\n \"swoFrequency\": 0,\n \"source\": \"probe\"\n },\n \"rttConfig\": {\n \"enabled\": false,\n \"decoders\": []\n },\n \"graphConfig\": [],\n \"preLaunchCommands\": [],\n \"postLaunchCommands\": [],\n \"preAttachCommands\": [],\n \"postAttachCommands\": [],\n \"preRestartCommands\": [],\n \"postRestartCommands\": [],\n \"pre[...]
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin/riscv-none-elf-objdump.exe --syms -C -h -w D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Reading symbols from c:/tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin/riscv-none-elf-nm.exe --defined-only -S -l -C -p D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"Launching GDB: \"C:\\\\Tool\\\\xpack-riscv-none-elf-gcc-12.2.0-3\\\\bin\\\\riscv-none-elf-gdb.exe\" -q --interpreter=mi2\n"}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"stderr","output":"1-gdb-version\n"}}
To client: {"seq":0,"type":"event","event":"custom-event-ports-allocated","body":{"info":[50000,50001,50002,50003]}}
To client: {"seq":0,"type":"event","event":"custom-event-ports-done","body":{}}
Launching gdb-server: openocd.exe -c "gdb_port 50000" -c "tcl_port 50001" -c "telnet_port 50002" -s "D:\\SRB2\\cmake_ws" -f "c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0/support/openocd-helpers.tcl" -f "C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg"
Please check TERMINAL tab (gdb-server) for output from openocd.exe
Finished reading symbols from objdump: Time: 60 ms
Finished reading symbols from nm: Time: 55 ms
-> =thread-group-added,id="i1"
-> ~"GNU gdb (xPack GNU RISC-V Embedded GCC x86_64) 12.1\n"
-> ~"Copyright (C) 2022 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=riscv-none-elf\".\n"
-> ~"Type \"show configuration\" for configuration details.\n"
-> ~"For bug reporting instructions, please see:\n"
-> ~"<https://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"
-> 1^done
2-gdb-set mi-async on
-> 2^done
3-interpreter-exec console "set print demangle on"
-> 3^done
4-interpreter-exec console "set print asm-demangle on"
-> =cmd-param-changed,param="print asm-demangle",value="on"
-> 4^done
5-enable-pretty-printing
-> 5^done
6-interpreter-exec console "source c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0/support/gdbsupport.init"
-> 6^done
7-interpreter-exec console "source c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0/support/gdb-swo.init"
-> =cmd-param-changed,param="language",value="c"
-> =cmd-param-changed,param="language",value="auto"
-> 7^done
8-interpreter-exec console "set output-radix 0xa"
-> ~"Output radix now set to decimal 10, hex a, octal 12.\n"
Output radix now set to decimal 10, hex a, octal 12.
-> 8^done
9-interpreter-exec console "set input-radix 0xa"
-> ~"Input radix now set to decimal 10, hex a, octal 12.\n"
Input radix now set to decimal 10, hex a, octal 12.
-> 9^done
10-file-exec-and-symbols "D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf"
-> 10^done
To client: {"seq":0,"type":"event","event":"custom-event-post-start-server","body":{"info":{"name":"UsbToAmmc6","type":"cortex-debug","cwd":"D:\\SRB2\\cmake_ws","executable":"D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf","device":"ch32v203","request":"launch","runToEntryPoint":"main","servertype":"openocd","armToolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","toolchainPrefix":"riscv-none-elf","svdFile":"C:/MounRiver/MounRiver_Studio/template/wizard/WCH/RISC-V/CH32V203/NoneOS/CH32V203xx.svd","configFiles":["C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg"],"showDevDebugOutput":"raw","__configurationTarget":6,"gdbServerConsolePort":55878,"pvtAvoidPorts":[],"chainedConfigurations":{"enabled":false},"debuggerArgs":[],"swoConfig":{"enabled":false,"decoders":[],"cpuFrequency":0,"swoFrequency":0,"source":"probe"},"rttConfig":{"enabled":false,"decoders":[]},"graphConfig":[],"preLaunchCommands":[],"postLaunchCommands":[],"preAttachCommands":[],"postAttachCommands":[],"preRestartCommands":[],"postRestartCommands":[],"preResetCommands":[],"postResetCommands":[],"searchDir":[],"toolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","extensionPath":"c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0","registerUseNaturalFormat":true,"variableUseNaturalFormat":true,"pvtVersion":"1.12.0","__sessionId":"f897430a-2f22-4c66-a7a8-cf5a85026455","gdbPath":"C:\\Tool\\xpack-riscv-none-elf-gcc-12.2.0-3\\bin\\riscv-none-elf-gdb.exe","numberOfProce[...]
11-target-select extended-remote localhost:50000
-> =thread-group-started,id="i1",pid="42000"
-> =thread-created,id="1",group-id="i1"
To client: {"seq":0,"type":"event","event":"thread","body":{"reason":"started","threadId":1}}
-> ~"initVTF () at D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp:26\n"
initVTF () at D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp:26
-> ~"26\t PFIC->VTFIDR[0] = 8;\n"
26 PFIC->VTFIDR[0] = 8;
-> *stopped,frame={addr="0x0000131c",func="initVTF",args=[],file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="26",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
-> 11^connected
12-interpreter-exec console "monitor reset halt"
-> 12^done
13-target-download
From client: threads(undefined)
To client: {"seq":0,"type":"response","request_seq":3,"command":"threads","success":true,"body":{"threads":[]}}
-> 13+download,{section=".init",section-size="56",total-size="123667"}
-> 13+download,{section=".init",section-sent="56",section-size="56",total-sent="56",total-size="123667"}
-> 13+download,{section=".vector",section-size="264",total-size="123667"}
-> 13+download,{section=".text",section-size="13256",total-size="123667"}
-> 13+download,{section=".data",section-size="252",total-size="123667"}
-> 13^done,address="0x00000000",load-size="13828",transfer-rate="56320",write-rate="3457"
14-interpreter-exec console "monitor reset halt"
-> 14^done
To client: {"seq":0,"type":"event","event":"initialized"}
To client: {"seq":0,"type":"event","event":"custom-event-post-start-gdb","body":{"info":{"name":"UsbToAmmc6","type":"cortex-debug","cwd":"D:\\SRB2\\cmake_ws","executable":"D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf","device":"ch32v203","request":"launch","runToEntryPoint":"main","servertype":"openocd","armToolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","toolchainPrefix":"riscv-none-elf","svdFile":"C:/MounRiver/MounRiver_Studio/template/wizard/WCH/RISC-V/CH32V203/NoneOS/CH32V203xx.svd","configFiles":["C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg"],"showDevDebugOutput":"raw","__configurationTarget":6,"gdbServerConsolePort":55878,"pvtAvoidPorts":[],"chainedConfigurations":{"enabled":false},"debuggerArgs":[],"swoConfig":{"enabled":false,"decoders":[],"cpuFrequency":0,"swoFrequency":0,"source":"probe"},"rttConfig":{"enabled":false,"decoders":[]},"graphConfig":[],"preLaunchCommands":[],"postLaunchCommands":[],"preAttachCommands":[],"postAttachCommands":[],"preRestartCommands":[],"postRestartCommands":[],"preResetCommands":[],"postResetCommands":[],"searchDir":[],"toolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","extensionPath":"c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0","registerUseNaturalFormat":true,"variableUseNaturalFormat":true,"pvtVersion":"1.12.0","__sessionId":"f897430a-2f22-4c66-a7a8-cf5a85026455","gdbPath":"C:\\Tool\\xpack-riscv-none-elf-gcc-12.2.0-3\\bin\\riscv-none-elf-gdb.exe","numberOfProcesso[...]
To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":true}
From client: setBreakpoints({"source":{"name":"ch32v20x_misc.c","path":"d:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c"},"lines":[37],"breakpoints":[{"line":37}],"sourceModified":false})
15-break-insert "d:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c:37"
From client: setBreakpoints({"source":{"name":"Led.cpp","path":"d:\\SRB2\\cmake_ws\\Code\\Core\\Led.cpp"},"lines":[13],"breakpoints":[{"line":13}],"sourceModified":false})
From client: setBreakpoints({"source":{"name":"main.cpp","path":"d:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp"},"lines":[49],"breakpoints":[{"line":49}],"sourceModified":false})
From client: setFunctionBreakpoints({"breakpoints":[]})
From client: setDataBreakpoints({"breakpoints":[]})
From client: setInstructionBreakpoints({"breakpoints":[]})
-> ~"Note: automatically using hardware breakpoints for read-only addresses.\n"
Note: automatically using hardware breakpoints for read-only addresses.
-> 15^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000fc2",func="NVIC_PriorityGroupConfig",file="D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c",fullname="D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c",line="37",thread-groups=["i1"],times="0",original-location="d:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c:37"}
To client: {"seq":0,"type":"response","request_seq":4,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"line":37,"id":1,"instructionReference":"0x00000fc2","verified":true}]}}
16-break-insert "d:\\SRB2\\cmake_ws\\Code\\Core\\Led.cpp:13"
-> 16^done,bkpt={number="2",type="breakpoint",disp="keep",enabled="y",addr="0x0000025e",func="Core::delayEightTick(unsigned int)",file="D:/SRB2/cmake_ws/Code/Core/Led.cpp",fullname="D:\\SRB2\\cmake_ws\\Code\\Core\\Led.cpp",line="15",thread-groups=["i1"],times="0",original-location="d:\\SRB2\\cmake_ws\\Code\\Core\\Led.cpp:13"}
To client: {"seq":0,"type":"response","request_seq":5,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"line":15,"id":2,"instructionReference":"0x0000025e","verified":true}]}}
17-break-insert "d:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp:49"
-> 17^done,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00001346",func="main()",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="49",thread-groups=["i1"],times="0",original-location="d:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp:49"}
To client: {"seq":0,"type":"response","request_seq":6,"command":"setBreakpoints","success":true,"body":{"breakpoints":[{"line":49,"id":3,"instructionReference":"0x00001346","verified":true}]}}
To client: {"seq":0,"type":"response","request_seq":7,"command":"setFunctionBreakpoints","success":true,"body":{"breakpoints":[]}}
To client: {"seq":0,"type":"response","request_seq":8,"command":"setDataBreakpoints","success":true,"body":{"breakpoints":[]}}
To client: {"seq":0,"type":"response","request_seq":9,"command":"setInstructionBreakpoints","success":true,"body":{"breakpoints":[]}}
From client: get-arguments(undefined)
To client: {"seq":0,"type":"response","request_seq":10,"command":"get-arguments","success":true,"body":{"name":"UsbToAmmc6","type":"cortex-debug","cwd":"D:\\SRB2\\cmake_ws","executable":"D:/SRB2/cmake_ws/build/UsbToAmmc6/UsbToAmmc6.elf","device":"ch32v203","request":"launch","runToEntryPoint":"main","servertype":"openocd","armToolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","toolchainPrefix":"riscv-none-elf","svdFile":"C:/MounRiver/MounRiver_Studio/template/wizard/WCH/RISC-V/CH32V203/NoneOS/CH32V203xx.svd","configFiles":["C:/MounRiver/MounRiver_Studio/toolchain/OpenOCD/bin/wch-riscv.cfg"],"showDevDebugOutput":"raw","__configurationTarget":6,"gdbServerConsolePort":55878,"pvtAvoidPorts":[],"chainedConfigurations":{"enabled":false},"debuggerArgs":[],"swoConfig":{"enabled":false,"decoders":[],"cpuFrequency":0,"swoFrequency":0,"source":"probe"},"rttConfig":{"enabled":false,"decoders":[]},"graphConfig":[],"preLaunchCommands":[],"postLaunchCommands":[],"preAttachCommands":[],"postAttachCommands":[],"preRestartCommands":[],"postRestartCommands":[],"preResetCommands":[],"postResetCommands":[],"searchDir":[],"toolchainPath":"C:/Tool/xpack-riscv-none-elf-gcc-12.2.0-3/bin","extensionPath":"c:/Users/lee88/.vscode/extensions/marus25.cortex-debug-1.12.0","registerUseNaturalFormat":true,"variableUseNaturalFormat":true,"pvtVersion":"1.12.0","__sessionId":"f897430a-2f22-4c66-a7a8-cf5a85026455","gdbPath":"C:\\Tool\\xpack-riscv-none-elf-gcc-12.2.0-3\\bin\\riscv-none-elf-gdb.exe","n[...]
From client: configurationDone(undefined)
To client: {"seq":0,"type":"response","request_seq":11,"command":"configurationDone","success":true}
From client: threads(undefined)
To client: {"seq":0,"type":"response","request_seq":12,"command":"threads","success":true,"body":{"threads":[]}}
To client: {"seq":0,"type":"event","event":"continued","body":{"threadId":1,"allThreadsContinued":true}}
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"entry","threadId":1,"allThreadsStopped":true}}
To client: {"seq":0,"type":"event","event":"custom-stop","body":{"reason":"entry","threadID":1}}
From client: threads(undefined)
Returning dummy thread-id to workaround VSCode issue with pause button not working
To client: {"seq":0,"type":"response","request_seq":13,"command":"threads","success":true,"body":{"threads":[{"id":1,"name":"cortex-debug-dummy-thread"}]}}
From client: stackTrace({"threadId":1,"startFrame":0,"levels":20})
Returning dummy stack frame to workaround VSCode issue with pause button not working: {"threadId":1,"startFrame":0,"levels":20}
18-break-insert -t --function main
To client: {"seq":0,"type":"response","request_seq":14,"command":"stackTrace","success":true,"body":{"stackFrames":[{"id":4096,"source":null,"line":0,"column":0,"name":"cortex-debug-dummy"}],"totalFrames":1}}
-> 18^done,bkpt={number="4",type="breakpoint",disp="del",enabled="y",addr="0x00001330",func="main()",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",thread-groups=["i1"],times="0",original-location="-function main"}
19-exec-continue --all
-> 19^running
-> *running,thread-id="all"
mi2.status = running
To client: {"seq":0,"type":"event","event":"continued","body":{"threadId":1,"allThreadsContinued":true}}
To client: {"seq":0,"type":"event","event":"custom-continued","body":{"threadID":1,"allThreads":true}}
-> =breakpoint-modified,bkpt={number="4",type="breakpoint",disp="del",enabled="y",addr="0x00001330",func="main()",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",thread-groups=["i1"],times="1",original-location="-function main"}
-> ~"\n"
-> ~"Temporary breakpoint 4, main () at D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp:47\n"
Temporary breakpoint 4, main () at D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp:47
-> ~"47\t NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);\n"
47 NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
-> *stopped,reason="breakpoint-hit",disp="del",bkptno="4",frame={addr="0x00001330",func="main",args=[],file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",arch="riscv:rv32"},thread-id="1",stopped-threads="all"
mi2.status = stopped
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"breakpoint","threadId":1,"allThreadsStopped":true}}
To client: {"seq":0,"type":"event","event":"custom-stop","body":{"reason":"breakpoint","threadID":1}}
-> =breakpoint-deleted,id="4"
From client: threads(undefined)
20-thread-list-ids
-> 20^done,thread-ids={thread-id="1"},current-thread-id="1",number-of-threads="1"
21-thread-info 1
-> 21^done,threads=[{id="1",target-id="Remote target",frame={level="0",addr="0x00001330",func="main",args=[],file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",arch="riscv:rv32"},state="stopped"}]
To client: {"seq":0,"type":"response","request_seq":15,"command":"threads","success":true,"body":{"threads":[{"id":1,"name":"Remote target"}]}}
From client: stackTrace({"threadId":1,"startFrame":0,"levels":20})
22-stack-info-depth --thread 1 1000
-> 22^done,depth="1"
23-stack-list-frames --thread 1 0 0
-> 23^done,stack=[frame={level="0",addr="0x00001330",func="main",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",arch="riscv:rv32"}]
To client: {"seq":0,"type":"response","request_seq":16,"command":"stackTrace","success":true,"body":{"stackFrames":[{"id":4096,"source":{"name":"D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp","path":"D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp","sourceReference":0},"line":47,"column":0,"name":"main@0x00001330","instructionPointerReference":"0x00001330"}],"totalFrames":1}}
From client: readMemory({"memoryReference":"0x40005c00","count":30})
24-data-read-memory-bytes "0x40005c00" 30
-> 24^done,memory=[{begin="0x40005c00",offset="0x00000000",end="0x40005c1e",contents="000000000000000000000000000000000000000000000000000000000000"}]
To client: {"seq":0,"type":"response","request_seq":17,"command":"readMemory","success":true,"body":{"address":"0x40005c00","data":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}
From client: readMemory({"memoryReference":"0x40005c40","count":20})
25-data-read-memory-bytes "0x40005c40" 20
-> 25^done,memory=[{begin="0x40005c40",offset="0x00000000",end="0x40005c54",contents="0000000000000000000000000000000000000000"}]
To client: {"seq":0,"type":"response","request_seq":18,"command":"readMemory","success":true,"body":{"address":"0x40005c40","data":"AAAAAAAAAAAAAAAAAAAAAAAAAAA="}}
From client: scopes({"frameId":4096})
26-stack-info-frame --thread 1 --frame 0
-> 26^done,frame={level="0",addr="0x00001330",func="main",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",arch="riscv:rv32"}
To client: {"seq":0,"type":"response","request_seq":19,"command":"scopes","success":true,"body":{"scopes":[{"name":"Local","variablesReference":4096,"expensive":false},{"name":"Global","variablesReference":4294967295,"expensive":false},{"name":"Static: ./UsbToAmmc6/main.cpp","variablesReference":1052672,"expensive":false},{"name":"Registers","variablesReference":2101248,"expensive":false}]}}
From client: variables({"variablesReference":4096})
27-stack-select-frame --thread 1 0
-> 27^done
28-stack-list-variables --thread 1 --frame 0 --simple-values
-> 28^done,variables=[]
To client: {"seq":0,"type":"response","request_seq":20,"command":"variables","success":true,"body":{"variables":[]}}
From client: continue({"threadId":1})
29-exec-continue --thread 1
-> 29^running
-> *running,thread-id="all"
mi2.status = running
To client: {"seq":0,"type":"event","event":"continued","body":{"threadId":1,"allThreadsContinued":true}}
To client: {"seq":0,"type":"event","event":"custom-continued","body":{"threadID":1,"allThreads":true}}
To client: {"seq":0,"type":"response","request_seq":21,"command":"continue","success":true,"body":{"allThreadsContinued":true}}
-> =breakpoint-modified,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000fc2",func="NVIC_PriorityGroupConfig",file="D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c",fullname="D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c",line="37",thread-groups=["i1"],times="1",original-location="d:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c:37"}
-> ~"\n"
-> ~"Breakpoint 1, NVIC_PriorityGroupConfig (NVIC_PriorityGroup=1) at D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c:37\n"
Breakpoint 1, NVIC_PriorityGroupConfig (NVIC_PriorityGroup=1) at D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c:37
-> ~"37\t NVIC_Priority_Group = NVIC_PriorityGroup;\n"
37 NVIC_Priority_Group = NVIC_PriorityGroup;
-> *stopped,reason="breakpoint-hit",disp="keep",bkptno="1",frame={addr="0x00000fc2",func="NVIC_PriorityGroupConfig",args=[{name="NVIC_PriorityGroup",value="1"}],file="D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c",fullname="D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c",line="37",arch="riscv:rv32"},thread-id="1",stopped-threads="all"
mi2.status = stopped
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"breakpoint","threadId":1,"allThreadsStopped":true}}
To client: {"seq":0,"type":"event","event":"custom-stop","body":{"reason":"breakpoint","threadID":1}}
From client: threads(undefined)
30-thread-list-ids
-> 30^done,thread-ids={thread-id="1"},current-thread-id="1",number-of-threads="1"
31-thread-info 1
-> 31^done,threads=[{id="1",target-id="Remote target",frame={level="0",addr="0x00000fc2",func="NVIC_PriorityGroupConfig",args=[{name="NVIC_PriorityGroup",value="1"}],file="D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c",fullname="D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c",line="37",arch="riscv:rv32"},state="stopped"}]
To client: {"seq":0,"type":"response","request_seq":22,"command":"threads","success":true,"body":{"threads":[{"id":1,"name":"Remote target"}]}}
From client: stackTrace({"threadId":1,"startFrame":0,"levels":20})
32-stack-info-depth --thread 1 1000
-> 32^done,depth="2"
33-stack-list-frames --thread 1 0 1
-> 33^done,stack=[frame={level="0",addr="0x00000fc2",func="NVIC_PriorityGroupConfig",file="D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c",fullname="D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c",line="37",arch="riscv:rv32"},frame={level="1",addr="0x00001344",func="main",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="47",arch="riscv:rv32"}]
To client: {"seq":0,"type":"response","request_seq":23,"command":"stackTrace","success":true,"body":{"stackFrames":[{"id":4096,"source":{"name":"D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c","path":"D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c","sourceReference":0},"line":37,"column":0,"name":"NVIC_PriorityGroupConfig@0x00000fc2","instructionPointerReference":"0x00000fc2"},{"id":4097,"source":{"name":"D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp","path":"D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp","sourceReference":0},"line":47,"column":0,"name":"main@0x00001344","instructionPointerReference":"0x00001344"}],"totalFrames":2}}
From client: readMemory({"memoryReference":"0x40005c00","count":30})
34-data-read-memory-bytes "0x40005c00" 30
-> 34^done,memory=[{begin="0x40005c00",offset="0x00000000",end="0x40005c1e",contents="000000000000000000000000000000000000000000000000000000000000"}]
To client: {"seq":0,"type":"response","request_seq":24,"command":"readMemory","success":true,"body":{"address":"0x40005c00","data":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}
From client: readMemory({"memoryReference":"0x40005c40","count":20})
35-data-read-memory-bytes "0x40005c40" 20
-> 35^done,memory=[{begin="0x40005c40",offset="0x00000000",end="0x40005c54",contents="0000000000000000000000000000000000000000"}]
To client: {"seq":0,"type":"response","request_seq":25,"command":"readMemory","success":true,"body":{"address":"0x40005c40","data":"AAAAAAAAAAAAAAAAAAAAAAAAAAA="}}
From client: scopes({"frameId":4096})
36-stack-info-frame --thread 1 --frame 0
-> 36^done,frame={level="0",addr="0x00000fc2",func="NVIC_PriorityGroupConfig",file="D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c",fullname="D:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c",line="37",arch="riscv:rv32"}
To client: {"seq":0,"type":"response","request_seq":26,"command":"scopes","success":true,"body":{"scopes":[{"name":"Local","variablesReference":4096,"expensive":false},{"name":"Global","variablesReference":4294967295,"expensive":false},{"name":"Static: ./old/Peripheral/src/ch32v20x_misc.c","variablesReference":1052672,"expensive":false},{"name":"Registers","variablesReference":2101248,"expensive":false}]}}
From client: variables({"variablesReference":4096})
37-stack-select-frame --thread 1 0
-> 37^done
38-stack-list-variables --thread 1 --frame 0 --simple-values
-> 38^done,variables=[{name="NVIC_PriorityGroup",arg="1",type="uint32",value="1"}]
39-var-update --thread 1 --frame 0 --all-values var_NVIC_PriorityGroup_4096
-> 39^error,msg="Variable object not found"
40-var-create --thread 1 --frame 0 var_NVIC_PriorityGroup_4096 * "NVIC_PriorityGroup"
-> 40^done,name="var_NVIC_PriorityGroup_4096",numchild="0",value="1",type="uint32",thread-id="1",has_more="0"
To client: {"seq":0,"type":"response","request_seq":27,"command":"variables","success":true,"body":{"variables":[{"name":"NVIC_PriorityGroup","evaluateName":"NVIC_PriorityGroup","value":"1","type":"uint32 NVIC_PriorityGroup;\ndec: 1\nhex: 0x00000001\noct: 000000000001\nbin: 00000000 00000000 00000000 00000001","presentationHint":{},"variablesReference":0}]}}
From client: setBreakpoints({"source":{"name":"D:/SRB2/cmake_ws/old/Peripheral/src/ch32v20x_misc.c","path":"d:\\SRB2\\cmake_ws\\old\\Peripheral\\src\\ch32v20x_misc.c","sourceReference":0},"lines":[],"breakpoints":[],"sourceModified":false})
41-break-delete 1
-> 41^done
To client: {"seq":0,"type":"response","request_seq":28,"command":"setBreakpoints","success":true,"body":{"breakpoints":[]}}
From client: continue({"threadId":1})
42-exec-continue --thread 1
-> 42^running
-> *running,thread-id="all"
mi2.status = running
To client: {"seq":0,"type":"event","event":"continued","body":{"threadId":1,"allThreadsContinued":true}}
To client: {"seq":0,"type":"event","event":"custom-continued","body":{"threadID":1,"allThreads":true}}
To client: {"seq":0,"type":"response","request_seq":29,"command":"continue","success":true,"body":{"allThreadsContinued":true}}
-> =breakpoint-modified,bkpt={number="3",type="breakpoint",disp="keep",enabled="y",addr="0x00001346",func="main()",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="49",thread-groups=["i1"],times="1",original-location="d:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp:49"}
-> ~"\n"
-> ~"Breakpoint 3, main () at D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp:49\n"
Breakpoint 3, main () at D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp:49
-> ~"49\t USART_Printf_Init(115200);\n"
49 USART_Printf_Init(115200);
-> *stopped,reason="breakpoint-hit",disp="keep",bkptno="3",frame={addr="0x00001346",func="main",args=[],file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="49",arch="riscv:rv32"},thread-id="1",stopped-threads="all"
mi2.status = stopped
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"breakpoint","threadId":1,"allThreadsStopped":true}}
To client: {"seq":0,"type":"event","event":"custom-stop","body":{"reason":"breakpoint","threadID":1}}
From client: threads(undefined)
43-thread-list-ids
-> 43^done,thread-ids={thread-id="1"},current-thread-id="1",number-of-threads="1"
44-thread-info 1
-> 44^done,threads=[{id="1",target-id="Remote target",frame={level="0",addr="0x00001346",func="main",args=[],file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="49",arch="riscv:rv32"},state="stopped"}]
To client: {"seq":0,"type":"response","request_seq":30,"command":"threads","success":true,"body":{"threads":[{"id":1,"name":"Remote target"}]}}
From client: stackTrace({"threadId":1,"startFrame":0,"levels":20})
45-stack-info-depth --thread 1 1000
-> 45^done,depth="1"
46-stack-list-frames --thread 1 0 0
-> 46^done,stack=[frame={level="0",addr="0x00001346",func="main",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="49",arch="riscv:rv32"}]
To client: {"seq":0,"type":"response","request_seq":31,"command":"stackTrace","success":true,"body":{"stackFrames":[{"id":4096,"source":{"name":"D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp","path":"D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp","sourceReference":0},"line":49,"column":0,"name":"main@0x00001346","instructionPointerReference":"0x00001346"}],"totalFrames":1}}
From client: readMemory({"memoryReference":"0x40005c00","count":30})
47-data-read-memory-bytes "0x40005c00" 30
-> 47^done,memory=[{begin="0x40005c00",offset="0x00000000",end="0x40005c1e",contents="000000000000000000000000000000000000000000000000000000000000"}]
To client: {"seq":0,"type":"response","request_seq":32,"command":"readMemory","success":true,"body":{"address":"0x40005c00","data":"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"}}
From client: readMemory({"memoryReference":"0x40005c40","count":20})
48-data-read-memory-bytes "0x40005c40" 20
-> 48^done,memory=[{begin="0x40005c40",offset="0x00000000",end="0x40005c54",contents="0000000000000000000000000000000000000000"}]
To client: {"seq":0,"type":"response","request_seq":33,"command":"readMemory","success":true,"body":{"address":"0x40005c40","data":"AAAAAAAAAAAAAAAAAAAAAAAAAAA="}}
From client: scopes({"frameId":4096})
49-stack-info-frame --thread 1 --frame 0
-> 49^done,frame={level="0",addr="0x00001346",func="main",file="D:/SRB2/cmake_ws/UsbToAmmc6/main.cpp",fullname="D:\\SRB2\\cmake_ws\\UsbToAmmc6\\main.cpp",line="49",arch="riscv:rv32"}
To client: {"seq":0,"type":"response","request_seq":34,"command":"scopes","success":true,"body":{"scopes":[{"name":"Local","variablesReference":4096,"expensive":false},{"name":"Global","variablesReference":4294967295,"expensive":false},{"name":"Static: ./UsbToAmmc6/main.cpp","variablesReference":1052672,"expensive":false},{"name":"Registers","variablesReference":2101248,"expensive":false}]}}
From client: variables({"variablesReference":4096})
50-stack-select-frame --thread 1 0
-> 50^done
51-stack-list-variables --thread 1 --frame 0 --simple-values
-> 51^done,variables=[]
To client: {"seq":0,"type":"response","request_seq":35,"command":"variables","success":true,"body":{"variables":[]}}
From client: disassemble({"memoryReference":"0x00001346","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true})
Debug-36: Enqueuing {"command":"disassemble","arguments":{"memoryReference":"0x00001346","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true},"type":"request","seq":36}
52-interpreter-exec console "show architecture"
-> ~"The target architecture is set to \"auto\" (currently \"riscv:rv32\").\n"
-> 52^done
Warning: Unknown architecture for disassembly. Results may not be accurate at edge of memories
Gdb command "show architecture" shows "The target architecture is set to "auto" (currently "riscv:rv32").
"
53-interpreter-exec console "info mem"
-> ~"Using memory regions provided by the target.\n"
-> ~"Num Enb Low Addr High Addr Attrs \n"
-> ~"0 y \t0x00000000 0xe4008000 flash blocksize 0x400 nocache \n"
-> ~"1 y \t0xe4008000 0x100000000 rw nocache \n"
-> 53^done
Note: We detected the following memory regions as valid using gdb "info mem" and "objdump -h"
This information is used to adjust bounds only when normal disassembly fails.
================================================================================
Using following memory regions for disassembly
================================================================================
Size VMA Beg VMA End LMA Beg LMA End Attributes
================================================================================
e4008000 00000000 e4008000 -------- -------- flash blocksize 0x400 nocache
1bff8000 e4008000 00000000 -------- -------- rw nocache
------------------------------------------------------------------------------
00000038 00000000 00000038 -------- -------- (.init) contents alloc load readonly code
00000108 00000038 00000140 -------- -------- (.vector) contents alloc load readonly code
000033c8 00000140 00003508 -------- -------- (.text) contents alloc load readonly code
00000000 00003508 00003508 -------- -------- (.fini) contents alloc load code
000000fc 20000000 200000fc 00003508 00003604 (.data) contents alloc load data
00000074 200000fc 20000170 00003604 00003678 (.bss) alloc
00000000 20000170 20000170 00003678 00003678 (.noinit) alloc
00000800 20002000 20002800 -------- -------- (.stack) alloc
================================================================================
Debug-36: Dequeuing...
Debug: Gdb command: -data-disassemble -s 0x00000140 -e 0x000002f4 -- 5 436 bytes (memset)
Suppressing output for '54-data-disassemble -s 0x00000140 -e 0x000002f4 -- 5'
Debug: Gdb command: -data-disassemble -s 0x000002f4 -e 0x00002962 -- 5 9838 bytes (rs485::init())
Suppressing output for '55-data-disassemble -s 0x000002f4 -e 0x00002962 -- 5'
Debug: data-disassemble -s 0x00000140 -e 0x000002f4 -- 5 => Found 154 instructions. 0 with source code, 154 without
From client: disassemble({"memoryReference":"0x00001346","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true})
Debug-37: Enqueuing {"command":"disassemble","arguments":{"memoryReference":"0x00001346","offset":0,"instructionOffset":-200,"instructionCount":400,"resolveSymbols":true},"type":"request","seq":37}
Debug-37: ******** Waiting for previous request to complete
Debug: data-disassemble -s 0x000002f4 -e 0x00002962 -- 5 => Found 3562 instructions. 0 with source code, 3562 without
Debug-36: Elapsed time for Disassembly Request: 4979 ms
To client: {"seq":0,"type":"response","request_seq":36,"command":"disassemble","success":true,"body":{"instructions":[{"address":"0x00001120","pvtAddress":4384,"instruction":"2d83 srli\ta4,a4,0xb","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"2d 83","instructionBytes":"<RCC_GetClocksFreq+138>"},{"address":"0x00001122","pvtAddress":4386,"instruction":"1d8b andi\ta4,a4,7","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"1d 8b","instructionBytes":"<RCC_GetClocksFreq+140>"},{"address":"0x00001124","pvtAddress":4388,"instruction":"ba96 add\ta3,a3,a4","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"ba 96","instructionBytes":"<RCC_GetClocksFreq+142>"},{"address":"0x00001126","pvtAddress":4390,"instruction":"03c70600 lbu\ta4,0(a3)","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"03 c7 06 00","instructionBytes":"<RCC_GetClocksFreq+144>"},{"address":"0x0000112a","pvtAddress":4394,"instruction":"97f6ff1f auipc\ta3,0x1ffff","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"97 f6 ff 1f","instructionBytes":"<RCC_GetClocksFreq+148>"},{"address":"0x0000112e","pvtAddress":4398,"instruction":"9386a6f7 addi\ta3,a3,-134 # 0x200000a4 <ADCPrescTable>","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":[...]
Debug-37: Dequeuing...
Debug-37: Elapsed time for Disassembly Request: 004 ms
To client: {"seq":0,"type":"response","request_seq":37,"command":"disassemble","success":true,"body":{"instructions":[{"address":"0x00001120","pvtAddress":4384,"instruction":"2d83 srli\ta4,a4,0xb","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"2d 83","instructionBytes":"<RCC_GetClocksFreq+138>"},{"address":"0x00001122","pvtAddress":4386,"instruction":"1d8b andi\ta4,a4,7","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"1d 8b","instructionBytes":"<RCC_GetClocksFreq+140>"},{"address":"0x00001124","pvtAddress":4388,"instruction":"ba96 add\ta3,a3,a4","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"ba 96","instructionBytes":"<RCC_GetClocksFreq+142>"},{"address":"0x00001126","pvtAddress":4390,"instruction":"03c70600 lbu\ta4,0(a3)","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"03 c7 06 00","instructionBytes":"<RCC_GetClocksFreq+144>"},{"address":"0x0000112a","pvtAddress":4394,"instruction":"97f6ff1f auipc\ta3,0x1ffff","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":"97 f6 ff 1f","instructionBytes":"<RCC_GetClocksFreq+148>"},{"address":"0x0000112e","pvtAddress":4398,"instruction":"9386a6f7 addi\ta3,a3,-134 # 0x200000a4 <ADCPrescTable>","symbol":"RCC_GetClocksFreq","pvtInstructionBytes":[...]
Debug: Gdb command: -data-disassemble -s 0x00000140 -e 0x000002f4 -- 5 436 bytes (memset)
That gdb command says please give me disassembly for those addresses with inlined source code if available. See https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Data-Manipulation.html#GDB_002fMI-Data-Manipulation
But source code is not guaranteed by GDB and depends on your version of GDB and how you compiled your code. You said if everything is the same, and just changing the version of Cortex-Debug, things fail. But something must be different. We don't filter out what is sent by GDB so, I have to assume that GDB is not finding the source code.
You can run the disassemble command from the Debug Console. Just use the command we used and you will see the raw output from GDB.
-data-disassemble -s 0x00000140 -e 0x000002f4 -- 5
With your help, I have chosen this piece of code for testing.
I run this code -data-disassemble -s 0x00000d94 -e 0x00000db0 -- 5
, and get following response:
It is a json string.
From this perspective, GDB knows the line number and file name of the disassembly.
Based on this information, the software should be able to locate the corresponding line and obtain the source code within it.
This is GDB response:
{"output":"","token":100,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["asm_insns",[["src_and_asm_line",[["line","89"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","90"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","91"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","92"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","93"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","94"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[[["address","0x00000d94"],["func-name","USART_Printf_Init"],["offset","0"],["opcodes","79 71"],["inst","addi\tsp,sp,-48"]],[["address","0x00000d96"],["func-name","USART_Printf_Init"],["offset","2"],["opcodes","22 d4"],["inst","sw\ts0,40(sp)"]],[["address","0x00000d98"],["func-name","USART_Printf_Init"],["offset","4"],["opcodes","2a 84"],["inst","mv\ts0,a0"]],[["address","0x00000d9a"],["func-name","USART_Printf_Init"],["offset","6"],["opcodes","11 65"],["inst","lui\ta0,0x4"]],[["address","0x00000d9c"],["func-name","USART_Printf_Init"],["offset","8"],["opcodes","85 45"],["inst","li\ta1,1"]],[["address","0x00000d9e"],["func-name","USART_Printf_Init"],["offset","10"],["opcodes","11 05"],["inst","addi\ta0,a0,4 # 0x4004"]]]]]],["src_and_asm_line",[["line","89"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[[["address","0x00000da0"],["func-name","USART_Printf_Init"],["offset","12"],["opcodes","06 d6"],["inst","sw\tra,44(sp)"]]]]]],["src_and_asm_line",[["line","90"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","91"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","92"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","93"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","94"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[[["address","0x00000da2"],["func-name","USART_Printf_Init"],["offset","14"],["opcodes","55 2e"],["inst","jal\t0x1156 <RCC_APB2PeriphClockCmd>"]]]]]],["src_and_asm_line",[["line","95"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","96"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[[["address","0x00000da4"],["func-name","USART_Printf_Init"],["offset","16"],["opcodes","93 07 00 20"],["inst","li\ta5,512"]],[["address","0x00000da8"],["func-name","USART_Printf_Init"],["offset","20"],["opcodes","23 12 f1 00"],["inst","sh\ta5,4(sp)"]]]]]],["src_and_asm_line",[["line","97"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[[["address","0x00000dac"],["func-name","USART_Printf_Init"],["offset","24"],["opcodes","37 15 01 40"],["inst","lui\ta0,0x40011"]]]]]]]]]}}
Does this file D:/SRB2/cmake_ws/old/Debug/debug.c
actually exist? I mean the exact path on disk. Note that actual source lines are not part of the GDB response. Just file and line numbers. The file needs to exist for VSCode to find the contents. GDB only reports. Instead of machine instructions lime -data-disassemble
where all responses are made for machine readable format, you can use normal gdb commands for human readable purposes. Enter the following in the Debug Console
disassemble /s <start>,><end>
Or one of the other methods like disassemble /s <start>,>+<length>
. See full documentation
https://sourceware.org/gdb/onlinedocs/gdb/Machine-Code.html
I notice you did not enable the proper debug mode either. It should be
"showDevDebugOutput": "vscode",
This shows us what VSCode is asking us and what we are sending back as a response. I don't see any of that here. Hopefully, we can see what is going on there...
This file do exist.
I have confirmed to write "showDevDebugOutput": "vscode",
,but in the output, this setting is still 'raw'
I tried change "runToEntryPoint" to "initVTF", and I can see that this command is indeed taking effect.
This indicates that the file used for debugging is the one I just modified. But 'showDevDebugOutput' is still 'raw',
About disassemble conmmend. I did see successful execution of these instructions, as well as disassembly and source code. But when executed again. It is impossible to reproduce the previous situation.
Wait, when you run the command to disassemble, you don't see any output from GDB to stdout? What we print as debug JSON stuff doesn't count. I see zero output from GDB when you ran the disassemble command. It executed but since this not a machine interface, we don't get to see the stdout of gdb. You should have seen like the examples shown here
https://sourceware.org/gdb/onlinedocs/gdb/Machine-Code.html
along with our junk.
Yes, showDevDebugOutput will start out as "vscode", but once VSCode is notified, we revert back to normal. You should see a LOT more output in your Debug Console and I don't see any. You should see stuff like
From client: ...
To client: ...
VSCode is the client and we are the adapter/server in this case. These while verbose, are important.
When I just executed these disassembly commands, I did see the correct output, as well as the source code and disassembly. Like this: I didn't take any screenshots.
Later, I tried the issue with 'showDevDebugOutput', and of course, I restarted GDB. But I didn't see the correct output again, which is really strange.
I tried many configurations but couldn't see the output of the disassembly command again. I am continuing to search for the reason. I have no clue about this issue that cannot be reproduced, except for GDB ran for a relatively long time, about 30 minutes.
To me actual text from the Debug Console is much more helpful than partial screenshots. Screenshots are fine for stuff outside the Debug Console.
In your last response, I have trouble telling what you actually did.
I have successfully used disassemble main
command once. GDB returns readable source code and disassemble
When I run GDB again, this command returns nothing.
I may not have made any modifications to the configuration. But I'm not quite sure yet.
For now:
disassemble main
{"output":"","token":26,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
disassemble /s 0x1330,0x1340
{"output":"","token":30,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
-data-disassemble -s 0x00000d94 -e 0x00000da0 -- 5
{"output":"","token":34,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["asm_insns",[["src_and_asm_line",[["line","89"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","90"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","91"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","92"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","93"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[]]]],["src_and_asm_line",[["line","94"],["file","D:/SRB2/cmake_ws/old/Debug/debug.c"],["fullname","D:\\SRB2\\cmake_ws\\old\\Debug\\debug.c"],["line_asm_insn",[[["address","0x00000d94"],["func-name","USART_Printf_Init"],["offset","0"],["opcodes","79 71"],["inst","addi\tsp,sp,-48"]],[["address","0x00000d96"],["func-name","USART_Printf_Init"],["offset","2"],["opcodes","22 d4"],["inst","sw\ts0,40(sp)"]],[["address","0x00000d98"],["func-name","USART_Printf_Init"],["offset","4"],["opcodes","2a 84"],["inst","mv\ts0,a0"]],[["address","0x00000d9a"],["func-name","USART_Printf_Init"],["offset","6"],["opcodes","11 65"],["inst","lui\ta0,0x4"]],[["address","0x00000d9c"],["func-name","USART_Printf_Init"],["offset","8"],["opcodes","85 45"],["inst","li\ta1,1"]],[["address","0x00000d9e"],["func-name","USART_Printf_Init"],["offset","10"],["opcodes","11 05"],["inst","addi\ta0,a0,4 # 0x4004"]]]]]]]]]}}
xxxxxxx
Undefined command: "xxxxxxx". Try "help". (from interpreter-exec console "xxxxxxx ")
You have a lot of information with various levels of debug output. I am only seeing bits and pieces. I have to sign off now and maybe you can make some progress on your own until tomorrow. I can't really help with such limited visibility.
Thank you very much for your help today.I will try to reproduce the phenomenon.
After this period of testing, I have not found any further issues. There was even a test where I saw the corresponding source code for disassembly, but I couldn't succeed next time.
Deeper testing requires manual execution of GDB, attempting non cross compilation. I don't have time to handle it at the moment.
So I closed the issue and made the following summary:
Disassembly can not show source code .
Phenomenon
I am using
xpack-riscv-none-elf-gcc-12.2.0-3
and do some embedding developing. Start debuging and open disassembly: Than, using this commend@command:debug.action.toggleDisassemblyViewSourceCode
, nothing happened, but terminal show more information:I tried old
version Cortex-Debug v1.6.0
. Source code is showed like this: It worked for C code well, but for CPP code :launch.json: