Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
wdbg.cpp File Reference
#include "precompiled.h"
#include "lib/debug.h"
#include "lib/bits.h"
#include "lib/sysdep/os/win/win.h"
#include "lib/sysdep/os/win/wutil.h"

Go to the source code of this file.

Functions

int debug_IsPointerBogus (const void *p)
 check if a pointer appears to be totally invalid. More...
 
bool debug_IsCodePointer (void *p)
 does the given pointer appear to point to code? More...
 
bool debug_IsStackPointer (void *p)
 does the given pointer appear to point to the stack? More...
 
void debug_puts (const wchar_t *text)
 [system-dependent] write a string to the debug channel. More...
 
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. More...
 
void debug_SetThreadName (const char *name)
 inform the debugger of the current thread's name. More...
 

Function Documentation

bool debug_IsCodePointer ( void *  p)

does the given pointer appear to point to code?

Definition at line 62 of file wdbg.cpp.

int debug_IsPointerBogus ( const void *  p)

check if a pointer appears to be totally invalid.

this check is not authoritative (the pointer may be "valid" but incorrect) but can be used to filter out obviously wrong values in a portable manner.

Parameters
ppointer
Returns
1 if totally bogus, otherwise 0.

Definition at line 38 of file wdbg.cpp.

bool debug_IsStackPointer ( void *  p)

does the given pointer appear to point to the stack?

Definition at line 77 of file wdbg.cpp.

void debug_puts ( const wchar_t text)

[system-dependent] write a string to the debug channel.

this can be quite slow (~1 ms)! On Windows, it uses OutputDebugString (entails context switch), otherwise stdout+fflush (waits for IO).

Definition at line 95 of file wdbg.cpp.

void debug_SetThreadName ( const char *  name)

inform the debugger of the current thread's name.

(threads are easier to keep apart when they are identified by name rather than TID.)

Definition at line 117 of file wdbg.cpp.

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.

this function does not allocate memory from the CRT heap, which makes it safe to use from an allocation hook.

Definition at line 101 of file wdbg.cpp.