From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2809 invoked by alias); 6 Aug 2003 10:25:26 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 2782 invoked from network); 6 Aug 2003 10:25:22 -0000 Received: from unknown (HELO e6.ny.us.ibm.com) (32.97.182.106) by sources.redhat.com with SMTP; 6 Aug 2003 10:25:22 -0000 Received: from northrelay04.pok.ibm.com (northrelay04.pok.ibm.com [9.56.224.206]) by e6.ny.us.ibm.com (8.12.9/8.12.2) with ESMTP id h76APGkh204208; Wed, 6 Aug 2003 06:25:16 -0400 Received: from srikrishnan (d01av02.pok.ibm.com [9.56.224.216]) by northrelay04.pok.ibm.com (8.12.9/NCO/VER6.5) with SMTP id h76APB8I117138; Wed, 6 Aug 2003 06:25:12 -0400 Message-ID: <001101c35c05$ced95f90$9915b609@srikrishnan> From: "srikrish" To: "J. Johnston" Cc: References: <03eb01c35aa1$4f781490$9915b609@srikrishnan> <050c01c35b69$fb91dcc0$9915b609@srikrishnan> <3F2FF49E.5050707@redhat.com> Subject: Re: lin-lwp.c:1317: internal-error: lin_lwp_wait: Assertion `iterate_over_lwps (runing_callback, NULL)' failed. Date: Wed, 06 Aug 2003 10:25:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2003-08/txt/msg00073.txt.bz2 I tried commenting iterate_over_lwps (stop_and_resume_callback, NULL); at lin-lwp.c:1301. Now I get the 'Cannot find user-level thread for LWP 19020: generic error. ' Upon pressing continue I get 'Cannot find thread 2049: generic error'. I recall that the same happened while using gdb 5.2.1 and 5.3. However, while using gdb 5.2.1 and gdb 5.3, quit didn't work - I was not able to get out of gdb without 'killing'. Where as while using the gdb20030731, after getting the error, quit works. Srikrishnan ----- Original Message ----- From: "J. Johnston" To: "srikrish" Cc: Sent: Tuesday, August 05, 2003 11:47 PM Subject: Re: lin-lwp.c:1317: internal-error: lin_lwp_wait: Assertion `iterate_over_lwps (runing_callback, NULL)' failed. > srikrish wrote: > > In yesterday's post, I forgot to add that the program runs fine outside gdb. > > Here's the output: > > mymachine: /home/srik>./myprog somearg > > entering main program. pid: 10861 > > In threadproc pid:10863 > > > > getting up from sleep > > entering main program. pid: 10863 > > end of main: 10863 > > > > mymachine: /home/srik> > > > > Is this a limitation of GDB? > > > > No, it is a bug. The assert is historical and was left in after the nptl > modifications. It is meant to prevent gdb from being left hanging because there > are no running threads to get events from. > > With the advent of the new nptl model, gdb has to look for the case > of exiting the main thread. In nptl, when you exit the main thread, it > means all other threads should have exited. This is not the case for > linuxthreads. Since gdb is not notified when nptl lwps exit, > it tries stopping the other lwps to see if they have exited, then > resumes them if they are still around. > > In your case, the last non-main thread remaining got to a breakpoint so it > was stopped with pending status and the resume did not mark the thread as running. > After gdb got rid of the main thread, it looked to see if any threads existed and if > so, were they still running. The non-main thread was found but wasn't marked as running > so the assert tripped. > > I believe the answer is to adjust the assert to also look for pending events on > the existing threads. > > I can shortly submit a patch for consideration which you can try out. > > -- Jeff J. > > > > > > Subject: lin-lwp.c:1317: internal-error: lin_lwp_wait: Assertion > > `iterate_over_lwps (runing_callback, NULL)' failed. > > > > > > > >>Hi, > >>I am getting an assertion failure/gdb-internal-error while running a > >>multi-threaded program using the GDB20030731. Can some one point out if > > > > this > > > >>is a known bug or is there a workaround? > >> > >>Error Message: lin-lwp.c:1317: internal-error: lin_lwp_wait: Assertion > >>`iterate_over_lwps (runing_callback, NULL)' failed. > >> > >>The test program and output follows. I am using 2.4.19-3Suse-SMP kernel. > >>(linuxthreads) > >>Thanks, > >>Srikrishnan > >> > >>Test Program: Please note that I am calling exec of the same program > > > > without > > > >>arguments. > >>#include > >>#include > >>void * threadproc(void * junk) > >>{ > >> int i; > >> printf("In threadproc pid:%d \n", getpid()); > >> printf("\n getting up from sleep \n"); > >> execv("myprog",0);=20 > >> printf("exec failed \n"); > >>} > >> > >>int main(int argc, char * argv) > >>{ > >> int i; > >> void * ret; > >> pthread_t newthread; > >> printf("entering main program. pid: %d \n", getpid()); > >> if(argc >1) > >> { > >> pthread_create(&newthread, NULL, threadproc, NULL); > >> printf("back to main. pid:%d \n",getpid()); > >> } > >> printf("end of main: %d \n", getpid()); > >>} > >> > >> > >>OUTOUT WHILE USING GDB after enabling printing of verbose/debug statements > >>in gdb/lin-lwp.c > >> > >> > >>>gdbdir/gdb myprog > >> > >>GNU gdb 20030731 > >>Copyright 2003 Free Software Foundation, Inc. > >>GDB is free software, covered by the GNU General Public License, and you > > > > are > > > >>welcome to change it and/or distribute copies of it under certain > >>conditions. > >>Type "show copying" to see the conditions. > >>There is absolutely no warranty for GDB. Type "show warranty" for > > > > details. > > > >>This GDB was configured as "s390-ibm-linux"... > >>(gdb) run somearg > >>Starting program: /home/fultonm/bug3380/test3380nosleep somearg > >>CW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>CW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>CW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>[New Thread 1024 (LWP 2122)] > >>LLR: PTRACE_SINGLESTEP process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>SEL: Select single-step LWP 2122 > >>LLW: trap_ptid is process 2122. > >>LLR: PTRACE_CONT process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>LLW: trap_ptid is process 2122. > >>LLR: PTRACE_SINGLESTEP process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>SEL: Select single-step LWP 2122 > >>LLW: trap_ptid is process 2122. > >>LLR: PTRACE_CONT process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>LLW: trap_ptid is process 2122. > >>LLR: PTRACE_SINGLESTEP process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>SEL: Select single-step LWP 2122 > >>LLW: trap_ptid is process 2122. > >>LLR: PTRACE_CONT process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>LLW: trap_ptid is process 2122. > >>[New Thread 2049 (LWP 2123)] > >>LLAL: PTRACE_ATTACH LWP 2123, 0, 0 (OK) > >>LLAL: waitpid LWP 2123 received Stopped (signal) (stopped) > >>LLR: PTRACE_SINGLESTEP process 2122, 0 (resume event thread) > >>LLW: waitpid 2122 received Trace/breakpoint trap (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2122, 0, 0 (OK) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2122. > >>SEL: Select single-step LWP 2122 > >>LLW: trap_ptid is LWP 2122. > >>RC: PTRACE_CONT LWP 2123, 0, 0 (resume sibling) > >>LLR: PTRACE_CONT process 2122, 0 (resume event thread) > >>LLW: waitpid 2123 received Real-time signal 0 (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2123, 0, 0 (OK) > >>LLW: PTRACE_CONT LWP 2123, Unknown signal 77 (preempt 'handle') > >>LLW: waitpid 2123 received Trace/breakpoint trap (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2123, 0, 0 (OK) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2123. > >>SC: kill LWP 2122 **** > >>SC: lwp kill 0 ERRNO-OK > >>SWC: waitpid LWP 2122 received Stopped (signal) (stopped) > >>SWC: CALLING LLTA > >>LLTA: PTRACE_PEEKUSER LWP 2122, 0, 0 (OK) > >>LLW: trap_ptid is LWP 2123. > >>[New Thread 1026 (LWP 2124)] > >>LLAL: PTRACE_ATTACH LWP 2124, 0, 0 (OK) > >>LLAL: waitpid LWP 2124 received Stopped (signal) (stopped) > >>LLR: PTRACE_SINGLESTEP process 2123, 0 (resume event thread) > >>LLW: waitpid 2123 received Trace/breakpoint trap (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2123, 0, 0 (OK) > >>LLW: Candidate event Trace/breakpoint trap (stopped) in LWP 2123. > >>SEL: Select single-step LWP 2123 > >>LLW: trap_ptid is LWP 2123. > >>RC: PTRACE_CONT LWP 2124, 0, 0 (resume sibling) > >>RC: PTRACE_CONT LWP 2122, 0, 0 (resume sibling) > >>LLR: PTRACE_CONT process 2123, 0 (resume event thread) > >>LLW: waitpid 2124 received Real-time signal 0 (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2124, 0, 0 (OK) > >>LLW: PTRACE_CONT LWP 2124, Unknown signal 77 (preempt 'handle') > >>In threadproc pid:2124 > >>LLW: waitpid 2122 received Real-time signal 0 (stopped) > >> getting up from sleep > >>LLTA: PTRACE_PEEKUSER LWP 2122, 0, 0 (OK) > >>back to main. pid:2122 > >>LLW: PTRACE_CONT LWP 2122, Unknown signal 77 (preempt 'handle') > >>LLW: waitpid 2122 received Real-time signal 1 (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2122, 0, 0 (OK) > >>LLW: PTRACE_CONT LWP 2122, Real-time signal 13 (preempt 'handle') > >>LLW: waitpid 2124 received Real-time signal 0 (stopped) > >>LLTA: PTRACE_PEEKUSER LWP 2124, 0, 0 (OK) > >>LLW: PTRACE_CONT LWP 2124, Unknown signal 77 (preempt 'handle') > >>LLW: waitpid 2123 received 0 (exited) > >>LLW: LWP 2123 exited. > >>LLW: waitpid 2122 received 0 (exited) > >>SC: kill LWP 2124 **** > >>SC: lwp kill 0 ERRNO-OK > >>SWC: waitpid LWP 2124 received Trace/breakpoint trap (stopped) > >>SWC: CALLING LLTA > >>LLTA: PTRACE_PEEKUSER LWP 2124, 0, 0 (OK) > >>PTRACE_CONT LWP 2124, 0, 0 (OK) > >>SWC: Candidate SIGTRAP event in LWP 2124 > >>SWC: waitpid LWP 2124 received Stopped (signal) (stopped) > >>SWC: CALLING LLTA > >>LLTA: PTRACE_PEEKUSER LWP 2124, 0, 0 (OK) > >>LLW: LWP 2122 exited. > >>lin-lwp.c:1317: internal-error: lin_lwp_wait: Assertion `iterate_over_lwps > >>(run > >>ing_callback, NULL)' failed. > >>A problem internal to GDB has been detected, > >>further debugging may prove unreliable. > >>Quit this debugging session? (y or n) y > >> > >>Create a core file of GDB? (y or n) y > >>Abort > >>mymachine: /home/srik> > >> > >> > >> > > > > > > > >