This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] windows: do not crash if inferior
- From: Tristan Gingold <gingold at adacore dot com>
- To: gdb-patches ml <gdb-patches at sourceware dot org>
- Date: Wed, 13 Jan 2010 10:26:44 +0100
- Subject: [RFA] windows: do not crash if inferior
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);