public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/14808] New: vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not)
@ 2012-11-05 19:06 palves at redhat dot com
  2014-05-01 21:08 ` [Bug gdb/14808] " donbreazeal at gmail dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: palves at redhat dot com @ 2012-11-05 19:06 UTC (permalink / raw)
  To: gdb-prs

http://sourceware.org/bugzilla/show_bug.cgi?id=14808

             Bug #: 14808
           Summary: vfork, follow-fork child, detach-on-fork on, child
                    execs, parent changes executable too (but should not)
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
        AssignedTo: unassigned@sourceware.org
        ReportedBy: palves@redhat.com
    Classification: Unclassified


$ ./gdb -q ./testsuite/gdb.base/foll-vfork -ex "cd testsuite" -ex "set
follow-fork child" -ex "set detach-on-fork on"

(gdb) r
Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/foll-vfork 
[New process 2497]
I'm the child!
I'm the proud parent of child #2497!
process 2497 is executing new program:
/home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/vforked-prog
Hello from vforked-prog...
[Inferior 2 (process 2497) exited normally]
(gdb) info inferiors 
  Num  Description       Executable        
* 2    <null>           
/home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/vforked-prog 
  1    <null>           
/home/pedro/gdb/mygit/build/gdb/testsuite/gdb.base/vforked-prog 
                                                                           
^^^^^^^^^^^^
(gdb) 

Note how inferior 1 (the parent)'s executable changed to "vforked-prog" too... 
Only the child's executable should have changed in reaction to the exec.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/14808] vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not)
  2012-11-05 19:06 [Bug gdb/14808] New: vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not) palves at redhat dot com
@ 2014-05-01 21:08 ` donbreazeal at gmail dot com
  2014-05-01 21:16 ` donbreazeal at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: donbreazeal at gmail dot com @ 2014-05-01 21:08 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=14808

Don Breazeal <donbreazeal at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |donbreazeal at gmail dot com

--- Comment #1 from Don Breazeal <donbreazeal at gmail dot com> ---
Shouldn't inferior #1 be deleted from the list, since it has been detached?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/14808] vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not)
  2012-11-05 19:06 [Bug gdb/14808] New: vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not) palves at redhat dot com
  2014-05-01 21:08 ` [Bug gdb/14808] " donbreazeal at gmail dot com
@ 2014-05-01 21:16 ` donbreazeal at gmail dot com
  2014-05-06 22:18 ` donbreazeal at gmail dot com
  2014-06-04 18:17 ` donbreazeal at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: donbreazeal at gmail dot com @ 2014-05-01 21:16 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=14808

--- Comment #2 from Don Breazeal <donbreazeal at gmail dot com> ---
There's a relevant comment in linux-nat.c:linux_child_follow_fork, right after
the parent is detached:

      else if (detach_fork)
        target_detach (NULL, 0);

      /* Note that the detach above makes PARENT_INF dangling.  */

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/14808] vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not)
  2012-11-05 19:06 [Bug gdb/14808] New: vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not) palves at redhat dot com
  2014-05-01 21:08 ` [Bug gdb/14808] " donbreazeal at gmail dot com
  2014-05-01 21:16 ` donbreazeal at gmail dot com
@ 2014-05-06 22:18 ` donbreazeal at gmail dot com
  2014-06-04 18:17 ` donbreazeal at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: donbreazeal at gmail dot com @ 2014-05-06 22:18 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=14808

Don Breazeal <donbreazeal at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at sourceware dot org   |donbreazeal at gmail dot com

--- Comment #3 from Don Breazeal <donbreazeal at gmail dot com> ---
Taking this one.  I've concluded my previous two comments were misguided, and
the inferior should stay around so the user can switch to it and run it later
in the debug session.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug gdb/14808] vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not)
  2012-11-05 19:06 [Bug gdb/14808] New: vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not) palves at redhat dot com
                   ` (2 preceding siblings ...)
  2014-05-06 22:18 ` donbreazeal at gmail dot com
@ 2014-06-04 18:17 ` donbreazeal at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: donbreazeal at gmail dot com @ 2014-06-04 18:17 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=14808

--- Comment #4 from Don Breazeal <donbreazeal at gmail dot com> ---
I posted a patch fixing addressing this issue:

https://sourceware.org/ml/gdb-patches/2014-05/msg00674.html

However there is an open question about whether the detached-on-fork inferior
should be displayed in the list at all.  Most recent discussion of that issue
is here:

https://sourceware.org/ml/gdb/2014-05/msg00026.html

My conclusion was that the detached-on-fork inferior should be in the list, so
that the user has the option switch to that inferior and run it.  Here are a
couple of relevant passages from the GDB manual
(https://sourceware.org/gdb/onlinedocs/gdb/Inferiors-and-Programs.html)

"Inferiors may be created before a process runs, and may be retained after a
process exits."

"After the successful completion of a command such as detach, detach inferiors,
kill or kill inferiors, or after a normal process exit, the inferior is still
valid and listed with info inferiors, ready to be restarted."

However, I don't know the history of this feature, so my conclusion may be off
base.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-04 18:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 19:06 [Bug gdb/14808] New: vfork, follow-fork child, detach-on-fork on, child execs, parent changes executable too (but should not) palves at redhat dot com
2014-05-01 21:08 ` [Bug gdb/14808] " donbreazeal at gmail dot com
2014-05-01 21:16 ` donbreazeal at gmail dot com
2014-05-06 22:18 ` donbreazeal at gmail dot com
2014-06-04 18:17 ` donbreazeal at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).