libTriton  version 0.7 build 1398
snapshot.hpp
Go to the documentation of this file.
1 /*
3 ** Copyright (C) - Triton
4 **
5 ** This program is under the terms of the BSD License.
6 */
7 
8 #ifndef PINTOOL_SNAPSHOT_H
9 #define PINTOOL_SNAPSHOT_H
10 
11 #include <map>
12 #include <set>
13 
14 #include <pin.H>
15 
16 /* libTriton */
17 #include <triton/ast.hpp>
19 #include <triton/taintEngine.hpp>
20 #include <triton/x8664Cpu.hpp>
21 #include <triton/x86Cpu.hpp>
22 
23 
25 namespace tracer {
31  namespace pintool {
39  class Snapshot {
42 
43  private:
45  std::map<triton::__uint, char> memory;
46 
48  bool locked;
49 
51  bool mustBeRestore;
52 
55 
57  triton::engines::taint::TaintEngine* snapshotTaintEngine;
58 
61 
63  #if defined(__x86_64__) || defined(_M_X64)
65  #endif
66  #if defined(__i386) || defined(_M_IX86)
68  #endif
69 
71  CONTEXT pinCtx;
72 
73 
74  public:
76  Snapshot();
77 
79  ~Snapshot();
80 
82  CONTEXT *getCtx(void);
83 
85  bool isLocked(void);
86 
88  bool mustBeRestored(void);
89 
91  void addModification(triton::__uint address, char byte);
92 
94  void disableSnapshot(void);
95 
97  void resetEngine(void);
98 
100  void restoreSnapshot(CONTEXT *ctx);
101 
103  void setRestore(bool flag);
104 
106  void takeSnapshot(CONTEXT *ctx);
107  };
108 
110  };
112 };
113 
114 #endif /* PINTOOL_SNAPSHOT_H */
115 
void restoreSnapshot(CONTEXT *ctx)
Restores a snapshot.
Definition: snapshot.cpp:66
Snapshot()
Constructor.
Definition: snapshot.cpp:19
void resetEngine(void)
Resets the snapshot engine.
Definition: snapshot.cpp:111
void takeSnapshot(CONTEXT *ctx)
Takes a snapshot.
Definition: snapshot.cpp:39
void setRestore(bool flag)
Sets the restore flag.
Definition: snapshot.cpp:140
AST Context - Used as AST builder.
Definition: astContext.hpp:49
CONTEXT * getCtx(void)
Returns the Pin context.
Definition: snapshot.cpp:128
bool mustBeRestored(void)
Returns true if we must restore the context.
Definition: snapshot.cpp:134
void disableSnapshot(void)
Disables the snapshot engine.
Definition: snapshot.cpp:104
~Snapshot()
Destructor.
Definition: snapshot.cpp:27
This class is used to describe the x86 (64-bits) spec.
Definition: x8664Cpu.hpp:52
bool isLocked(void)
Returns true if the snapshot engine is disabled.
Definition: snapshot.cpp:123
This class is used to describe the x86 (32-bits) spec.
Definition: x86Cpu.hpp:52
The taint engine class.
Definition: taintEngine.hpp:53
void addModification(triton::__uint address, char byte)
Adds a memory modifiction.
Definition: snapshot.cpp:32
unsigned long long __uint
unsigned long long if the arch is 64-bits.
Definition: tritonTypes.hpp:71
The Tracer namespace.
Definition: api.cpp:12