This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
CYGWIN file input redirection
- From: Steve Mucci <samsurfer117 at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 26 Sep 2016 08:43:36 -0400
- Subject: CYGWIN file input redirection
- Authentication-results: sourceware.org; auth=none
Hello!
I'm an amateur security researcher, and I mainly work with Windows and
the MinGW/CYGWIN/GoW toolset.
I've found in my studies a confirmed bug in the CYGWIN version of gdb;
http://cygwin.com/ml/cygwin/1999-04/msg00308.html
It states that a command such as;
(gdb)run < input.txt
or
(gdb)args < input.txt
do not work.
I've heard that gdb on Windows creates processes with CreateProcess.
Fortunately from what I've found the STARTUPINFO structure contains
a field for standard input called;
HANDLE hStdInput;
Which would allow for directing standard input to I would assume
anything involving a handle.
Since I've also heard that CYGWIN handles the command line differently
than Linux, there are two files in particular that could be useful in solving
this problem located in the CYGWIN source.
target.c //For Linux command line
windows-nat.c //For Windows command line
Here are the MSDN pages for CreateProcess and STARTUPINFO;
https://msdn.microsoft.com/en-us/library/windows/desktop/ms682425(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/desktop/ms686331(v=vs.85).aspx
How can we fix this bug?