ROSE  0.9.10.103
BinaryAstHash.h
1 #ifndef ROSE_BinaryAnalysis_AstHash_H
2 #define ROSE_BinaryAnalysis_AstHash_H
3 
4 #include <MemoryMap.h>
5 #include <Partitioner2/BasicBlock.h>
6 #include "Combinatorics.h"
7 
8 namespace Rose {
9 namespace BinaryAnalysis {
10 
30  {
31  public:
32  // @brief Constructor just initializes output buffer
33  AstHash(Rose::Combinatorics::Hasher& in_hasher, bool includeConstants = false, bool includeAddresses = false) :
34  hasher_(in_hasher), includeConstants(includeConstants), includeAddresses(includeAddresses){}
35 
36  // @brief Generates the hash. Called by traverse
37  void visit(SgNode* n);
38 
39  // @brief For the Partitioner Interface, traverses a basic block
40  void appendBasicBlock(Rose::BinaryAnalysis::Partitioner2::BasicBlock::Ptr bb );
41 
42  // @brief Gets the Rose::Combinatorics::Hasher
43  const Rose::Combinatorics::Hasher& hasher() const { return hasher_; };
44 
45  private:
46  // @brief The reference used to the output data buffer,
47  // get the opcodes
49 
50  // @brief Include constant values in the hash, usually
51  // false to avoid linking changing pointers, and therefore
52  // the signature
53  bool includeConstants;
54 
55  // @brief Include instruction addresses in the hash, usually
56  // false to avoid different memory map changing the signature
57  bool includeAddresses;
58 
59  };
60 
61 } // namespace
62 } // namespace
63 
64 #endif
Class for traversing the AST.
Main namespace for the ROSE library.
void visit(SgNode *n)
this method is called at every traversed node.
This class represents the base class for all IR nodes within Sage III.
Definition: Cxx_Grammar.h:8752
A simple traversal that builds up a hash code for the AST.
Definition: BinaryAstHash.h:29