* strace.cc (version): New global variable.
(usage): Accomodate stdout output. (print_version): New function.
This commit is contained in:
parent
f7a7cc9067
commit
ba692ae9c0
@ -1,3 +1,9 @@
|
|||||||
|
2002-06-05 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
|
||||||
|
* strace.cc (version): New global variable.
|
||||||
|
(usage): Accomodate stdout output.
|
||||||
|
(print_version): New function.
|
||||||
|
|
||||||
2002-06-03 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
2002-06-03 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
|
||||||
* ssp.c (version): New global variable.
|
* ssp.c (version): New global variable.
|
||||||
|
@ -35,7 +35,7 @@ int _impure_ptr;
|
|||||||
#define alloca __builtin_alloca
|
#define alloca __builtin_alloca
|
||||||
|
|
||||||
// Version string.
|
// Version string.
|
||||||
static const char *version_string = "@(#)strace V1.0, Copyright (C) 2001, 2002 Red Hat Inc., " __DATE__ "\n";
|
static const char version[] = "$Revision$";
|
||||||
|
|
||||||
static const char *pgm;
|
static const char *pgm;
|
||||||
static int forkdebug = 1;
|
static int forkdebug = 1;
|
||||||
@ -782,25 +782,27 @@ parse_mask (const char *ms, char **endptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
usage ()
|
usage (FILE *where = stderr)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "\
|
fprintf (where, "\
|
||||||
Usage: strace [OPTIONS] <command-line>\n\
|
Usage: %s [OPTIONS] <command-line>\n\
|
||||||
-b, --buffer-size=SIZE set size of output file buffer\n\
|
-b, --buffer-size=SIZE set size of output file buffer\n\
|
||||||
-d, --no-delta don't display the delta-t microsecond timestamp\n\
|
-d, --no-delta don't display the delta-t microsecond timestamp\n\
|
||||||
-f, --trace-children trace child processes (toggle - default true)\n\
|
-f, --trace-children trace child processes (toggle - default true)\n\
|
||||||
-h, --help display this help info\n\
|
-h, --help output usage information and exit\n\
|
||||||
-m, --mask=MASK set message filter mask\n\
|
-m, --mask=MASK set message filter mask\n\
|
||||||
-o, --output=FILENAME set output file to FILENAME\n\
|
-o, --output=FILENAME set output file to FILENAME\n\
|
||||||
-p, --pid=n attach to executing program with cygwin pid n\n\
|
-p, --pid=n attach to executing program with cygwin pid n\n\
|
||||||
-n, --crack-error-numbers output descriptive text instead of error\n\
|
-n, --crack-error-numbers output descriptive text instead of error\n\
|
||||||
numbers for Windows errors\n\
|
numbers for Windows errors\n\
|
||||||
-S, --flush-period=PERIOD flush buffered strace output every PERIOD secs\n\
|
-S, --flush-period=PERIOD flush buffered strace output every PERIOD secs\n\
|
||||||
-t, --timestamp use an absolute hh:mm:ss timestamp insted of the\n\
|
-t, --timestamp use an absolute hh:mm:ss timestamp insted of \n\
|
||||||
default microsecond timestamp. Implies -d\n\
|
the default microsecond timestamp. Implies -d\n\
|
||||||
-v, --version display version info\n\
|
-v, --version output version information and exit\n\
|
||||||
-w, --new-window spawn program under test in a new window\n\
|
-w, --new-window spawn program under test in a new window\n\
|
||||||
\n\
|
\n", pgm);
|
||||||
|
if ( where == stdout)
|
||||||
|
fprintf (stdout, "\
|
||||||
MASK can be any combination of the following mnemonics and/or hex values\n\
|
MASK can be any combination of the following mnemonics and/or hex values\n\
|
||||||
(0x is optional). Combine masks with '+' or ',' like so:\n\
|
(0x is optional). Combine masks with '+' or ',' like so:\n\
|
||||||
\n\
|
\n\
|
||||||
@ -822,17 +824,14 @@ Usage: strace [OPTIONS] <command-line>\n\
|
|||||||
sigp 0x00800 (_STRACE_SIGP) Trace signal and process handling.\n\
|
sigp 0x00800 (_STRACE_SIGP) Trace signal and process handling.\n\
|
||||||
minimal 0x01000 (_STRACE_MINIMAL) Very minimal strace output.\n\
|
minimal 0x01000 (_STRACE_MINIMAL) Very minimal strace output.\n\
|
||||||
exitdump 0x04000 (_STRACE_EXITDUMP) Dump strace cache on exit.\n\
|
exitdump 0x04000 (_STRACE_EXITDUMP) Dump strace cache on exit.\n\
|
||||||
system 0x08000 (_STRACE_SYSTEM) Serious error which goes to console and log.\n\
|
system 0x08000 (_STRACE_SYSTEM) Serious error; goes to console and log.\n\
|
||||||
nomutex 0x10000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.\n\
|
nomutex 0x10000 (_STRACE_NOMUTEX) Don't use mutex for synchronization.\n\
|
||||||
malloc 0x20000 (_STRACE_MALLOC) Trace malloc calls.\n\
|
malloc 0x20000 (_STRACE_MALLOC) Trace malloc calls.\n\
|
||||||
thread 0x40000 (_STRACE_THREAD) Thread-locking calls.\n\
|
thread 0x40000 (_STRACE_THREAD) Thread-locking calls.\n\
|
||||||
");
|
");
|
||||||
}
|
if (where == stderr)
|
||||||
|
fprintf (stderr, "Try '%s --help' for more information.\n", pgm);
|
||||||
static void
|
exit (where == stderr ? 1 : 0 );
|
||||||
version ()
|
|
||||||
{
|
|
||||||
fputs (version_string + 4, stderr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
@ -854,6 +853,28 @@ struct option longopts[] = {
|
|||||||
|
|
||||||
static const char *const opts = "b:dhfm:no:p:S:tuvw";
|
static const char *const opts = "b:dhfm:no:p:S:tuvw";
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_version ()
|
||||||
|
{
|
||||||
|
const char *v = strchr (version, ':');
|
||||||
|
int len;
|
||||||
|
if (!v)
|
||||||
|
{
|
||||||
|
v = "?";
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v += 2;
|
||||||
|
len = strchr (v, ' ') - v;
|
||||||
|
}
|
||||||
|
printf ("\
|
||||||
|
%s (cygwin) %.*s\n\
|
||||||
|
System Trace\n\
|
||||||
|
Copyright 2000, 2001, 2002 Red Hat, Inc.\n\
|
||||||
|
Compiled on %s", pgm, len, v, __DATE__);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
@ -881,8 +902,7 @@ main (int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
// Print help and exit
|
// Print help and exit
|
||||||
usage ();
|
usage (stdout);
|
||||||
return 1;
|
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
{
|
{
|
||||||
@ -921,14 +941,17 @@ character #%d.\n", optarg, (int) (endptr - optarg), endptr);
|
|||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
// Print version info and exit
|
// Print version info and exit
|
||||||
version ();
|
print_version ();
|
||||||
return 1;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
new_window ^= 1;
|
new_window ^= 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( argv[optind] == NULL)
|
||||||
|
usage ();
|
||||||
|
|
||||||
if (!mask)
|
if (!mask)
|
||||||
mask = 1;
|
mask = 1;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user