gdb调试之 f 1 , i locals, i args, i catch ------ 并用这些来调试core dump
来源:互联网 发布:国内gis软件 编辑:程序博客网 时间:2024/06/01 23:10
先不多说, 看代码:
#include <iostream>#include <cstring>using namespace std;void inner(int xx, int yy){int a = 1;int b = 2;char *p = NULL;memset(p, 0, 1);}void middle(){int x = 10;int y = 20;inner(30, 40);}void outer(){int m = 100;int n = 200;middle();}int main(){int s = 3;int t = 4;outer();return 0;}编译运行并调试:
taoge@localhost Desktop> g++ -g main.cpp taoge@localhost Desktop> ./a.out Segmentation fault (core dumped)taoge@localhost Desktop> gdb a.out core.8146 GNU gdb (GDB) Red Hat Enterprise Linux (7.1-29.el6)Copyright (C) 2010 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 "i686-redhat-linux-gnu".For bug reporting instructions, please see:<http://www.gnu.org/software/gdb/bugs/>...Reading symbols from /home/taoge/Desktop/a.out...done.[New Thread 8146]Missing separate debuginfo for Try: yum --disablerepo='*' --enablerepo='*-debuginfo' install /usr/lib/debug/.build-id/74/d23352fd770753e375bd0caecf375bd77bded5Reading symbols from /usr/lib/libstdc++.so.6...(no debugging symbols found)...done.Loaded symbols for /usr/lib/libstdc++.so.6Reading symbols from /lib/libm.so.6...(no debugging symbols found)...done.Loaded symbols for /lib/libm.so.6Reading symbols from /lib/libgcc_s.so.1...(no debugging symbols found)...done.Loaded symbols for /lib/libgcc_s.so.1Reading symbols from /lib/libc.so.6...(no debugging symbols found)...done.Loaded symbols for /lib/libc.so.6Reading symbols from /lib/ld-linux.so.2...(no debugging symbols found)...done.Loaded symbols for /lib/ld-linux.so.2Core was generated by `./a.out'.Program terminated with signal 11, Segmentation fault.#0 0x009a6935 in __memset_sse2 () from /lib/libc.so.6Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.7.el6.i686 libgcc-4.4.4-13.el6.i686 libstdc++-4.4.4-13.el6.i686(gdb) (gdb) (gdb) (gdb) bt#0 0x009a6935 in __memset_sse2 () from /lib/libc.so.6#1 0x080485aa in inner (xx=30, yy=40) at main.cpp:10#2 0x080485d4 in middle () at main.cpp:17#3 0x080485ef in outer () at main.cpp:24#4 0x0804860f in main () at main.cpp:31(gdb) f 0#0 0x009a6935 in __memset_sse2 () from /lib/libc.so.6(gdb) i localsNo symbol table info available.(gdb) i argsNo symbol table info available.(gdb) i catchprint_frame_label_vars disabled.(gdb) f 1#1 0x080485aa in inner (xx=30, yy=40) at main.cpp:1010memset(p, 0, 1);(gdb) i localsa = 1b = 2p = 0x0(gdb) i argsxx = 30yy = 40(gdb) i catchprint_frame_label_vars disabled.(gdb)无需多说。
0 0
- gdb调试之 f 1 , i locals, i args, i catch ------ 并用这些来调试core dump
- gdb调试使用frame i命令
- gdb调试core dump文件
- gdb调试core时能用i locals看栈变量、函数行(即不出现No symbol table info available)的必要条件: 1. 编译时有-g参数; 2.so库未被strip脱衣服
- i.mx515 调试经验总结
- 用gdb调试core dump文件
- 用gdb调试core dump文件
- gdb Core Dump 调试程序错误
- 用gdb调试core dump文件
- 用gdb调试core dump文件
- 用gdb调试core dump文件
- 用gdb调试core dump文件
- LINUX core dump详解 & GDB调试
- 用gdb调试core dump文件
- 用gdb调试core dump文件
- 使用 GDB 调试 core dump 文件
- 用GDB调试core dump文件
- gdb core dump调试程序错误
- OpenGL:显示列表
- i++的线程安全性
- redis菜鸟教程
- hibernate HQL查询参数设置
- Android关于回调函数的定义及用法
- gdb调试之 f 1 , i locals, i args, i catch ------ 并用这些来调试core dump
- 设计模式之原型模式
- 在Xcode 6.2中遇到Your build settings specify a provisioning profile with the UUID, no provisioning prof
- iOS判断一个字符是不是数字
- 图片透明到状态栏的方法
- matlab练习程序(结构张量structure tensor)
- 安卓开发——Android studio怎么使用列选择模式
- 【杭电】[1166]敌兵布阵
- Fiddler2用于手机抓包时的配置方法