From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Daniel Jacobowitz <drow@false.org>, Michael Snyder <msnyder@vmware.com>
Subject: Re: RFC: Do not call write_pc for "signal SIGINT"
Date: Tue, 18 Nov 2008 05:46:00 -0000 [thread overview]
Message-ID: <200811172322.32422.pedro@codesourcery.com> (raw)
In-Reply-To: <20081117215501.GA19975@caradoc.them.org>
On Monday 17 November 2008 21:55:01, Daniel Jacobowitz wrote:
> To recap: there is a tricky bug in signal_command. If any non-zero
> signal is specified, it performs a jump to the current address instead
> of just resuming there. This causes any pending system call to be
> interrupted, in a way that leaves a kernel-internal value in the
> return value register. If we just delete that code, and the FIXME
> that goes with it, the right thing happens: instead of "Unknown
> error 514", the system call returns EINTR and
> the loop continues.
This may help explain it better:
/* Set the program counter for process PTID to PC. */
static void
i386_linux_write_pc (struct regcache *regcache, CORE_ADDR pc)
{
regcache_cooked_write_unsigned (regcache, I386_EIP_REGNUM, pc);
/* We must be careful with modifying the program counter. If we
just interrupted a system call, the kernel might try to restart
it when we resume the inferior. On restarting the system call,
the kernel will try backing up the program counter even though it
no longer points at the system call. This typically results in a
SIGSEGV or SIGILL. We can prevent this by writing `-1' in the
"orig_eax" pseudo-register.
Note that "orig_eax" is saved when setting up a dummy call frame.
This means that it is properly restored when that frame is
popped, and that the interrupted system call will be restarted
when we resume the inferior on return from a function call from
within GDB. In all other cases the system call will not be
restarted. */
regcache_cooked_write_unsigned (regcache, I386_LINUX_ORIG_EAX_REGNUM, -1);
}
--
Pedro Alves
next prev parent reply other threads:[~2008-11-17 23:22 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-28 15:56 Daniel Jacobowitz
2008-08-28 18:13 ` Michael Snyder
2008-08-28 18:19 ` Daniel Jacobowitz
2008-08-28 18:38 ` Michael Snyder
2008-08-28 22:33 ` Daniel Jacobowitz
2008-11-18 4:18 ` Daniel Jacobowitz
2008-11-18 5:46 ` Pedro Alves [this message]
2009-01-20 15:32 ` Daniel Jacobowitz
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=200811172322.32422.pedro@codesourcery.com \
--to=pedro@codesourcery.com \
--cc=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.com \
/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