From 26c07f704b8f95681afe552fe21cd186574b4044 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 9 May 2005 01:21:43 +0000 Subject: * 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. --- winsup/utils/strace.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'winsup/utils/strace.cc') diff --git a/winsup/utils/strace.cc b/winsup/utils/strace.cc index ab0dc62e2..6ed267a54 100644 --- a/winsup/utils/strace.cc +++ b/winsup/utils/strace.cc @@ -1,6 +1,6 @@ /* 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 @@ -279,7 +279,6 @@ load_cygwin () static void attach_process (pid_t pid) { - load_cygwin (); child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); if (!child_pid) { @@ -652,7 +651,6 @@ proc_child (unsigned mask, FILE *ofile, pid_t pid) static void dotoggle (pid_t pid) { - load_cygwin (); child_pid = (DWORD) cygwin_internal (CW_CYGWIN_PID_TO_WINPID, pid); if (!child_pid) { @@ -906,6 +904,14 @@ main (int argc, char **argv) int opt; 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, '/'))) pgm = *argv; else -- cgit v1.2.3