Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Message-ID: <01ff01c0c140$73537190$0200a8c0@lifelesswks> From: "Robert Collins" To: References: <20010409104706 DOT A29382 AT redhat DOT com> Subject: Re: G++ guru's please comment - Re: FW: pthread_create problem in Cygwin 1.1.8-2] Date: Tue, 10 Apr 2001 08:00:10 +1000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 X-OriginalArrivalTime: 09 Apr 2001 21:53:39.0671 (UTC) FILETIME=[89489670:01C0C13F] ----- Original Message ----- From: "Christopher Faylor" > On Mon, Apr 09, 2001 at 02:34:04PM +1000, Robert Collins wrote: > > > >> -----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 > >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. > > I'm confused by this snippet of assembly. It looks like gcc is using > the result of sched_yield to index into a table. But, %eax should be > either 0 or 1 in this case. So, maybe you're right. This is a gcc > problem. And, it may be fixed by configuring gcc with --enable-threads. this is Intel format disasembly not att. so paraphrasing it eax = *(ebp-100) eax +=4 edx = *(eax) ecx = *(edx) *eax = ecx Don't ask me why it loops the data around, it just does ;]. (ebp-100) is a pointer to the exception handler context. (call it eh_handle) I don't know what eh_handle+4 points to. But that gets trashed before the function completes it's exit from the try{} block. > > This is one of those situations where it looks like gcc can't be > released until a version of cygwin is released with the requisite > functionality. What's missing? I have a list of over 20 functions in front of me that I've just coded stubs for... Rob > > cgf > >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 > > -- > cgf AT cygnus DOT com Red Hat, Inc. > http://sources.redhat.com/ http://www.redhat.com/ > > -- > Want to unsubscribe from this list? > Check out: http://cygwin.com/ml/#unsubscribe-simple > > -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple