V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
cexia
V2EX  ›  问与答

gdb core dump backtrace address meaing

  •  
  •   cexia · 2016-02-05 09:57:10 +08:00 · 1209 次点击
    这是一个创建于 3023 天前的主题,其中的信息可能已经有所发展或是发生改变。
    程序崩溃了,生成了 core 文件
    g++ -O3 ,不是-g

    # gdb XXX core.xxx
    ( gdb ) bt

    #0 0x00007feba6619d5f in __strlen_sse42 () from /lib64/libc.so.6
    #1 0x00007feba6fcdf20 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib64/libstdc++.so.6
    #2 0x00007feba77eb27a in Foo::Bar(InterestField const*) () from ./foobar.so
    #3 0x00007feba77e02e5 in PolicyThreadProc(void*) () from ./foobar.so
    #4 0x00007feba6881851 in start_thread () from /lib64/libpthread.so.0
    #5 0x00007feba65cf90d in clone () from /lib64/libc.so.6

    想请教一下:
    类似于 0x00007feba77eb27a 的地址指向含义是什么?
    当前情况下,有什么办法可以获取到#2 参数 InterestField const pointer 指向内存的信息,用 x 命令查看?
    2 条回复    2016-02-05 11:54:17 +08:00
    bengol
        1
    bengol  
       2016-02-05 10:04:49 +08:00 via Android
    '试试 addr2line
    simpx
        2
    simpx  
       2016-02-05 11:54:17 +08:00
    1. 没用-g ,是没有 debug info 的,没法知道地址对应的行号。可以尝试加-g 重新编译一个,再用 addr2line

    2.重新编译后,可能 add2line 也对应不上。在当前情况下,直接看汇编代码也是可以看到整个函数的状况的。你可以试试"f 2",如果 Foo::Bar 是静态函数,可以用"info reg rdi"拿第一个参数,如果 Foo::Bar 是个成员函数,用"info reg rsi"。拿到后在 x 查看
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1112 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 19:18 · PVG 03:18 · LAX 12:18 · JFK 15:18
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.