This is the mail archive of the
mailing list for the GDB project.
Re: Detecting when gdb is attached
On Thu, Nov 4, 2010 at 2:40 PM, Gruenhagen, Andreas
> I'm developing an application which cannot be started from
> within the gdb. Therefore, I have the start the application and
> attach the gdb afterwards. In some cases it would be nice to
> have the application wait in a spin loop until the debugger is
> attached. Is there any way of accomplishing such a thing?
how should the application know whether to enter the wait loop
until gdb is attached or run as usual?
> I thought of having some sort of action which is executed when
> the gdb is attached and detached, this could be for example
> used to switch a static flag in the debugee. Is something like
> this possible ?
via ~/.gdbinit for example you could simply try:
to invoke the function some_sort_of_action in the application