Reputation: 2734
I'm trying to debug an Ada
program with gdb
. Specifically, I'm trying to put a breakpoint in a function like the following:
function Moment(OC: Object'Class) return Float is
begin
return OC.X_Coord * OC.Area;
end Moment;
I can put the breakpoint, and the execution stops when it is reached. My problem is that, when I use the gdb's source code view (with wh
) I can't see the source code.
I suspected that it's caused by gnatmake
, that is inlining the described function even if I apply the options -O0 -g
. For checking this, I have tried to add a Put_Line
call to stop gnatmake inlining my function, and it has worked: with the following function I can stop the execution and see the source code:
function Moment(OC: Object'Class) return Float is
begin
Put_Line("ASDASD");
return OC.X_Coord * OC.Area;
end Moment;
How can I stop gnatmake
inlining functions?
Upvotes: 0
Views: 66
Reputation: 594
Add -cargs -fno-inline
to your gnatmake or gprbuild command line, or -fno-inline
to your project file.
Upvotes: 3