* command Ctrll-C
@ 2008-11-05 4:40 raja.saleru
2008-11-05 5:19 ` Michael Snyder
0 siblings, 1 reply; 4+ messages in thread
From: raja.saleru @ 2008-11-05 4:40 UTC (permalink / raw)
To: gdb
Hi,
During program execution thought GDB, the execution can be stopped by
command Ctrll-C
How it works internally in GDB source? Which function will be called after
user enters the command Ctrl-C ?
Thanks in Advance
Raja Saleru
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: command Ctrll-C
2008-11-05 4:40 command Ctrll-C raja.saleru
@ 2008-11-05 5:19 ` Michael Snyder
2008-11-05 12:03 ` Pedro Alves
0 siblings, 1 reply; 4+ messages in thread
From: Michael Snyder @ 2008-11-05 5:19 UTC (permalink / raw)
To: raja.saleru; +Cc: gdb
raja.saleru@iap-online.com wrote:
> Hi,
>
> During program execution thought GDB, the execution can be stopped by
> command Ctrll-C
>
> How it works internally in GDB source? Which function will be called after
> user enters the command Ctrl-C ?
>
> Thanks in Advance
> Raja Saleru
Have a look at "handle_sigint" and "async_request_quit"
in gdb/event-top.c.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: command Ctrll-C
2008-11-05 5:19 ` Michael Snyder
@ 2008-11-05 12:03 ` Pedro Alves
2008-11-05 16:59 ` Roland Puntaier
0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2008-11-05 12:03 UTC (permalink / raw)
To: gdb; +Cc: Michael Snyder, raja.saleru
On Wednesday 05 November 2008 05:12:06, Michael Snyder wrote:
> raja.saleru@iap-online.com wrote:
> > Hi,
> >
> > During program execution thought GDB, the execution can be stopped by
> > command Ctrll-C
> >
> > How it works internally in GDB source? Which function will be called after
> > user enters the command Ctrl-C ?
> >
> > Thanks in Advance
> > Raja Saleru
>
> Have a look at "handle_sigint" and "async_request_quit"
> in gdb/event-top.c.
Nope, sorry, that's used when there's no execution. It calls
quit(), doesn't interrupt the target at all.
If you're talking about native debugging, running a program
under GDB, not attached, then GDB "gives the terminal"
to the inferior (debuggee) (see target_terminal_inferior and friends)
whenever it is going to run it, so the ctrl-c hit while the inferior
is running is sent directly to the debuggee --- GDB is then informed
by ptrace that the inferior got a SIGINT (waitpid returns) (that is
the inferior sees the ctrl-c before gdb does in this case).
If talking about native debugging, attached to a program,
GDB installs a SIGINT handler that forwards the SIGINT to the inferior.
See set_sigint_trap/pass_signal in inflow.c/linux-nat.c for example.
If you go the to attachee's terminal and do a ctrl-c there, GDB will
be reported about a SIGINT just like the in native,non-attached case.
If talking about remote debugging, there are more steps involved depending
on the mode you're talking about, but, in the simplest and standard
mode (all-stop, sync), the idea is that GDB installs a SIGINT signal
handler that ends up passing an "out-of-band" interrupt "packet" to the
remote side (\\03). Then, when seeing this packet, the remote stub interrupts
its inferior (e.g., sends it a SIGINT) and then informs GDB that the remote
was interrupted with a regular stop reply. See remote_wait_as installing
remote_interrupt as SIGINT handler. When ctrl-c is done on GDB, this
handler then calls through async_remote_interrupt -> remote_stop_as -> serial_write (\\03).
--
Pedro Alves
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: command Ctrll-C
2008-11-05 12:03 ` Pedro Alves
@ 2008-11-05 16:59 ` Roland Puntaier
0 siblings, 0 replies; 4+ messages in thread
From: Roland Puntaier @ 2008-11-05 16:59 UTC (permalink / raw)
To: gdb
gdb-owner@sourceware.org schrieb am 05.11.2008 13:03:23:
> On Wednesday 05 November 2008 05:12:06, Michael Snyder wrote:
> > raja.saleru@iap-online.com wrote:
> > > Hi,
> > >
> > > During program execution thought GDB, the execution can be stopped
by
> > > command Ctrll-C
> > >
> > > How it works internally in GDB source? Which function will be called
after
> > > user enters the command Ctrl-C ?
> > >
> > > Thanks in Advance
> > > Raja Saleru
> >
>
> > Have a look at "handle_sigint" and "async_request_quit"
> > in gdb/event-top.c.
>
> Nope, sorry, that's used when there's no execution. It calls
> quit(), doesn't interrupt the target at all.
>
> If you're talking about native debugging, running a program
> under GDB, not attached, then GDB "gives the terminal"
> to the inferior (debuggee) (see target_terminal_inferior and friends)
> whenever it is going to run it, so the ctrl-c hit while the inferior
> is running is sent directly to the debuggee --- GDB is then informed
> by ptrace that the inferior got a SIGINT (waitpid returns) (that is
> the inferior sees the ctrl-c before gdb does in this case).
>
> If talking about native debugging, attached to a program,
> GDB installs a SIGINT handler that forwards the SIGINT to the inferior.
> See set_sigint_trap/pass_signal in inflow.c/linux-nat.c for example.
> If you go the to attachee's terminal and do a ctrl-c there, GDB will
> be reported about a SIGINT just like the in native,non-attached case.
>
> If talking about remote debugging, there are more steps involved
depending
> on the mode you're talking about, but, in the simplest and standard
> mode (all-stop, sync), the idea is that GDB installs a SIGINT signal
> handler that ends up passing an "out-of-band" interrupt "packet" to the
> remote side (\\03). Then, when seeing this packet, the remote stub
interrupts
> its inferior (e.g., sends it a SIGINT) and then informs GDB that the
remote
> was interrupted with a regular stop reply. See remote_wait_as
installing
> remote_interrupt as SIGINT handler. When ctrl-c is done on GDB, this
> handler then calls through async_remote_interrupt -> remote_stop_as
> -> serial_write (\\03).
I use Ctrl-C to leave the remote gdbserver without terminating it.
Then I can set new breakpoints in gdb and re-attach to the remote server
and continue.
Question: Is there another way to make the gdb responsive,
while the remote inferior continues running, maybe via MI?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-11-05 16:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-05 4:40 command Ctrll-C raja.saleru
2008-11-05 5:19 ` Michael Snyder
2008-11-05 12:03 ` Pedro Alves
2008-11-05 16:59 ` Roland Puntaier
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox