Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
3.1 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #ifndef MINIDUMP_H
  7. #define MINIDUMP_H
  8. #ifdef _WIN32
  9. #pragma once
  10. #endif
  11. #include "tier0/platform.h"
  12. // writes out a minidump of the current stack trace with a unique filename
  13. PLATFORM_INTERFACE void WriteMiniDump();
  14. typedef void (*FnWMain)( int , tchar *[] );
  15. #ifdef IS_WINDOWS_PC
  16. // calls the passed in function pointer and catches any exceptions/crashes thrown by it, and writes a minidump
  17. // use from wmain() to protect the whole program
  18. PLATFORM_INTERFACE void CatchAndWriteMiniDump( FnWMain pfn, int argc, tchar *argv[] );
  19. // The ExceptionInfo_t struct is a typeless data struct
  20. // which is OS-dependent and should never be used by external code.
  21. // Just pass it back into MinidumpSetUnhandledExceptionFunction
  22. struct ExceptionInfo_t;
  23. // Replaces the current function pointer with the one passed in.
  24. // Returns the previously-set function.
  25. // The function is called internally by WriteMiniDump() and CatchAndWriteMiniDump()
  26. // The default is the built-in function that uses DbgHlp.dll's MiniDumpWriteDump function
  27. typedef void (*FnMiniDump)( unsigned int uStructuredExceptionCode, ExceptionInfo_t * pExceptionInfo );
  28. PLATFORM_INTERFACE FnMiniDump SetMiniDumpFunction( FnMiniDump pfn );
  29. // Use this to write a minidump explicitly.
  30. // Some of the tools choose to catch the minidump themselves instead of using CatchAndWriteMinidump
  31. // so they can show their own dialog.
  32. //
  33. // ptchMinidumpFileNameBuffer if not-NULL should be a writable tchar buffer of length at
  34. // least _MAX_PATH and on return will contain the name of the minidump file written.
  35. // If ptchMinidumpFileNameBuffer is NULL the name of the minidump file written will not
  36. // be available after the function returns.
  37. //
  38. // NOTE: Matches windows.h
  39. enum MinidumpType_t
  40. {
  41. MINIDUMP_Normal = 0x00000000,
  42. MINIDUMP_WithDataSegs = 0x00000001,
  43. MINIDUMP_WithFullMemory = 0x00000002,
  44. MINIDUMP_WithHandleData = 0x00000004,
  45. MINIDUMP_FilterMemory = 0x00000008,
  46. MINIDUMP_ScanMemory = 0x00000010,
  47. MINIDUMP_WithUnloadedModules = 0x00000020,
  48. MINIDUMP_WithIndirectlyReferencedMemory = 0x00000040,
  49. MINIDUMP_FilterModulePaths = 0x00000080,
  50. MINIDUMP_WithProcessThreadData = 0x00000100,
  51. MINIDUMP_WithPrivateReadWriteMemory = 0x00000200,
  52. MINIDUMP_WithoutOptionalData = 0x00000400,
  53. MINIDUMP_WithFullMemoryInfo = 0x00000800,
  54. MINIDUMP_WithThreadInfo = 0x00001000,
  55. MINIDUMP_WithCodeSegs = 0x00002000
  56. };
  57. PLATFORM_INTERFACE bool WriteMiniDumpUsingExceptionInfo(
  58. unsigned int uStructuredExceptionCode,
  59. ExceptionInfo_t *pExceptionInfo,
  60. uint32 nMinidumpTypeFlags, // OR-ed together MinidumpType_t flags
  61. tchar *ptchMinidumpFileNameBuffer = NULL
  62. );
  63. PLATFORM_INTERFACE void MinidumpSetUnhandledExceptionFunction( FnMiniDump pfn );
  64. #endif
  65. #endif // MINIDUMP_H