gdb调试libtool封装的可执行文件
来源:互联网 发布:windows sublime c 编辑:程序博客网 时间:2024/05/21 21:48
转载地址:http://www.cnblogs.com/ericsun/p/3168842.html
http://www.gnu.org/software/libtool/manual/html_node/Debugging-executables.html
3.4 Debugging executables
Ifhellwas a complicated program, you would certainly want to test and debug it before installing it on your system. In the above section, you saw how the libtool wrapper script makes it possible to run the program directly, but unfortunately, this mechanism interferes with the debugger:
burger$ gdb hell GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is no warranty for GDB; type "show warranty" for details. GDB 4.16 (i386-unknown-netbsd), (C) 1996 Free Software Foundation, Inc. "hell": not in executable format: File format not recognized (gdb) quit burger$
Sad. It doesn't work because GDB doesn't know where the executable lives. So, let's try again, by invoking GDB directly on the executable:
burger$ gdb .libs/hell GNU gdb 5.3 (i386-unknown-netbsd) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is no warranty for GDB. Type "show warranty" for details. (gdb) break main Breakpoint 1 at 0x8048547: file main.c, line 29. (gdb) run Starting program: /home/src/libtool/demo/.libs/hell /home/src/libtool/demo/.libs/hell: can't load library 'libhello.so.0' Program exited with code 020. (gdb) quit burger$
Argh. Now GDB complains because it cannot find the shared library thathellis linked against. So, we must use libtool in order to properly set the library path and run the debugger. Fortunately, we can forget all about the.libsdirectory, and just run it on the executable wrapper (see Execute mode):
burger$ libtool --mode=execute gdb hell GNU gdb 5.3 (i386-unknown-netbsd) Copyright 2002 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is no warranty for GDB. Type "show warranty" for details. (gdb) break main Breakpoint 1 at 0x8048547: file main.c, line 29. (gdb) run Starting program: /home/src/libtool/demo/.libs/hell Breakpoint 1, main (argc=1, argv=0xbffffc40) at main.c:29 29 printf ("Welcome to GNU Hell!\n"); (gdb) quit The program is running. Quit anyway (and kill it)? (y or n) y burger$
- gdb调试libtool封装的可执行文件
- CMake生成的可执行文件能够gdb调试
- CMake生成可用gdb调试的可执行文件
- CMake生成的可执行文件能够gdb调试
- CMake生成的可执行文件能够gdb调试
- GDB调试可执行文件
- gdb可以调试keil生成的可执行文件吗?
- 【GDB调试学习笔记】Makefile生成多个可执行文件
- 【GDB调试学习笔记】Makefile多级目录生成可执行文件
- “调试会话的可执行文件”对话框
- 1、调试会话的可执行文件
- 用GDB修改可执行文件的代码和变量(gdb)
- GDB 调试的常用命令
- 嵌入式的gdb调试
- gdb的调试命令
- GDB的调试方法
- 关于gdb的调试
- gdb的调试使用
- 如何在设置父视图的alpha的时候使子视图不受影响
- ecshop 函数笔记
- 试一下哟
- 技术揭秘12306改造(一):尖峰日PV值297亿下可每秒出票1032张
- 前端性能优化
- gdb调试libtool封装的可执行文件
- linux下彻底卸载MySQL
- Appium入门--环境准备和实例
- 技术揭秘12306改造(二):探讨12306两地三中心混合云架构
- java飞机游戏小项目
- 计算文本文件中各个词(中英文)出现的频率
- 用Java实现单向链表
- 用java实现优先级别队列
- 考研成绩查询系统(jsp、mysql、java)