delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/04/09/00:41:37

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Subject: RE: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2]
MIME-Version: 1.0
X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0
content-class: urn:content-classes:message
Date: Mon, 9 Apr 2001 14:34:04 +1000
Message-ID: <EA18B9FA0FE4194AA2B4CDB91F73C0EF79B9@itdomain002.itdomain.net.au>
Thread-Topic: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2]
Thread-Index: AcDAlwZnKQrnYy8nTYKHxD/z8YBTUQAAFGqw
From: "Robert Collins" <robert DOT collins AT itdomain DOT com DOT au>
To: <cygwin AT cygwin DOT com>
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id AAA20799

> -----Original Message-----
> From: Christopher Faylor [mailto:cgf AT redhat DOT com]
> On Mon, Apr 09, 2001 at 11:31:57AM +1000, Robert Collins wrote:
> >> -----Original Message-----
> 
> I wouldn't expect the stack pointer to be screwed up.  I'd expect that
> the *stack* is screwed up.  I don't believe that the ecx 
> register should
> be preserved across function calls so I don't know why this 
> would mater.

Doh! Ask me how many years since I wrote assembly.... please :]

Well, the exception occurs on the last line here (Intel format cause I'm
reading intel doco).

call   0x404c98 <sched_yield>
mov    %eax,DWORD PTR [%ebp-100]
add    %eax,4
mov    %edx,DWORD PTR [%eax]
mov    %ecx,DWORD PTR [%edx]
mov    DWORD PTR [%eax],%ecx

As you can see, no stack references :[. And the crash doesn't occur if
the thread doesn't lose the processor.

Now the registers should be saved when context switch's occur, so I
don't believe the corruption occurs during that section of code, but
rather:

first thread setsup the try{}, returning an exception handler context.
yields.
main runs, starts second thread
second thread is started, it sets up it's try{}, and recieves the _sames
context_, yields.
first thread completes, exits the try{}, trashing the exception handler
context.

I'm not going to look into this any alonger. IMO it's the
__get_eh_context function in g++ which I know nothing about, and don't
have a debug version built. I hopped on this initially to see if it was
a pthreads issue... 

If it does turn out to be cygwin threads, rather than a non-reentrant
library function, I'm happy to look at it again.
 
> 
> Yep.  Probably.  Somebody should try that.

Chuckle.
 
> cgf
> 

Rob.

--
Want to unsubscribe from this list?
Check out: http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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