Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA] dummy frame handling cleanup, plus inferior fun call signal  	handling improvement
Date: Tue, 02 Dec 2008 01:20:00 -0000	[thread overview]
Message-ID: <e394668d0812011720v1edee9b3rc31a9e4f184f6d5@mail.gmail.com> (raw)
In-Reply-To: <200812012121.59580.pedro@codesourcery.com>

On Mon, Dec 1, 2008 at 1:21 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> Hi Doug,
>
> I'd like to bring a current GDB deficiency to your attention, in
> case it affects anything related to this patch.
>
> If GDB stops due to a signal instead of hitting the dummy frame
> breakpoint, and you have set GDB to restore the state
> automatically with "set unwindonsignal on", and the thread
> that reported the signal (say a SIGSEGV) was *not* the same that was
> doing the infcall, GDB will currently restore the old context to the
> wrong thread (seen by inspection, having really tried it).
>
> Not having studied the patch yet, I'm just wondering if your changes
> would make it easier or harder to fix this, or if you could be
> extending the problem by possibly restoring things in the wrong
> thread as well.

Heh.  My patch serendipitously has the following to catch another case
I was seeing where the current thread unexpectedly changed.

  if (! ptid_equal (this_thread->ptid, inferior_thread ()->ptid))
    {
      /* We've switched threads.  Perhaps this shouldn't happen, but we
         protect ourselves anyway.
         There's no point in restoring the inferior status,
         we're in a different thread.  */
      discard_cleanups (inf_status_cleanup);
      discard_inferior_status (inf_status);
      dummy_frame_discard (dummy_frame);
      error (_("\
The current thread has switched while making a function call from GDB.\n\
The state of the function call has been lost.\n\
It may be recoverable by changing back to the original thread\n\
and examining the state."));
    }

I need fix my patch to save the calling thread's ptid
(this_thread->ptid) before resuming execution in case the thread dies.
I think I shouldn't call dummy_frame_discard here too.
And I also need to change the comment to document why the current
thread can switch, because it _can_ happen. :-)
I'll prepare a new version of my patch, and include a testcase to
handle the situation you mention.  Thanks!


  reply	other threads:[~2008-12-02  1:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 21:01 Doug Evans
2008-11-19 14:07 ` Doug Evans
2008-11-20 15:02 ` Doug Evans
2008-11-20 15:06   ` Doug Evans
2008-12-01 20:52     ` Doug Evans
2008-12-01 21:22       ` Pedro Alves
2008-12-02  1:20         ` Doug Evans [this message]
2008-12-03  6:04           ` Doug Evans
2008-12-04 15:32             ` Ulrich Weigand
2008-12-04 15:54               ` Pedro Alves
2008-12-04 22:32               ` Doug Evans
2008-12-04 22:42                 ` Pedro Alves
2008-12-05  0:18                   ` Ulrich Weigand
2008-12-05  0:37                     ` Pedro Alves
2008-12-05  1:16                       ` Get rid of stop_pc (was: [RFA] dummy frame handling cleanup, plus inferior fun call signal handling improvement) Pedro Alves
2008-12-05  1:50                         ` Doug Evans
2008-12-05  2:14                           ` Pedro Alves
2008-12-05  2:46                         ` Pedro Alves
2008-12-05 18:43                         ` Ulrich Weigand
2008-12-05 19:07                           ` Pedro Alves
2008-12-05  0:30                 ` [RFA] dummy frame handling cleanup, plus inferior fun call signal handling improvement Ulrich Weigand
2008-11-26 19:17 ` Doug Evans
2009-01-07  6:52 Doug Evans
2009-01-07 16:36 ` Doug Evans
2009-01-14 15:07   ` Ulrich Weigand
2009-01-07 17:02 ` Pedro Alves
2009-01-14 15:07 ` Ulrich Weigand
2009-01-19  7:24   ` Doug Evans
2009-01-19 14:40     ` Ulrich Weigand

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=e394668d0812011720v1edee9b3rc31a9e4f184f6d5@mail.gmail.com \
    --to=dje@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.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