Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

DebugBreak() in Ada

43 views
Skip to first unread message

Petter

unread,
Apr 25, 2023, 7:18:52 AM4/25/23
to
I used some way to cause a DebugBreak() (programmatically causeng a break command in gdb) some 10 years ago. Now I can't find it. Perhaps one could raise int3? But I can't find how to either.
Regards,
Petter

Niklas Holsti

unread,
Apr 25, 2023, 8:12:02 AM4/25/23
to
What do you mean by "causing a break command in gdb"? Do you intend to
run the program under gdb, and want to be able to insert something --
perhaps a call DebugBreak -- in the Ada source to always cause a break
into gdb control at the point of that call, without having to set gdb
breakpoints at every call?

It is not a fully automatic method, but you could write a null Ada
procedure DebugBreak and set a breakpoint in that procedure, manually
from gdb, before starting the program. Then every call to DebugBreak
will break, and you can look one level down in the call chain to see the
state at the point of call.

Petter

unread,
Apr 25, 2023, 11:21:24 AM4/25/23
to
Sorry, I thougth DebugBreak() was familiar. If you in other languages not used by me call DebugBreak() i cuases the debugger to stop a running execution. I'm thought we had a similar for Ada. But I can be mistaken

Simon Wright

unread,
Apr 25, 2023, 1:20:25 PM4/25/23
to
I just googled debugbreak and the third hit was this:
https://github.com/scottt/debugbreak

It'd need some work, but at least on macOS/x86_64 GCC & clang[++] both
give a SIGTRAP.

Simon Wright

unread,
Apr 25, 2023, 1:22:41 PM4/25/23
to
Niklas Holsti <niklas...@tidorum.invalid> writes:

> It is not a fully automatic method, but you could write a null Ada
> procedure DebugBreak and set a breakpoint in that procedure, manually
> from gdb, before starting the program. Then every call to DebugBreak
> will break, and you can look one level down in the call chain to see
> the state at the point of call.

Great idea!
0 new messages