comp.lang.ada
 help / color / mirror / Atom feed
* DebugBreak() in Ada
@ 2023-04-25 11:18 Petter
  2023-04-25 12:11 ` Niklas Holsti
  2023-04-25 17:20 ` Simon Wright
  0 siblings, 2 replies; 5+ messages in thread
From: Petter @ 2023-04-25 11:18 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DebugBreak() in Ada
  2023-04-25 11:18 DebugBreak() in Ada Petter
@ 2023-04-25 12:11 ` Niklas Holsti
  2023-04-25 15:21   ` Petter
  2023-04-25 17:22   ` Simon Wright
  2023-04-25 17:20 ` Simon Wright
  1 sibling, 2 replies; 5+ messages in thread
From: Niklas Holsti @ 2023-04-25 12:11 UTC (permalink / raw)


On 2023-04-25 14:18, Petter wrote:
> 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


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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DebugBreak() in Ada
  2023-04-25 12:11 ` Niklas Holsti
@ 2023-04-25 15:21   ` Petter
  2023-04-25 17:22   ` Simon Wright
  1 sibling, 0 replies; 5+ messages in thread
From: Petter @ 2023-04-25 15:21 UTC (permalink / raw)


tisdag 25 april 2023 kl. 14:12:02 UTC+2 skrev Niklas Holsti:
> On 2023-04-25 14:18, Petter wrote: 
> > 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
> 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.

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DebugBreak() in Ada
  2023-04-25 11:18 DebugBreak() in Ada Petter
  2023-04-25 12:11 ` Niklas Holsti
@ 2023-04-25 17:20 ` Simon Wright
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Wright @ 2023-04-25 17:20 UTC (permalink / raw)


Petter <petter_fryklund@hotmail.com> writes:

> 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.

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: DebugBreak() in Ada
  2023-04-25 12:11 ` Niklas Holsti
  2023-04-25 15:21   ` Petter
@ 2023-04-25 17:22   ` Simon Wright
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Wright @ 2023-04-25 17:22 UTC (permalink / raw)


Niklas Holsti <niklas.holsti@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!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-04-25 17:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-25 11:18 DebugBreak() in Ada Petter
2023-04-25 12:11 ` Niklas Holsti
2023-04-25 15:21   ` Petter
2023-04-25 17:22   ` Simon Wright
2023-04-25 17:20 ` Simon Wright

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox