delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/12/05/12:52:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
From: "Dave Korn" <dave DOT korn AT artimi DOT com>
To: <cygwin AT cygwin DOT com>
References: <042c01c836a1$e6c0d1d0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20071205123104 DOT GH26345 AT calimero DOT vinschen DOT de> <04a001c8374f$a58b1a00$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20071205153214 DOT GI26345 AT calimero DOT vinschen DOT de> <04a801c83756$90a8b5f0$2e08a8c0 AT CAM DOT ARTIMI DOT COM> <20071205172520 DOT GB3147 AT ednor DOT casa DOT cgf DOT cx>
Subject: RE: Odd behaviour of __cygwin_environ?
Date: Wed, 5 Dec 2007 17:52:14 -0000
Message-ID: <04b901c83767$91e6f290$2e08a8c0@CAM.ARTIMI.COM>
MIME-Version: 1.0
X-Mailer: Microsoft Office Outlook 11
In-Reply-To: <20071205172520.GB3147@ednor.casa.cgf.cx>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 05 December 2007 17:25, Christopher Faylor wrote:

> I have a vague feeling that I'll regret mentioning this 

  Oh, I hope not.

> but, if you've
> built the DLL with --enable-debugging, you can set the CYGWIN_SLEEP
> environment variable, to some millisecond value that you want the cygwin
> process to sleep for and then attach to the process using 'strace -p'.
> 
> You can also set the CYGWIN_DEBUG variable to the name of the program
> that you want to debug to have a debugger popped up when that program
> executes.

  Thanks, I've been looking in that area...

static void
initial_env ()
{
  char buf[CYG_MAX_PATH];
  if (GetEnvironmentVariable ("CYGWIN_TESTING", buf, sizeof (buf) - 1))
    _cygwin_testing = 1;

  if (GetEnvironmentVariable ("CYGWIN_STRACE", buf, sizeof (buf) - 1))
    {
      strace.hello ();
      dk_printf ("dk: found CYGWIN STRACE, hello'd.");
    }
#ifdef DEBUGGING
  DWORD len;


  ... along with that patch, I also hacked about strace.hello to auto-activate
itself when it spots that the program name contains "cc1plus.exe", which is
where I'm getting the problem.  I'm currently trying to test the theory that
the environment might not be correct inbetween cygwin1 DLL_PROCESS_ATTACH time
and application main() invocation when it's >32k.

  Just in case anyone's curious, I'm finding that an mno-cygwin invocation of
g++ turns into an mcygwin invocation of cc1plus, and it occurs to me to wonder
if

static void
set_mingw (void)
{
  char *env = getenv ("GCC_CYGWIN_MINGW");

isn't guaranteed to work when the environment is >32k, owing to set_mingw
being called:

static void set_mingw (void) __attribute__ ((constructor));

prior to entering main() (and hence without a clear ordering WRT. crt0 process
init sequence).


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019