microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
818 stars 219 forks source link

No response for loading stack trace #1308

Closed JoergMeier106 closed 2 years ago

JoergMeier106 commented 2 years ago

I'm using VS Code on Windows with a QNX adjusted GDB client based on version 8.3. I noticed that sometimes when I debug remotely, reach a breakpoint and the stacktrace command is send, loading the stack trace hangs forever. image This seems to only happen if I have two breakpoints in different threads and one of the thread waits for the other. These are the last logs I see when putting on trace logging: <-- C (stackTrace-27): {"command":"stackTrace","arguments":{"threadId":-21,"startFrame":0,"levels":20},"type":"request","seq":27} <-- C (stackTrace-28): {"command":"stackTrace","arguments":{"threadId":-2,"startFrame":0,"levels":20},"type":"request","seq":28} --> R (stackTrace-27): {"type":"response","request_seq":27,"success":true,"command":"stackTrace","body":{"stackFrames": ....

It seems that there is no problem loading the stack trace of the running thread. But it does not seem to be able to load the stack of the thread waiting for the other thread. If I quit the debug session, I see the stack trace opening for a few milliseconds. In that situation there is nothing I can do except quiting the debug session.

JoergMeier106 commented 2 years ago

While debugging the debug adapter, I saw that it hangs in the lock inside of the function AD7DebugSession.HandleIDebugThreadDestroyEvent2. Commenting out the lock resolves the issue. Maybe this helps narrowing down the real issue.