summaryrefslogtreecommitdiff
path: root/src/shared/stackdata.h
blob: 7151699cce418223f23e489acac55ded5c4d6ffd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef STACKDATA_H
#define STACKDATA_H


#include <string>
#include <Windows.h>


namespace MOShared {


class StackData {
  friend bool operator==(const StackData &LHS, const StackData &RHS);
  friend bool operator<(const StackData &LHS, const StackData &RHS);
public:

  StackData();
  StackData(const char *function, int line);

  std::string toString() const;

private:

  void load_modules(HANDLE process, DWORD processID);

  void initTrace();

private:

  static const int FRAMES_TO_SKIP = 1;
  static const int FRAMES_TO_CAPTURE = 20;

private:

  LPVOID m_Stack[FRAMES_TO_CAPTURE];
  USHORT m_Count;
  std::string m_Function;
  int m_Line;

};


bool operator==(const StackData &LHS, const StackData &RHS);

bool operator<(const StackData &LHS, const StackData &RHS);

} // namespace MOShared


#endif // STACKDATA_H