gdb 和 GPS:无法在属于受保护类型 Ada 对象一部分的函数或过程上设置断点

发布于 2024-09-15 08:33:06 字数 385 浏览 2 评论 0原文

我有一个受保护的对象,它在其界面中呈现函数和过程。 在 gdb 中,当我在其中一个的第一行设置 bp 时,我得到了奇怪的结果。

这是我的 gdb 控制台的片段:

(gdb)
(gdb) b database-access_manager.adb:20001
Breakpoint 3 at 0x1a10588: file y:/svs/central_switch/controller/database/
database-access_manager.ads, line 20001.
(gdb)

您可以看到 gdb 很混乱。我在 .adb 文件的 20001 处指定了 bp,但 gdb 回应说它已将相应广告文件的 bp 设置为 20001 - 该文件没有那么多行。

什么给?

I've got a protected object that presents functions and procedures in its interface.
In gdb, when I set a bp on the first line of one of those, I get odd results.

Here's a snippet from my gdb console:

(gdb)
(gdb) b database-access_manager.adb:20001
Breakpoint 3 at 0x1a10588: file y:/svs/central_switch/controller/database/
database-access_manager.ads, line 20001.
(gdb)

You can see that gdb is confused. I specified a bp at 20001 of the .adb file but gdb responded by saying it had set the bp at 20001 of the corresponding ads file - which doesn't have that many lines.

What gives?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

好倦 2024-09-22 08:33:06

.ads 文件不会恰好定义或使用泛型,不是吗?

我还没有找到一个可以很好地处理 Ada 泛型的调试器。编译器经常创建大量半不可见的代码,让调试器感到困惑。我怀疑 C++ 模板也有同样的问题。

另一种可能性是您正在查看自程序编译以来已修改的源文件。

That .ads file wouldn't happen to be defining or using a generic, would it?

I have yet to find a debugger that handles Ada generics very well. The compiler often creates a raft of semi-invisible code that confuses the heck out of debuggers. I suspect C++ templates have the same issue.

Another possibility is that you are looking at a source file that has been modified since your program was compiled.

烟燃烟灭 2024-09-22 08:33:06

使用 GNAT Pro 6.3.1 在 Windows 上运行(我意识到这对您来说不是理想的数据点!),效果很好。

我确实注意到,当我在子程序规范上请求 bp 时,GDB 实际上设置了两个 bp,一个在规范中,一个在第一个语句中:因此,鉴于

package body Protected_Object is

   protected body PO is
      procedure Put (V : Integer) is
      begin
         Value := V;
      end Put;
      function Get return Integer is
      begin
         return Value;
      end Get;
    end PO;

end Protected_Object;

GDB 控制台显示(对于 Put

gdb) break protected_object.adb:4
Breakpoint 1 at 0x401729: file protected_object.adb, line 6. (2 locations)

并且在运行时,果然有 2 个中断:

Breakpoint 1, <protected_object__po__putP> (<_object>=..., v=42) at protected_object.adb:4
(gdb) cont

Breakpoint 1, protected_object.po.put (<_object>=..., v=42) at protected_object.adb:6

Version: GNU gdb (GDB) 7.0.1 for GNAT Pro 6.3.1 (20100112) [rev:158983]

Running on Windows with GNAT Pro 6.3.1 (I realise this isn't an ideal data point for you!) this worked fine.

I did notice that when I requested a bp on the subprogram specification, GDB effectively set two bps, one in the specification and one at the first statement: so, given

package body Protected_Object is

   protected body PO is
      procedure Put (V : Integer) is
      begin
         Value := V;
      end Put;
      function Get return Integer is
      begin
         return Value;
      end Get;
    end PO;

end Protected_Object;

the GDB console says (for Put)

gdb) break protected_object.adb:4
Breakpoint 1 at 0x401729: file protected_object.adb, line 6. (2 locations)

and at run time, sure enough there are 2 breaks:

Breakpoint 1, <protected_object__po__putP> (<_object>=..., v=42) at protected_object.adb:4
(gdb) cont

Breakpoint 1, protected_object.po.put (<_object>=..., v=42) at protected_object.adb:6

Version: GNU gdb (GDB) 7.0.1 for GNAT Pro 6.3.1 (20100112) [rev:158983]

只是偏爱你 2024-09-22 08:33:06

这是我的问题的更新。

我使用访问方法创建了一个受保护类型,并在一个小的主程序中使用它,发现我的示例受保护类型中的断点工作得很好。

现在我试图理解为什么在我公司非常大的构建背景下,断点不起作用。

我使用相同的 gdb、GPS 和编译器在每种情况下都会切换,它适用于小程序,但不适用于大程序。

当/如果有的话我会发布我的结果。

感谢所有回复者。

汤姆

Here's the update on my problem.

I made a protected type with access methods and used it in a small main and found that breakpoints in my example protected type worked fine.

Now I'm trying to understand why, within the context of my company's very large build, the breakpoints don't work.

I'm using the same gdb, GPS, & compiler switches in each case and it works for the small program but not in the large one.

I'll post my results when/if I have any.

Thanks to all the repliers.

Tom

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文