[RFA] windows: do not crash if inferior

Tristan Gingold gingold@adacore.com
Wed Jan 13 09:25:00 GMT 2010


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);




More information about the Gdb-patches mailing list