* strace.cc (attach_process): Don't call load_cygwin(). Assume that it's

already happened.
(dotoggle): Ditto.
(main): Set argv from cygwin environment, if it exists.
This commit is contained in:
Christopher Faylor 2005-05-09 01:21:43 +00:00
parent 1cd8ccec87
commit 26c07f704b
2 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2005-05-08 Christopher Faylor <cgf@timesys.com>
* strace.cc (attach_process): Don't call load_cygwin(). Assume that
it's already happened.
(dotoggle): Ditto.
(main): Set argv from cygwin environment, if it exists.
2005-05-01 Christopher Faylor <cgf@timesys.com> 2005-05-01 Christopher Faylor <cgf@timesys.com>
* mount.cc (usage): Clarify action of -m option. * mount.cc (usage): Clarify action of -m option.

View File

@ -1,6 +1,6 @@
/* strace.cc /* strace.cc
Copyright 2000, 2001, 2002, 2003, 2004 Red Hat Inc. Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat Inc.
Written by Chris Faylor <cgf@redhat.com> Written by Chris Faylor <cgf@redhat.com>
@ -279,7 +279,6 @@ load_cygwin ()
static void static void
attach_process (pid_t pid) attach_process (pid_t pid)
{ {
load_cygwin ();
child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
if (!child_pid) if (!child_pid)
{ {
@ -652,7 +651,6 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid)
static void static void
dotoggle (pid_t pid) dotoggle (pid_t pid)
{ {
load_cygwin ();
child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid);
if (!child_pid) if (!child_pid)
{ {
@ -906,6 +904,14 @@ main (int argc, char **argv)
int opt; int opt;
int toggle = 0; int toggle = 0;
if (load_cygwin ())
{
char **av = (char **) cygwin_internal (CW_ARGV);
if (av)
for (argc = 0, argv = av; *av; av++)
argc++;
}
if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/'))) if (!(pgm = strrchr (*argv, '\\')) && !(pgm = strrchr (*argv, '/')))
pgm = *argv; pgm = *argv;
else else