ROSE  0.9.9.139
Engine.h
1 #ifndef ROSE_Partitioner2_Engine_H
2 #define ROSE_Partitioner2_Engine_H
3 
4 #include <BinaryLoader.h>
5 #include <boost/noncopyable.hpp>
6 #include <Disassembler.h>
7 #include <FileSystem.h>
8 #include <Partitioner2/Function.h>
9 #include <Partitioner2/Partitioner.h>
10 #include <Partitioner2/Utility.h>
11 #include <Progress.h>
12 #include <Sawyer/DistinctList.h>
13 
14 namespace Rose {
15 namespace BinaryAnalysis {
16 namespace Partitioner2 {
17 
101 class ROSE_DLL_API Engine: private boost::noncopyable {
102 public:
106  struct Settings {
113  private:
114  friend class boost::serialization::access;
115 
116  template<class S>
117  void serialize(S &s, unsigned version) {
118  s & loader & disassembler & partitioner & engine & astConstruction;
119  }
120  };
121 
123  // Internal data structures
125 private:
126  // Engine callback for handling instructions added to basic blocks. This is called when a basic block is discovered,
127  // before it's attached to a partitioner, so it shouldn't really be modifying any state in the engine, but rather only
128  // preparing the basic block to be processed.
129  class BasicBlockFinalizer: public BasicBlockCallback {
130  typedef Sawyer::Container::Map<rose_addr_t /*target*/, std::vector<rose_addr_t> /*sources*/> WorkList;
131  public:
132  static Ptr instance() { return Ptr(new BasicBlockFinalizer); }
133  virtual bool operator()(bool chain, const Args &args) ROSE_OVERRIDE;
134  };
135 
136  // Basic blocks that need to be worked on next. These lists are adjusted whenever a new basic block (or placeholder) is
137  // inserted or erased from the CFG.
138  class BasicBlockWorkList: public CfgAdjustmentCallback {
139  Sawyer::Container::DistinctList<rose_addr_t> pendingCallReturn_; // blocks that might need an E_CALL_RETURN edge
140  Sawyer::Container::DistinctList<rose_addr_t> processedCallReturn_; // call sites whose may-return was indeterminate
141  Sawyer::Container::DistinctList<rose_addr_t> finalCallReturn_; // indeterminate call sites awaiting final analysis
142  Sawyer::Container::DistinctList<rose_addr_t> undiscovered_; // undiscovered basic block list (last-in-first-out)
143  Engine *engine_; // engine to which this callback belongs
144  protected:
145  explicit BasicBlockWorkList(Engine *engine): engine_(engine) {}
146  public:
148  static Ptr instance(Engine *engine) { return Ptr(new BasicBlockWorkList(engine)); }
149  virtual bool operator()(bool chain, const AttachedBasicBlock &args) ROSE_OVERRIDE;
150  virtual bool operator()(bool chain, const DetachedBasicBlock &args) ROSE_OVERRIDE;
151  Sawyer::Container::DistinctList<rose_addr_t>& pendingCallReturn() { return pendingCallReturn_; }
152  Sawyer::Container::DistinctList<rose_addr_t>& processedCallReturn() { return processedCallReturn_; }
153  Sawyer::Container::DistinctList<rose_addr_t>& finalCallReturn() { return finalCallReturn_; }
154  Sawyer::Container::DistinctList<rose_addr_t>& undiscovered() { return undiscovered_; }
155  void moveAndSortCallReturn(const Partitioner&);
156  };
157 
158  // A work list providing constants from instructions that are part of the CFG.
159  class CodeConstants: public CfgAdjustmentCallback {
160  public:
162 
163  private:
164  std::set<rose_addr_t> toBeExamined_; // instructions waiting to be examined
165  std::set<rose_addr_t> wasExamined_; // instructions we've already examined
166  rose_addr_t inProgress_; // instruction that is currently in progress
167  std::vector<rose_addr_t> constants_; // constants for the instruction in progress
168 
169  protected:
170  CodeConstants(): inProgress_(0) {}
171 
172  public:
173  static Ptr instance() { return Ptr(new CodeConstants); }
174 
175  // Possibly insert more instructions into the work list when a basic block is added to the CFG
176  virtual bool operator()(bool chain, const AttachedBasicBlock &attached) ROSE_OVERRIDE;
177 
178  // Possibly remove instructions from the worklist when a basic block is removed from the CFG
179  virtual bool operator()(bool chain, const DetachedBasicBlock &detached) ROSE_OVERRIDE;
180 
181  // Return the next available constant if any.
182  Sawyer::Optional<rose_addr_t> nextConstant(const Partitioner &partitioner);
183  };
184 
186  // Data members
188 private:
189  Settings settings_; // Settings for the partitioner.
190  SgAsmInterpretation *interp_; // interpretation set by loadSpecimen
191  BinaryLoader *binaryLoader_; // how to remap, link, and fixup
192  Disassembler *disassembler_; // not ref-counted yet, but don't destroy it since user owns it
193  MemoryMap::Ptr map_; // memory map initialized by load()
194  BasicBlockWorkList::Ptr basicBlockWorkList_; // what blocks to work on next
195  CodeConstants::Ptr codeFunctionPointers_; // generates constants that are found in instruction ASTs
196  Progress::Ptr progress_; // optional progress reporting
197 
199  // Constructors
201 public:
204  : interp_(NULL), binaryLoader_(NULL), disassembler_(NULL), basicBlockWorkList_(BasicBlockWorkList::instance(this)),
205  progress_(Progress::instance()) {
206  init();
207  }
208 
210  explicit Engine(const Settings &settings)
211  : settings_(settings), interp_(NULL), binaryLoader_(NULL), disassembler_(NULL),
212  basicBlockWorkList_(BasicBlockWorkList::instance(this)), progress_(Progress::instance()) {
213  init();
214  }
215 
216  virtual ~Engine() {}
217 
219  // The very top-level use case
221 public:
246  SgAsmBlock* frontend(int argc, char *argv[],
247  const std::string &purpose, const std::string &description);
248  virtual SgAsmBlock* frontend(const std::vector<std::string> &args,
249  const std::string &purpose, const std::string &description);
252  // Basic top-level steps
255 public:
261  void reset();
262 
289  Sawyer::CommandLine::ParserResult parseCommandLine(int argc, char *argv[],
290  const std::string &purpose, const std::string &description) /*final*/;
291  virtual Sawyer::CommandLine::ParserResult parseCommandLine(const std::vector<std::string> &args,
292  const std::string &purpose, const std::string &description);
314  virtual SgAsmInterpretation* parseContainers(const std::vector<std::string> &fileNames);
315  SgAsmInterpretation* parseContainers(const std::string &fileName) /*final*/;
338  virtual MemoryMap::Ptr loadSpecimens(const std::vector<std::string> &fileNames = std::vector<std::string>());
339  MemoryMap::Ptr loadSpecimens(const std::string &fileName) /*final*/;
361  virtual Partitioner partition(const std::vector<std::string> &fileNames = std::vector<std::string>());
362  Partitioner partition(const std::string &fileName) /*final*/;
379  SgAsmBlock* buildAst(const std::vector<std::string> &fileNames = std::vector<std::string>()) /*final*/;
380  SgAsmBlock* buildAst(const std::string &fileName) /*final*/;
383  // Command-line parsing
385  //
386  // top-level: parseCommandLine
388 public:
390  virtual Sawyer::CommandLine::SwitchGroup loaderSwitches();
391 
393  virtual Sawyer::CommandLine::SwitchGroup disassemblerSwitches();
394 
396  virtual Sawyer::CommandLine::SwitchGroup partitionerSwitches();
397 
399  virtual Sawyer::CommandLine::SwitchGroup engineSwitches();
400 
402  virtual Sawyer::CommandLine::SwitchGroup astConstructionSwitches();
403 
405  static std::string specimenNameDocumentation();
406 
418  virtual Sawyer::CommandLine::Parser commandLineParser(const std::string &purpose, const std::string &description);
419 
426  virtual void checkSettings();
427 
429  // Container parsing
430  //
431  // top-level: parseContainers
433 public:
438  virtual bool isNonContainer(const std::string&);
439 
445  virtual bool areContainersParsed() const;
446 
448  // Load specimens
449  //
450  // top-level: loadSpecimens
452 public:
456  virtual bool areSpecimensLoaded() const;
457 
473  virtual BinaryLoader *obtainLoader(BinaryLoader *hint=NULL);
474 
480  virtual void loadContainers(const std::vector<std::string> &fileNames);
481 
486  virtual void loadNonContainers(const std::vector<std::string> &names);
487 
491  virtual void adjustMemoryMap();
492 
501  MemoryMap::Ptr memoryMap() const /*final*/ { return map_; }
502  virtual void memoryMap(const MemoryMap::Ptr &m) { map_ = m; }
506  // Disassembler
509 public:
526  virtual Disassembler* obtainDisassembler(Disassembler *hint=NULL);
530  // Partitioner high-level functions
532  //
533  // top-level: partition
535 public:
537  virtual void checkCreatePartitionerPrerequisites() const;
538 
545  virtual Partitioner createBarePartitioner();
546 
552  virtual Partitioner createGenericPartitioner();
553 
558  virtual Partitioner createTunedPartitioner();
559 
564  virtual Partitioner createPartitionerFromAst(SgAsmInterpretation*);
565 
570  virtual Partitioner createPartitioner();
571 
575  virtual void runPartitionerInit(Partitioner&);
576 
580  virtual void runPartitionerRecursive(Partitioner&);
581 
586  virtual void runPartitionerFinal(Partitioner&);
587 
593  virtual void runPartitioner(Partitioner&);
594 
595 
597  // Partitioner mid-level functions
598  //
599  // These are the functions called by the partitioner high-level stuff. These are sometimes overridden in subclasses,
600  // although it is more likely that the high-level stuff is overridden.
602 public:
607  virtual void labelAddresses(Partitioner&);
608 
612  virtual std::vector<DataBlock::Ptr> makeConfiguredDataBlocks(Partitioner&, const Configuration&);
613 
617  virtual std::vector<Function::Ptr> makeConfiguredFunctions(Partitioner&, const Configuration&);
618 
625  virtual std::vector<Function::Ptr> makeEntryFunctions(Partitioner&, SgAsmInterpretation*);
626 
633  virtual std::vector<Function::Ptr> makeErrorHandlingFunctions(Partitioner&, SgAsmInterpretation*);
634 
644  virtual std::vector<Function::Ptr> makeImportFunctions(Partitioner&, SgAsmInterpretation*);
645 
652  virtual std::vector<Function::Ptr> makeExportFunctions(Partitioner&, SgAsmInterpretation*);
653 
660  virtual std::vector<Function::Ptr> makeSymbolFunctions(Partitioner&, SgAsmInterpretation*);
661 
669  virtual std::vector<Function::Ptr> makeContainerFunctions(Partitioner&, SgAsmInterpretation*);
670 
677  virtual std::vector<Function::Ptr> makeInterruptVectorFunctions(Partitioner&, const AddressInterval &vector);
678 
683  virtual std::vector<Function::Ptr> makeUserFunctions(Partitioner&, const std::vector<rose_addr_t>&);
684 
691  virtual void discoverBasicBlocks(Partitioner&);
692 
702  virtual Function::Ptr makeNextDataReferencedFunction(const Partitioner&, rose_addr_t &startVa /*in,out*/);
703 
715  virtual Function::Ptr makeNextCodeReferencedFunction(const Partitioner&);
716 
723  virtual std::vector<Function::Ptr> makeCalledFunctions(Partitioner&);
724 
737  virtual std::vector<Function::Ptr> makeNextPrologueFunction(Partitioner&, rose_addr_t startVa);
738 
757  virtual std::vector<Function::Ptr>
758  makeFunctionFromInterFunctionCalls(Partitioner &partitioner, rose_addr_t &startVa /*in,out*/);
759 
766  virtual void discoverFunctions(Partitioner&);
767 
782  virtual std::set<rose_addr_t> attachDeadCodeToFunction(Partitioner&, const Function::Ptr&, size_t maxIterations=size_t(-1));
783 
791  virtual DataBlock::Ptr attachPaddingToFunction(Partitioner&, const Function::Ptr&);
792 
797  virtual std::vector<DataBlock::Ptr> attachPaddingToFunctions(Partitioner&);
798 
809  virtual size_t attachAllSurroundedCodeToFunctions(Partitioner&);
810 
818  virtual size_t attachSurroundedCodeToFunctions(Partitioner&);
819 
824  virtual void attachBlocksToFunctions(Partitioner&);
825 
832  virtual std::set<rose_addr_t> attachDeadCodeToFunctions(Partitioner&, size_t maxIterations=size_t(-1));
833 
843  virtual std::vector<DataBlock::Ptr> attachSurroundedDataToFunctions(Partitioner&);
844 
850  virtual void updateAnalysisResults(Partitioner&);
851 
852 
854  // Partitioner low-level functions
855  //
856  // These are functions that a subclass seldom overrides, and maybe even shouldn't override because of their complexity or
857  // the way the interact with one another.
859 public:
870  virtual bool makeNextCallReturnEdge(Partitioner&, boost::logic::tribool assumeCallReturns);
871 
877  virtual BasicBlock::Ptr makeNextBasicBlockFromPlaceholder(Partitioner&);
878 
893  virtual BasicBlock::Ptr makeNextBasicBlock(Partitioner&);
894 
895 
897  // Build AST
899 public:
900  // Used internally by ROSE's ::frontend disassemble instructions to build the AST that goes under each SgAsmInterpretation.
901  static void disassembleForRoseFrontend(SgAsmInterpretation*);
902 
903 
905  // Settings and properties
907 public:
914  const Settings& settings() const /*final*/ { return settings_; }
915  Settings& settings() /*final*/ { return settings_; }
926  bool exitOnError() const /*final*/ { return settings_.engine.exitOnError; }
927  virtual void exitOnError(bool b) { settings_.engine.exitOnError = b; }
935  Progress::Ptr progress() const /*final*/ { return progress_; }
936  virtual void progress(const Progress::Ptr &progress) { progress_ = progress; }
946  SgAsmInterpretation* interpretation() const /*final*/ { return interp_; }
947  virtual void interpretation(SgAsmInterpretation *interp) { interp_ = interp; }
956  BinaryLoader* binaryLoader() const /*final*/ { return binaryLoader_; }
957  virtual void binaryLoader(BinaryLoader *loader) { binaryLoader_ = loader; }
970  size_t deExecuteZerosThreshold() const /*final*/ { return settings_.loader.deExecuteZerosThreshold; }
971  virtual void deExecuteZerosThreshold(size_t n) { settings_.loader.deExecuteZerosThreshold = n; }
972  size_t deExecuteZerosLeaveAtFront() const /*final*/ { return settings_.loader.deExecuteZerosLeaveAtFront; }
973  virtual void deExecuteZerosLeaveAtFront(size_t n) { settings_.loader.deExecuteZerosLeaveAtFront = n; }
974  size_t deExecuteZerosLeaveAtBack() const /*final*/ { return settings_.loader.deExecuteZerosLeaveAtBack; }
975  virtual void deExecuteZerosLeaveAtBack(size_t n) { settings_.loader.deExecuteZerosLeaveAtBack = n; }
990  MemoryDataAdjustment memoryDataAdjustment() const /*final*/ { return settings_.loader.memoryDataAdjustment; }
991  virtual void memoryDataAdjustment(MemoryDataAdjustment x) { settings_.loader.memoryDataAdjustment = x; }
1001  bool memoryIsExecutable() const /*final*/ { return settings_.loader.memoryIsExecutable; }
1002  virtual void memoryIsExecutable(bool b) { settings_.loader.memoryIsExecutable = b; }
1011  Disassembler *disassembler() const /*final*/ { return disassembler_; }
1012  virtual void disassembler(Disassembler *d) { disassembler_ = d; }
1021  const std::string& isaName() const /*final*/ { return settings_.disassembler.isaName; }
1022  virtual void isaName(const std::string &s) { settings_.disassembler.isaName = s; }
1031  const std::vector<rose_addr_t>& startingVas() const /*final*/ { return settings_.partitioner.startingVas; }
1032  std::vector<rose_addr_t>& startingVas() /*final*/ { return settings_.partitioner.startingVas; }
1041  bool usingSemantics() const /*final*/ { return settings_.partitioner.base.usingSemantics; }
1042  virtual void usingSemantics(bool b) { settings_.partitioner.base.usingSemantics = b; }
1051  SemanticMemoryParadigm semanticMemoryParadigm() const /*final*/ { return settings_.partitioner.semanticMemoryParadigm; }
1052  virtual void semanticMemoryParadigm(SemanticMemoryParadigm p) { settings_.partitioner.semanticMemoryParadigm = p; }
1063  bool followingGhostEdges() const /*final*/ { return settings_.partitioner.followingGhostEdges; }
1064  virtual void followingGhostEdges(bool b) { settings_.partitioner.followingGhostEdges = b; }
1074  bool discontiguousBlocks() const /*final*/ { return settings_.partitioner.discontiguousBlocks; }
1075  virtual void discontiguousBlocks(bool b) { settings_.partitioner.discontiguousBlocks = b; }
1084  bool findingFunctionPadding() const /*final*/ { return settings_.partitioner.findingFunctionPadding; }
1085  virtual void findingFunctionPadding(bool b) { settings_.partitioner.findingFunctionPadding = b; }
1094  bool findingThunks() const /*final*/ { return settings_.partitioner.findingThunks; }
1095  virtual void findingThunks(bool b) { settings_.partitioner.findingThunks = b; }
1104  bool splittingThunks() const /*final*/ { return settings_.partitioner.splittingThunks; }
1105  virtual void splittingThunks(bool b) { settings_.partitioner.splittingThunks = b; }
1114  bool findingDeadCode() const /*final*/ { return settings_.partitioner.findingDeadCode; }
1115  virtual void findingDeadCode(bool b) { settings_.partitioner.findingDeadCode = b; }
1124  rose_addr_t peScramblerDispatcherVa() const /*final*/ { return settings_.partitioner.peScramblerDispatcherVa; }
1125  virtual void peScramblerDispatcherVa(rose_addr_t va) { settings_.partitioner.peScramblerDispatcherVa = va; }
1134  bool findingIntraFunctionCode() const /*final*/ { return settings_.partitioner.findingIntraFunctionCode; }
1135  virtual void findingIntraFunctionCode(bool b) { settings_.partitioner.findingIntraFunctionCode = b; }
1144  bool findingIntraFunctionData() const /*final*/ { return settings_.partitioner.findingIntraFunctionData; }
1145  virtual void findingIntraFunctionData(bool b) { settings_.partitioner.findingIntraFunctionData = b; }
1154  const AddressInterval& interruptVector() const /*final*/ { return settings_.partitioner.interruptVector; }
1155  virtual void interruptVector(const AddressInterval &i) { settings_.partitioner.interruptVector = i; }
1164  bool doingPostAnalysis() const /*final*/ { return settings_.partitioner.doingPostAnalysis; }
1165  virtual void doingPostAnalysis(bool b) { settings_.partitioner.doingPostAnalysis = b; }
1173  bool doingPostFunctionMayReturn() const /*final*/ { return settings_.partitioner.doingPostFunctionMayReturn; }
1174  virtual void doingPostFunctionMayReturn(bool b) { settings_.partitioner.doingPostFunctionMayReturn = b; }
1182  bool doingPostFunctionStackDelta() const /*final*/ { return settings_.partitioner.doingPostFunctionStackDelta; }
1183  virtual void doingPostFunctionStackDelta(bool b) { settings_.partitioner.doingPostFunctionStackDelta = b; }
1191  bool doingPostCallingConvention() const /*final*/ { return settings_.partitioner.doingPostCallingConvention; }
1192  virtual void doingPostCallingConvention(bool b) { settings_.partitioner.doingPostCallingConvention = b; }
1201  bool doingPostFunctionNoop() const /*final*/ { return settings_.partitioner.doingPostFunctionNoop; }
1202  virtual void doingPostFunctionNoop(bool b) { settings_.partitioner.doingPostFunctionNoop = b; }
1211  FunctionReturnAnalysis functionReturnAnalysis() const /*final*/ { return settings_.partitioner.functionReturnAnalysis; }
1212  virtual void functionReturnAnalysis(FunctionReturnAnalysis x) { settings_.partitioner.functionReturnAnalysis = x; }
1221  bool findingInterFunctionCalls() const /*final*/ { return settings_.partitioner.findingInterFunctionCalls; }
1222  virtual void findingInterFunctionCalls(bool b) { settings_.partitioner.findingInterFunctionCalls = b; }
1231  bool findingDataFunctionPointers() const /*final*/ { return settings_.partitioner.findingDataFunctionPointers; }
1232  virtual void findingDataFunctionPointers(bool b) { settings_.partitioner.findingDataFunctionPointers = b; }
1241  bool findingCodeFunctionPointers() const /*final*/ { return settings_.partitioner.findingCodeFunctionPointers; }
1242  virtual void findingCodeFunctionPointers(bool b) { settings_.partitioner.findingCodeFunctionPointers = b; }
1250  bool checkingCallBranch() const /*final*/ { return settings_.partitioner.base.checkingCallBranch; }
1251  virtual void checkingCallBranch(bool b) { settings_.partitioner.base.checkingCallBranch = b; }
1265  bool basicBlockSemanticsAutoDrop() const /*final*/ { return settings_.partitioner.base.basicBlockSemanticsAutoDrop; }
1266  void basicBlockSemanticsAutoDrop(bool b) { settings_.partitioner.base.basicBlockSemanticsAutoDrop = b; }
1274  const std::vector<std::string>& configurationNames() /*final*/ const { return settings_.engine.configurationNames; }
1275  std::vector<std::string>& configurationNames() /*final*/ { return settings_.engine.configurationNames; }
1283  bool namingConstants() const /*final*/ { return settings_.partitioner.namingConstants; }
1284  virtual void namingConstants(bool b) { settings_.partitioner.namingConstants = b; }
1292  bool namingStrings() const /*final*/ { return settings_.partitioner.namingStrings; }
1293  virtual void namingStrings(bool b) { settings_.partitioner.namingStrings = b; }
1302  bool demangleNames() const /*final*/ { return settings_.partitioner.demangleNames; }
1303  virtual void demangleNames(bool b) { settings_.partitioner.demangleNames = b; }
1312  bool astAllowEmptyGlobalBlock() const /*final*/ { return settings_.astConstruction.allowEmptyGlobalBlock; }
1313  virtual void astAllowEmptyGlobalBlock(bool b) { settings_.astConstruction.allowEmptyGlobalBlock = b; }
1322  bool astAllowFunctionWithNoBasicBlocks() const /*final*/ {
1323  return settings_.astConstruction.allowFunctionWithNoBasicBlocks;
1324  }
1325  virtual void astAllowFunctionWithNoBasicBlocks(bool b) {
1326  settings_.astConstruction.allowFunctionWithNoBasicBlocks = b;
1327  }
1336  bool astAllowEmptyBasicBlock() const /*final*/ { return settings_.astConstruction.allowEmptyBasicBlocks; }
1337  virtual void astAllowEmptyBasicBlock(bool b) { settings_.astConstruction.allowEmptyBasicBlocks = b; }
1349  bool astCopyAllInstructions() const /*final*/ { return settings_.astConstruction.copyAllInstructions; }
1350  virtual void astCopyAllInstructions(bool b) { settings_.astConstruction.copyAllInstructions = b; }
1353  // Internal stuff
1356 private:
1357  void init();
1358 };
1359 
1360 } // namespace
1361 } // namespace
1362 } // namespace
1363 
1364 #endif
const Settings & settings() const
Property: All settings.
Definition: Engine.h:914
bool doingPostFunctionStackDelta() const
Property: Whether to run the function stack delta analysis.
Definition: Engine.h:1182
virtual void findingIntraFunctionCode(bool b)
Property: Whether to find intra-function code.
Definition: Engine.h:1135
virtual void memoryIsExecutable(bool b)
Property: Global adjustment to executability.
Definition: Engine.h:1002
virtual void disassembler(Disassembler *d)
Property: Disassembler.
Definition: Engine.h:1012
bool checkingCallBranch() const
Property: Whether to look for function calls used as branches.
Definition: Engine.h:1250
Settings for controling the engine behavior.
Definition: BasicTypes.h:353
virtual void namingStrings(bool b)
Property: Give names to string literal addresses.
Definition: Engine.h:1293
MemoryDataAdjustment
How the partitioner should globally treat memory.
Definition: BasicTypes.h:155
bool findingInterFunctionCalls() const
Property: Whether to search for function calls between exiting functions.
Definition: Engine.h:1221
Instruction basic block.
Progress::Ptr progress() const
Property: progress reporting.
Definition: Engine.h:935
Base class for adjusting basic blocks during discovery.
Definition: Modules.h:38
virtual void followingGhostEdges(bool b)
Property: Whether to follow ghost edges.
Definition: Engine.h:1064
virtual void interruptVector(const AddressInterval &i)
Property: Location of machine interrupt vector.
Definition: Engine.h:1155
virtual void astCopyAllInstructions(bool b)
Property: Whether to copy instructions when building the AST.
Definition: Engine.h:1350
bool namingStrings() const
Property: Give names to string literal addresses.
Definition: Engine.h:1292
bool findingDeadCode() const
Property: Whether to find dead code.
Definition: Engine.h:1114
virtual void findingCodeFunctionPointers(bool b)
Property: Whether to search existing instructions for function pointers.
Definition: Engine.h:1242
const std::vector< std::string > & configurationNames() const
Property: Configuration files.
Definition: Engine.h:1274
virtual void doingPostFunctionNoop(bool b)
Property: Whether to run no-op function analysis.
Definition: Engine.h:1202
Settings that control the disassembler.
Definition: BasicTypes.h:210
Base class for engines driving the partitioner.
Definition: Engine.h:101
Engine(const Settings &settings)
Construct engine with settings.
Definition: Engine.h:210
The result from parsing a command line.
Definition: CommandLine.h:3177
bool namingConstants() const
Property: Give names to constants.
Definition: Engine.h:1283
Disassembler * disassembler() const
Property: Disassembler.
Definition: Engine.h:1011
virtual void exitOnError(bool b)
Property: Error handling.
Definition: Engine.h:927
virtual void peScramblerDispatcherVa(rose_addr_t va)
Property: PE-Scrambler dispatcher address.
Definition: Engine.h:1125
SemanticMemoryParadigm semanticMemoryParadigm() const
Property: Type of container for semantic memory.
Definition: Engine.h:1051
List of things to work on.
Definition: WorkLists.h:58
FunctionReturnAnalysis functionReturnAnalysis() const
Property: Whether to run the function may-return analysis.
Definition: Engine.h:1211
size_t deExecuteZerosLeaveAtBack() const
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:974
const std::string & isaName() const
Property: Instruction set architecture name.
Definition: Engine.h:1021
virtual void findingIntraFunctionData(bool b)
Property: Whether to find intra-function data.
Definition: Engine.h:1145
Settings & settings()
Property: All settings.
Definition: Engine.h:915
A collection of related switch declarations.
Definition: CommandLine.h:2488
MemoryDataAdjustment memoryDataAdjustment() const
Property: Global adjustments to memory map data access bits.
Definition: Engine.h:990
virtual void findingDataFunctionPointers(bool b)
Property: Whether to search static data for function pointers.
Definition: Engine.h:1232
virtual void isaName(const std::string &s)
Property: Instruction set architecture name.
Definition: Engine.h:1022
virtual void memoryMap(const MemoryMap::Ptr &m)
Property: memory map.
Definition: Engine.h:502
Main namespace for the ROSE library.
Settings for loading specimens.
Definition: BasicTypes.h:170
Settings that control building the AST.
Definition: BasicTypes.h:69
bool followingGhostEdges() const
Property: Whether to follow ghost edges.
Definition: Engine.h:1063
bool demangleNames() const
Property: Demangle names.
Definition: Engine.h:1302
bool astAllowEmptyGlobalBlock() const
Property: Whether to allow empty global block in the AST.
Definition: Engine.h:1312
bool findingFunctionPadding() const
Property: Whether to find function padding.
Definition: Engine.h:1084
bool doingPostCallingConvention() const
Property: Whether to run calling-convention analysis.
Definition: Engine.h:1191
bool discontiguousBlocks() const
Property: Whether to allow discontiguous basic blocks.
Definition: Engine.h:1074
virtual void namingConstants(bool b)
Property: Give names to constants.
Definition: Engine.h:1284
bool findingIntraFunctionData() const
Property: Whether to find intra-function data.
Definition: Engine.h:1144
virtual void astAllowEmptyGlobalBlock(bool b)
Property: Whether to allow empty global block in the AST.
Definition: Engine.h:1313
bool memoryIsExecutable() const
Property: Global adjustment to executability.
Definition: Engine.h:1001
bool doingPostFunctionMayReturn() const
Property: Whether to run the function may-return analysis.
Definition: Engine.h:1173
virtual void doingPostFunctionStackDelta(bool b)
Property: Whether to run the function stack delta analysis.
Definition: Engine.h:1183
virtual void findingThunks(bool b)
Property: Whether to find thunk patterns.
Definition: Engine.h:1095
virtual void usingSemantics(bool b)
Property: Whether to use instruction semantics.
Definition: Engine.h:1042
virtual void findingFunctionPadding(bool b)
Property: Whether to find function padding.
Definition: Engine.h:1085
size_t deExecuteZerosLeaveAtFront() const
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:972
bool astAllowFunctionWithNoBasicBlocks() const
Property: Whether to allow empty functions in the AST.
Definition: Engine.h:1322
virtual void astAllowEmptyBasicBlock(bool b)
Property: Whether to allow empty basic blocks in the AST.
Definition: Engine.h:1337
The parser for a program command line.
Definition: CommandLine.h:2674
bool findingIntraFunctionCode() const
Property: Whether to find intra-function code.
Definition: Engine.h:1134
virtual void semanticMemoryParadigm(SemanticMemoryParadigm p)
Property: Type of container for semantic memory.
Definition: Engine.h:1052
virtual void interpretation(SgAsmInterpretation *interp)
Property: interpretation.
Definition: Engine.h:947
const AddressInterval & interruptVector() const
Property: Location of machine interrupt vector.
Definition: Engine.h:1154
Settings that control the engine partitioning.
Definition: BasicTypes.h:269
virtual void deExecuteZerosLeaveAtBack(size_t n)
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:975
std::vector< std::string > & configurationNames()
Property: Configuration files.
Definition: Engine.h:1275
bool findingDataFunctionPointers() const
Property: Whether to search static data for function pointers.
Definition: Engine.h:1231
DisassemblerSettings disassembler
Settings for creating the disassembler.
Definition: Engine.h:108
SemanticMemoryParadigm
Organization of semantic memory.
Definition: BasicTypes.h:60
virtual void findingDeadCode(bool b)
Property: Whether to find dead code.
Definition: Engine.h:1115
bool findingCodeFunctionPointers() const
Property: Whether to search existing instructions for function pointers.
Definition: Engine.h:1241
virtual void deExecuteZerosThreshold(size_t n)
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:971
FunctionReturnAnalysis
Controls whether the function may-return analysis runs.
Definition: BasicTypes.h:225
SgAsmInterpretation * interpretation() const
Property: interpretation.
Definition: Engine.h:946
virtual void checkingCallBranch(bool b)
Property: Whether to look for function calls used as branches.
Definition: Engine.h:1251
AstConstructionSettings astConstruction
Settings for constructing the AST.
Definition: Engine.h:111
bool astCopyAllInstructions() const
Property: Whether to copy instructions when building the AST.
Definition: Engine.h:1349
size_t deExecuteZerosThreshold() const
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:970
virtual void demangleNames(bool b)
Property: Demangle names.
Definition: Engine.h:1303
bool doingPostAnalysis() const
Property: Whether to perform post-partitioning analysis steps.
Definition: Engine.h:1164
bool usingSemantics() const
Property: Whether to use instruction semantics.
Definition: Engine.h:1041
void basicBlockSemanticsAutoDrop(bool b)
Property: Automatically drop semantics for attached basic blocks.
Definition: Engine.h:1266
MemoryMap::Ptr memoryMap() const
Property: memory map.
Definition: Engine.h:501
bool exitOnError() const
Property: Error handling.
Definition: Engine.h:926
bool doingPostFunctionNoop() const
Property: Whether to run no-op function analysis.
Definition: Engine.h:1201
A general, thread-safe way to report progress made on some task.
Definition: Progress.h:164
virtual void splittingThunks(bool b)
Property: Whether to split thunk instructions into mini functions.
Definition: Engine.h:1105
virtual void astAllowFunctionWithNoBasicBlocks(bool b)
Property: Whether to allow empty functions in the AST.
Definition: Engine.h:1325
bool astAllowEmptyBasicBlock() const
Property: Whether to allow empty basic blocks in the AST.
Definition: Engine.h:1336
virtual void deExecuteZerosLeaveAtFront(size_t n)
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:973
Base class for loading a static or dynamic object.
Definition: BinaryLoader.h:48
rose_addr_t peScramblerDispatcherVa() const
Property: PE-Scrambler dispatcher address.
Definition: Engine.h:1124
virtual void binaryLoader(BinaryLoader *loader)
Property: binary loader.
Definition: Engine.h:957
virtual void findingInterFunctionCalls(bool b)
Property: Whether to search for function calls between exiting functions.
Definition: Engine.h:1222
PartitionerSettings partitioner
Settings for creating a partitioner.
Definition: Engine.h:109
LoaderSettings loader
Settings used during specimen loading.
Definition: Engine.h:107
virtual void doingPostCallingConvention(bool b)
Property: Whether to run calling-convention analysis.
Definition: Engine.h:1192
virtual void discontiguousBlocks(bool b)
Property: Whether to allow discontiguous basic blocks.
Definition: Engine.h:1075
bool findingThunks() const
Property: Whether to find thunk patterns.
Definition: Engine.h:1094
Partitions instructions into basic blocks and functions.
Definition: Partitioner.h:290
virtual void doingPostFunctionMayReturn(bool b)
Property: Whether to run the function may-return analysis.
Definition: Engine.h:1174
Virtual base class for instruction disassemblers.
Definition: Disassembler.h:41
Represents an interpretation of a binary container.
virtual void functionReturnAnalysis(FunctionReturnAnalysis x)
Property: Whether to run the function may-return analysis.
Definition: Engine.h:1212
EngineSettings engine
Settings that control engine behavior.
Definition: Engine.h:110
const std::vector< rose_addr_t > & startingVas() const
Property: Starting addresses for disassembly.
Definition: Engine.h:1031
bool basicBlockSemanticsAutoDrop() const
Property: Automatically drop semantics for attached basic blocks.
Definition: Engine.h:1265
Container associating values with keys.
Definition: Sawyer/Map.h:64
std::vector< rose_addr_t > & startingVas()
Property: Starting addresses for disassembly.
Definition: Engine.h:1032
virtual void doingPostAnalysis(bool b)
Property: Whether to perform post-partitioning analysis steps.
Definition: Engine.h:1165
virtual void progress(const Progress::Ptr &progress)
Property: progress reporting.
Definition: Engine.h:936
BinaryLoader * binaryLoader() const
Property: binary loader.
Definition: Engine.h:956
Sawyer::SharedPointer< Progress > Ptr
Progress objects are reference counted.
Definition: Progress.h:167
virtual void memoryDataAdjustment(MemoryDataAdjustment x)
Property: Global adjustments to memory map data access bits.
Definition: Engine.h:991
Holds configuration information.
Definition: Config.h:210
bool splittingThunks() const
Property: Whether to split thunk instructions into mini functions.
Definition: Engine.h:1104