New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GDB]Can’t hit the breakpoint in child process after "-exec set follow-fork-mode child" #2738
Comments
Yes, actually the breakpoint is hit in my case (according to DEBUG CONSOLE), but VSCode UI is not reacting on attaching and detaching of child process with actual breakpoint. |
@msvaillant I can confirm I get the same result too, breakpoint is hit (and thus execution is stopped) but the UI does not react. I have attached a full engine log below:
|
Ok, I decided to try some old versions to see if I could pinpoint the version where it went wrong, as it seems that per #511 it has worked previously, and curiously it seems that the exact same scenario actually worked fine in 1.22.2! Below I have attached the full engine log from a successful run in 1.22.2.
|
I can verify stjen's result. I can't get -exec set db-follow-fork (or variants -gdb-set ...) to work in 1.31, but if I back up to 1.22.2 it works as expected. Please fix this. |
I'm having the same issue. For anyone else here looking for the old version of vscode: https://code.visualstudio.com/updates/v1_22. |
Any news on this? |
I was able to investigate this and see that this broke when this fix was introduced. I'm currently working on a fix for this. |
Fixed with 0.24.0. |
Type: Debugger
i want to debug child process created by fork() and i use "-exec set follow-fork-mode child" before the fork() is called, but i found it doesn't work at all, it can't hit any break point in child process. Then i use the simple program in #511 to test, not work too.The answer in #511 doesn't work too.( "setupCommands": [
{"text": "-gdb-set follow-fork-mode child"}
])
simple program that i use to test(see #511):
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
int main()
{
pid_t pid = fork();
if (pid != 0) {
printf("Main process\n");
} else {
printf("Forked process\n");
}
return 0;
}
launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
build task:
{
"version": "2.0.0",
"tasks": [
{
"label": "forktest compile task",
"type": "shell",
"command": "gcc -g forktest.c",
"group": {
"kind": "build",
"isDefault": true
}
}
],
}
here is debug console output:
=thread-group-added,id="i1"
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-110.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
Loaded '/lib64/libc.so.6'. Symbols loaded.
Execute debugger commands using "-exec ", for example "-exec info registers" will list registers in use (when GDB is the debugger)
-exec set follow-fork-mode child
=cmd-param-changed,param="follow-fork-mode",value="child"
=thread-group-added,id="i2"
[New process 24823]
[Switching to process 24823]
The text was updated successfully, but these errors were encountered: