Linux应用调试技术之GDB和GDBServer(2)

  在ARM板上:
  4.1、 ulimit -c unlimited
  4.2、 执行应用程序 : 程序出错时会在当前目录下生成名为core的文件

 

  在PC上:

  4.3、首先将core文件拷贝到pc机上

       然后:/bin/arm-linux-gdb ./test_debug ./core

 

  打印出如下信息:

 

GNU gdb (GDB) 7.4 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 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-linux". For bug reporting instructions, please see: <http://>... Reading symbols from /home/share/jz2440/test_debug...done. [New LWP 748] warning: `/lib/libc.so.6': Shared library architecture unknown is not compatible with target architecture arm. warning: `/lib/ld-linux.so.2': Shared library architecture unknown is not compatible with target architecture arm. Core was generated by `./test_debug'. Program terminated with signal 11, Segmentation fault. #0 0x000084ac in C (p=0x0) at test_debug.c:6 6 *p = 0x12;

 

  4.4、bt:可以显示调用关系

 

#0 0x000084ac in C (p=0x0) at test_debug.c:6 #1 0x000084d0 in B (p=0x0) at test_debug.c:12 #2 0x000084f0 in A (p=0x0) at test_debug.c:17 #3 0x00008554 in main (argc=1, argv=0xbeb32eb4) at test_debug.c:34

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/59a29d7b60ad06ef75eb831bdc25eaea.html