Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEgor Duda <deo@logos-m.ru>2001-11-04 15:57:55 +0300
committerEgor Duda <deo@logos-m.ru>2001-11-04 15:57:55 +0300
commit86fbc3d90be4aa7a039e3800e3bf0f9a36c2944a (patch)
tree201eec3e23e6aa8164552490ca62aed94dc8f4bf /winsup/utils
parent7cf5e175fe7594f07a2655cd8ec821c7803c5298 (diff)
* 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.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog7
-rw-r--r--winsup/utils/strace.cc27
2 files changed, 31 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index e52de1e3b..9df1877a9 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -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>
* Makefile.in: Remove EXEEXT consideration. We always need .exe
diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc
index 58547ed4a..bd68d4a98 100644
--- a/winsup/utils/strace.cc
+++ b/winsup/utils/strace.cc
@@ -16,6 +16,7 @@ details. */
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
+#include <time.h>
#include <windows.h>
#include <signal.h>
#include "sys/strace.h"
@@ -36,6 +37,8 @@ static int usecs = 1;
static int delta = 1;
static int hhmmss = 0;
static int bufsize = 0;
+static int new_window = 0;
+static long flush_period = 0;
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); */
flags = forkdebug ? 0 : DEBUG_ONLY_THIS_PROCESS;
- flags |=
- /*CREATE_NEW_PROCESS_GROUP | */ CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
+ flags |= CREATE_DEFAULT_ERROR_MODE | DEBUG_PROCESS;
+ flags |= (new_window ? CREATE_NEW_CONSOLE | CREATE_NEW_PROCESS_GROUP : 0);
make_command_line (one_line, argv);
@@ -524,11 +527,22 @@ proc_child (unsigned mask, FILE *ofile)
{
DEBUG_EVENT ev;
int processes = 0;
+ time_t cur_time, last_time;
+
SetThreadPriority (GetCurrentThread (), THREAD_PRIORITY_HIGHEST);
+ last_time = time (NULL);
while (1)
{
BOOL debug_event = WaitForDebugEvent (&ev, 1000);
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)
continue;
@@ -600,7 +614,7 @@ main (int argc, char **argv)
else
pgm++;
- while ((opt = getopt (argc, argv, "b:m:o:fndut")) != EOF)
+ while ((opt = getopt (argc, argv, "b:m:o:fndutwS:")) != EOF)
switch (opt)
{
case 'f':
@@ -630,6 +644,13 @@ main (int argc, char **argv)
break;
case 'u':
usecs ^= 1;
+ break;
+ case 'w':
+ new_window ^= 1;
+ break;
+ case 'S':
+ flush_period = strtol (optarg, NULL, 10);
+ break;
}
if (!mask)