在cygwin命令行输入arm-elf-gdb a.out (gdb) set remotebaud 115200 (gdb) target remote COM1 Remote debugging using COM1 0x80007704 in ?? () (gdb) load (gdb) list (gdb) c 可以通过串口0调试a.out程序,注意:因为串口0已经用于GDB调试目的,所以被调试程序不能使用串口0,否则会发生冲突。
使用n命令,单步调试,不进入函数内部 (gdb) n 12 int i = 0; (gdb) n 13 int j = 0; (gdb) n 17 printf(" AAAAAA111111 is active.thread data is %d.
",message); (gdb) n 18 i = i + 1; (gdb) n 19 j = j + 10; (gdb) n 20 cyg_thread_delay(300); (gdb) n 15 for(;;) (gdb) n 17 printf(" AAAAAA111111 is active.thread data is %d.
",message);
还可以使用display命令显示局部变量值,以后每次执行单步调试都会显示这个变量的值 (gdb) display i 1: i = 2 (gdb) n 18 i = i + 1; 1: i = 2 (gdb) n 19 j = j + 10; 1: i = 3