完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
|
|
相关推荐
1个回答
|
|
概述
移植准备
(具体解释请看下面tips) make CFLAGS=-static make install
下载gdb
tar jxvf gdb-6.8a.tar.bz2 编译PC端 //编译PC端 gdb cd gdb-6.8/ mkdir _install ./configure --target=arm-cortex_a9-linux-gnueabi --disable-werror --prefix=/home/ww/ARM/gdb/gdb-7.6.1/_install //没有设置host 默认= x86_64 make make install 编译开发板端
cd gdb-6.8/gdb/gdbserver ./configure --host=arm-cortex_a9-linux-gnueabi make //当前路径就有gdbserver 测试实现
void debug(char *str) { printf("debug info :%sn",str ); } main(int argc,char *argv[]) { int i,j; j=0; for(i=0;i<10;i++){ j+=5; printf("now a=%dn", j); } }
GNU gdb 6.8 Copyright (C) 2008 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=arm-none-linux-gnueabi". (gdb) target remote 172.16.30.20:777 重中之重! Remote debugging using 172.16.30.20:777 [New Thread 319] 0xb6efced0 in ?? () (gdb) b main No symbol table is loaded. Use the "file" command. (gdb) file a.out A program is being debugged already. Are you sure you want to change the file? (y or n) y Reading symbols from /home/fuzk/tools/gdb/gdb-6.8/_install/bin/a.out...done. (gdb) b main Breakpoint 1 at 0x846c: file test.c, line 11. (gdb) c Continuing. Breakpoint 1, main (argc=1, argv=0xbe8d4e54) at test.c:11 j=0; (gdb) n for(i=0;i<10;i++){ (gdb) n 这里发生异常, 直接执行完, 同时开发板也打印全部, 猜测是版本问题 Program exited with code 012. (gdb) 开发板log: /data/app/MAINAPP/data # ./gdbserver 172.16.2.212:777 /data/a.out [ 7431.399932] c0 init: untracked pid 318 exited Process /data/a.out created; pid = 319 Listening on port 777 Remote debugging from host 172.16.2.212 now a=5 now a=10 now a=15 now a=20 now a=25 now a=30 now a=35 now a=40 now a=45 now a=50 Child exited with retcode = a Child exited with status 10 GDBserver exiting
GNU gdb (Sourcery CodeBench Lite 2012.03-57) 7.2.50.20100908-cvs Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi". For bug reporting instructions, please see: (gdb) target remote 172.16.30.20:777 Remote debugging using 172.16.30.20:777 0xb6ed7ed0 in ?? () (gdb) b main No symbol table is loaded. Use the "file" command. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (main) pending. (gdb) b main No symbol table is loaded. Use the "file" command. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 2 (main) pending. (gdb) file a.out A program is being debugged already. Are you sure you want to change the file? (y or n) y Reading symbols from /home/fuzk/test/gdb/simple/a.out...done. Cannot access memory at address 0x0 (gdb) b main Cannot access memory at address 0x0 Note: breakpoints 1 and 2 also set at pc 0x846c. Breakpoint 3 at 0x846c: file test.c, line 11. (gdb) c Continuing. Breakpoint 1, main (argc=1, argv=0xbe9bbe54) at test.c:11 j=0; (gdb) s for(i=0;i<10;i++){ (gdb) s j+=5; (gdb) s printf("now a=%dn", j); (gdb) n for(i=0;i<10;i++){ (gdb) s j+=5; (gdb) s printf("now a=%dn", j); (gdb) n for(i=0;i<10;i++){ (gdb) n j+=5; (gdb) n printf("now a=%dn", j); (gdb) n for(i=0;i<10;i++){ (gdb) n j+=5; (gdb) n printf("now a=%dn", j); (gdb) (gdb) s for(i=0;i<10;i++){ (gdb) s j+=5; (gdb) s printf由于没有-g编译 调用step会导致异常, 所以建议使用next, 但如果用系统自带的会有上面红色提示 所以用step也不怕! printf("now a=%dn", j); (gdb) s for(i=0;i<10;i++){ (gdb) s j+=5; (gdb) s printf("now a=%dn", j); ===================== 对应开发板: /data/app/MAINAPP/data # ./gdbserver 172.16.2.212:777 /data/a.out [ 8046.924774] c0 init: untracked pid 326 exited Process /data/a.out created; pid = 327 Listening on port 777 Remote debugging from host 172.16.2.212 now a=5 now a=10 now a=15 now a=20 now a=25 遇到的问题 igure: error: no termcap library found Makefile:10927: recipe for target 'configure-gdb' failed make[1]: *** [configure-gdb] Error 1 make[1]: Leaving directory '/home/fuzk/tools/gdb/gdb-7.2' 缺少 termcap库, 先安装该库: https://ftp.gnu.org/gnu/termcap/ tar zxvf termcap-1.3.1.tar.gz cd termcap-1.3.1/ ./configure --prefix=/home/fuzk/tools/gdb/gdb-7.2/_install --target=arm-none-linux-gnueabi vi Makefile : CC = /opt/toolchain/arm-2012.03/bin/arm-none-linux-gnueabi-gcc AR = /opt/toolchain/arm-2012.03/bin/arm-none-linux-gnueabi-ar make install 重初始化: CFLAGS=-I/home/fuzk/tools/gdb/gdb-7.2/_install/include LDFLAGS=-L/home/fuzk/tools/gdb/gdb-7.2/_install/lib ./configure --prefix=/home/fuzk/tools/gdb/gdb-7.2/_install --target=arm-none-linux-gnueabi --host=arm-none-linux-gnueabi make make install |
|
|
|
只有小组成员才能发言,加入小组>>
890 浏览 1 评论
2286 浏览 5 评论
2596 浏览 9 评论
移植了freeRTOS到STMf103之后显示没有定义的原因?
2405 浏览 6 评论
2308 浏览 7 评论
使用eim外接fpga可是端口一点反应都没有有没有大哥指点一下啊
451浏览 9评论
464浏览 7评论
请教大神怎样去解决iMX6Q在linux3.0.35内核上做AP失败的问题呢
568浏览 6评论
445浏览 5评论
477浏览 5评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-19 07:22 , Processed in 1.157455 second(s), Total 78, Slave 59 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号