From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15533 invoked by alias); 6 Jul 2009 14:42:40 -0000 Received: (qmail 15523 invoked by uid 22791); 6 Jul 2009 14:42:39 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from outbound1-1.us4.outblaze.com (HELO outbound1-1.us4.outblaze.com) (208.36.123.129) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 06 Jul 2009 14:42:30 +0000 Received: from wfilter3.us4.outblaze.com.int (wfilter3.us4.outblaze.com.int [192.168.8.242]) by outbound1-1.us4.outblaze.com (Postfix) with QMQP id 258FE7A320C for ; Mon, 6 Jul 2009 14:41:50 +0000 (GMT) X-OB-Received: from unknown (208.36.123.70) by wfilter3.us4.outblaze.com; 6 Jul 2009 14:41:50 -0000 Received: by ws1-8.us4.outblaze.com (Postfix, from userid 1001) id E3D55326701; Mon, 6 Jul 2009 14:21:04 +0000 (GMT) Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" MIME-Version: 1.0 From: "suresh ds" To: "Pedro Alves" Cc: gdb@sourceware.org Date: Mon, 06 Jul 2009 14:42:00 -0000 Subject: Re: Behaviour of default all-stop mode -- Why no one has replied ? Received: from [203.92.57.132] by ws1-8.us4.outblaze.com with http for dssuresh66@mail.com; Mon, 6 Jul 2009 09:21:04 -0500 X-Ob-Auth: dssuresh66:mail.com@mail.com Message-Id: <20090706142104.E3D55326701@ws1-8.us4.outblaze.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00033.txt.bz2 After some trial and error, I observed that "vCont;c" indicates that 'c'ont= inue should be applied to all the threads that do not have any default acti= on specified. Actually, gdb documentation could have been clearer; I read i= t a few times, tried out a few times, only then understood the vCont behavi= our. I saw your mail later with your explanation of vCont which confirms my= understanding is correct. Well, anyway, vCont is implemented and things ar= e working fine. But I have a new issue here, given below: 1) Does gdb support threads with shared text ? It is common to see differen= t threads calling the same function in which case the function becomes shar= ed code for those threads. Any specific option has to be turned on (in gdb)? 2) I've mapped gdb threads to hardware threads in a multi-processor MIPS So= C and these hardware threads share the text. Theoritically, this is same as= a function shared by different software threads. I've pasted the log below: (gdb)target remote : Remote debugging using : Sending packet: $qSupported#37...Ack Packet received:=20 Packet qSupported (supported-packets) is NOT supported Sending packet: $g#67...Ack Packet received: 0000000000000000000000005000000100000000000000a00000000000= 0000100000000000000001000000000087000000000000000000b0ffffffff900ddeed00000= 000018066ac00000000018066f8ffffffff800b400000000000018068680000000001806768= 000000000000000100000000008717040000000000871724000000000180687800000000008= 00000ffffffff800b40400000000000000004000000000080000000000000002d0000000000= 00009538780000000000800000ffffffff800b4000000000000000000100000000000000000= 000000000000000000000000080ac5000000000008f2e800000000000000001000000000023= a9fc000000005000000300000000015be680000000000124f80000000000008000000000000= 000008024000000000023757800000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000 Sending packet: $?#3f...Ack Packet received: T00thread:4; Sending packet: $Hc-1#09...Ack Packet received: OK Sending packet: $qC#b4...Ack Packet received: QC 4 Sending packet: $qOffsets#4b...Ack Packet received: Text=3D0;Data=3D0;Bss=3D0 [New Thread 4] Sending packet: $g#67...Ack Packet received: 0000000000000000000000005000000100000000000000a00000000000= 0000100000000000000001000000000087000000000000000000b0ffffffff900ddeed00000= 000018066ac00000000018066f8ffffffff800b400000000000018068680000000001806768= 000000000000000100000000008717040000000000871724000000000180687800000000008= 00000ffffffff800b40400000000000000004000000000080000000000000002d0000000000= 00009538780000000000800000ffffffff800b4000000000000000000100000000000000000= 000000000000000000000000080ac5000000000008f2e800000000000000001000000000023= a9fc000000005000000300000000015be680000000000124f80000000000008000000000000= 000008024000000000023757800000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000 0x00237578 in gdb_break () at blah..blah.. 85 blah..blah.. in blah..blah.. Sending packet: $qSymbol::#5b...Ack Packet received:=20 Packet qSymbol (symbol-lookup) is NOT supported (gdb)b fun Breakpoint 1 at 0x200388: file debug_test.c, line 46. (gdb)c Continuing. Sending packet: $Z0,200388,4#4b...Ack Packet received: OK Packet Z0 (software-breakpoint) is supported Sending packet: $vCont?#49...Ack Packet received: vCont;c;C;s;S;t;T Packet vCont (verbose-resume) is supported Sending packet: $vCont;c#a8...Ack Packet received: T05thread:7; [New Thread 7] Sending packet: $g#67...Ack Packet received: 000000000000000000000000500000010000000000802c54ffffffffff= ffffff000000000000000000000000008f2fe000000000008f2fe8000000000000000000000= 000008000000000000000000001ffffffff800b400000000000018068680000000001806768= 0000000000000001000000000087170700000000008717270000000000000620ffffffff8c2= 626880000000000980000ffffffff8c145b88ffffffff8c2626880000000000000001000000= 000098968000000000000030c8ffffffff800b4000000000000000000000000000000000000= 000000000000000000000000080ac5000000000008f2f380000000000000000000000000020= 0720000000005000000300000000015be680000000000124f80000810d688c26ce100000000= 000008024000000000020038800000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000 Sending packet: $g#67...Ack Packet received: 000000000000000000000000500000010000000000802c54ffffffffff= ffffff000000000000000000000000008f2fe000000000008f2fe8000000000000000000000= 000008000000000000000000001ffffffff800b400000000000018068680000000001806768= 0000000000000001000000000087170700000000008717270000000000000620ffffffff8c2= 626880000000000980000ffffffff8c145b88ffffffff8c2626880000000000000001000000= 000098968000000000000030c8ffffffff800b4000000000000000000000000000000000000= 000000000000000000000000080ac5000000000008f2f380000000000000000000000000020= 0720000000005000000300000000015be680000000000124f80000810d688c26ce100000000= 000008024000000000020038800000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000 [Switching to Thread 7] Sending packet: $z0,200388,4#6b...Ack Packet received: OK Breakpoint 1, fun () at debug_test.c:46 46 debug_test.c: No such file or directory. in debug_test.c (gdb)c Continuing. Sending packet: $vCont;s:7#29...Ack Packet received: T05thread:7; Sending packet: $g#67...Ack Packet received: 000000000000000000000000500000010000000000000002ffffffffff= ffffff000000000000000000000000008f2fe000000000008f2fe8000000000000000000000= 000008000000000000000000001ffffffff800b400000000000018068680000000001806768= 0000000000000001000000000087170700000000008717270000000000000620ffffffff8c2= 626880000000000980000ffffffff8c145b88ffffffff8c2626880000000000000001000000= 000098968000000000000030c8ffffffff800b4000000000000000000000000000000000000= 000000000000000000000000080ac5000000000008f2f380000000000000000000000000020= 0720000000005000000300000000015be680000000000124f80000810d688c26ce100000000= 000008024000000000020038c00000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000 Sending packet: $Z0,200388,4#4b...Ack Packet received: OK Sending packet: $vCont;c#a8...Ack Packet received: T05thread:7; Sending packet: $g#67...Ack Packet received: 0000000000000000000000005000000000000000500000010000000000= 00000b000000000000000b0000000000800398000000000000000a000000000000000100000= 000008000000000000000000001ffffffffbef1400000000000008f26b400000000008e0760= 0000000000800000ffffffffffffffff00000000000000010000000000800000ffffffff8c2= 626880000000000980000ffffffff8c145b88ffffffff8c2626880000000000000001000000= 000098968000000000000030c8000000000000000700000000000000010000000b000000000= 02cedf000000000000000000080ac5000000000008f2f380000000000000000000000000020= 0720000000005000000300000000015be680000000000124f800ffffffff8c145b880000000= 000008024000000000020038800000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000 Sending packet: $z0,200388,4#6b...Ack Packet received: OK Breakpoint 1, fun () at debug_test.c:46 46 in debug_test.c (gdb)info b Num Type Disp Enb Address What 1 breakpoint keep y 0x00200388 in fun at debug_test.c:46 breakpoint already hit 2 times <=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D> I want to point out a few things. Here, four threads are running, 4,5,6,7. = Thread 7 hits the breakpoint and stops other threads too; gdb also acknowle= dges this by typing "[Switching to Thread 7]". A further continue gives ris= e to the foll. sequence (and my comments are intersperced): (rmios-gdb)c Continuing. Sending packet: $vCont;s:7#29...Ack Packet received: T05thread:7; <=3D=3D> At this point, gdb makes Thread 7 to step while indicating nothing= for the other threads Sending packet: $g#67...Ack Packet received: blah...blah.. Sending packet: $Z0,200388,4#4b...Ack Packet received: OK <=3D=3D> Once Thread 7 single steps, it inserts the breakpoint; Note that o= ther threads have not yet moved, but the breakpoint is already inserted bac= k !! Sending packet: $vCont;c#a8...Ack Packet received: T05thread:7; <=3D=3D> Now, gdb makes all threads to continue. But this only makes Thread= 7 to continue and other threads are still at the same point, because they = came out of exception, and tried to execute the same PC which has the addre= ss with breakpoint already inserted back, so they hit the break again witho= ut really proceeding. Since Thread 7 has already single-stepped, it does no= t see this break (which it itself inserted), proceeds further, later hits t= his break again (as the code is in a loop). Ideally, the sequence should have been something like this: Sending packet: $vCont;s#29...Ack Packet received: blah...blah... Sending packet: $Z0,200388,4#4b...Ack Packet received: OK Sending packet: $g#67...Ack Packet received: blah...blah.. Sending packet: $vCont;c#a8...Ack Packet received: T05thread:7; This will ensure that all threads have single-stepped once, then the break = can be inserted and the threads can be proceeded. Is this a bug in gdb ? Is this the default behaviour of gdb, and it is left to the stub to find so= me workaround for this ?? Is there any option which can make this happen cleanly ? If this is how gdb behaves, then other threads won't proceed at all and jus= t keep hitting the break again and again. Note that the above problem occurs because the threads share the code (text= ). If they indeed are running different texts, then this problem would not = arise at all, which makes me think, does gdb support threads with shared te= xt, in the first place ? Please reply. Thanks, Suresh --=20 Be Yourself @ mail.com! Choose From 200+ Email Addresses Get a Free Account at www.mail.com