|
小弟刚开始学习嵌入式,想请教如何控制目标端的程序在自己控制下运行
我自己的demo中有错误,如下:
#include <stdlib.h>
#include <stdio.h>
int main(void)
{
int *i;
i = -1;
i[5000] = -1;
printf("test %d\n", i[5000]);
// i = 3000;
free(i);
printf("Hello world! \n");
return 0;
}
将它加入了uClinx中,在skyeye中运行
启动gdbserver:
gdbserver :3000 /bin/demo
然后在host中启动arm-elf-gdb:
arm-elf-gdb user/myapp/demo.gdb
(gdb)target remote 10.0.0.2:3000(目标机ip设为10.0.0.2)
显示:
Remote debugging using 10.0.0.2:3000
0x142f560 in ?? ()
此时目标端显示:
Remote debugging from host 10.0.0.1
code at (nil) - (nil), data at (nil)
skyeye: write data to nic is bigger than 256
R ff000040,fffa002f,1a,22,fffa0024,fffa0020,40,fffa0000,fffa001f,1128120,196,13f9d7c,fffa003f,13f9d50,fffa0028,107546c,C 20000013,S 0,0,20000093,20000000,a0000093,0,0,M 13,B 3,E 0,I 0,P 11a4250,T 0,L e3740a01,D e1a04000,skyeye: write data to nic is bigger than 256
R fffa0014,fffa0018,40,fffa001f,fffa0fff,fffa0020,40,fffa0000,fffa001f,1128120,196,13f9d7c,fffa0000,13f9d50,fffa0010,10754e8,C 20000013,S 0,0,20000093,20000000,a0000093,0,0,M 13,B 3,E 0,I 0,P 11a4250,T 0,L e3740a01,D e1a04000,
请问这是不是说这个程序已经跑过了?而我如果在host端运行r命令,就会提示:
You can't do that without a process to debug.
而目标端也会重新进入shell提示符状态
请问应该怎样在设置断点,以使得程序在我的控制下运行?
另外,为什么我的程序的code和data都是在nil??
急盼解疑,多谢多谢!! |
|