【问题标题】:about GDB and CRC mismatch关于 GDB 和 CRC 不匹配
【发布时间】:2012-10-17 03:50:19
【问题描述】:

我想使用gdb 来调试代码。当我写命令时:

gdb gdns_processor 

它会输出来自gdb的警告信息:

<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/local/gdnscenter/bin/gdns_processor...
warning: the debug information found in "/usr/lib/debug//usr/local/gdnscenter/bin/gdns_processor.debug" does not match "/usr/local/gdnscenter/bin/gdns_processor" (CRC mismatch).
warning: the debug information found in "/usr/lib/debug/usr/local/gdnscenter/bin/gdns_processor.debug" does not match "/usr/local/gdnscenter/bin/gdns_processor" (CRC mismatch).

(no debugging symbols found)...done.

我不明白 CRC 不匹配。为什么gdb 找不到符号?

PS:我的gcc 选项设置了-g 标志。

CPPFLAGS="-D_LIBC_REENTRANT $CPPFLAGS -g"

【问题讨论】:

  • 确保包与 debuginfo 包的版本相同。我只是升级我的包。比如说,glibc-debuginfo-common-2.28-39.fc29.x86_64、glibc-debuginfo-2.28-39.fc29.x86_64、glibc-2.28-33.fc29.x86_64、glibc-common-2.28-33.fc29.x86_64。只需sudo dnf upgrade glibc

标签: c++ gcc gdb


【解决方案1】:

我不明白 CRC 不匹配

要理解该消息,您需要阅读有关 GDB 使用“单独调试文件”的信息,例如here.

我的 Gcc 选项设置了 -g。 CPPFLAGS="-D_LIBC_REENTRANT $CPPFLAGS -g"

您可能没有告诉我们整个故事。您的构建过程可能会为它生成 gdns_processor 二进制文件和 gdns_processor.debug “单独的调试文件”。

然后您将gdns_processor 复制到/usr/local/gdnsceter/bin/,但(显然)忽略将gdns_processor.debug 复制到/usr/lib/debug/usr/local/gdnscenter/bin/

【讨论】:

  • 谢谢。 gdns_processor 二进制文件位于 /usr/local/gdnsceter/bin/ 中。 gdns_processor.debug 在 /usr/lib/debug//usr/local/gdnscenter/bin/ 中。我将在单独的文件中阅读此调试信息
  • " 此外,调试链接为调试文件指定了一个 32 位循环冗余校验 (CRC) 校验和,gdb 使用它来验证可执行文件和调试文件是否来自同一个构建。 " 但我的系统是 x86_64。所以CRC校验和是错误的?
  • 我试试这个:(gdb) 符号文件 /usr/lib/debug/usr/local/gdnscenter/bin/gdns_processor.debug 从 /usr/lib/debug/usr/local/ 读取符号gdnscenter/bin/gdns_processor.debug...完成。
  • 对不起,我弄错了。 CRC 错误,因为我在不同的时间构建项目。例如:gdnscenter-1.3.0-7.x86_64.rpm 和 gdnscenter-debuginfo-1.3.0-6.x86_64.rpm
【解决方案2】:

可能你调试的程序与源代码不匹配,考虑重新编译程序。 PS:如果你想要更详细的调试信息,你可以使用 -ggdb 选项。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-01
    • 1970-01-01
    • 2019-07-06
    • 2012-06-16
    • 2022-01-15
    • 1970-01-01
    • 2012-07-24
    • 1970-01-01
    相关资源
    最近更新 更多