Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: gdb-patches ml <gdb-patches@sourceware.org>
Subject: [RFA] windows: do not crash if inferior
Date: Wed, 13 Jan 2010 09:25:00 -0000	[thread overview]
Message-ID: <1C9A707A-AE7C-4947-A9DA-F105674F81AE@adacore.com> (raw)

Hi,

in case of early exit of the inferior, gdb crashes due to an assertion failure in inferior_thread().
This can happen if the inferior is not able to load a DLL due to a permission issue.

I am not sure that this is the best fix, but at least it avoids the crash.

Tristan.

2010-01-13  gingold  <gingold@adacore.com>

        * windows-nat.c (do_initial_windows_stuff): Call error() if the
        inferior doesn't exist anymore.


diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index f91ca32..29a28a9 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1603,6 +1603,11 @@ do_initial_windows_stuff (struct target_ops *ops, DWORD p
     {
       stop_after_trap = 1;
       wait_for_inferior (0);
+
+      /* The inferior may have exited early, due to eg. a DLL load error.  */
+      if (ptid_equal (inferior_ptid, null_ptid))
+       error (_("inferior exited early"));
+
       tp = inferior_thread ();
       if (tp->stop_signal != TARGET_SIGNAL_TRAP)
        resume (0, tp->stop_signal);



             reply	other threads:[~2010-01-13  9:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-13  9:25 Tristan Gingold [this message]
2010-01-19  9:22 ` Joel Brobecker
2010-01-20 16:16   ` Christopher Faylor
2010-01-20 16:35     ` Pedro Alves
2010-01-20 17:38     ` Christopher Faylor
2010-01-20 18:57       ` Christopher Faylor
2010-01-20 19:12       ` Pedro Alves
2010-01-21 17:57         ` Christopher Faylor
2010-01-26 15:59           ` Tristan Gingold
2010-01-28 14:55             ` Christopher Faylor
2010-01-20 16:41   ` Pedro Alves

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=1C9A707A-AE7C-4947-A9DA-F105674F81AE@adacore.com \
    --to=gingold@adacore.com \
    --cc=gdb-patches@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