* ssp.c (help_desk): Fix compiler warning. Christopher Faylor <cgf@redhat.com>
Change appropriate globals to statics throughout. * cygcheck.cc (usage): Simplify usage output. Generalize to allow use for help. (longopts): Add version option. (opts): Add 'V" version option. (print_version): New function. (main): Accommodate new version option. Accommodate usage parameter changes. Use usage to output help message. * Makefile.in (CXXFLAGS): Add override so that HAVE_DECL_GETOPT is defined. (libbfd): Use -B rather than -L so that bfd from build directory is correctly found. (libintl): Ditto.
This commit is contained in:
parent
e3c6baed8a
commit
67763c0ca2
|
@ -1,3 +1,27 @@
|
||||||
|
2002-02-27 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* ssp.c (help_desk): Fix compiler warning.
|
||||||
|
|
||||||
|
2002-02-27 Joshua Daniel Franklin <joshuadfranklin@yahoo.com>
|
||||||
|
Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
Change appropriate globals to statics throughout.
|
||||||
|
* cygcheck.cc (usage): Simplify usage output. Generalize to allow use
|
||||||
|
for help.
|
||||||
|
(longopts): Add version option.
|
||||||
|
(opts): Add 'V" version option.
|
||||||
|
(print_version): New function.
|
||||||
|
(main): Accommodate new version option. Accommodate usage parameter
|
||||||
|
changes. Use usage to output help message.
|
||||||
|
|
||||||
|
002-02-19 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* Makefile.in (CXXFLAGS): Add override so that HAVE_DECL_GETOPT is
|
||||||
|
defined.
|
||||||
|
(libbfd): Use -B rather than -L so that bfd from build directory is
|
||||||
|
correctly found.
|
||||||
|
(libintl): Ditto.
|
||||||
|
|
||||||
2002-02-15 Christopher Faylor <cgf@redhat.com>
|
2002-02-15 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* mount.cc (usage): Fix typo in output.
|
* mount.cc (usage): Fix typo in output.
|
||||||
|
|
|
@ -32,14 +32,14 @@ CXX_FOR_TARGET:=$(CXX)
|
||||||
|
|
||||||
CFLAGS:=@CFLAGS@
|
CFLAGS:=@CFLAGS@
|
||||||
CXXFLAGS:=@CXXFLAGS@
|
CXXFLAGS:=@CXXFLAGS@
|
||||||
CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
|
override CXXFLAGS+=-fno-exceptions -fno-rtti -DHAVE_DECL_GETOPT=0
|
||||||
|
|
||||||
include $(srcdir)/../Makefile.common
|
include $(srcdir)/../Makefile.common
|
||||||
|
|
||||||
MINGW_INCLUDES:=$(MINGW_INCLUDES) $(w32api_include) -I$(updir)
|
MINGW_INCLUDES:=$(MINGW_INCLUDES) $(w32api_include) -I$(updir)
|
||||||
|
|
||||||
libbfd:=${shell $(CC) -L$(bupdir2)/bfd --print-file-name=libbfd.a}
|
libbfd:=${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
|
||||||
libintl:=${shell $(CC) -L$(bupdir2)/intl --print-file-name=libintl.a}
|
libintl:=${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
|
||||||
build_dumper:=${shell test -r $(libbfd) && test -r ${libintl} && echo 1}
|
build_dumper:=${shell test -r $(libbfd) && test -r ${libintl} && echo 1}
|
||||||
|
|
||||||
DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
|
DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/* cygcheck.cc
|
/* cygcheck.cc
|
||||||
|
|
||||||
Copyright 1998, 1999, 2000, 2001 Red Hat, Inc.
|
Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
||||||
|
|
||||||
This file is part of Cygwin.
|
This file is part of Cygwin.
|
||||||
|
|
||||||
|
@ -33,7 +33,9 @@ typedef __int64 longlong;
|
||||||
|
|
||||||
void dump_setup (int, char **, bool);
|
void dump_setup (int, char **, bool);
|
||||||
|
|
||||||
const char *known_env_vars[] = {
|
static const char version[] = "$Revision$";
|
||||||
|
|
||||||
|
static const char *known_env_vars[] = {
|
||||||
"c_include_path",
|
"c_include_path",
|
||||||
"compiler_path",
|
"compiler_path",
|
||||||
"cxx_include_path",
|
"cxx_include_path",
|
||||||
|
@ -63,7 +65,7 @@ struct
|
||||||
const char *name;
|
const char *name;
|
||||||
int missing_is_good;
|
int missing_is_good;
|
||||||
}
|
}
|
||||||
common_apps[] =
|
static common_apps[] =
|
||||||
{
|
{
|
||||||
{"bash", 0},
|
{"bash", 0},
|
||||||
{"cat", 0},
|
{"cat", 0},
|
||||||
|
@ -78,20 +80,20 @@ common_apps[] =
|
||||||
{0, 0}
|
{0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
int num_paths = 0, max_paths = 0;
|
static int num_paths = 0, max_paths = 0;
|
||||||
char **paths = 0;
|
static char **paths = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* keyeprint() is used to report failure modes
|
* keyeprint() is used to report failure modes
|
||||||
*/
|
*/
|
||||||
int
|
static int
|
||||||
keyeprint (const char *name)
|
keyeprint (const char *name)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "cygcheck: %s failed: %lu\n", name, GetLastError ());
|
fprintf (stderr, "cygcheck: %s failed: %lu\n", name, GetLastError ());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
add_path (char *s, int maxlen)
|
add_path (char *s, int maxlen)
|
||||||
{
|
{
|
||||||
if (num_paths >= max_paths)
|
if (num_paths >= max_paths)
|
||||||
|
@ -119,7 +121,7 @@ add_path (char *s, int maxlen)
|
||||||
num_paths++;
|
num_paths++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
init_paths ()
|
init_paths ()
|
||||||
{
|
{
|
||||||
char tmp[4000], *sl;
|
char tmp[4000], *sl;
|
||||||
|
@ -156,7 +158,7 @@ init_paths ()
|
||||||
printf ("WARNING: PATH is not set at all!\n");
|
printf ("WARNING: PATH is not set at all!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
static char *
|
||||||
find_on_path (char *file, char *default_extension,
|
find_on_path (char *file, char *default_extension,
|
||||||
int showall = 0, int search_sysdirs = 0)
|
int showall = 0, int search_sysdirs = 0)
|
||||||
{
|
{
|
||||||
|
@ -215,9 +217,9 @@ struct Did
|
||||||
char *file;
|
char *file;
|
||||||
int state;
|
int state;
|
||||||
};
|
};
|
||||||
Did *did = 0;
|
static Did *did = 0;
|
||||||
|
|
||||||
Did *
|
static Did *
|
||||||
already_did (char *file)
|
already_did (char *file)
|
||||||
{
|
{
|
||||||
Did *d;
|
Did *d;
|
||||||
|
@ -232,7 +234,7 @@ already_did (char *file)
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
get_word (HANDLE fh, int offset)
|
get_word (HANDLE fh, int offset)
|
||||||
{
|
{
|
||||||
short rv;
|
short rv;
|
||||||
|
@ -248,7 +250,7 @@ get_word (HANDLE fh, int offset)
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
get_dword (HANDLE fh, int offset)
|
get_dword (HANDLE fh, int offset)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
|
@ -273,7 +275,7 @@ struct Section
|
||||||
int pointer_to_raw_data;
|
int pointer_to_raw_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
int
|
static int
|
||||||
rva_to_offset (int rva, char *sections, int nsections, int *sz)
|
rva_to_offset (int rva, char *sections, int nsections, int *sz)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -322,7 +324,7 @@ struct ImpDirectory
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void track_down (char *file, char *suffix, int lvl);
|
static void track_down (char *file, char *suffix, int lvl);
|
||||||
|
|
||||||
#define CYGPREFIX (sizeof ("%%% Cygwin ") - 1)
|
#define CYGPREFIX (sizeof ("%%% Cygwin ") - 1)
|
||||||
static void
|
static void
|
||||||
|
@ -400,7 +402,7 @@ cygwin_info (HANDLE h)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
dll_info (const char *path, HANDLE fh, int lvl, int recurse)
|
dll_info (const char *path, HANDLE fh, int lvl, int recurse)
|
||||||
{
|
{
|
||||||
DWORD junk;
|
DWORD junk;
|
||||||
|
@ -511,7 +513,7 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse)
|
||||||
cygwin_info (fh);
|
cygwin_info (fh);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
track_down (char *file, char *suffix, int lvl)
|
track_down (char *file, char *suffix, int lvl)
|
||||||
{
|
{
|
||||||
if (file == NULL)
|
if (file == NULL)
|
||||||
|
@ -588,7 +590,7 @@ track_down (char *file, char *suffix, int lvl)
|
||||||
keyeprint ("track_down: CloseHandle()");
|
keyeprint ("track_down: CloseHandle()");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
ls (char *f)
|
ls (char *f)
|
||||||
{
|
{
|
||||||
HANDLE h = CreateFile (f, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
HANDLE h = CreateFile (f, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||||
|
@ -610,7 +612,7 @@ ls (char *f)
|
||||||
keyeprint ("ls: CloseHandle()");
|
keyeprint ("ls: CloseHandle()");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
cygcheck (char *app)
|
cygcheck (char *app)
|
||||||
{
|
{
|
||||||
char *papp = find_on_path (app, (char *) ".exe", 1, 0);
|
char *papp = find_on_path (app, (char *) ".exe", 1, 0);
|
||||||
|
@ -645,7 +647,7 @@ struct RegInfo
|
||||||
HKEY key;
|
HKEY key;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
static void
|
||||||
show_reg (RegInfo * ri, int nest)
|
show_reg (RegInfo * ri, int nest)
|
||||||
{
|
{
|
||||||
if (!ri)
|
if (!ri)
|
||||||
|
@ -657,7 +659,7 @@ show_reg (RegInfo * ri, int nest)
|
||||||
printf ("%s\n", ri->name);
|
printf ("%s\n", ri->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
|
scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
|
||||||
{
|
{
|
||||||
RegInfo ri;
|
RegInfo ri;
|
||||||
|
@ -750,7 +752,7 @@ scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
|
||||||
free (subkey_name);
|
free (subkey_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
dump_sysinfo ()
|
dump_sysinfo ()
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
@ -1131,7 +1133,7 @@ dump_sysinfo ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
static int
|
||||||
check_keys ()
|
check_keys ()
|
||||||
{
|
{
|
||||||
HANDLE h = CreateFileA ("CONIN$", GENERIC_READ | GENERIC_WRITE,
|
HANDLE h = CreateFileA ("CONIN$", GENERIC_READ | GENERIC_WRITE,
|
||||||
|
@ -1215,18 +1217,20 @@ check_keys ()
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
usage ()
|
usage (FILE *stream, int status)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Usage: cygcheck [OPTIONS] [program ...]\n");
|
fprintf (stream, "\
|
||||||
fprintf (stderr, " -c, --check-setup = check packages installed via setup.exe\n");
|
Usage: cygcheck [OPTIONS] [program ...]\n\
|
||||||
fprintf (stderr, " -s, --sysinfo = system information (not with -k)\n");
|
-c, --check-setup check packages installed via setup.exe\n\
|
||||||
fprintf (stderr, " -v, --verbose = verbose output (indented) (for -s or programs)\n");
|
-s, --sysinfo system information (not with -k)\n\
|
||||||
fprintf (stderr, " -r, --registry = registry search (requires -s)\n");
|
-v, --verbose verbose output (indented) (for -s or programs)\n\
|
||||||
fprintf (stderr, " -k, --keycheck = perform a keyboard check session (not with -s)\n");
|
-r, --registry registry search (requires -s)\n\
|
||||||
fprintf (stderr, " -h, --help = give help about the info (not with -c)\n");
|
-k, --keycheck perform a keyboard check session (not with -s)\n\
|
||||||
fprintf (stderr, "You must at least give either -s or -k or a program name\n");
|
-h, --help give help about the info (not with -c)\n\
|
||||||
exit (1);
|
-V, --version output version information and exit\n\
|
||||||
|
You must at least give either -s or -k or a program name\n");
|
||||||
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct option longopts[] = {
|
struct option longopts[] = {
|
||||||
|
@ -1236,10 +1240,33 @@ struct option longopts[] = {
|
||||||
{"verbose", no_argument, NULL, 'v'},
|
{"verbose", no_argument, NULL, 'v'},
|
||||||
{"keycheck", no_argument, NULL, 'k'},
|
{"keycheck", no_argument, NULL, 'k'},
|
||||||
{"help", no_argument, NULL, 'h'},
|
{"help", no_argument, NULL, 'h'},
|
||||||
|
{"version", no_argument, 0, 'z'},
|
||||||
{0, no_argument, NULL, 0}
|
{0, no_argument, NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
char opts[] = "srvkhc";
|
static char opts[] = "chkrsvV";
|
||||||
|
|
||||||
|
static void
|
||||||
|
print_version ()
|
||||||
|
{
|
||||||
|
const char *v = strchr (version, ':');
|
||||||
|
int len;
|
||||||
|
if (!v)
|
||||||
|
{
|
||||||
|
v = "?";
|
||||||
|
len = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v += 2;
|
||||||
|
len = strchr (v, ' ') - v;
|
||||||
|
}
|
||||||
|
printf ("\
|
||||||
|
cygcheck version %.*s\n\
|
||||||
|
System Checker for Cygwin\n\
|
||||||
|
Copyright 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.\n\
|
||||||
|
Compiled on %s", len, v, __DATE__);
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
|
@ -1267,17 +1294,24 @@ main (int argc, char **argv)
|
||||||
case 'h':
|
case 'h':
|
||||||
givehelp = 1;
|
givehelp = 1;
|
||||||
break;
|
break;
|
||||||
|
case 'V':
|
||||||
|
print_version ();
|
||||||
|
exit (0);
|
||||||
default:
|
default:
|
||||||
usage ();
|
usage (stderr, 1);
|
||||||
/*NOTREACHED*/}
|
/*NOTREACHED*/}
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
if (argc == 0 && !sysinfo && !keycheck && !check_setup)
|
if (argc == 0 && !sysinfo && !keycheck && !check_setup) {
|
||||||
usage ();
|
if (givehelp)
|
||||||
|
usage (stdout, 0);
|
||||||
|
else
|
||||||
|
usage (stderr, 1);
|
||||||
|
}
|
||||||
|
|
||||||
if ((check_setup || sysinfo) && keycheck)
|
if ((check_setup || sysinfo) && keycheck)
|
||||||
usage ();
|
usage (stderr, 1);
|
||||||
|
|
||||||
if (keycheck)
|
if (keycheck)
|
||||||
return check_keys ();
|
return check_keys ();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2000, Red Hat, Inc.
|
* Copyright (c) 2000, 2001, 2002 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -22,47 +22,47 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
const char *help_text = "
|
const char *help_text = "\
|
||||||
Usage: ssp [options] low_pc high_pc command...
|
Usage: ssp [options] low_pc high_pc command...\n\
|
||||||
|
\n\
|
||||||
The SSP is a `single-step profiler' - it uses the debug API to
|
The SSP is a `single-step profiler' - it uses the debug API to\n\
|
||||||
single-step your program, noting *everything* your program runs, not
|
single-step your program, noting *everything* your program runs, not\n\
|
||||||
just random places hit by random timer interrupts. You must specify
|
just random places hit by random timer interrupts. You must specify\n\
|
||||||
the range of EIP values to profile. For example, you could profile
|
the range of EIP values to profile. For example, you could profile\n\
|
||||||
just a function, or just a line of code, or the whole thing.
|
just a function, or just a line of code, or the whole thing.\n\
|
||||||
Use \"objdump -h\" to find the start of .text and the section following
|
Use \"objdump -h\" to find the start of .text and the section following\n\
|
||||||
it; this is what you want.
|
it; this is what you want.\n\
|
||||||
|
\n\
|
||||||
There are many options to ssp. Since step-profiling makes your
|
There are many options to ssp. Since step-profiling makes your\n\
|
||||||
program run about 1,000 times slower than normal, it's best to
|
program run about 1,000 times slower than normal, it's best to\n\
|
||||||
understand all the options so that you can narrow down the parts
|
understand all the options so that you can narrow down the parts\n\
|
||||||
of your program you need to single-step.
|
of your program you need to single-step.\n\
|
||||||
|
\n\
|
||||||
-v = verbose messages about debug events.
|
-v = verbose messages about debug events.\n\
|
||||||
|
\n\
|
||||||
-d, -e = disable/enable single-stepping by default. Use
|
-d, -e = disable/enable single-stepping by default. Use\n\
|
||||||
OutputDebugString (\"ssp on\") to enable stepping, or \"ssp off\" to
|
OutputDebugString (\"ssp on\") to enable stepping, or \"ssp off\" to\n\
|
||||||
disable it. Thus, you can profile a single function call or block.
|
disable it. Thus, you can profile a single function call or block.\n\
|
||||||
|
\n\
|
||||||
-t = trace every EIP value to a file TRACE.SSP. This gets big *fast*.
|
-t = trace every EIP value to a file TRACE.SSP. This gets big *fast*.\n\
|
||||||
Use \"addr2line -C -f -s -e foo.exe < trace.ssp > lines.ssp\" and then
|
Use \"addr2line -C -f -s -e foo.exe < trace.ssp > lines.ssp\" and then\n\
|
||||||
\"perl cvttrace\" to convert to symbolic traces.
|
\"perl cvttrace\" to convert to symbolic traces.\n\
|
||||||
|
\n\
|
||||||
-tc = trace every EIP value to the console. *Lots* slower.
|
-tc = trace every EIP value to the console. *Lots* slower.\n\
|
||||||
|
\n\
|
||||||
-s = trace sub-threads too. Dangerous if you have race conditions.
|
-s = trace sub-threads too. Dangerous if you have race conditions.\n\
|
||||||
|
\n\
|
||||||
-dll = enable dll profiling. A chart of relative DLL usage is
|
-dll = enable dll profiling. A chart of relative DLL usage is\n\
|
||||||
produced after the run.
|
produced after the run.\n\
|
||||||
|
\n\
|
||||||
Examples:
|
Examples:\n\
|
||||||
ssp 0x401000 0x403000 hello.exe
|
ssp 0x401000 0x403000 hello.exe\n\
|
||||||
ssp -v -d -dll 0x401000 0x440000 foo.exe
|
ssp -v -d -dll 0x401000 0x440000 foo.exe\n\
|
||||||
|
\n\
|
||||||
The output is a file \"gmon.out\" that can be read with gprof:
|
The output is a file \"gmon.out\" that can be read with gprof:\n\
|
||||||
gprof -b foo.exe
|
gprof -b foo.exe\n\
|
||||||
|
\n\
|
||||||
See ssp.txt in the cygwin sources for more information.
|
See ssp.txt in the cygwin sources for more information.\n\
|
||||||
";
|
";
|
||||||
#else
|
#else
|
||||||
char *help_text = "Usage: get cygwin!\n";
|
char *help_text = "Usage: get cygwin!\n";
|
||||||
|
|
Loading…
Reference in New Issue