#include "gdbsupport/common-defs.h"
#include "nat/windows-nat.h"
#include "gdbsupport/common-debug.h"
+#include "target/target.h"
#ifdef __CYGWIN__
#define __USEWIDE
return buf;
}
+/* See nat/windows-nat.h. */
+
+bool
+windows_process_info::handle_ms_vc_exception (const EXCEPTION_RECORD *rec)
+{
+ if (rec->NumberParameters >= 3
+ && (rec->ExceptionInformation[0] & 0xffffffff) == 0x1000)
+ {
+ DWORD named_thread_id;
+ windows_thread_info *named_thread;
+ CORE_ADDR thread_name_target;
+
+ thread_name_target = rec->ExceptionInformation[1];
+ named_thread_id = (DWORD) (0xffffffff & rec->ExceptionInformation[2]);
+
+ if (named_thread_id == (DWORD) -1)
+ named_thread_id = current_event.dwThreadId;
+
+ named_thread = thread_rec (ptid_t (current_event.dwProcessId,
+ named_thread_id, 0),
+ DONT_INVALIDATE_CONTEXT);
+ if (named_thread != NULL)
+ {
+ int thread_name_len;
+ gdb::unique_xmalloc_ptr<char> thread_name
+ = target_read_string (thread_name_target, 1025, &thread_name_len);
+ if (thread_name_len > 0)
+ {
+ thread_name.get ()[thread_name_len - 1] = '\0';
+ named_thread->name = std::move (thread_name);
+ }
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
/* The exception thrown by a program to tell the debugger the name of
a thread. The exception record contains an ID of a thread and a
name to give it. This exception has no documented name, but MSDN
adjustments if the registers are read multiple times. */
bool pc_adjusted = false;
- /* The name of the thread, allocated by xmalloc. */
+ /* The name of the thread. */
gdb::unique_xmalloc_ptr<char> name;
};
void handle_unload_dll ();
- /* Handle MS_VC_EXCEPTION when processing a stop. MS_VC_EXCEPTION is
- somewhat undocumented but is used to tell the debugger the name of
- a thread.
-
- Return true if the exception was handled; return false otherwise.
-
- This function must be supplied by the embedding application. */
-
- bool handle_ms_vc_exception (const EXCEPTION_RECORD *rec);
-
/* When EXCEPTION_ACCESS_VIOLATION is processed, we give the embedding
application a chance to change it to be considered "unhandled".
This function must be supplied by the embedding application. If it
private:
+ /* Handle MS_VC_EXCEPTION when processing a stop. MS_VC_EXCEPTION is
+ somewhat undocumented but is used to tell the debugger the name of
+ a thread.
+
+ Return true if the exception was handled; return false otherwise. */
+
+ bool handle_ms_vc_exception (const EXCEPTION_RECORD *rec);
+
/* Iterate over all DLLs currently mapped by our inferior, looking for
a DLL which is loaded at LOAD_ADDR. If found, add the DLL to our
list of solibs; otherwise do nothing. LOAD_ADDR NULL means add all
/* See nat/windows-nat.h. */
-bool
-windows_nat::windows_process_info::handle_ms_vc_exception
- (const EXCEPTION_RECORD *rec)
-{
- if (rec->NumberParameters >= 3
- && (rec->ExceptionInformation[0] & 0xffffffff) == 0x1000)
- {
- DWORD named_thread_id;
- windows_thread_info *named_thread;
- CORE_ADDR thread_name_target;
-
- thread_name_target = rec->ExceptionInformation[1];
- named_thread_id = (DWORD) (0xffffffff & rec->ExceptionInformation[2]);
-
- if (named_thread_id == (DWORD) -1)
- named_thread_id = current_event.dwThreadId;
-
- named_thread = thread_rec (ptid_t (current_event.dwProcessId,
- named_thread_id, 0),
- DONT_INVALIDATE_CONTEXT);
- if (named_thread != NULL)
- {
- int thread_name_len;
- gdb::unique_xmalloc_ptr<char> thread_name
- = target_read_string (thread_name_target, 1025, &thread_name_len);
- if (thread_name_len > 0)
- {
- thread_name.get ()[thread_name_len - 1] = '\0';
- named_thread->name = std::move (thread_name);
- }
- }
-
- return true;
- }
-
- return false;
-}
-
-/* See nat/windows-nat.h. */
-
bool
windows_nat::windows_process_info::handle_access_violation
(const EXCEPTION_RECORD *rec)
/* See nat/windows-nat.h. */
-bool
-windows_nat::windows_process_info::handle_ms_vc_exception
- (const EXCEPTION_RECORD *rec)
-{
- return false;
-}
-
-/* See nat/windows-nat.h. */
-
bool
windows_nat::windows_process_info::handle_access_violation
(const EXCEPTION_RECORD *rec)