ROSE  0.11.2.0
BinaryAstHash.h
1 #ifndef ROSE_BinaryAnalysis_AstHash_H
2 #define ROSE_BinaryAnalysis_AstHash_H
3 #include <rosePublicConfig.h>
4 #ifdef ROSE_BUILD_BINARY_ANALYSIS_SUPPORT
5 
6 #include <MemoryMap.h>
7 #include <Partitioner2/BasicBlock.h>
8 #include "Combinatorics.h"
9 
10 namespace Rose {
11 namespace BinaryAnalysis {
12 
32  {
33  public:
34  // @brief Constructor just initializes output buffer
35  AstHash(boost::shared_ptr<Rose::Combinatorics::Hasher> in_hasher, bool includeConstants = false, bool includeAddresses = false) :
36  hasher_(in_hasher), includeConstants(includeConstants), includeAddresses(includeAddresses){}
37 
38  // @brief Generates the hash. Called by traverse
39  void visit(SgNode* n);
40 
41  // @brief For the Partitioner Interface, traverses a basic block
42  void appendBasicBlock(Rose::BinaryAnalysis::Partitioner2::BasicBlock::Ptr bb );
43 
44  // @brief Gets the Rose::Combinatorics::Hasher
45  const boost::shared_ptr<Rose::Combinatorics::Hasher> hasher() const { return hasher_; };
46 
47  private:
48  // @brief The reference used to the output data buffer,
49  // get the opcodes
50  boost::shared_ptr<Rose::Combinatorics::Hasher> hasher_;
51 
52  // @brief Include constant values in the hash, usually
53  // false to avoid linking changing pointers, and therefore
54  // the signature
55  bool includeConstants;
56 
57  // @brief Include instruction addresses in the hash, usually
58  // false to avoid different memory map changing the signature
59  bool includeAddresses;
60 
61  };
62 
63 } // namespace
64 } // namespace
65 
66 #endif
67 #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:9311
A simple traversal that builds up a hash code for the AST.
Definition: BinaryAstHash.h:31