This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: command Ctrll-C schrieb am 05.11.2008 13:03:23:

> On Wednesday 05 November 2008 05:12:06, Michael Snyder wrote:
> > wrote:
> > > Hi,
> > > 
> > > During program execution thought GDB, the execution can be stopped 
> > > command Ctrll-C
> > > 
> > > How it works internally in GDB source? Which function will be called 
> > > 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 
> 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 
> its inferior (e.g., sends it a SIGINT) and then informs GDB that the 
> was interrupted with a regular stop reply.  See remote_wait_as 
> 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?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]