27 #include "precompiled.h"
40 if(p < (
void*)0x10000)
43 if(p == (
const void*)(uintptr_t)0xCCCCCCCCCCCCCCCCull)
46 if(p == (
const void*)(uintptr_t)0xCCCCCCCCul)
64 uintptr_t addr = (uintptr_t)p;
69 static const HMODULE base = GetModuleHandle(0);
70 if(addr < (uintptr_t)base)
79 uintptr_t addr = (uintptr_t)p;
84 if(addr %
sizeof(
void*))
87 NT_TIB* tib = (NT_TIB*)NtCurrentTeb();
88 if(!(tib->StackLimit < p && p < tib->StackBase))
97 OutputDebugStringW(text);
106 wvsprintfW(buf, fmt, ap);
122 if(!IsDebuggerPresent())
126 const struct ThreadNameInfo
133 info = { 0x1000, name, (
DWORD)-1, 0 };
136 RaiseException(0x406D1388, 0,
sizeof(info)/
sizeof(
DWORD), (ULONG_PTR*)&info);
138 __except(EXCEPTION_EXECUTE_HANDLER)
LIB_API void debug_puts(const wchar_t *text)
[system-dependent] write a string to the debug channel.
LIB_API bool debug_IsCodePointer(void *p)
does the given pointer appear to point to code?
LIB_API void debug_SetThreadName(const char *name)
inform the debugger of the current thread's name.
LIB_API int debug_IsPointerBogus(const void *p)
check if a pointer appears to be totally invalid.
LIB_API bool debug_IsStackPointer(void *p)
does the given pointer appear to point to the stack?
void wdbg_printf(const wchar_t *fmt,...)
same as debug_printf except that some type conversions aren't supported (in particular, no floating point) and output is limited to 1024+1 characters.