ROSE  0.9.9.109
Engine.h
1 #ifndef ROSE_Partitioner2_Engine_H
2 #define ROSE_Partitioner2_Engine_H
3 
4 #include <BinaryLoader.h>
5 #include <Disassembler.h>
6 #include <FileSystem.h>
7 #include <Partitioner2/Function.h>
8 #include <Partitioner2/Partitioner.h>
9 #include <Partitioner2/Utility.h>
10 #include <Progress.h>
11 #include <Sawyer/DistinctList.h>
12 
13 namespace Rose {
14 namespace BinaryAnalysis {
15 namespace Partitioner2 {
16 
100 class ROSE_DLL_API Engine {
101 public:
105  struct Settings {
112  private:
113  friend class boost::serialization::access;
114 
115  template<class S>
116  void serialize(S &s, unsigned version) {
117  s & loader & disassembler & partitioner & engine & astConstruction;
118  }
119  };
120 
122  // Internal data structures
124 private:
125  // Engine callback for handling instructions added to basic blocks. This is called when a basic block is discovered,
126  // before it's attached to a partitioner, so it shouldn't really be modifying any state in the engine, but rather only
127  // preparing the basic block to be processed.
128  class BasicBlockFinalizer: public BasicBlockCallback {
129  typedef Sawyer::Container::Map<rose_addr_t /*target*/, std::vector<rose_addr_t> /*sources*/> WorkList;
130  public:
131  static Ptr instance() { return Ptr(new BasicBlockFinalizer); }
132  virtual bool operator()(bool chain, const Args &args) ROSE_OVERRIDE;
133  };
134 
135  // Basic blocks that need to be worked on next. These lists are adjusted whenever a new basic block (or placeholder) is
136  // inserted or erased from the CFG.
137  class BasicBlockWorkList: public CfgAdjustmentCallback {
138  Sawyer::Container::DistinctList<rose_addr_t> pendingCallReturn_; // blocks that might need an E_CALL_RETURN edge
139  Sawyer::Container::DistinctList<rose_addr_t> processedCallReturn_; // call sites whose may-return was indeterminate
140  Sawyer::Container::DistinctList<rose_addr_t> finalCallReturn_; // indeterminate call sites awaiting final analysis
141  Sawyer::Container::DistinctList<rose_addr_t> undiscovered_; // undiscovered basic block list (last-in-first-out)
142  Engine *engine_; // engine to which this callback belongs
143  protected:
144  explicit BasicBlockWorkList(Engine *engine): engine_(engine) {}
145  public:
147  static Ptr instance(Engine *engine) { return Ptr(new BasicBlockWorkList(engine)); }
148  virtual bool operator()(bool chain, const AttachedBasicBlock &args) ROSE_OVERRIDE;
149  virtual bool operator()(bool chain, const DetachedBasicBlock &args) ROSE_OVERRIDE;
150  Sawyer::Container::DistinctList<rose_addr_t>& pendingCallReturn() { return pendingCallReturn_; }
151  Sawyer::Container::DistinctList<rose_addr_t>& processedCallReturn() { return processedCallReturn_; }
152  Sawyer::Container::DistinctList<rose_addr_t>& finalCallReturn() { return finalCallReturn_; }
153  Sawyer::Container::DistinctList<rose_addr_t>& undiscovered() { return undiscovered_; }
154  void moveAndSortCallReturn(const Partitioner&);
155  };
156 
157  // A work list providing constants from instructions that are part of the CFG.
158  class CodeConstants: public CfgAdjustmentCallback {
159  public:
161 
162  private:
163  std::set<rose_addr_t> toBeExamined_; // instructions waiting to be examined
164  std::set<rose_addr_t> wasExamined_; // instructions we've already examined
165  rose_addr_t inProgress_; // instruction that is currently in progress
166  std::vector<rose_addr_t> constants_; // constants for the instruction in progress
167 
168  protected:
169  CodeConstants(): inProgress_(0) {}
170 
171  public:
172  static Ptr instance() { return Ptr(new CodeConstants); }
173 
174  // Possibly insert more instructions into the work list when a basic block is added to the CFG
175  virtual bool operator()(bool chain, const AttachedBasicBlock &attached) ROSE_OVERRIDE;
176 
177  // Possibly remove instructions from the worklist when a basic block is removed from the CFG
178  virtual bool operator()(bool chain, const DetachedBasicBlock &detached) ROSE_OVERRIDE;
179 
180  // Return the next available constant if any.
181  Sawyer::Optional<rose_addr_t> nextConstant(const Partitioner &partitioner);
182  };
183 
185  // Data members
187 private:
188  Settings settings_; // Settings for the partitioner.
189  SgAsmInterpretation *interp_; // interpretation set by loadSpecimen
190  BinaryLoader *binaryLoader_; // how to remap, link, and fixup
191  Disassembler *disassembler_; // not ref-counted yet, but don't destroy it since user owns it
192  MemoryMap::Ptr map_; // memory map initialized by load()
193  BasicBlockWorkList::Ptr basicBlockWorkList_; // what blocks to work on next
194  CodeConstants::Ptr codeFunctionPointers_; // generates constants that are found in instruction ASTs
195  Progress::Ptr progress_; // optional progress reporting
196 
198  // Constructors
200 public:
203  : interp_(NULL), binaryLoader_(NULL), disassembler_(NULL), basicBlockWorkList_(BasicBlockWorkList::instance(this)),
204  progress_(Progress::instance()) {
205  init();
206  }
207 
209  explicit Engine(const Settings &settings)
210  : settings_(settings), interp_(NULL), binaryLoader_(NULL), disassembler_(NULL),
211  basicBlockWorkList_(BasicBlockWorkList::instance(this)), progress_(Progress::instance()) {
212  init();
213  }
214 
215  virtual ~Engine() {}
216 
218  // The very top-level use case
220 public:
245  SgAsmBlock* frontend(int argc, char *argv[],
246  const std::string &purpose, const std::string &description);
247  virtual SgAsmBlock* frontend(const std::vector<std::string> &args,
248  const std::string &purpose, const std::string &description);
251  // Basic top-level steps
254 public:
260  void reset();
261 
288  Sawyer::CommandLine::ParserResult parseCommandLine(int argc, char *argv[],
289  const std::string &purpose, const std::string &description) /*final*/;
290  virtual Sawyer::CommandLine::ParserResult parseCommandLine(const std::vector<std::string> &args,
291  const std::string &purpose, const std::string &description);
313  virtual SgAsmInterpretation* parseContainers(const std::vector<std::string> &fileNames);
314  SgAsmInterpretation* parseContainers(const std::string &fileName) /*final*/;
337  virtual MemoryMap::Ptr loadSpecimens(const std::vector<std::string> &fileNames = std::vector<std::string>());
338  MemoryMap::Ptr loadSpecimens(const std::string &fileName) /*final*/;
360  virtual Partitioner partition(const std::vector<std::string> &fileNames = std::vector<std::string>());
361  Partitioner partition(const std::string &fileName) /*final*/;
378  SgAsmBlock* buildAst(const std::vector<std::string> &fileNames = std::vector<std::string>()) /*final*/;
379  SgAsmBlock* buildAst(const std::string &fileName) /*final*/;
382  // Command-line parsing
384  //
385  // top-level: parseCommandLine
387 public:
389  virtual Sawyer::CommandLine::SwitchGroup loaderSwitches();
390 
392  virtual Sawyer::CommandLine::SwitchGroup disassemblerSwitches();
393 
395  virtual Sawyer::CommandLine::SwitchGroup partitionerSwitches();
396 
398  virtual Sawyer::CommandLine::SwitchGroup engineSwitches();
399 
401  virtual Sawyer::CommandLine::SwitchGroup astConstructionSwitches();
402 
404  static std::string specimenNameDocumentation();
405 
417  virtual Sawyer::CommandLine::Parser commandLineParser(const std::string &purpose, const std::string &description);
418 
425  virtual void checkSettings();
426 
428  // Container parsing
429  //
430  // top-level: parseContainers
432 public:
437  virtual bool isNonContainer(const std::string&);
438 
444  virtual bool areContainersParsed() const;
445 
447  // Load specimens
448  //
449  // top-level: loadSpecimens
451 public:
455  virtual bool areSpecimensLoaded() const;
456 
472  virtual BinaryLoader *obtainLoader(BinaryLoader *hint=NULL);
473 
479  virtual void loadContainers(const std::vector<std::string> &fileNames);
480 
485  virtual void loadNonContainers(const std::vector<std::string> &names);
486 
490  virtual void adjustMemoryMap();
491 
500  MemoryMap::Ptr memoryMap() const /*final*/ { return map_; }
501  virtual void memoryMap(const MemoryMap::Ptr &m) { map_ = m; }
505  // Disassembler
508 public:
525  virtual Disassembler* obtainDisassembler(Disassembler *hint=NULL);
529  // Partitioner high-level functions
531  //
532  // top-level: partition
534 public:
536  virtual void checkCreatePartitionerPrerequisites() const;
537 
544  virtual Partitioner createBarePartitioner();
545 
551  virtual Partitioner createGenericPartitioner();
552 
557  virtual Partitioner createTunedPartitioner();
558 
563  virtual Partitioner createPartitionerFromAst(SgAsmInterpretation*);
564 
569  virtual Partitioner createPartitioner();
570 
574  virtual void runPartitionerInit(Partitioner&);
575 
579  virtual void runPartitionerRecursive(Partitioner&);
580 
585  virtual void runPartitionerFinal(Partitioner&);
586 
592  virtual void runPartitioner(Partitioner&);
593 
594 
596  // Partitioner mid-level functions
597  //
598  // These are the functions called by the partitioner high-level stuff. These are sometimes overridden in subclasses,
599  // although it is more likely that the high-level stuff is overridden.
601 public:
606  virtual void labelAddresses(Partitioner&);
607 
611  virtual std::vector<DataBlock::Ptr> makeConfiguredDataBlocks(Partitioner&, const Configuration&);
612 
616  virtual std::vector<Function::Ptr> makeConfiguredFunctions(Partitioner&, const Configuration&);
617 
624  virtual std::vector<Function::Ptr> makeEntryFunctions(Partitioner&, SgAsmInterpretation*);
625 
632  virtual std::vector<Function::Ptr> makeErrorHandlingFunctions(Partitioner&, SgAsmInterpretation*);
633 
643  virtual std::vector<Function::Ptr> makeImportFunctions(Partitioner&, SgAsmInterpretation*);
644 
651  virtual std::vector<Function::Ptr> makeExportFunctions(Partitioner&, SgAsmInterpretation*);
652 
659  virtual std::vector<Function::Ptr> makeSymbolFunctions(Partitioner&, SgAsmInterpretation*);
660 
668  virtual std::vector<Function::Ptr> makeContainerFunctions(Partitioner&, SgAsmInterpretation*);
669 
676  virtual std::vector<Function::Ptr> makeInterruptVectorFunctions(Partitioner&, const AddressInterval &vector);
677 
682  virtual std::vector<Function::Ptr> makeUserFunctions(Partitioner&, const std::vector<rose_addr_t>&);
683 
690  virtual void discoverBasicBlocks(Partitioner&);
691 
701  virtual Function::Ptr makeNextDataReferencedFunction(const Partitioner&, rose_addr_t &startVa /*in,out*/);
702 
714  virtual Function::Ptr makeNextCodeReferencedFunction(const Partitioner&);
715 
722  virtual std::vector<Function::Ptr> makeCalledFunctions(Partitioner&);
723 
736  virtual std::vector<Function::Ptr> makeNextPrologueFunction(Partitioner&, rose_addr_t startVa);
737 
756  virtual std::vector<Function::Ptr>
757  makeFunctionFromInterFunctionCalls(Partitioner &partitioner, rose_addr_t &startVa /*in,out*/);
758 
765  virtual void discoverFunctions(Partitioner&);
766 
781  virtual std::set<rose_addr_t> attachDeadCodeToFunction(Partitioner&, const Function::Ptr&, size_t maxIterations=size_t(-1));
782 
790  virtual DataBlock::Ptr attachPaddingToFunction(Partitioner&, const Function::Ptr&);
791 
796  virtual std::vector<DataBlock::Ptr> attachPaddingToFunctions(Partitioner&);
797 
808  virtual size_t attachAllSurroundedCodeToFunctions(Partitioner&);
809 
817  virtual size_t attachSurroundedCodeToFunctions(Partitioner&);
818 
823  virtual void attachBlocksToFunctions(Partitioner&);
824 
831  virtual std::set<rose_addr_t> attachDeadCodeToFunctions(Partitioner&, size_t maxIterations=size_t(-1));
832 
842  virtual std::vector<DataBlock::Ptr> attachSurroundedDataToFunctions(Partitioner&);
843 
849  virtual void updateAnalysisResults(Partitioner&);
850 
851 
853  // Partitioner low-level functions
854  //
855  // These are functions that a subclass seldom overrides, and maybe even shouldn't override because of their complexity or
856  // the way the interact with one another.
858 public:
869  virtual bool makeNextCallReturnEdge(Partitioner&, boost::logic::tribool assumeCallReturns);
870 
876  virtual BasicBlock::Ptr makeNextBasicBlockFromPlaceholder(Partitioner&);
877 
892  virtual BasicBlock::Ptr makeNextBasicBlock(Partitioner&);
893 
894 
896  // Build AST
898 public:
899  // Used internally by ROSE's ::frontend disassemble instructions to build the AST that goes under each SgAsmInterpretation.
900  static void disassembleForRoseFrontend(SgAsmInterpretation*);
901 
902 
904  // Settings and properties
906 public:
913  const Settings& settings() const /*final*/ { return settings_; }
914  Settings& settings() /*final*/ { return settings_; }
925  bool exitOnError() const /*final*/ { return settings_.engine.exitOnError; }
926  virtual void exitOnError(bool b) { settings_.engine.exitOnError = b; }
934  Progress::Ptr progress() const /*final*/ { return progress_; }
935  virtual void progress(const Progress::Ptr &progress) { progress_ = progress; }
945  SgAsmInterpretation* interpretation() const /*final*/ { return interp_; }
946  virtual void interpretation(SgAsmInterpretation *interp) { interp_ = interp; }
955  BinaryLoader* binaryLoader() const /*final*/ { return binaryLoader_; }
956  virtual void binaryLoader(BinaryLoader *loader) { binaryLoader_ = loader; }
969  size_t deExecuteZerosThreshold() const /*final*/ { return settings_.loader.deExecuteZerosThreshold; }
970  virtual void deExecuteZerosThreshold(size_t n) { settings_.loader.deExecuteZerosThreshold = n; }
971  size_t deExecuteZerosLeaveAtFront() const /*final*/ { return settings_.loader.deExecuteZerosLeaveAtFront; }
972  virtual void deExecuteZerosLeaveAtFront(size_t n) { settings_.loader.deExecuteZerosLeaveAtFront = n; }
973  size_t deExecuteZerosLeaveAtBack() const /*final*/ { return settings_.loader.deExecuteZerosLeaveAtBack; }
974  virtual void deExecuteZerosLeaveAtBack(size_t n) { settings_.loader.deExecuteZerosLeaveAtBack = n; }
989  MemoryDataAdjustment memoryDataAdjustment() const /*final*/ { return settings_.loader.memoryDataAdjustment; }
990  virtual void memoryDataAdjustment(MemoryDataAdjustment x) { settings_.loader.memoryDataAdjustment = x; }
1000  bool memoryIsExecutable() const /*final*/ { return settings_.loader.memoryIsExecutable; }
1001  virtual void memoryIsExecutable(bool b) { settings_.loader.memoryIsExecutable = b; }
1010  Disassembler *disassembler() const /*final*/ { return disassembler_; }
1011  virtual void disassembler(Disassembler *d) { disassembler_ = d; }
1020  const std::string& isaName() const /*final*/ { return settings_.disassembler.isaName; }
1021  virtual void isaName(const std::string &s) { settings_.disassembler.isaName = s; }
1030  const std::vector<rose_addr_t>& startingVas() const /*final*/ { return settings_.partitioner.startingVas; }
1031  std::vector<rose_addr_t>& startingVas() /*final*/ { return settings_.partitioner.startingVas; }
1040  bool usingSemantics() const /*final*/ { return settings_.partitioner.base.usingSemantics; }
1041  virtual void usingSemantics(bool b) { settings_.partitioner.base.usingSemantics = b; }
1050  SemanticMemoryParadigm semanticMemoryParadigm() const /*final*/ { return settings_.partitioner.semanticMemoryParadigm; }
1051  virtual void semanticMemoryParadigm(SemanticMemoryParadigm p) { settings_.partitioner.semanticMemoryParadigm = p; }
1062  bool followingGhostEdges() const /*final*/ { return settings_.partitioner.followingGhostEdges; }
1063  virtual void followingGhostEdges(bool b) { settings_.partitioner.followingGhostEdges = b; }
1073  bool discontiguousBlocks() const /*final*/ { return settings_.partitioner.discontiguousBlocks; }
1074  virtual void discontiguousBlocks(bool b) { settings_.partitioner.discontiguousBlocks = b; }
1083  bool findingFunctionPadding() const /*final*/ { return settings_.partitioner.findingFunctionPadding; }
1084  virtual void findingFunctionPadding(bool b) { settings_.partitioner.findingFunctionPadding = b; }
1093  bool findingThunks() const /*final*/ { return settings_.partitioner.findingThunks; }
1094  virtual void findingThunks(bool b) { settings_.partitioner.findingThunks = b; }
1103  bool splittingThunks() const /*final*/ { return settings_.partitioner.splittingThunks; }
1104  virtual void splittingThunks(bool b) { settings_.partitioner.splittingThunks = b; }
1113  bool findingDeadCode() const /*final*/ { return settings_.partitioner.findingDeadCode; }
1114  virtual void findingDeadCode(bool b) { settings_.partitioner.findingDeadCode = b; }
1123  rose_addr_t peScramblerDispatcherVa() const /*final*/ { return settings_.partitioner.peScramblerDispatcherVa; }
1124  virtual void peScramblerDispatcherVa(rose_addr_t va) { settings_.partitioner.peScramblerDispatcherVa = va; }
1133  bool findingIntraFunctionCode() const /*final*/ { return settings_.partitioner.findingIntraFunctionCode; }
1134  virtual void findingIntraFunctionCode(bool b) { settings_.partitioner.findingIntraFunctionCode = b; }
1143  bool findingIntraFunctionData() const /*final*/ { return settings_.partitioner.findingIntraFunctionData; }
1144  virtual void findingIntraFunctionData(bool b) { settings_.partitioner.findingIntraFunctionData = b; }
1153  const AddressInterval& interruptVector() const /*final*/ { return settings_.partitioner.interruptVector; }
1154  virtual void interruptVector(const AddressInterval &i) { settings_.partitioner.interruptVector = i; }
1163  bool doingPostAnalysis() const /*final*/ { return settings_.partitioner.doingPostAnalysis; }
1164  virtual void doingPostAnalysis(bool b) { settings_.partitioner.doingPostAnalysis = b; }
1172  bool doingPostFunctionMayReturn() const /*final*/ { return settings_.partitioner.doingPostFunctionMayReturn; }
1173  virtual void doingPostFunctionMayReturn(bool b) { settings_.partitioner.doingPostFunctionMayReturn = b; }
1181  bool doingPostFunctionStackDelta() const /*final*/ { return settings_.partitioner.doingPostFunctionStackDelta; }
1182  virtual void doingPostFunctionStackDelta(bool b) { settings_.partitioner.doingPostFunctionStackDelta = b; }
1190  bool doingPostCallingConvention() const /*final*/ { return settings_.partitioner.doingPostCallingConvention; }
1191  virtual void doingPostCallingConvention(bool b) { settings_.partitioner.doingPostCallingConvention = b; }
1200  bool doingPostFunctionNoop() const /*final*/ { return settings_.partitioner.doingPostFunctionNoop; }
1201  virtual void doingPostFunctionNoop(bool b) { settings_.partitioner.doingPostFunctionNoop = b; }
1210  FunctionReturnAnalysis functionReturnAnalysis() const /*final*/ { return settings_.partitioner.functionReturnAnalysis; }
1211  virtual void functionReturnAnalysis(FunctionReturnAnalysis x) { settings_.partitioner.functionReturnAnalysis = x; }
1220  bool findingInterFunctionCalls() const /*final*/ { return settings_.partitioner.findingInterFunctionCalls; }
1221  virtual void findingInterFunctionCalls(bool b) { settings_.partitioner.findingInterFunctionCalls = b; }
1230  bool findingDataFunctionPointers() const /*final*/ { return settings_.partitioner.findingDataFunctionPointers; }
1231  virtual void findingDataFunctionPointers(bool b) { settings_.partitioner.findingDataFunctionPointers = b; }
1240  bool findingCodeFunctionPointers() const /*final*/ { return settings_.partitioner.findingCodeFunctionPointers; }
1241  virtual void findingCodeFunctionPointers(bool b) { settings_.partitioner.findingCodeFunctionPointers = b; }
1249  bool checkingCallBranch() const /*final*/ { return settings_.partitioner.base.checkingCallBranch; }
1250  virtual void checkingCallBranch(bool b) { settings_.partitioner.base.checkingCallBranch = b; }
1264  bool basicBlockSemanticsAutoDrop() const /*final*/ { return settings_.partitioner.base.basicBlockSemanticsAutoDrop; }
1265  void basicBlockSemanticsAutoDrop(bool b) { settings_.partitioner.base.basicBlockSemanticsAutoDrop = b; }
1273  const std::vector<std::string>& configurationNames() /*final*/ const { return settings_.engine.configurationNames; }
1274  std::vector<std::string>& configurationNames() /*final*/ { return settings_.engine.configurationNames; }
1282  bool namingConstants() const /*final*/ { return settings_.partitioner.namingConstants; }
1283  virtual void namingConstants(bool b) { settings_.partitioner.namingConstants = b; }
1291  bool namingStrings() const /*final*/ { return settings_.partitioner.namingStrings; }
1292  virtual void namingStrings(bool b) { settings_.partitioner.namingStrings = b; }
1301  bool demangleNames() const /*final*/ { return settings_.partitioner.demangleNames; }
1302  virtual void demangleNames(bool b) { settings_.partitioner.demangleNames = b; }
1311  bool astAllowEmptyGlobalBlock() const /*final*/ { return settings_.astConstruction.allowEmptyGlobalBlock; }
1312  virtual void astAllowEmptyGlobalBlock(bool b) { settings_.astConstruction.allowEmptyGlobalBlock = b; }
1321  bool astAllowFunctionWithNoBasicBlocks() const /*final*/ {
1322  return settings_.astConstruction.allowFunctionWithNoBasicBlocks;
1323  }
1324  virtual void astAllowFunctionWithNoBasicBlocks(bool b) {
1325  settings_.astConstruction.allowFunctionWithNoBasicBlocks = b;
1326  }
1335  bool astAllowEmptyBasicBlock() const /*final*/ { return settings_.astConstruction.allowEmptyBasicBlocks; }
1336  virtual void astAllowEmptyBasicBlock(bool b) { settings_.astConstruction.allowEmptyBasicBlocks = b; }
1348  bool astCopyAllInstructions() const /*final*/ { return settings_.astConstruction.copyAllInstructions; }
1349  virtual void astCopyAllInstructions(bool b) { settings_.astConstruction.copyAllInstructions = b; }
1352  // Internal stuff
1355 private:
1356  void init();
1357 };
1358 
1359 } // namespace
1360 } // namespace
1361 } // namespace
1362 
1363 #endif
const Settings & settings() const
Property: All settings.
Definition: Engine.h:913
bool doingPostFunctionStackDelta() const
Property: Whether to run the function stack delta analysis.
Definition: Engine.h:1181
virtual void findingIntraFunctionCode(bool b)
Property: Whether to find intra-function code.
Definition: Engine.h:1134
virtual void memoryIsExecutable(bool b)
Property: Global adjustment to executability.
Definition: Engine.h:1001
virtual void disassembler(Disassembler *d)
Property: Disassembler.
Definition: Engine.h:1011
bool checkingCallBranch() const
Property: Whether to look for function calls used as branches.
Definition: Engine.h:1249
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:1292
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:1220
Instruction basic block.
Progress::Ptr progress() const
Property: progress reporting.
Definition: Engine.h:934
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:1063
virtual void interruptVector(const AddressInterval &i)
Property: Location of machine interrupt vector.
Definition: Engine.h:1154
virtual void astCopyAllInstructions(bool b)
Property: Whether to copy instructions when building the AST.
Definition: Engine.h:1349
bool namingStrings() const
Property: Give names to string literal addresses.
Definition: Engine.h:1291
bool findingDeadCode() const
Property: Whether to find dead code.
Definition: Engine.h:1113
virtual void findingCodeFunctionPointers(bool b)
Property: Whether to search existing instructions for function pointers.
Definition: Engine.h:1241
const std::vector< std::string > & configurationNames() const
Property: Configuration files.
Definition: Engine.h:1273
virtual void doingPostFunctionNoop(bool b)
Property: Whether to run no-op function analysis.
Definition: Engine.h:1201
Settings that control the disassembler.
Definition: BasicTypes.h:210
Base class for engines driving the partitioner.
Definition: Engine.h:100
Engine(const Settings &settings)
Construct engine with settings.
Definition: Engine.h:209
The result from parsing a command line.
Definition: CommandLine.h:3177
bool namingConstants() const
Property: Give names to constants.
Definition: Engine.h:1282
Disassembler * disassembler() const
Property: Disassembler.
Definition: Engine.h:1010
virtual void exitOnError(bool b)
Property: Error handling.
Definition: Engine.h:926
virtual void peScramblerDispatcherVa(rose_addr_t va)
Property: PE-Scrambler dispatcher address.
Definition: Engine.h:1124
SemanticMemoryParadigm semanticMemoryParadigm() const
Property: Type of container for semantic memory.
Definition: Engine.h:1050
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:1210
size_t deExecuteZerosLeaveAtBack() const
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:973
const std::string & isaName() const
Property: Instruction set architecture name.
Definition: Engine.h:1020
virtual void findingIntraFunctionData(bool b)
Property: Whether to find intra-function data.
Definition: Engine.h:1144
Settings & settings()
Property: All settings.
Definition: Engine.h:914
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:989
virtual void findingDataFunctionPointers(bool b)
Property: Whether to search static data for function pointers.
Definition: Engine.h:1231
virtual void isaName(const std::string &s)
Property: Instruction set architecture name.
Definition: Engine.h:1021
virtual void memoryMap(const MemoryMap::Ptr &m)
Property: memory map.
Definition: Engine.h:501
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:1062
bool demangleNames() const
Property: Demangle names.
Definition: Engine.h:1301
bool astAllowEmptyGlobalBlock() const
Property: Whether to allow empty global block in the AST.
Definition: Engine.h:1311
bool findingFunctionPadding() const
Property: Whether to find function padding.
Definition: Engine.h:1083
bool doingPostCallingConvention() const
Property: Whether to run calling-convention analysis.
Definition: Engine.h:1190
bool discontiguousBlocks() const
Property: Whether to allow discontiguous basic blocks.
Definition: Engine.h:1073
virtual void namingConstants(bool b)
Property: Give names to constants.
Definition: Engine.h:1283
bool findingIntraFunctionData() const
Property: Whether to find intra-function data.
Definition: Engine.h:1143
virtual void astAllowEmptyGlobalBlock(bool b)
Property: Whether to allow empty global block in the AST.
Definition: Engine.h:1312
bool memoryIsExecutable() const
Property: Global adjustment to executability.
Definition: Engine.h:1000
bool doingPostFunctionMayReturn() const
Property: Whether to run the function may-return analysis.
Definition: Engine.h:1172
virtual void doingPostFunctionStackDelta(bool b)
Property: Whether to run the function stack delta analysis.
Definition: Engine.h:1182
virtual void findingThunks(bool b)
Property: Whether to find thunk patterns.
Definition: Engine.h:1094
virtual void usingSemantics(bool b)
Property: Whether to use instruction semantics.
Definition: Engine.h:1041
virtual void findingFunctionPadding(bool b)
Property: Whether to find function padding.
Definition: Engine.h:1084
size_t deExecuteZerosLeaveAtFront() const
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:971
bool astAllowFunctionWithNoBasicBlocks() const
Property: Whether to allow empty functions in the AST.
Definition: Engine.h:1321
virtual void astAllowEmptyBasicBlock(bool b)
Property: Whether to allow empty basic blocks in the AST.
Definition: Engine.h:1336
The parser for a program command line.
Definition: CommandLine.h:2674
bool findingIntraFunctionCode() const
Property: Whether to find intra-function code.
Definition: Engine.h:1133
virtual void semanticMemoryParadigm(SemanticMemoryParadigm p)
Property: Type of container for semantic memory.
Definition: Engine.h:1051
virtual void interpretation(SgAsmInterpretation *interp)
Property: interpretation.
Definition: Engine.h:946
const AddressInterval & interruptVector() const
Property: Location of machine interrupt vector.
Definition: Engine.h:1153
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:974
std::vector< std::string > & configurationNames()
Property: Configuration files.
Definition: Engine.h:1274
bool findingDataFunctionPointers() const
Property: Whether to search static data for function pointers.
Definition: Engine.h:1230
DisassemblerSettings disassembler
Settings for creating the disassembler.
Definition: Engine.h:107
SemanticMemoryParadigm
Organization of semantic memory.
Definition: BasicTypes.h:60
virtual void findingDeadCode(bool b)
Property: Whether to find dead code.
Definition: Engine.h:1114
bool findingCodeFunctionPointers() const
Property: Whether to search existing instructions for function pointers.
Definition: Engine.h:1240
virtual void deExecuteZerosThreshold(size_t n)
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:970
FunctionReturnAnalysis
Controls whether the function may-return analysis runs.
Definition: BasicTypes.h:225
SgAsmInterpretation * interpretation() const
Property: interpretation.
Definition: Engine.h:945
virtual void checkingCallBranch(bool b)
Property: Whether to look for function calls used as branches.
Definition: Engine.h:1250
AstConstructionSettings astConstruction
Settings for constructing the AST.
Definition: Engine.h:110
bool astCopyAllInstructions() const
Property: Whether to copy instructions when building the AST.
Definition: Engine.h:1348
size_t deExecuteZerosThreshold() const
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:969
virtual void demangleNames(bool b)
Property: Demangle names.
Definition: Engine.h:1302
bool doingPostAnalysis() const
Property: Whether to perform post-partitioning analysis steps.
Definition: Engine.h:1163
bool usingSemantics() const
Property: Whether to use instruction semantics.
Definition: Engine.h:1040
void basicBlockSemanticsAutoDrop(bool b)
Property: Automatically drop semantics for attached basic blocks.
Definition: Engine.h:1265
MemoryMap::Ptr memoryMap() const
Property: memory map.
Definition: Engine.h:500
bool exitOnError() const
Property: Error handling.
Definition: Engine.h:925
bool doingPostFunctionNoop() const
Property: Whether to run no-op function analysis.
Definition: Engine.h:1200
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:1104
virtual void astAllowFunctionWithNoBasicBlocks(bool b)
Property: Whether to allow empty functions in the AST.
Definition: Engine.h:1324
bool astAllowEmptyBasicBlock() const
Property: Whether to allow empty basic blocks in the AST.
Definition: Engine.h:1335
virtual void deExecuteZerosLeaveAtFront(size_t n)
Property: when to remove execute permission from zero bytes.
Definition: Engine.h:972
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:1123
virtual void binaryLoader(BinaryLoader *loader)
Property: binary loader.
Definition: Engine.h:956
virtual void findingInterFunctionCalls(bool b)
Property: Whether to search for function calls between exiting functions.
Definition: Engine.h:1221
PartitionerSettings partitioner
Settings for creating a partitioner.
Definition: Engine.h:108
LoaderSettings loader
Settings used during specimen loading.
Definition: Engine.h:106
virtual void doingPostCallingConvention(bool b)
Property: Whether to run calling-convention analysis.
Definition: Engine.h:1191
virtual void discontiguousBlocks(bool b)
Property: Whether to allow discontiguous basic blocks.
Definition: Engine.h:1074
bool findingThunks() const
Property: Whether to find thunk patterns.
Definition: Engine.h:1093
Partitions instructions into basic blocks and functions.
Definition: Partitioner.h:289
virtual void doingPostFunctionMayReturn(bool b)
Property: Whether to run the function may-return analysis.
Definition: Engine.h:1173
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:1211
EngineSettings engine
Settings that control engine behavior.
Definition: Engine.h:109
const std::vector< rose_addr_t > & startingVas() const
Property: Starting addresses for disassembly.
Definition: Engine.h:1030
bool basicBlockSemanticsAutoDrop() const
Property: Automatically drop semantics for attached basic blocks.
Definition: Engine.h:1264
Container associating values with keys.
Definition: Sawyer/Map.h:64
std::vector< rose_addr_t > & startingVas()
Property: Starting addresses for disassembly.
Definition: Engine.h:1031
virtual void doingPostAnalysis(bool b)
Property: Whether to perform post-partitioning analysis steps.
Definition: Engine.h:1164
virtual void progress(const Progress::Ptr &progress)
Property: progress reporting.
Definition: Engine.h:935
BinaryLoader * binaryLoader() const
Property: binary loader.
Definition: Engine.h:955
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:990
Holds configuration information.
Definition: Config.h:210
bool splittingThunks() const
Property: Whether to split thunk instructions into mini functions.
Definition: Engine.h:1103