foobar2000 SDK  2015-08-03
Data Structures | Functions
fb2kdebug.h File Reference

Go to the source code of this file.

Data Structures

class  uCallStackTracker
 

Functions

static void _InvalidParameter (const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t pReserved)
 
static void __cdecl _OverrideCrtAbort_handler (int signal)
 
static void __cdecl _PureCallHandler ()
 
static PFC_NORETURN void fb2kCriticalError (DWORD code, DWORD argCount=0, const ULONG_PTR *args=NULL)
 
static PFC_NORETURN void fb2kDeadlock ()
 
void SHARED_EXPORT fb2kDebugSelfTest ()
 
static void fb2kWaitForCompletion (HANDLE hEvent)
 
static void fb2kWaitForThreadCompletion (HANDLE hWaitFor, DWORD threadID)
 
static void fb2kWaitForThreadCompletion2 (HANDLE hWaitFor, HANDLE hThread, DWORD threadID)
 
static void OverrideCrtAbort ()
 
PFC_NORETURN void SHARED_EXPORT uBugCheck ()
 
LONG SHARED_EXPORT uExceptFilterProc (LPEXCEPTION_POINTERS param)
 
static int uExceptFilterProc_inline (LPEXCEPTION_POINTERS param)
 
LPCSTR SHARED_EXPORT uGetCallStackPath ()
 

Function Documentation

static void _InvalidParameter ( const wchar_t *  expression,
const wchar_t *  function,
const wchar_t *  file,
unsigned int  line,
uintptr_t  pReserved 
)
static

Definition at line 88 of file fb2kdebug.h.

94  {
95  RaiseException(0xd142b808 /* random GUID */, EXCEPTION_NONCONTINUABLE, 0, 0);
96 }
static void __cdecl _OverrideCrtAbort_handler ( int  signal)
static

Definition at line 79 of file fb2kdebug.h.

79  {
80  const ULONG_PTR args[] = {signal};
81  RaiseException(0x6F8E1DC8 /* random GUID */, EXCEPTION_NONCONTINUABLE, _countof(args), args);
82 }
static void __cdecl _PureCallHandler ( )
static

Definition at line 84 of file fb2kdebug.h.

84  {
85  RaiseException(0xf6538887 /* random GUID */, EXCEPTION_NONCONTINUABLE, 0, 0);
86 }
static PFC_NORETURN void fb2kCriticalError ( DWORD  code,
DWORD  argCount = 0,
const ULONG_PTR *  args = NULL 
)
static

Definition at line 44 of file fb2kdebug.h.

44  {
45  fb2k_instacrash_scope( RaiseException(code,EXCEPTION_NONCONTINUABLE,argCount,args); );
46 }
static PFC_NORETURN void fb2kDeadlock ( )
static

Definition at line 47 of file fb2kdebug.h.

47  {
48  fb2kCriticalError(0x63d81b66);
49 }
static PFC_NORETURN void fb2kCriticalError(DWORD code, DWORD argCount=0, const ULONG_PTR *args=NULL)
Definition: fb2kdebug.h:44
void SHARED_EXPORT fb2kDebugSelfTest ( )
static void fb2kWaitForCompletion ( HANDLE  hEvent)
static

Definition at line 51 of file fb2kdebug.h.

51  {
52  switch(WaitForSingleObject(hEvent, INFINITE)) {
53  case WAIT_OBJECT_0:
54  return;
55  default:
56  uBugCheck();
57  }
58 }
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
Definition: pp-winapi.h:16
PFC_NORETURN void SHARED_EXPORT uBugCheck()
static void fb2kWaitForThreadCompletion ( HANDLE  hWaitFor,
DWORD  threadID 
)
static

Definition at line 60 of file fb2kdebug.h.

60  {
61  switch(WaitForSingleObject(hWaitFor, INFINITE)) {
62  case WAIT_OBJECT_0:
63  return;
64  default:
65  uBugCheck();
66  }
67 }
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
Definition: pp-winapi.h:16
PFC_NORETURN void SHARED_EXPORT uBugCheck()
static void fb2kWaitForThreadCompletion2 ( HANDLE  hWaitFor,
HANDLE  hThread,
DWORD  threadID 
)
static

Definition at line 69 of file fb2kdebug.h.

69  {
70  switch(WaitForSingleObject(hWaitFor, INFINITE)) {
71  case WAIT_OBJECT_0:
72  return;
73  default:
74  uBugCheck();
75  }
76 }
DWORD WaitForSingleObject(HANDLE hHandle, DWORD dwMilliseconds)
Definition: pp-winapi.h:16
PFC_NORETURN void SHARED_EXPORT uBugCheck()
static void OverrideCrtAbort ( )
static

Definition at line 98 of file fb2kdebug.h.

98  {
99  const int signals[] = {SIGINT, SIGTERM, SIGBREAK, SIGABRT};
100  for(size_t i=0; i<_countof(signals); i++) signal(signals[i], _OverrideCrtAbort_handler);
101  _set_abort_behavior(0, ~0);
102 
103  _set_purecall_handler(_PureCallHandler);
104  _set_invalid_parameter_handler(_InvalidParameter);
105 }
static void __cdecl _OverrideCrtAbort_handler(int signal)
Definition: fb2kdebug.h:79
static void _InvalidParameter(const wchar_t *expression, const wchar_t *function, const wchar_t *file, unsigned int line, uintptr_t pReserved)
Definition: fb2kdebug.h:88
static void __cdecl _PureCallHandler()
Definition: fb2kdebug.h:84
PFC_NORETURN void SHARED_EXPORT uBugCheck ( )
LONG SHARED_EXPORT uExceptFilterProc ( LPEXCEPTION_POINTERS  param)
static int uExceptFilterProc_inline ( LPEXCEPTION_POINTERS  param)
static

Definition at line 32 of file fb2kdebug.h.

32  {
33  uDumpCrashInfo(param);
34  TerminateProcess(GetCurrentProcess(), 0);
35  return 0;// never reached
36 }
void SHARED_EXPORT uDumpCrashInfo(LPEXCEPTION_POINTERS param)
LPCSTR SHARED_EXPORT uGetCallStackPath ( )