+2003-12-26 Christopher Faylor <cgf@redhat.com>
+
+ * win32-nat.c: Add some comments about below change.
+
2003-12-25 Christopher Faylor <cgf@redhat.com>
Fix for PR threads/1048
long l;
if (!current_thread)
- return;
+ return; /* Windows sometimes uses a non-existent thread id in its
+ events */
if (current_thread->reload_context)
{
child_fetch_inferior_registers (int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
+ /* Check if current_thread exists. Windows sometimes uses a non-existent
+ thread id in its events */
if (current_thread)
do_child_fetch_inferior_registers (r);
}
do_child_store_inferior_registers (int r)
{
if (!current_thread)
- /* nothing to do */;
+ /* Windows sometimes uses a non-existent thread id in its events */;
else if (r >= 0)
regcache_collect (r, ((char *) ¤t_thread->context) + mappings[r]);
else
child_store_inferior_registers (int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
+ /* Check if current_thread exists. Windows sometimes uses a non-existent
+ thread id in its events */
if (current_thread)
do_child_store_inferior_registers (r);
}
return res;
}
+/* Called in pathological case where Windows fails to send a
+ CREATE_PROCESS_DEBUG_EVENT after an attach. */
DWORD
fake_create_process ()
{
{
if (!saw_create && attach_flag)
{
+ /* Kludge around a Windows bug where first event is a create
+ thread event. Caused when attached process does not have
+ a main thread. */
retval = ourstatus->value.related_pid = fake_create_process ();
saw_create++;
}
long l;
if (!current_thread)
- return;
+ return; /* Windows sometimes uses a non-existent thread id in its
+ events */
if (current_thread->reload_context)
{
child_fetch_inferior_registers (int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
+ /* Check if current_thread exists. Windows sometimes uses a non-existent
+ thread id in its events */
if (current_thread)
do_child_fetch_inferior_registers (r);
}
do_child_store_inferior_registers (int r)
{
if (!current_thread)
- /* nothing to do */;
+ /* Windows sometimes uses a non-existent thread id in its events */;
else if (r >= 0)
regcache_collect (r, ((char *) ¤t_thread->context) + mappings[r]);
else
child_store_inferior_registers (int r)
{
current_thread = thread_rec (PIDGET (inferior_ptid), TRUE);
+ /* Check if current_thread exists. Windows sometimes uses a non-existent
+ thread id in its events */
if (current_thread)
do_child_store_inferior_registers (r);
}
return res;
}
+/* Called in pathological case where Windows fails to send a
+ CREATE_PROCESS_DEBUG_EVENT after an attach. */
DWORD
fake_create_process ()
{
{
if (!saw_create && attach_flag)
{
+ /* Kludge around a Windows bug where first event is a create
+ thread event. Caused when attached process does not have
+ a main thread. */
retval = ourstatus->value.related_pid = fake_create_process ();
saw_create++;
}