* 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>
* Makefile.in (dumper): Change logic for libbfd and libintl so that

View File

@ -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,23 +782,38 @@ 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;
}
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"));
if (!core_file)
{
@ -805,14 +822,6 @@ main (int argc, char **argv)
}
sprintf (core_file, "%s.core", p);
if (argv && *(argv + optind))
pid = atoi (*(argv + optind));
else
{
usage ();
return -1;
}
DWORD tid = 0;
if (verbose)