delorie.com/djgpp/doc/libc/libc_653.html | search |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
#include <debug/redir.h> int redir_to_child (cmdline_t *cmd); |
For the rationale and general description of the debugger redirection issue, see redir_debug_init.
This function redirects all 3 standard streams so that they point to the
files/devices where the child (a.k.a. debuggee) process connected
them. All three standard handles point to the console device by
default, but this could be changed, either because the command line for
the child requested redirection, like in `prog > foo', or because
the child program itself redirected one of its standard handles
e.g. with a call to dup2
.
redir_to_child
uses information stored in the cmdline_t
variable pointed to by the cmd argument to redirect the standard
streams as appropriate for the debuggee, while saving the original
debugger's handles to be restored by redir_to_debugger
.
The function returns zero in case of success, -1 in case of failure. Failure usually means the process has run out of available file handles.
ANSI/ISO C | No |
POSIX | No |
errno = 0; if (redir_to_child (&child_cmd) == -1) { redir_to_debugger (&child_cmd); error ("Cannot redirect standard handles for program: %s.", strerror (errno)); } |
webmaster | delorie software privacy |
Copyright © 2004 | Updated Apr 2004 |