Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros | Functions
udbg.cpp File Reference
#include "precompiled.h"
#include <cstdio>
#include <sys/types.h>
#include <signal.h>
#include "lib/timer.h"
#include "lib/sysdep/sysdep.h"
#include "lib/debug.h"
#include "lib/utf8.h"

Go to the source code of this file.

Macros

#define DEBUGGER_WAIT   3
 
#define DEBUGGER_CMD   "gdb"
 
#define DEBUGGER_ARG_FORMAT   "--pid=%d"
 
#define DEBUGGER_BREAK_AFTER_WAIT   0
 

Functions

Status debug_CaptureContext (void *context)
 
void debug_break ()
 trigger a breakpoint when reached/"called". More...
 
void udbg_launch_debugger ()
 
void debug_puts (const wchar_t *text)
 [system-dependent] write a string to the debug channel. More...
 
int debug_IsPointerBogus (const void *p)
 check if a pointer appears to be totally invalid. More...
 

Macro Definition Documentation

#define DEBUGGER_ARG_FORMAT   "--pid=%d"

Definition at line 55 of file udbg.cpp.

#define DEBUGGER_BREAK_AFTER_WAIT   0

Definition at line 56 of file udbg.cpp.

#define DEBUGGER_CMD   "gdb"

Definition at line 54 of file udbg.cpp.

#define DEBUGGER_WAIT   3

Definition at line 53 of file udbg.cpp.

Function Documentation

void debug_break ( )

trigger a breakpoint when reached/"called".

if defined as a macro, the debugger can break directly into the target function instead of one frame below it as with a conventional call-based implementation.

Definition at line 48 of file udbg.cpp.

Status debug_CaptureContext ( void *  context)
Parameters
contextmust point to an instance of the platform-specific type (e.g. CONTEXT) or CACHE_ALIGNED storage of DEBUG_CONTEXT_SIZE bytes.

Definition at line 42 of file udbg.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 114 of file udbg.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 106 of file udbg.cpp.

void udbg_launch_debugger ( )

Definition at line 62 of file udbg.cpp.