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!