windows-nat: Cleanups in get_windows_debug_event
gdb/ChangeLog: 2015-04-16 Jon Turney <jon.turney@dronecode.org.uk> * windows-nat.c (get_windows_debug_event): Replace retval with thread_id throughout. Update stale comment.
This commit is contained in:
parent
776704b917
commit
e6ad66bd09
@ -1,3 +1,8 @@
|
|||||||
|
2015-04-16 Jon Turney <jon.turney@dronecode.org.uk>
|
||||||
|
|
||||||
|
* windows-nat.c (get_windows_debug_event): Replace retval with
|
||||||
|
thread_id throughout. Update stale comment.
|
||||||
|
|
||||||
2015-04-16 Jon Turney <jon.turney@dronecode.org.uk>
|
2015-04-16 Jon Turney <jon.turney@dronecode.org.uk>
|
||||||
|
|
||||||
* windows-nat.c (get_windows_debug_event): Don't use ternary
|
* windows-nat.c (get_windows_debug_event): Don't use ternary
|
||||||
|
@ -1307,8 +1307,8 @@ ctrl_c_handler (DWORD event_type)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the next event from the child. Return 1 if the event requires
|
/* Get the next event from the child. Returns a non-zero thread id if the event
|
||||||
handling by WFI (or whatever). */
|
requires handling by WFI (or whatever). */
|
||||||
static int
|
static int
|
||||||
get_windows_debug_event (struct target_ops *ops,
|
get_windows_debug_event (struct target_ops *ops,
|
||||||
int pid, struct target_waitstatus *ourstatus)
|
int pid, struct target_waitstatus *ourstatus)
|
||||||
@ -1317,7 +1317,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
DWORD continue_status, event_code;
|
DWORD continue_status, event_code;
|
||||||
windows_thread_info *th;
|
windows_thread_info *th;
|
||||||
static windows_thread_info dummy_thread_info;
|
static windows_thread_info dummy_thread_info;
|
||||||
int retval = 0;
|
DWORD thread_id = 0;
|
||||||
|
|
||||||
last_sig = GDB_SIGNAL_0;
|
last_sig = GDB_SIGNAL_0;
|
||||||
|
|
||||||
@ -1348,14 +1348,14 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
/* Kludge around a Windows bug where first event is a create
|
/* Kludge around a Windows bug where first event is a create
|
||||||
thread event. Caused when attached process does not have
|
thread event. Caused when attached process does not have
|
||||||
a main thread. */
|
a main thread. */
|
||||||
retval = fake_create_process ();
|
thread_id = fake_create_process ();
|
||||||
if (retval)
|
if (thread_id)
|
||||||
saw_create++;
|
saw_create++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Record the existence of this thread. */
|
/* Record the existence of this thread. */
|
||||||
retval = current_event.dwThreadId;
|
thread_id = current_event.dwThreadId;
|
||||||
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
|
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
|
||||||
current_event.dwThreadId),
|
current_event.dwThreadId),
|
||||||
current_event.u.CreateThread.hThread,
|
current_event.u.CreateThread.hThread,
|
||||||
@ -1398,7 +1398,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
current_event.dwThreadId),
|
current_event.dwThreadId),
|
||||||
current_event.u.CreateProcessInfo.hThread,
|
current_event.u.CreateProcessInfo.hThread,
|
||||||
current_event.u.CreateProcessInfo.lpThreadLocalBase);
|
current_event.u.CreateProcessInfo.lpThreadLocalBase);
|
||||||
retval = current_event.dwThreadId;
|
thread_id = current_event.dwThreadId;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXIT_PROCESS_DEBUG_EVENT:
|
case EXIT_PROCESS_DEBUG_EVENT:
|
||||||
@ -1417,7 +1417,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
{
|
{
|
||||||
ourstatus->kind = TARGET_WAITKIND_EXITED;
|
ourstatus->kind = TARGET_WAITKIND_EXITED;
|
||||||
ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
|
ourstatus->value.integer = current_event.u.ExitProcess.dwExitCode;
|
||||||
retval = main_thread_id;
|
thread_id = main_thread_id;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1432,7 +1432,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
catch_errors (handle_load_dll, NULL, (char *) "", RETURN_MASK_ALL);
|
catch_errors (handle_load_dll, NULL, (char *) "", RETURN_MASK_ALL);
|
||||||
ourstatus->kind = TARGET_WAITKIND_LOADED;
|
ourstatus->kind = TARGET_WAITKIND_LOADED;
|
||||||
ourstatus->value.integer = 0;
|
ourstatus->value.integer = 0;
|
||||||
retval = main_thread_id;
|
thread_id = main_thread_id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNLOAD_DLL_DEBUG_EVENT:
|
case UNLOAD_DLL_DEBUG_EVENT:
|
||||||
@ -1445,7 +1445,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
catch_errors (handle_unload_dll, NULL, (char *) "", RETURN_MASK_ALL);
|
catch_errors (handle_unload_dll, NULL, (char *) "", RETURN_MASK_ALL);
|
||||||
ourstatus->kind = TARGET_WAITKIND_LOADED;
|
ourstatus->kind = TARGET_WAITKIND_LOADED;
|
||||||
ourstatus->value.integer = 0;
|
ourstatus->value.integer = 0;
|
||||||
retval = main_thread_id;
|
thread_id = main_thread_id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EXCEPTION_DEBUG_EVENT:
|
case EXCEPTION_DEBUG_EVENT:
|
||||||
@ -1461,7 +1461,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
continue_status = DBG_EXCEPTION_NOT_HANDLED;
|
continue_status = DBG_EXCEPTION_NOT_HANDLED;
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
retval = current_event.dwThreadId;
|
thread_id = current_event.dwThreadId;
|
||||||
break;
|
break;
|
||||||
case -1:
|
case -1:
|
||||||
last_sig = 1;
|
last_sig = 1;
|
||||||
@ -1477,7 +1477,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
"OUTPUT_DEBUG_STRING_EVENT"));
|
"OUTPUT_DEBUG_STRING_EVENT"));
|
||||||
if (saw_create != 1)
|
if (saw_create != 1)
|
||||||
break;
|
break;
|
||||||
retval = handle_output_debug_string (ourstatus);
|
thread_id = handle_output_debug_string (ourstatus);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -1491,7 +1491,7 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!retval || saw_create != 1)
|
if (!thread_id || saw_create != 1)
|
||||||
{
|
{
|
||||||
if (continue_status == -1)
|
if (continue_status == -1)
|
||||||
windows_resume (ops, minus_one_ptid, 0, 1);
|
windows_resume (ops, minus_one_ptid, 0, 1);
|
||||||
@ -1501,14 +1501,14 @@ get_windows_debug_event (struct target_ops *ops,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
inferior_ptid = ptid_build (current_event.dwProcessId, 0,
|
inferior_ptid = ptid_build (current_event.dwProcessId, 0,
|
||||||
retval);
|
thread_id);
|
||||||
current_thread = th;
|
current_thread = th;
|
||||||
if (!current_thread)
|
if (!current_thread)
|
||||||
current_thread = thread_rec (current_event.dwThreadId, TRUE);
|
current_thread = thread_rec (current_event.dwThreadId, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return retval;
|
return thread_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Wait for interesting events to occur in the target process. */
|
/* Wait for interesting events to occur in the target process. */
|
||||||
|
Loading…
Reference in New Issue
Block a user