extended_trace.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // -----------------------------------------------------------------------------------------
  2. //
  3. // Written by Zoltan Csizmadia, zoltan_csizmadia@yahoo.com
  4. // For companies(Austin,TX): If you would like to get my resume, send an email.
  5. //
  6. // The source is free, but if you want to use it, mention my name and e-mail address
  7. //
  8. // History:
  9. // 1.0 Initial version Zoltan Csizmadia
  10. // 1.1 WhineCube version Masken
  11. // 1.2 Dolphin version Masken
  12. //
  13. // ----------------------------------------------------------------------------------------
  14. #ifndef _EXTENDEDTRACE_H_INCLUDED_
  15. #define _EXTENDEDTRACE_H_INCLUDED_
  16. #if defined(WIN32)
  17. #include <windows.h>
  18. #include <tchar.h>
  19. #include <string>
  20. #pragma comment( lib, "imagehlp.lib" )
  21. #define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
  22. #define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
  23. #define STACKTRACE(file) StackTrace( GetCurrentThread(), "", file)
  24. #define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), "", file, eip, esp, ebp)
  25. // class File;
  26. BOOL InitSymInfo( PCSTR );
  27. BOOL UninitSymInfo();
  28. void StackTrace(HANDLE, char const* msg, FILE *file);
  29. void StackTrace(HANDLE, char const* msg, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
  30. // functions by Masken
  31. void etfprintf(FILE *file, const char *format, ...);
  32. void etfprint(FILE *file, const std::string &text);
  33. #define UEFBUFSIZE 2048
  34. extern char g_uefbuf[UEFBUFSIZE];
  35. #else // not WIN32
  36. #define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
  37. #define EXTENDEDTRACEUNINITIALIZE() ((void)0)
  38. #define STACKTRACE(file) ((void)0)
  39. #define STACKTRACE2(file, eip, esp, ebp) ((void)0)
  40. #endif // WIN32
  41. #endif // _EXTENDEDTRACE_H_INCLUDED_