Vscode-cpptools: [gdb] lost debugging after fork()

Created on 13 Oct 2018  Â·  6Comments  Â·  Source: microsoft/vscode-cpptools

I'm trying to use vscode to debug persistence in Redis and I make a breakpoint at a line with a call to fork(). But I found that after a fork(), vscode debugger does not work anymore, it's totally lost. I have to reconnect to make it work again.

I just build the Redis server with "make noopt V=1" and nothing else.
Here is my attach.json:

{ // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "(gdb) attach", "type": "cppdbg", "request": "attach", "processId": "2033", "program": "/home/devpc/opensrc/redis/src/redis-server", "MIMode": "gdb", "setupCommands": [ { "description": "Enable pretty-printing for gdb", "text": "-enable-pretty-printing", "ignoreFailures": true }, { "text": "-gdb-set follow-fork-mode child", "ignoreFailures": true } ] } ] }

The breakpoint is set at: https://github.com/antirez/redis/blob/91685eeeb1462edfc12da2e079e76bdbeec0eddb/src/aof.c#L1518

If I use gdb in terminal directly, there is no such issue.
Could you please take a look? Thank you :)

debugger

Most helpful comment

I run -exec show follow-fork-mode and it is set to child.
But no matter what value I set, the debugging is still lost.
Sorry I have not tried a simple project, I will try that soon

All 6 comments

In the debug console, can you enter -exec show follow-fork-mode and see if it is set on parent or child?
I see that you are setting it but i wonder what the response is?
Have you tried a simple project with a fork() call to see if it works?

I run -exec show follow-fork-mode and it is set to child.
But no matter what value I set, the debugging is still lost.
Sorry I have not tried a simple project, I will try that soon

i'm seeing this too. this pretty much breaks vscode for debugging forking processes :(

still not working.

This should be fixed with 0.24.0

Was this page helpful?
0 / 5 - 0 ratings