Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Authentication-Warning: atacama.four-d.de: mail set sender to using -f Message-ID: <3DF6FBD8.6090702@gmx.net> Date: Wed, 11 Dec 2002 09:48:24 +0100 From: Thomas Pfaff User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en-us, en MIME-Version: 1.0 To: oreste DOT bernardi AT st DOT com CC: cygwin AT cygwin DOT com Subject: Re: SIGSEGV when called sem_init() with gdb. References: <63340-220021221016341397 AT M2W082 DOT mail2web DOT com> <003e01c2a077$3b065ba0$940782a4 AT agr DOT st DOT com> <3DF6F700 DOT 2030305 AT gmx DOT net> In-Reply-To: <3DF6F700.2030305@gmx.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Sorry, I forgot to mention: Your work around is not portable. The type of sem_t is not necessary a pointer. Portable would be something like: memset(&sem, 0, sizeof(sem)); Thomas Thomas Pfaff wrote: > Just add a breakpoint after the sem_init call. > To avoid multiple initializations sem_init checks if the semaphore is > already initialized and will return EBUSY in that case. > The check is done via IsBadWritePtr which will trigger a SEGV if the > pointer is invalid and not NULL. > The SEGV is handled internally and will not cause the program to stop. > > Thomas > > Oreste Bernardi wrote: > >> I installed >> gdb 20020718-1. >> >> I tried again and I see same behavior. >> >> By the way, is gdb 20020718-1 experimental version or stable version ? >> >> Oreste >> >> >> ----- Original Message ----- From: >> To: ; >> Sent: Tuesday, December 10, 2002 5:03 PM >> Subject: RE: SIGSEGV when called sem_init() with gdb. >> >> >> Rerun setup and update your gdb. If that doesn't help, let the list >> know. >> >> Larry >> >> Original Message: >> ----------------- >> From: Oreste Bernardi oreste DOT bernardi AT st DOT com >> Date: Tue, 10 Dec 2002 16:01:16 +0100 >> To: cygwin AT cygwin DOT com >> Subject: SIGSEGV when called sem_init() with gdb. >> >> >> Dear, all >> >> #include >> int main () { >> int p; >> sem_t sem; >> int i=0,d; >> //sem=(sem_t)NULL; //With this There isn't any problem >> sem_init (&sem,0,1); >> sem_post (&sem); >> sem_wait(&sem); >> return i; >> } >> >> cygwin 1.3.17-1 >> gcc 3.2-3 >> gdb 20010428-3 >> >> When executing this source code with gdb I get an SIGSEGV signal when >> sem_init() function is called. >> If I continue on, program works fine. >> If program is not executed from gdb, it works without any error. >> If I initialize it with NULL, I don't get any error. >> >> I think that is the same behavior as described by following mail: >> http://sources.redhat.com/ml/cygwin/2002-10/msg00956.html >> Is this true ? >> >> To avoid annoying gdb error message, is my solution ("sem=(sem_t)NULL") >> reliable and portable ? >> >> Best Regards >> Oreste Bernardi >> >> >> -- >> Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple >> Bug reporting: http://cygwin.com/bugs.html >> Documentation: http://cygwin.com/docs.html >> FAQ: http://cygwin.com/faq/ >> >> >> -------------------------------------------------------------------- >> mail2web - Check your email from the web at >> http://mail2web.com/ . >> >> >> >> > > > -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/