extended_trace.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. #pragma once
  15. #if defined(WIN32)
  16. #include <windows.h>
  17. #include <tchar.h>
  18. #include <string>
  19. #pragma comment( lib, "imagehlp.lib" )
  20. #define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) InitSymInfo( IniSymbolPath )
  21. #define EXTENDEDTRACEUNINITIALIZE() UninitSymInfo()
  22. #define STACKTRACE(file) StackTrace( GetCurrentThread(), "", file)
  23. #define STACKTRACE2(file, eip, esp, ebp) StackTrace(GetCurrentThread(), "", file, eip, esp, ebp)
  24. // class File;
  25. BOOL InitSymInfo( PCSTR );
  26. BOOL UninitSymInfo();
  27. void StackTrace(HANDLE, char const* msg, FILE *file);
  28. void StackTrace(HANDLE, char const* msg, FILE *file, DWORD eip, DWORD esp, DWORD ebp);
  29. // functions by Masken
  30. void etfprintf(FILE *file, const char *format, ...);
  31. void etfprint(FILE *file, const std::string &text);
  32. #define UEFBUFSIZE 2048
  33. extern char g_uefbuf[UEFBUFSIZE];
  34. #else // not WIN32
  35. #define EXTENDEDTRACEINITIALIZE( IniSymbolPath ) ((void)0)
  36. #define EXTENDEDTRACEUNINITIALIZE() ((void)0)
  37. #define STACKTRACE(file) ((void)0)
  38. #define STACKTRACE2(file, eip, esp, ebp) ((void)0)
  39. #endif // WIN32