开发者

gdb and GPS: Cannot set a breakpoint on a function or procedure that is part of a protected type Ada object

I've got a pro开发者_Python百科tected 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?


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.


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]


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜