From 26c07f704b8f95681afe552fe21cd186574b4044 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Mon, 9 May 2005 01:21:43 +0000 Subject: [PATCH] * 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/ChangeLog | 7 +++++++ winsup/utils/strace.cc | 12 +++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index ccf93d03e..9438a5586 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,10 @@ +2005-05-08 Christopher Faylor + + * 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 * mount.cc (usage): Clarify action of -m option. 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