Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Michael Elizabeth Chastain <mec@shout.net>
To: a2782@dis.ulpgc.es
Cc: gdb@sources.redhat.com
Subject: Re: Pipe question
Date: Wed, 04 Dec 2002 08:45:00 -0000	[thread overview]
Message-ID: <200212041644.gB4GigY20676@duracef.shout.net> (raw)

Good morning,

> But when I close the program, I only write \"quit\\n\" to togdb[1]. This 
> causes that the program doesn\'t end properly (GDB, which is the child 
> process, ends well). I have to go and type \"kill\" in a console.

Try running gdb directly and starting up an inferior process (child process).
Then type "quit <CR>" on the command line and you will see what is happening:

  (gdb) quit
  The program is running.  Exit anyway? (y or n)

At this point gdb is still running and the inferior process still exists.
Your program is probably closing the pipe and killing gdb at this point
and that leaves the inferior process.

> Could anybody tell me what instructions I have to put in the end of the 
> program in order to finish it succesfully (without kill)?

Write a "y\n" down the pipe.  Then gdb will take care of killing the
inferior process.

Note that gdb will ask the question only if it has an inferior process running,
so your program has to parse gdb's output to see if it is asking the
question.  Or you may know for sure that there is always an inferior process.
Or you could just slam a "y\n" down the pipe unconditionally; if gdb does not
ask the question, it won't be alive to read the "y\n".  But that would
be crude.

Hope this helps,

Michael C


             reply	other threads:[~2002-12-04 16:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-04  8:45 Michael Elizabeth Chastain [this message]
2002-12-04 13:27 ` Pipe question (mmm) a2782
2002-12-05 10:56   ` Stanley Gambarin
     [not found]   ` <02Dec5.103736pst.119043@gateway.apogee.com>
2002-12-06  8:58     ` a2782
  -- strict thread matches above, loose matches on Subject: below --
2002-12-04  5:39 Pipe question a2782
2002-12-04  8:18 ` Eli Zaretskii

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=200212041644.gB4GigY20676@duracef.shout.net \
    --to=mec@shout.net \
    --cc=a2782@dis.ulpgc.es \
    --cc=gdb@sources.redhat.com \
    /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