From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <drow@false.org>
Subject: Re: Refuse following the vfork parent if not letting the child run.
Date: Mon, 08 Jun 2009 15:03:00 -0000 [thread overview]
Message-ID: <200906081604.35800.pedro@codesourcery.com> (raw)
In-Reply-To: <200906081540.24300.pedro@codesourcery.com>
On Monday 08 June 2009 15:40:23, Pedro Alves wrote:
> > Is this actually a fork-following error, and we've stopped execution?
>
> I guess you could call it an error. We can't satisfy the users request,
> so we kind of stopped execution --- in reality, we're refusing to
> continue execution, as the inferior is stopped already.
How about?
(gdb) n
error resuming execution: can not resume the parent of a vfork in the
foreground if not letting the child run until it execs or exits, as
it would lock the terminal and hang the debug session.
0x00007ffff789aee4 in vfork () from /lib/libc.so.6
(gdb)
--
Pedro Alves
2009-06-08 Pedro Alves <pedro@codesourcery.com>
* linux-nat.c (linux_child_follow_fork): Refuse to follow a vfork
parent in the foreground if not letting the child run.
---
gdb/linux-nat.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)
Index: src/gdb/linux-nat.c
===================================================================
--- src.orig/gdb/linux-nat.c 2009-06-08 13:22:47.000000000 +0100
+++ src/gdb/linux-nat.c 2009-06-08 16:01:40.000000000 +0100
@@ -596,6 +596,21 @@ linux_child_follow_fork (struct target_o
if (!detach_fork)
linux_enable_event_reporting (pid_to_ptid (child_pid));
+ if (has_vforked
+ && (!target_is_async_p () || sync_execution)
+ && !(follow_child || detach_fork || sched_multi))
+ {
+ /* The parent stays blocked inside the vfork syscall until the
+ child execs or exits. If we don't let the child run, then
+ the parent stays blocked. If we're telling the parent to run
+ in the foreground, the user will not be able to ctrl-c to get
+ back the terminal, effectively hanging the debug session. */
+ fprintf_filtered (gdb_stderr, _("\
+error resuming execution: can not resume the parent of a vfork in the foreground if not letting \
+the child run until it execs or exits, as it would lock the terminal and hang the debug session.\n"));
+ return 1;
+ }
+
if (! follow_child)
{
/* We're already attached to the parent, by default. */
next prev parent reply other threads:[~2009-06-08 15:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-08 13:30 Pedro Alves
2009-06-08 14:31 ` Daniel Jacobowitz
2009-06-08 14:39 ` Pedro Alves
2009-06-08 15:03 ` Pedro Alves [this message]
2009-06-08 15:43 ` Daniel Jacobowitz
2009-06-08 17:44 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200906081604.35800.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox