mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-30 02:50:25 +08:00
* strace.cc (main): New option '-w'. Start traced process in separate
window. New option '-S x'. Flush buffered output every x seconds. (create_child): Start child process in new window, when requested. When requested, periodically flush debugging output.
This commit is contained in:
parent
7cf5e175fe
commit
86fbc3d90b
@ -1,3 +1,10 @@
|
|||||||
|
2001-11-04 Egor Duda <deo@logos-m.ru>
|
||||||
|
|
||||||
|
* strace.cc (main): New option '-w'. Start traced process in separate
|
||||||
|
window. New option '-S x'. Flush buffered output every x seconds.
|
||||||
|
(create_child): Start child process in new window, when requested.
|
||||||
|
When requested, periodically flush debugging output.
|
||||||
|
|
||||||
2001-10-24 Christopher Faylor <cgf@redhat.com>
|
2001-10-24 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* Makefile.in: Remove EXEEXT consideration. We always need .exe
|
* Makefile.in: Remove EXEEXT consideration. We always need .exe
|
||||||
|
@ -16,6 +16,7 @@ details. */
|
|||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <time.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "sys/strace.h"
|
#include "sys/strace.h"
|
||||||
@ -36,6 +37,8 @@ static int usecs = 1;
|
|||||||
static int delta = 1;
|
static int delta = 1;
|
||||||
static int hhmmss = 0;
|
static int hhmmss = 0;
|
||||||
static int bufsize = 0;
|
static int bufsize = 0;
|
||||||
|
static int new_window = 0;
|
||||||
|
static long flush_period = 0;
|
||||||
|
|
||||||
static BOOL close_handle (HANDLE h, DWORD ok);
|
static BOOL close_handle (HANDLE h, DWORD ok);
|
||||||
|
|
||||||
@ -264,8 +267,8 @@ create_child (char **argv)
|
|||||||
/* cygwin32_conv_to_win32_path (exec_file, real_path); */
|
/* cygwin32_conv_to_win32_path (exec_file, real_path); */
|
||||||
|
|
||||||
flags = forkdebug ? 0 : DEBUG_ONLY_THIS_PROCESS;
|
flags = forkdebug ? 0 : DEBUG_ONLY_THIS_PROCESS;
|
||||||
flags |=
|
flags |= CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
|
||||||
/*CREATE_NEW_PROCESS_GROUP | */ CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
|
flags |= (new_window ? CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP : 0);
|
||||||
|
|
||||||
make_command_line (one_line, argv);
|
make_command_line (one_line, argv);
|
||||||
|
|
||||||
@ -524,11 +527,22 @@ proc_child (unsigned mask, FILE *ofile)
|
|||||||
{
|
{
|
||||||
DEBUG_EVENT ev;
|
DEBUG_EVENT ev;
|
||||||
int processes = 0;
|
int processes = 0;
|
||||||
|
time_t cur_time, last_time;
|
||||||
|
|
||||||
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
|
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
|
||||||
|
last_time = time (NULL);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
BOOL debug_event = WaitForDebugEvent (&ev, 1000);
|
BOOL debug_event = WaitForDebugEvent (&ev, 1000);
|
||||||
DWORD status = DBG_CONTINUE;
|
DWORD status = DBG_CONTINUE;
|
||||||
|
|
||||||
|
if (bufsize && flush_period > 0 &&
|
||||||
|
(cur_time = time (NULL)) >= last_time + flush_period)
|
||||||
|
{
|
||||||
|
last_time = cur_time;
|
||||||
|
fflush (ofile);
|
||||||
|
}
|
||||||
|
|
||||||
if (!debug_event)
|
if (!debug_event)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -600,7 +614,7 @@ main (int argc, char **argv)
|
|||||||
else
|
else
|
||||||
pgm++;
|
pgm++;
|
||||||
|
|
||||||
while ((opt = getopt (argc, argv, "b:m:o:fndut")) != EOF)
|
while ((opt = getopt (argc, argv, "b:m:o:fndutwS:")) != EOF)
|
||||||
switch (opt)
|
switch (opt)
|
||||||
{
|
{
|
||||||
case 'f':
|
case 'f':
|
||||||
@ -630,6 +644,13 @@ main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'u':
|
case 'u':
|
||||||
usecs ^= 1;
|
usecs ^= 1;
|
||||||
|
break;
|
||||||
|
case 'w':
|
||||||
|
new_window ^= 1;
|
||||||
|
break;
|
||||||
|
case 'S':
|
||||||
|
flush_period = strtol (optarg, NULL, 10);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mask)
|
if (!mask)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user