打开具有不同可执行文件但相同源的核心转储文件

时间:2016-09-24 14:35:01

标签: gdb coredump

我有一个来自同事机器的coredump文件。

我们都有相同的程序源和相同的第三方libmysqlclient18文件(如user@ubuntu:/mnt/hgfs/share/dir$ gdb prog core GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 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 "i686-linux-gnu". For bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>... Reading symbols from /mnt/hgfs/share/dir/prog...done. warning: exec file is newer than core file. [New LWP 4465] [New LWP 4462] [New LWP 4464] warning: Can't read pathname for load map: Input/output error. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Core was generated by `./prog'. Program terminated with signal 11, Segmentation fault. #0 0x002d3706 in ?? () from /lib/i386-linux-gnu/libc.so.6 (gdb) bt full #0 0x002d3706 in ?? () from /lib/i386-linux-gnu/libc.so.6 No symbol table info available. #1 0x00000000 in ?? () No symbol table info available. (gdb) 和几个内部文件)。

问题是我们都是独立编译软件(来自相同的源码),我想在我的机器上使用他的核心转储文件进行GDB检查。

当我尝试将核心文件和我的可执行文件加载到gdb中时,我得到:

*.so

这种情况可行吗? (我编译软件时启用了调试符号) 如果没有,我缺少哪些技术细节?

我肯定知道如果他或我会修改源代码就不可能,因为那时可执行文件会有所不同,但事实并非如此,第三方libc6-dbg文件和来源,它们都匹配。

更新: 在评论中建议用户 mkfs 安装user@ubuntu:/mnt/hgfs/share/dir$ gdb prog core GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04 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 "i686-linux-gnu". For bug reporting instructions, please see: <http://bugs.launchpad.net/gdb-linaro/>... Reading symbols from /mnt/hgfs/share/dir/prog...done. warning: exec file is newer than core file. [New LWP 4465] [New LWP 4462] [New LWP 4464] warning: Can't read pathname for load map: Input/output error. [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". Core was generated by `./prog'. Program terminated with signal 11, Segmentation fault. #0 0x002d3706 in _IO_helper_overflow (s=0x0, c=0) at vfprintf.c:2188 2188 vfprintf.c: No such file or directory. (gdb) bt #0 0x002d3706 in _IO_helper_overflow (s=0x0, c=0) at vfprintf.c:2188 #1 0x00000000 in ?? () (gdb) bt full #0 0x002d3706 in _IO_helper_overflow (s=0x0, c=0) at vfprintf.c:2188 written = 47 target = <optimized out> used = -1226838776 #1 0x00000000 in ?? () No symbol table info available. (gdb) 之后,我在gdb中得到了这个:

    Dim OpenExcelFile As String =("C:\Users\RoseAnnMarey\Documents\TRYMUNA.xlsx")
    Dim oExcel As Object
    oExcel = CreateObject("Excel.Application")
    oExcel.workbooks.open(OpenExcelFile)

    Dim oBook As Excel.Workbook
    Dim oSheet As Excel.Worksheet
    oBook = oExcel.ActiveWorkbook
    oSheet = oExcel.worksheets(1)

    ' update the value

    oSheet.Range("c5:c15").Value = TextBox1.Text
    oSheet.Range("d5:d15").Value = TextBox2.Text
    oSheet.Range("b5:b15").Value = Label4.Text

    'save
    oExcel.DisplayAlerts = True
    oBook.SaveAs(OpenExcelFile, 51) '51 == xlsx
    oBook.Close()
    oBook = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

  

这种情况可行吗?

是的,但您需要确保在两台计算机上构建的二进制文件的符号布局相同(或至少足够接近)。这不一定是微不足道的:诸如本地用户名,源或安装目录的路径名以及主机名之类的东西有时会泄漏到构建的目标文件中,并可能导致符号不匹配。

要检查二进制文件是否已关闭,请运行diff <(nm a.out) <(nm b.out) - 应该只有很少的差异。如果你看到很多差异,你的二进制文件就不够了。

  

我编译软件时启用了调试符号,当然

这可能是您的第一个错误:如果您的同事使用-O2构建,并使用-g构建(并隐含-O0),则二进制文件保证不匹配。

您需要使用完全构建您的同事构建的标志(但您可能添加调试符号;例如,如果您的同事使用-O2构建,则应与-O2 -g 一起构建)。

P.S。请注意,您还需要在两台计算机上identical versions of system libraries