From: a2782@dis.ulpgc.es
To: gdb@sources.redhat.com
Subject: Pipe question
Date: Wed, 04 Dec 2002 05:39:00 -0000 [thread overview]
Message-ID: <200212041436.gB4EaaP03992@siglo21.dis.ulpgc.es> (raw)
Hi to all!
First, I want to thank Eli Zaretskii, Jim Blandy, Kris Warkentin, Keith
Seitz and Joel Brobecker for their advices about communication with GDB.
Now, a question. I\'m doing this:
pipe(togdb); pipe(fromgdb);
if (fork() != 0)
{
close(togdb[0]);
close(fromgdb[1]);
}
else
{
/* This is necessary for my GUI */
int Max = sysconf(_SC_OPEN_MAX);
for (int i=STDERR_FILENO+1;i<Max;i++)
fcntl(i, F_SETFD, FD_CLOEXEC);
close(togdb[1]);
dup2(togdb[0],0);
close(fromgdb[0]);
dup2(fromgdb[1],1);
system(strcat(\"gdb --quiet -f \",executable));
}
When I want to give GDB a command, I write in togdb[1]; when I want to
parse GDB output, I read from fromgdb[0]. All is working. (Note: system
() is exec()).
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. Could
anybody tell me what instructions I have to put in the end of the
program in order to finish it succesfully (without kill)? I suppose
it\'s something related with the pipes...
Thanks in advance.
next reply other threads:[~2002-12-04 13:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-04 5:39 a2782 [this message]
2002-12-04 8:18 ` Eli Zaretskii
2002-12-04 8:45 Michael Elizabeth Chastain
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=200212041436.gB4EaaP03992@siglo21.dis.ulpgc.es \
--to=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