diff options
author | Pedro Alves <palves@redhat.com> | 2007-05-10 20:48:41 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2007-05-10 20:48:41 +0000 |
commit | 1d5315fee9335ecba7d345e41e451caa1d604114 (patch) | |
tree | b37c8d31835674ce437e57ffced180f6ce4a140f /gdb/gdbserver/win32-low.c | |
parent | bf9148316030a9f3f9b476d9049421864b6551cf (diff) | |
download | gdb-1d5315fee9335ecba7d345e41e451caa1d604114.zip gdb-1d5315fee9335ecba7d345e41e451caa1d604114.tar.gz gdb-1d5315fee9335ecba7d345e41e451caa1d604114.tar.bz2 |
* win32-low.c (win32-attach): Fix return value.
* target.h (target_ops): Describe ATTACH return values.
Diffstat (limited to 'gdb/gdbserver/win32-low.c')
-rw-r--r-- | gdb/gdbserver/win32-low.c | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c index 680cafe..265c916 100644 --- a/gdb/gdbserver/win32-low.c +++ b/gdb/gdbserver/win32-low.c @@ -580,7 +580,6 @@ win32_create_inferior (char *program, char **program_args) static int win32_attach (unsigned long pid) { - int res = 0; winapi_DebugActiveProcessStop DebugActiveProcessStop = NULL; winapi_DebugSetProcessKillOnExit DebugSetProcessKillOnExit = NULL; #ifdef _WIN32_WCE @@ -591,28 +590,24 @@ win32_attach (unsigned long pid) DebugActiveProcessStop = GETPROCADDRESS (dll, DebugActiveProcessStop); DebugSetProcessKillOnExit = GETPROCADDRESS (dll, DebugSetProcessKillOnExit); - res = DebugActiveProcess (pid) ? 1 : 0; - - if (!res) - error ("Attach to process failed."); - - if (DebugSetProcessKillOnExit != NULL) - DebugSetProcessKillOnExit (FALSE); + if (DebugActiveProcess (pid)) + { + if (DebugSetProcessKillOnExit != NULL) + DebugSetProcessKillOnExit (FALSE); - current_process_id = pid; - current_process_handle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid); + current_process_handle = OpenProcess (PROCESS_ALL_ACCESS, FALSE, pid); - if (current_process_handle == NULL) - { - res = 0; + if (current_process_handle != NULL) + { + current_process_id = pid; + do_initial_child_stuff (pid); + return 0; + } if (DebugActiveProcessStop != NULL) DebugActiveProcessStop (current_process_id); } - if (res) - do_initial_child_stuff (pid); - - return res; + error ("Attach to process failed."); } /* Handle OUTPUT_DEBUG_STRING_EVENT from child process. */ |