From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3074 invoked by alias); 29 Nov 2005 04:27:38 -0000 Received: (qmail 3066 invoked by uid 22791); 29 Nov 2005 04:27:38 -0000 X-Spam-Check-By: sourceware.org Received: from cse-mail.unl.edu (HELO cse-mail.unl.edu) (129.93.165.11) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Nov 2005 04:27:36 +0000 Received: from [192.168.0.100] (CPE-24-208-78-172.neb.res.rr.com [24.208.78.172]) (authenticated bits=0) by cse-mail.unl.edu (8.13.5/8.13.5) with ESMTP id jAT4ROvY006235 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Nov 2005 22:27:29 -0600 (CST) Message-ID: <438BD8D4.7050901@cse.unl.edu> Date: Tue, 29 Nov 2005 04:41:00 -0000 From: Neo Jia User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) MIME-Version: 1.0 To: yang xiaoli CC: gdb@sourceware.org Subject: Re: local gdb could not stop at breakpoint? References: In-Reply-To: Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit X-Greylist: Sender succeeded SMTP AUTH authentication, not delayed by milter-greylist-2.0.2 (cse-mail.unl.edu [129.93.165.11]); Mon, 28 Nov 2005 22:27:29 -0600 (CST) X-Virus-Status: Clean X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2005-11/txt/msg00608.txt.bz2 I think it would be better to post your assembly code instead of the source code, since we are in the gdb community. : ) So, I am guessing that your compiler does some optimization for your code, since I don't know the option you used. If you compile this code with -O2, you will get the following assembly code. 02000194
: { int a, b; a = 10; b = 20; printf("hello world\n"); <-- gdb should stop your problem here. 2000194: e1a0c00d mov r12, sp 2000198: e92dd800 stmdb sp!, {r11, r12, lr, pc} 200019c: e59f0014 ldr r0, [pc, #14] ; 20001b8 20001a0: e24cb004 sub r11, r12, #4 ; 0x4 20001a4: eb000178 bl 200078c <_IO_printf> printf("a+b=%d", a+b); 20001a8: e59f000c ldr r0, [pc, #c] ; 20001bc 20001ac: e3a0101e mov r1, #30 ; 0x1e 20001b0: eb000175 bl 200078c <_IO_printf> } If you compile this code without any optimization, you will get the following assmebly code. 02000194
: #include int main() { 2000194: e1a0c00d mov r12, sp 2000198: e92dd800 stmdb sp!, {r11, r12, lr, pc} 200019c: e24cb004 sub r11, r12, #4 ; 0x4 20001a0: e24dd008 sub sp, sp, #8 ; 0x8 int a, b; a = 10; 20001a4: e3a0300a mov r3, #10 ; 0xa 20001a8: e50b3010 str r3, [r11, -#16] b = 20; 20001ac: e3a03014 mov r3, #20 ; 0x14 20001b0: e50b3014 str r3, [r11, -#20] printf("hello world\n"); 20001b4: e59f001c ldr r0, [pc, #1c] ; 20001d8 20001b8: eb00017c bl 20007b0 <_IO_printf> printf("a+b=%d", a+b); 20001bc: e51b3010 ldr r3, [r11, -#16] 20001c0: e51b2014 ldr r2, [r11, -#20] 20001c4: e0833002 add r3, r3, r2 20001c8: e59f000c ldr r0, [pc, #c] ; 20001dc 20001cc: e1a01003 mov r1, r3 20001d0: eb000176 bl 20007b0 <_IO_printf> 20001d4: ea000001 b 20001e0 20001d8: 0202d758 andeq sp, r2, #23068672 ; 0x1600000 20001dc: 0202d768 andeq sp, r2, #27262976 ; 0x1a00000 } yang xiaoli wrote: > I compile gdb6.0 for arm , now it works, but when I debug a program > and set breakpoint at a line, it does't stop at breakpoint, it runs > over, for example like this: > > (gdb)l > 1 #include > 2 int main() > 3 { > 4 int a, b; > 5 6 a = 10; > 7 b = 20; > 8 printf("hello world\n"); > 9 printf("a+b= %d", a+b); > (gdb)b 6 > (gdb)r > Startomg program... > hello world > a+b= 30 > > Program exited normally (gdb) > > when I see breakpoints using command "info b" ,it display the > breakpoints information normally, why it does not stop at breakpoints? > > _________________________________________________________________ > Ãâ·ÑÏÂÔØ MSN Explorer: http://explorer.msn.com/lccn -- I would remember that if researchers were not ambitions probably today we haven't the technology we are using!