无法设置gdb断点 [英] Not able to set gdb breakpoint

查看:653
本文介绍了无法设置gdb断点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用多个C ++文件工作。我已经运行可执行文件通过gdb调试分段故障。稍后, gdb backtrace 提供了分段错误之前的函数列表。后来,我试图在一个特定行号的文件中设置一个断点。 (指定的路径是绝对路径)

I work on program with multiple C++ files. I have run the executable through gdb for debugging segmentation fault. Later, gdb backtrace provided the list of functions before segmentation fault. Later, I tried to set a break point in a file on a particular line-number. (The path specified is absolute path)

(gdb) break /aia/r015/home/sathish/zfs_amr/src/zfslbminterfaced2q9.cpp:100

但是,gdb给出以下消息:

However, gdb gives the following message:

No source file named /aia/r015/home/sathish/zfs_amr/src/zfslbminterfaced2q9.cpp.

但是,此位置确实存在。

However, this particular does exist in the location. What really the message means?

推荐答案


这是什么意思?

What really the message means?

消息意味着GDB不知道任何源文件名为 / aia / r015 / home / sathish / zfs_amr / src / zfslbminterfaced2q9 .cpp

The message means that GDB does not know about any source file named /aia/r015/home/sathish/zfs_amr/src/zfslbminterfaced2q9.cpp.

有多种原因可能会出现这种情况:

There are multiple reasons this could be the case:


  • 缺少此文件的调试信息,原因是该文件编译时没有 -g ,或者因为调试信息被(可能无意中)

  • 在上述路径中有一些符号链接,而GDB通过完全解析的路径名来了解该文件,


  • 共享库的文件部分和该共享库的符号尚未加载,

  • Etc。

  • The debug info for this file is missing, either because that file is compiled without -g, or because the debug info was (possibly inadvertantly) stripped later on,
  • There are some symbolic links in the above path, and GDB knows that file by fully-resolved pathname instead,
  • The file is actually not linked into the executable at all,
  • The file part of a shared library, and symbols for that shared library haven't been loaded yet,
  • Etc.

如Pat建议,在 zfslbminterfaced2q9.cpp:100

As Pat suggested, setting breakpoint on zfslbminterfaced2q9.cpp:100 is more likely to work.

如果这不起作用,信息来源会告诉你哪些文件GDB 知道。

If that doesn't work, info sources will tell you which files GDB does know about.

更新:


info sources are blank

info sources gives blank

这意味着应用程序根本没有任何调试信息。

This means that the application doesn't have any debug info at all.

通常会出现以下两种情况之一:

Usually this happens for one of two reasons:


  • 您忽略了 -g (有些平台在编译和链接时需要 -g 时间),

  • 您的链接上有一个stray -s li>
  • You neglected to specify -g on the link line (some platforms require -g both at compile and link time),
  • You have a "stray" -s somewhere on your link line (which strips the final executable).

这篇关于无法设置gdb断点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆