* dumper.cc (main): Change command-line arguments format to be

similar to gdb. Allow adding error_start=x:\path\to\dumper.exe to
CYGWIN environment variable to perform core dumping in case of
program crash.
(usage): Ditto.
This commit is contained in:
Egor Duda 2001-09-09 13:18:51 +00:00
parent d969111291
commit 92ef5188af
2 changed files with 39 additions and 22 deletions

View File

@ -1,3 +1,11 @@
2001-09-09 Egor Duda <deo@logos-m.ru>
* dumper.cc (main): Change command-line arguments format to be
similar to gdb. Allow adding error_start=x:\path\to\dumper.exe to
CYGWIN environment variable to perform core dumping in case of
program crash.
(usage): Ditto.
Wed Sep 5 22:37:21 2001 Christopher Faylor <cgf@cygnus.com> Wed Sep 5 22:37:21 2001 Christopher Faylor <cgf@cygnus.com>
* Makefile.in (dumper): Change logic for libbfd and libintl so that * Makefile.in (dumper): Change logic for libbfd and libintl so that

View File

@ -36,9 +36,9 @@ __attribute__ ((packed))
#endif #endif
note_header; note_header;
BOOL verbose = FALSE; BOOL verbose = FALSE;
int deb_printf (const char *format,...) int deb_printf (const char *format,...)
{ {
if (!verbose) if (!verbose)
return 0; return 0;
@ -768,10 +768,12 @@ dumper::write_core_dump ()
static void static void
usage () usage ()
{ {
fprintf (stderr, "Usage: dumper [-d] [-c filename] pid\n"); fprintf (stderr, "Usage: dumper [options] filename pid\n");
fprintf (stderr, "-c filename -- dump core to filename.core\n"); fprintf (stderr, "filename -- dump core to filename.core\n");
fprintf (stderr, "-d -- print some debugging info while dumping\n"); fprintf (stderr, "pid -- win32-pid of process to dump\n\n");
fprintf (stderr, "pid -- win32-pid of process to dump\n"); fprintf (stderr, "Possible options are:\n");
fprintf (stderr, "-d -- be verbose while dumping\n");
fprintf (stderr, "-q -- be quite while dumping (default)\n");
} }
int int
@ -780,23 +782,38 @@ main (int argc, char **argv)
int opt; int opt;
const char *p = ""; const char *p = "";
DWORD pid; DWORD pid;
char win32_name [MAX_PATH];
while ((opt = getopt (argc, argv, "dc:")) != EOF) while ((opt = getopt (argc, argv, "dq")) != EOF)
switch (opt) switch (opt)
{ {
case 'd': case 'd':
verbose = TRUE; verbose = TRUE;
break; break;
case 'c': case 'q':
char win32_name[MAX_PATH]; verbose = FALSE;
cygwin_conv_to_win32_path (optarg, win32_name); break;
if ((p = strrchr (win32_name, '\\'))) default:
p++; usage ();
else
p = win32_name;
break; break;
} }
if (argv && *(argv + optind) && *(argv + optind +1))
{
*win32_name = '\0';
cygwin_conv_to_win32_path (*(argv + optind), win32_name);
if ((p = strrchr (win32_name, '\\')))
p++;
else
p = win32_name;
pid = atoi (*(argv + optind + 1));
}
else
{
usage ();
return -1;
}
char *core_file = (char *) malloc (strlen (p) + sizeof (".core")); char *core_file = (char *) malloc (strlen (p) + sizeof (".core"));
if (!core_file) if (!core_file)
{ {
@ -805,14 +822,6 @@ main (int argc, char **argv)
} }
sprintf (core_file, "%s.core", p); sprintf (core_file, "%s.core", p);
if (argv && *(argv + optind))
pid = atoi (*(argv + optind));
else
{
usage ();
return -1;
}
DWORD tid = 0; DWORD tid = 0;
if (verbose) if (verbose)