Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Roland Puntaier <Roland.Puntaier@br-automation.com>
To: gdb@sourceware.org
Subject: Re: command Ctrll-C
Date: Wed, 05 Nov 2008 16:59:00 -0000	[thread overview]
Message-ID: <OF76820766.7D8CCCDB-ONC12574F8.005CBBCA-C12574F8.005D40B3@br-automation.com> (raw)
In-Reply-To: <200811051203.24490.alves.ped@gmail.com>

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?


      reply	other threads:[~2008-11-05 16:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-05  4:40 raja.saleru
2008-11-05  5:19 ` Michael Snyder
2008-11-05 12:03   ` Pedro Alves
2008-11-05 16:59     ` Roland Puntaier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OF76820766.7D8CCCDB-ONC12574F8.005CBBCA-C12574F8.005D40B3@br-automation.com \
    --to=roland.puntaier@br-automation.com \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox