From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25492 invoked by alias); 3 Aug 2010 16:52:25 -0000 Received: (qmail 25470 invoked by uid 22791); 3 Aug 2010 16:52:24 -0000 X-SWARE-Spam-Status: No, hits=-0.7 required=5.0 tests=AWL,BAYES_05 X-Spam-Check-By: sourceware.org Received: from etinternational-gw.customer.alter.net (HELO etinternational.com) (63.125.108.14) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 03 Aug 2010 16:52:19 +0000 Received: from [192.168.9.69] (random.xmen.eti [192.168.9.69]) (Authenticated sender: bheilig) by etinternational.com (Postfix) with ESMTPSA id C3D8BF00CF for ; Tue, 3 Aug 2010 12:52:17 -0400 (EDT) Subject: Re: Porting gdb to Cyclops64 From: Brian Heilig To: gdb@sourceware.org In-Reply-To: <201008021435.16106.pedro@codesourcery.com> References: <1280510022.1560.20.camel@random> <201007310017.53475.pedro@codesourcery.com> <1280755494.1560.47.camel@random> <201008021435.16106.pedro@codesourcery.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 03 Aug 2010 16:52:00 -0000 Message-ID: <1280854337.1560.66.camel@random> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit 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: 2010-08/txt/msg00021.txt.bz2 Guys, thanks again for all your help. My target is reporting events in a sane order in stop mode now but I've run into a snag. While debugging the following program: #include /* line 1 */ void foo(int *a) { /* line 2 */ *a = 9; /* line 3 */ } /* line 4 */ int main() { /* line 5 */ int a=0; /* line 6 */ foo(&a); /* line 7 */ printf("%d\n",a); /* line 8 */ return 0; /* line 9 */ } I set a breakpoint at line 7. All threads hit that breakpoint. I stepped thread 1 and continued the other threads. [Switching to Thread 1] Breakpoint 1, main () at step.c:7 7 foo(&a); /* line 7 */ (gdb) s [Switching to Thread 2] Breakpoint 1, main () at step.c:7 7 foo(&a); /* line 7 */ (gdb) c Continuing. [Switching to Thread 3] ... etc. (gdb) c Continuing. Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 1] 0x0000000080800274 in main () at step.c:7 7 foo(&a); /* line 7 */ I switched back to thread 1 and step again: (gdb) s foo (a=0x41103ae8) at step.c:3 3 *a = 9; /* line 3 */ (gdb) I step one more time and gdb switches to thread 2. Why is that? (gdb) s Program received signal SIGTRAP, Trace/breakpoint trap. [Switching to Thread 2] foo (a=0x41803ae8) at step.c:3 3 *a = 9; /* line 3 */ It turns out that when I stepped to line 3 (the second step) gdb actually set a breakpoint at line 3. This might be because 'foo' has been inlined. Then gdb told my target to continue all "vCont;c". All threads hit the breakpoint, but only thread 1 should have. I don't know how it's supposed to work, but gdb could have sent "vCont;c:1". Or gdb could have single stepped until it reached the correct address (obviously not the preferred method). How can I correct this? Thanks, Brian