Leaked source code of windows server 2003
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.

85 lines
1.6 KiB

  1. /*++
  2. Copyright (C) 1996-1999 Microsoft Corporation
  3. Module Name:
  4. STACKTRACE.H
  5. History:
  6. --*/
  7. //
  8. // Provides a mechanism for generating stacktraces and converting them to
  9. // human readable form.
  10. //
  11. #ifndef ESPUTIL_STACKTRACE_H
  12. #define ESPUTIL_STACKTRACE_H
  13. const UINT MODULE_NAME_LEN = 64;
  14. const UINT SYMBOL_NAME_LEN = 128;
  15. //
  16. // 'human readable' form of a stack-frame. Provides module and function name.
  17. struct SYMBOL_INFO1
  18. {
  19. DWORD dwAddress;
  20. DWORD dwOffset;
  21. TCHAR szModule[MODULE_NAME_LEN];
  22. TCHAR szSymbol[SYMBOL_NAME_LEN];
  23. BOOL fSymbolLocated;
  24. };
  25. #pragma warning(disable:4275)
  26. //
  27. // How we return a complete human readable stack walk.
  28. //
  29. class LTAPIENTRY CSymbolList : public CTypedPtrList<CPtrList, SYMBOL_INFO1 *>
  30. {
  31. public:
  32. CSymbolList();
  33. void Clear(void);
  34. ~CSymbolList();
  35. private:
  36. CSymbolList(const CSymbolList &);
  37. void operator=(const CSymbolList &);
  38. };
  39. #pragma warning(default:4275)
  40. //
  41. // Class for generating stack traces. Provides both native (compact) data
  42. // (in case you want to store it for later), and a human (versbose) form.
  43. //
  44. #pragma warning(disable : 4251)
  45. class LTAPIENTRY CStackTrace
  46. {
  47. public:
  48. CStackTrace();
  49. ~CStackTrace();
  50. void CreateStackTrace(void);
  51. void CreateStackTrace(UINT nSkip, UINT nTotal);
  52. void SetAddresses(const CDWordArray &);
  53. const CDWordArray &GetAddresses(void) const;
  54. void GetSymbolList(CSymbolList &) const;
  55. private:
  56. CStackTrace(const CStackTrace &);
  57. void operator=(const CStackTrace &);
  58. CDWordArray m_adwAddresses;
  59. };
  60. #pragma warning(default : 4251)
  61. #endif