gpt4 book ai didi

C代码在RHEL7中构建并部署在RHEL6中,gdb不工作

转载 作者:行者123 更新时间:2023-11-30 14:38:31 25 4
gpt4 key购买 nike

我正在 RHEL7 中构建 ProC 代码并将其部署到 RHEL6 服务器。它工作正常,但我无法正确使用 gdb。它说 - “单步执行直到从函数退出,该函数没有行号信息。”

如果我部署在 RHEL7 服务器中,我不会看到此错误,并且我可以逐行执行 gdb。

当 gdb 在 RHEL6 中部署的应用程序中运行时:

$> gdb progname
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-92.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 "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from progname...done.
(gdb) b progname.c:main
Breakpoint 1 at 0x8048fe8
(gdb) run arguments
Starting program: progname argments
[Thread debugging using libthread_db enabled]

Breakpoint 1, 0x08048fe8 in main ()
Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.212.el6.i686
(gdb) n
*Single stepping until exit from function main,
which has no line number information.*

当 gdb 在 RHEL7 部署的应用程序中运行时,我们将看到以下结果,这在 RHEL6 版本中也是预期的

 $> gdb progname
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-100.el7_4.1
Copyright (C) 2013 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 "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from progname...done.
(gdb) b progname.c:main
Breakpoint 1 at 0x8048ff1: file progname.c, line 87.
(gdb) run arguments
Starting program: progname arguments
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib64/libthread_db.so.1".

Breakpoint 1, main (argc=8, argv=0xffffbd14) at progname.c:87
87 progname.c:
Missing separate debuginfos, use: debuginfo-install glibc-2.17-196.el7_4.2.i686 libgcc-4.8.5-16.el7_4.3.i686 libstdc++-4.8.5-16.el7_4.3.i686
(gdb) n
88 in /progname.c

最佳答案

I am building my ProC code in RHEL7 and deploying it to RHEL6 server.

这只在偶然情况下有效,并且随时可能崩溃。

I am not able to gdb properly

您在 RHEL6 上使用较旧的 GDB,它可能无法理解 RHEL7 编译器创建的一些调试信息。

您可以尝试在 RHEL6 上构建新版本的 GDB,并使用它。

关于C代码在RHEL7中构建并部署在RHEL6中,gdb不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56531310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com