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.

83 lines
1.8 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // File: stacktrace.h
  4. // Copyright (C) 1994-1997 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // Provides a mechanism for generating stacktraces and converting them to
  8. // human readable form.
  9. //
  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. namespace LocStudio {
  18. struct SYMBOL_INFO
  19. {
  20. DWORD dwAddress;
  21. DWORD dwOffset;
  22. TCHAR szModule[MODULE_NAME_LEN];
  23. TCHAR szSymbol[SYMBOL_NAME_LEN];
  24. BOOL fSymbolLocated;
  25. };
  26. } // namespace LocStudio
  27. #pragma warning(disable:4275)
  28. //
  29. // How we return a complete human readable stack walk.
  30. //
  31. class LTAPIENTRY CSymbolList : public CTypedPtrList<CPtrList, LocStudio::SYMBOL_INFO *>
  32. {
  33. public:
  34. CSymbolList();
  35. void Clear(void);
  36. ~CSymbolList();
  37. private:
  38. CSymbolList(const CSymbolList &);
  39. void operator=(const CSymbolList &);
  40. };
  41. #pragma warning(default:4275)
  42. //
  43. // Class for generating stack traces. Provides both native (compact) data
  44. // (in case you want to store it for later), and a human (versbose) form.
  45. //
  46. #pragma warning(disable : 4251)
  47. class LTAPIENTRY CStackTrace
  48. {
  49. public:
  50. CStackTrace();
  51. ~CStackTrace();
  52. void CreateStackTrace(void);
  53. void CreateStackTrace(UINT nSkip, UINT nTotal);
  54. void SetAddresses(const CDWordArray &);
  55. const CDWordArray &GetAddresses(void) const;
  56. void GetSymbolList(CSymbolList &) const;
  57. private:
  58. CStackTrace(const CStackTrace &);
  59. void operator=(const CStackTrace &);
  60. CDWordArray m_adwAddresses;
  61. };
  62. #pragma warning(default : 4251)
  63. #endif