简体   繁体   English

无法设置gdb断点

[英]Not able to set gdb breakpoint

I work on program with multiple C++ files. 我正在处理带有多个C ++文件的程序。 I have run the executable through gdb for debugging segmentation fault. 我已经通过gdb运行可执行文件以调试分段错误。 Later, gdb backtrace provided the list of functions before segmentation fault. 后来, gdb backtrace提供了分段错误之前的功能列表。 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

However, gdb gives the following message: 但是,gdb给出以下消息:

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? 该消息的真正含义是什么?

The message means that GDB does not know about any source file named /aia/r015/home/sathish/zfs_amr/src/zfslbminterfaced2q9.cpp . 该消息表示GDB不知道任何名为/aia/r015/home/sathish/zfs_amr/src/zfslbminterfaced2q9.cpp源文件。

There are multiple reasons this could be the case: 可能有多种原因:

  • 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, 缺少此文件的调试信息,可能是因为该文件是在不带-g情况下编译的,或者是因为后来(可能是无意间)剥离了调试信息,
  • There are some symbolic links in the above path, and GDB knows that file by fully-resolved pathname instead, 上面的路径中有一些符号链接,GDB会通过完全解析的路径名来识别该文件,
  • 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. 等等。

As Pat suggested, setting breakpoint on zfslbminterfaced2q9.cpp:100 is more likely to work. 如Pat所建议的,在zfslbminterfaced2q9.cpp:100上设置断点更有可能起作用。

If that doesn't work, info sources will tell you which files GDB does know about. 如果不工作, info sources会告诉你哪些文件GDB 知道。

Update: 更新:

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: 通常,发生这种情况的原因有两个:

  • You neglected to specify -g on the link line (some platforms require -g both at compile and link time), 您忽略了在链接行上指定-g (某些平台在编译和链接时都要求-g ),
  • You have a "stray" -s somewhere on your link line (which strips the final executable). 您在链接行的某处有一个“ stray” -s (它剥夺了最终的可执行文件)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM