mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-30 02:50:25 +08:00
* 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>
|
||||
|
||||
* mount.cc (usage): Fix typo in output.
|
||||
|
@ -32,14 +32,14 @@ CXX_FOR_TARGET:=$(CXX)
|
||||
|
||||
CFLAGS:=@CFLAGS@
|
||||
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
|
||||
|
||||
MINGW_INCLUDES:=$(MINGW_INCLUDES) $(w32api_include) -I$(updir)
|
||||
|
||||
libbfd:=${shell $(CC) -L$(bupdir2)/bfd --print-file-name=libbfd.a}
|
||||
libintl:=${shell $(CC) -L$(bupdir2)/intl --print-file-name=libintl.a}
|
||||
libbfd:=${shell $(CC) -B$(bupdir2)/bfd/ --print-file-name=libbfd.a}
|
||||
libintl:=${shell $(CC) -B$(bupdir2)/intl/ --print-file-name=libintl.a}
|
||||
build_dumper:=${shell test -r $(libbfd) && test -r ${libintl} && echo 1}
|
||||
|
||||
DUMPER_INCLUDES:=-I$(bupdir2)/bfd -I$(updir1)/include
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* 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.
|
||||
|
||||
@ -33,7 +33,9 @@ typedef __int64 longlong;
|
||||
|
||||
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",
|
||||
"compiler_path",
|
||||
"cxx_include_path",
|
||||
@ -63,7 +65,7 @@ struct
|
||||
const char *name;
|
||||
int missing_is_good;
|
||||
}
|
||||
common_apps[] =
|
||||
static common_apps[] =
|
||||
{
|
||||
{"bash", 0},
|
||||
{"cat", 0},
|
||||
@ -78,20 +80,20 @@ common_apps[] =
|
||||
{0, 0}
|
||||
};
|
||||
|
||||
int num_paths = 0, max_paths = 0;
|
||||
char **paths = 0;
|
||||
static int num_paths = 0, max_paths = 0;
|
||||
static char **paths = 0;
|
||||
|
||||
/*
|
||||
* keyeprint() is used to report failure modes
|
||||
*/
|
||||
int
|
||||
static int
|
||||
keyeprint (const char *name)
|
||||
{
|
||||
fprintf (stderr, "cygcheck: %s failed: %lu\n", name, GetLastError ());
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
add_path (char *s, int maxlen)
|
||||
{
|
||||
if (num_paths >= max_paths)
|
||||
@ -119,7 +121,7 @@ add_path (char *s, int maxlen)
|
||||
num_paths++;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
init_paths ()
|
||||
{
|
||||
char tmp[4000], *sl;
|
||||
@ -156,7 +158,7 @@ init_paths ()
|
||||
printf ("WARNING: PATH is not set at all!\n");
|
||||
}
|
||||
|
||||
char *
|
||||
static char *
|
||||
find_on_path (char *file, char *default_extension,
|
||||
int showall = 0, int search_sysdirs = 0)
|
||||
{
|
||||
@ -215,9 +217,9 @@ struct Did
|
||||
char *file;
|
||||
int state;
|
||||
};
|
||||
Did *did = 0;
|
||||
static Did *did = 0;
|
||||
|
||||
Did *
|
||||
static Did *
|
||||
already_did (char *file)
|
||||
{
|
||||
Did *d;
|
||||
@ -232,7 +234,7 @@ already_did (char *file)
|
||||
return d;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
get_word (HANDLE fh, int offset)
|
||||
{
|
||||
short rv;
|
||||
@ -248,7 +250,7 @@ get_word (HANDLE fh, int offset)
|
||||
return rv;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
get_dword (HANDLE fh, int offset)
|
||||
{
|
||||
int rv;
|
||||
@ -273,7 +275,7 @@ struct Section
|
||||
int pointer_to_raw_data;
|
||||
};
|
||||
|
||||
int
|
||||
static int
|
||||
rva_to_offset (int rva, char *sections, int nsections, int *sz)
|
||||
{
|
||||
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)
|
||||
static void
|
||||
@ -400,7 +402,7 @@ cygwin_info (HANDLE h)
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dll_info (const char *path, HANDLE fh, int lvl, int recurse)
|
||||
{
|
||||
DWORD junk;
|
||||
@ -511,7 +513,7 @@ dll_info (const char *path, HANDLE fh, int lvl, int recurse)
|
||||
cygwin_info (fh);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
track_down (char *file, char *suffix, int lvl)
|
||||
{
|
||||
if (file == NULL)
|
||||
@ -588,7 +590,7 @@ track_down (char *file, char *suffix, int lvl)
|
||||
keyeprint ("track_down: CloseHandle()");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
ls (char *f)
|
||||
{
|
||||
HANDLE h = CreateFile (f, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
|
||||
@ -610,7 +612,7 @@ ls (char *f)
|
||||
keyeprint ("ls: CloseHandle()");
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
cygcheck (char *app)
|
||||
{
|
||||
char *papp = find_on_path (app, (char *) ".exe", 1, 0);
|
||||
@ -645,7 +647,7 @@ struct RegInfo
|
||||
HKEY key;
|
||||
};
|
||||
|
||||
void
|
||||
static void
|
||||
show_reg (RegInfo * ri, int nest)
|
||||
{
|
||||
if (!ri)
|
||||
@ -657,7 +659,7 @@ show_reg (RegInfo * ri, int nest)
|
||||
printf ("%s\n", ri->name);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
|
||||
{
|
||||
RegInfo ri;
|
||||
@ -750,7 +752,7 @@ scan_registry (RegInfo * prev, HKEY hKey, char *name, int cygnus)
|
||||
free (subkey_name);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
dump_sysinfo ()
|
||||
{
|
||||
int i, j;
|
||||
@ -1131,7 +1133,7 @@ dump_sysinfo ()
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
check_keys ()
|
||||
{
|
||||
HANDLE h = CreateFileA ("CONIN$", GENERIC_READ | GENERIC_WRITE,
|
||||
@ -1215,18 +1217,20 @@ check_keys ()
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
usage ()
|
||||
static void
|
||||
usage (FILE *stream, int status)
|
||||
{
|
||||
fprintf (stderr, "Usage: cygcheck [OPTIONS] [program ...]\n");
|
||||
fprintf (stderr, " -c, --check-setup = check packages installed via setup.exe\n");
|
||||
fprintf (stderr, " -s, --sysinfo = system information (not with -k)\n");
|
||||
fprintf (stderr, " -v, --verbose = verbose output (indented) (for -s or programs)\n");
|
||||
fprintf (stderr, " -r, --registry = registry search (requires -s)\n");
|
||||
fprintf (stderr, " -k, --keycheck = perform a keyboard check session (not with -s)\n");
|
||||
fprintf (stderr, " -h, --help = give help about the info (not with -c)\n");
|
||||
fprintf (stderr, "You must at least give either -s or -k or a program name\n");
|
||||
exit (1);
|
||||
fprintf (stream, "\
|
||||
Usage: cygcheck [OPTIONS] [program ...]\n\
|
||||
-c, --check-setup check packages installed via setup.exe\n\
|
||||
-s, --sysinfo system information (not with -k)\n\
|
||||
-v, --verbose verbose output (indented) (for -s or programs)\n\
|
||||
-r, --registry registry search (requires -s)\n\
|
||||
-k, --keycheck perform a keyboard check session (not with -s)\n\
|
||||
-h, --help give help about the info (not with -c)\n\
|
||||
-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[] = {
|
||||
@ -1236,10 +1240,33 @@ struct option longopts[] = {
|
||||
{"verbose", no_argument, NULL, 'v'},
|
||||
{"keycheck", no_argument, NULL, 'k'},
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, 0, 'z'},
|
||||
{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
|
||||
main (int argc, char **argv)
|
||||
@ -1267,17 +1294,24 @@ main (int argc, char **argv)
|
||||
case 'h':
|
||||
givehelp = 1;
|
||||
break;
|
||||
case 'V':
|
||||
print_version ();
|
||||
exit (0);
|
||||
default:
|
||||
usage ();
|
||||
usage (stderr, 1);
|
||||
/*NOTREACHED*/}
|
||||
argc -= optind;
|
||||
argv += optind;
|
||||
|
||||
if (argc == 0 && !sysinfo && !keycheck && !check_setup)
|
||||
usage ();
|
||||
if (argc == 0 && !sysinfo && !keycheck && !check_setup) {
|
||||
if (givehelp)
|
||||
usage (stdout, 0);
|
||||
else
|
||||
usage (stderr, 1);
|
||||
}
|
||||
|
||||
if ((check_setup || sysinfo) && keycheck)
|
||||
usage ();
|
||||
usage (stderr, 1);
|
||||
|
||||
if (keycheck)
|
||||
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
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@ -22,47 +22,47 @@
|
||||
#include <windows.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
const char *help_text = "
|
||||
Usage: ssp [options] low_pc high_pc command...
|
||||
|
||||
The SSP is a `single-step profiler' - it uses the debug API to
|
||||
single-step your program, noting *everything* your program runs, not
|
||||
just random places hit by random timer interrupts. You must specify
|
||||
the range of EIP values to profile. For example, you could profile
|
||||
just a function, or just a line of code, or the whole thing.
|
||||
Use \"objdump -h\" to find the start of .text and the section following
|
||||
it; this is what you want.
|
||||
|
||||
There are many options to ssp. Since step-profiling makes your
|
||||
program run about 1,000 times slower than normal, it's best to
|
||||
understand all the options so that you can narrow down the parts
|
||||
of your program you need to single-step.
|
||||
|
||||
-v = verbose messages about debug events.
|
||||
|
||||
-d, -e = disable/enable single-stepping by default. Use
|
||||
OutputDebugString (\"ssp on\") to enable stepping, or \"ssp off\" to
|
||||
disable it. Thus, you can profile a single function call or block.
|
||||
|
||||
-t = trace every EIP value to a file TRACE.SSP. This gets big *fast*.
|
||||
Use \"addr2line -C -f -s -e foo.exe < trace.ssp > lines.ssp\" and then
|
||||
\"perl cvttrace\" to convert to symbolic traces.
|
||||
|
||||
-tc = trace every EIP value to the console. *Lots* slower.
|
||||
|
||||
-s = trace sub-threads too. Dangerous if you have race conditions.
|
||||
|
||||
-dll = enable dll profiling. A chart of relative DLL usage is
|
||||
produced after the run.
|
||||
|
||||
Examples:
|
||||
ssp 0x401000 0x403000 hello.exe
|
||||
ssp -v -d -dll 0x401000 0x440000 foo.exe
|
||||
|
||||
The output is a file \"gmon.out\" that can be read with gprof:
|
||||
gprof -b foo.exe
|
||||
|
||||
See ssp.txt in the cygwin sources for more information.
|
||||
const char *help_text = "\
|
||||
Usage: ssp [options] low_pc high_pc command...\n\
|
||||
\n\
|
||||
The SSP is a `single-step profiler' - it uses the debug API to\n\
|
||||
single-step your program, noting *everything* your program runs, not\n\
|
||||
just random places hit by random timer interrupts. You must specify\n\
|
||||
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.\n\
|
||||
Use \"objdump -h\" to find the start of .text and the section following\n\
|
||||
it; this is what you want.\n\
|
||||
\n\
|
||||
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\n\
|
||||
understand all the options so that you can narrow down the parts\n\
|
||||
of your program you need to single-step.\n\
|
||||
\n\
|
||||
-v = verbose messages about debug events.\n\
|
||||
\n\
|
||||
-d, -e = disable/enable single-stepping by default. Use\n\
|
||||
OutputDebugString (\"ssp on\") to enable stepping, or \"ssp off\" to\n\
|
||||
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*.\n\
|
||||
Use \"addr2line -C -f -s -e foo.exe < trace.ssp > lines.ssp\" and then\n\
|
||||
\"perl cvttrace\" to convert to symbolic traces.\n\
|
||||
\n\
|
||||
-tc = trace every EIP value to the console. *Lots* slower.\n\
|
||||
\n\
|
||||
-s = trace sub-threads too. Dangerous if you have race conditions.\n\
|
||||
\n\
|
||||
-dll = enable dll profiling. A chart of relative DLL usage is\n\
|
||||
produced after the run.\n\
|
||||
\n\
|
||||
Examples:\n\
|
||||
ssp 0x401000 0x403000 hello.exe\n\
|
||||
ssp -v -d -dll 0x401000 0x440000 foo.exe\n\
|
||||
\n\
|
||||
The output is a file \"gmon.out\" that can be read with gprof:\n\
|
||||
gprof -b foo.exe\n\
|
||||
\n\
|
||||
See ssp.txt in the cygwin sources for more information.\n\
|
||||
";
|
||||
#else
|
||||
char *help_text = "Usage: get cygwin!\n";
|
||||
|
Loading…
x
Reference in New Issue
Block a user