aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorChristopher Faylor <me+cygwin@cgf.cx>2003-12-26 14:56:45 +0000
committerChristopher Faylor <me+cygwin@cgf.cx>2003-12-26 14:56:45 +0000
commitd6dc8049797b97d2d03fceabb17f4911334daa3e (patch)
tree687fdfd4d77b09adb6e5d925fc72b22eda61462f /gdb
parent3ade53336e08ff84a0b150acaafd41983c870472 (diff)
downloadbinutils-d6dc8049797b97d2d03fceabb17f4911334daa3e.zip
binutils-d6dc8049797b97d2d03fceabb17f4911334daa3e.tar.gz
binutils-d6dc8049797b97d2d03fceabb17f4911334daa3e.tar.bz2
* win32-nat.c: Add some comments about below change.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/win32-nat.c14
-rw-r--r--gdb/windows-nat.c14
3 files changed, 28 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index fc83580..a368b05 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+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
diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c
index c28e26a..c37c1a8 100644
--- a/gdb/win32-nat.c
+++ b/gdb/win32-nat.c
@@ -338,7 +338,8 @@ do_child_fetch_inferior_registers (int r)
long l;
if (!current_thread)
- return;
+ return; /* Windows sometimes uses a non-existent thread id in its
+ events */
if (current_thread->reload_context)
{
@@ -382,6 +383,8 @@ static void
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);
}
@@ -390,7 +393,7 @@ static void
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 *) &current_thread->context) + mappings[r]);
else
@@ -405,6 +408,8 @@ static void
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);
}
@@ -1207,6 +1212,8 @@ child_continue (DWORD continue_status, int id)
return res;
}
+/* Called in pathological case where Windows fails to send a
+ CREATE_PROCESS_DEBUG_EVENT after an attach. */
DWORD
fake_create_process ()
{
@@ -1253,6 +1260,9 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
{
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++;
}
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index c28e26a..c37c1a8 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -338,7 +338,8 @@ do_child_fetch_inferior_registers (int r)
long l;
if (!current_thread)
- return;
+ return; /* Windows sometimes uses a non-existent thread id in its
+ events */
if (current_thread->reload_context)
{
@@ -382,6 +383,8 @@ static void
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);
}
@@ -390,7 +393,7 @@ static void
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 *) &current_thread->context) + mappings[r]);
else
@@ -405,6 +408,8 @@ static void
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);
}
@@ -1207,6 +1212,8 @@ child_continue (DWORD continue_status, int id)
return res;
}
+/* Called in pathological case where Windows fails to send a
+ CREATE_PROCESS_DEBUG_EVENT after an attach. */
DWORD
fake_create_process ()
{
@@ -1253,6 +1260,9 @@ get_child_debug_event (int pid, struct target_waitstatus *ourstatus)
{
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++;
}