diff options
author | Egor Duda <deo@logos-m.ru> | 2001-09-09 17:18:51 +0400 |
---|---|---|
committer | Egor Duda <deo@logos-m.ru> | 2001-09-09 17:18:51 +0400 |
commit | 92ef5188af2deecd2054462bf940f6460d127fe9 (patch) | |
tree | 6e73cf79d7bbe3961a95457e4f20c5ec533d1185 /winsup | |
parent | d96911129113f5f43758005d3509b4f04639ccec (diff) |
* 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.
Diffstat (limited to 'winsup')
-rw-r--r-- | winsup/utils/ChangeLog | 8 | ||||
-rw-r--r-- | winsup/utils/dumper.cc | 53 |
2 files changed, 39 insertions, 22 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index e51ec6214..d54e0050f 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -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> * Makefile.in (dumper): Change logic for libbfd and libintl so that diff --git a/winsup/utils/dumper.cc b/winsup/utils/dumper.cc index dfa0a7df5..ee4a9eabc 100644 --- a/winsup/utils/dumper.cc +++ b/winsup/utils/dumper.cc @@ -36,9 +36,9 @@ __attribute__ ((packed)) #endif note_header; - BOOL verbose = FALSE; +BOOL verbose = FALSE; - int deb_printf (const char *format,...) +int deb_printf (const char *format,...) { if (!verbose) return 0; @@ -768,10 +768,12 @@ dumper::write_core_dump () static void usage () { - fprintf (stderr, "Usage: dumper [-d] [-c filename] pid\n"); - fprintf (stderr, "-c 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"); + fprintf (stderr, "Usage: dumper [options] filename pid\n"); + fprintf (stderr, "filename -- dump core to filename.core\n"); + fprintf (stderr, "pid -- win32-pid of process to dump\n\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 @@ -780,39 +782,46 @@ main (int argc, char **argv) int opt; const char *p = ""; DWORD pid; + char win32_name [MAX_PATH]; - while ((opt = getopt (argc, argv, "dc:")) != EOF) + while ((opt = getopt (argc, argv, "dq")) != EOF) switch (opt) { case 'd': verbose = TRUE; break; - case 'c': - char win32_name[MAX_PATH]; - cygwin_conv_to_win32_path (optarg, win32_name); - if ((p = strrchr (win32_name, '\\'))) - p++; - else - p = win32_name; + case 'q': + verbose = FALSE; + break; + default: + usage (); break; } - char *core_file = (char *) malloc (strlen (p) + sizeof (".core")); - if (!core_file) + if (argv && *(argv + optind) && *(argv + optind +1)) { - fprintf (stderr, "error allocating memory\n"); - return -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)); } - sprintf (core_file, "%s.core", p); - - if (argv && *(argv + optind)) - pid = atoi (*(argv + optind)); else { usage (); return -1; } + char *core_file = (char *) malloc (strlen (p) + sizeof (".core")); + if (!core_file) + { + fprintf (stderr, "error allocating memory\n"); + return -1; + } + sprintf (core_file, "%s.core", p); + DWORD tid = 0; if (verbose) |