WebFreak001 / code-debug

Native debugging for VSCode
The Unlicense
409 stars 115 forks source link

How to solve the problem that the plugin pauses the GDB current thread ID when tentatively pausing a specified thread? #449

Open hetaowz opened 2 weeks ago

hetaowz commented 2 weeks ago

When using the plugin for gdb debugging, I paused thread 1 in the call stack, but the thread that was paused was actually thread 4. The following are the relevant configurations launch.json { "configurations": [ { "name": "native-debug", "type": "gdb", "request": "attach", "executable": "D:\cmiot\tool\vsworkapce\kkdebug\out\oneos.elf", "gdbpath": "D:\cmiot\tool\document\arm-none-eabi-gdb.exe", "target": "192.168.1.109:1234", "cwd": "${workspaceRoot}", "debugger_args": [ ​ "-iex", ​ "set non-stop on" ], "showDevDebugOutput": true, "printCalls": true, "remote": true, "debugServer": 4711 } ] } image image image

GDB -> App: {"token":8,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Thread 14"],["details","user_led,prio:1,stat:SLP,errno:0,wake:1000,stackfree:7948"],["state","running"]],[["id","2"],["target-id","Thread 15"],["details","test,prio:1,stat:RDY,errno:0,wake:0,stackfree:7932"],["state","running"]],[["id","3"],["target-id","Thread 16"],["details","gdb_test,prio:1,stat:SLP,errno:0,wake:10,stackfree:7948"],["state","running"]],[["id","4"],["target-id","Thread 17"],["details","kerio_test,prio:1,stat:SLP,errno:0,wake:10,stackfree:7948"],["state","running"]]]],["current-thread-id","4"]]}}

Thread GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"4 stopped.\n","output":[],"asyncClass":""}]} 4 stopped.

GDB -> App: {"token":10,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["threads",[[["id","1"],["target-id","Thread 14"],["details","user_led,prio:1,stat:SLP,errno:0,wake:1000,stackfree:7948"],["state","running"]],[["id","2"],["target-id","Thread 15"],["details","test,prio:1,stat:RDY,errno:0,wake:0,stackfree:7940"],["state","running"]],[["id","3"],["target-id","Thread 16"],["details","gdb_test,prio:1,stat:SLP,errno:0,wake:10,stackfree:7948"],["state","running"]],[["id","4"],["target-id","Thread 17"],["details","kerio_test,prio:1,stat:SUSP,errno:0,wake:10,stackfree:7948"],["frame",[["level","0"],["addr","0x800aff90"],["func","os_arch_context_switch"],["args",[[["name","current_task"],["value","0x80143c80 <g_os_current_task+12>"]],[["name","next_task"],["value","0x80142798 <gs_os_idle_task+3672>"]],[["name","cpu_index"],["value","3"]]]],["file","D:\cmiot\tool\code\oneos-qiyun\arch\arm\arm32\source\arch_task.c"],["fullname","D:\cmiot\tool\code\oneos-qiyun\arch\arm\arm32\source\arch_task.c"],["line","233"],["arch","armv7"]]],["state","stopped"]]]],["current-thread-id","4"]]}}