[Converted from Gnats 2480] I'm trying to debug a simple console program running under wine, the problem is that gdb freezes when wine creates a new process, I'm using follow-fork-mode child and detach-on-fork off, I've even tried to put a catchpoint at the fork and attach a new instance of gdb to the new process but it can't be attached even as root, thanks for you help. Release: gdb 6.7.1 Environment: Linux Manchester 2.6.21.1 #2 SMP Wed Jan 2 01:40:41 CET 2008 i686 GNU/Linux How-To-Repeat: gdb /usr/lib/wine/wine.bin set args CrackMe#1.exe (http://crackmes.de/users/br0ken/crackme1/) set follow-fork-mode child set detach-on-fork off run ---- trying with a catchpoint gdb /usr/lib/wine/wine.bin set args CrackMe#1.exe (http://crackmes.de/users/br0ken/crackme1/) catch fork ... $gdb attach PID
I confirm this behaviour. I didn't use wine, but with a lot of programs I tried gdb just hangs. I tried running a simple bash script but even that doesn't work. Sometimes Ctrl-C can stop the process so you can quit gdb, but other times gdb hangs and I have to kill it. If you use 'set print inferior-events', you see that the new process is started, but nothing happens.
My architecture is x86_64, by the way
Can someone confirm this still happens with the latest release? Seeing "set debug infrun 1" and "set debug lin-lwp 1" output would also be interesting.
TBH I don't know whether this issue is the same I'm experiencing. My problem appears to be that a forked (notice that I don't really not what syscall it uses) process doesn't freeze execution. If I Ctrl+C I can change inferiors and invoke 'continue'. Then this process forks another process, again I Ctrl+C and change the inferior, then when I run it it seems to finish and gets listed as 'null' in the inferior list. Then I can't continue the inferior, gdb says they have no threads. Funny thing is that I ran with the parameters you suggested. Before I ran it the second time I enabled logging, than the execution did not freeze! I'll copy it from the terminal and attach it.
Created attachment 4709 [details] gdb log with debugging info
> My problem appears to be that a forked (notice that I don't really not what syscall it uses) process doesn't freeze execution. Why would it? Did you have "catch fork"/"catch vfork" set? > If I Ctrl+C I can change > inferiors and invoke 'continue'. Then this process forks another process, again I Ctrl+C and change the inferior, Did you mean to use "set schedule-multiple on" to have all inferiors running simultaneously? > then when I run it it seems to finish and gets > listed as 'null' in the inferior list. If the inferior exited, then it will have no process id, hence <null>. > gdb says they have no threads. If the program isn't running anymore, it can't have any threads. I think most of your problems will go away with "set schedule-multiple on". (gdb) help set schedule-multiple Set mode for resuming threads of all processes. When on, execution commands (such as 'continue' or 'next') resume all threads of all processes. When off (which is the default), execution commands only resume the threads of the current process. The set of threads that are resumed is further refined by the scheduler-locking mode (see help set scheduler-locking).
Thanks for the tip on "set schedule-multiple on", I've been looking for a setting like this for quite some time in the documentation(s). But I anyway, trying gdb behavior seems erratic, not even running the child process. Also, unfortunately the option didn't fix the problem for me. > Did you have "catch fork"/"catch vfork" set? No. > If the inferior exited, then it will have no process id, hence <null>. Sure. >> gdb says they have no threads. > If the program isn't running anymore, it can't have any threads. I meant the other inferiors, 1 and 2, not the exited inferior 3. > I think most of your problems will go away with "set schedule-multiple on". I'll attach the session (should have done it before...). Thanks.
Forgot to attach "show version": (gdb) show version GNU gdb (GDB) 7.1-ubuntu Copyright (C) 2010 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 "i486-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb)
Created attachment 4710 [details] gdb with sched-multiple on
These issues don't seem to have anything to do with gdb freezing, and we're going quite offtopic by now. Please open a new bug report. While doing so, please paste the relevant bit of the GDB session in the bug report body, and describe what you think is wrong, so one doesn't have to open an attachment and guess to quickly analyse the issue. Thanks.
> Pedro Alves 2010-04-06 10:33:35 UTC > > Can someone confirm this still happens with the latest release? Seeing > "set debug infrun 1" and "set debug lin-lwp 1" output would also be > interesting. No feedback on the original reported freeze in a couple years, and given this was reported against 6.7, last we heard was in 2009, and we've had numerous fixes to the fork support since, I'm closing this. Thanks.
As above.