1#ifndef ROSE_BinaryAnalysis_Partitioner2_BasicTypes_H
2#define ROSE_BinaryAnalysis_Partitioner2_BasicTypes_H
3#include <featureTests.h>
4#ifdef ROSE_ENABLE_BINARY_ANALYSIS
6#include <Rose/BinaryAnalysis/AddressInterval.h>
8#include <Sawyer/Graph.h>
10#include <Sawyer/Set.h>
11#include <Sawyer/SharedPointer.h>
13#include <boost/filesystem.hpp>
14#include <boost/regex.hpp>
15#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
16#include <boost/serialization/access.hpp>
26#define ROSE_PARTITIONER_EXPENSIVE_CHECKS 0
29namespace BinaryAnalysis {
30namespace Partitioner2 {
43namespace AllowParallelEdges {
135#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
137 friend class boost::serialization::access;
138 template<
class S>
void serialize(S&,
unsigned version);
259 std::string
linker =
"ld -o %o --unresolved-symbols=ignore-all --whole-archive %f";
280#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
282 friend class boost::serialization::access;
283 template<
class S>
void serialize(S&,
unsigned version);
304#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
306 friend class boost::serialization::access;
307 template<
class S>
void serialize(S&,
unsigned version);
357#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
359 friend class boost::serialization::access;
360 template<
class S>
void serialize(S&,
unsigned version);
621#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
623 friend class boost::serialization::access;
624 template<
class S>
void serialize(S&,
unsigned version);
646#ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
648 friend class boost::serialization::access;
649 template<
class S>
void serialize(S&,
unsigned version);
List of virtual address users.
Base class for adjusting basic blocks during discovery.
Base class for CFG-adjustment callbacks.
Control flow graph vertex.
Holds configuration information.
Engine for specimens containing machine instructions.
Engine for Java Virtual Machine (JVM) specimens.
Base class for engines driving the partitioner.
Function call information.
Base class for matching function padding.
Base class for matching function prologues.
Partitions instructions into basic blocks and functions.
Reference to a function, basic block, instruction, or address.
List of thunk predicates.
static Interval hull(Address v1, Address v2)
Construct an interval from two endpoints.
static Interval whole()
Construct an interval that covers the entire domain.
@ NO
Enum type for allowing parallel edges.
@ YES
Allow parallel edges, so each edge has a unit count.
@ LOW
Enum type for precision.
@ HIGH
High precision, but slow.
MemoryDataAdjustment
How the partitioner should globally treat memory.
@ DATA_NO_CHANGE
Do not make any global changes to the memory map.
@ DATA_IS_INITIALIZED
Treat all memory as if it were initialized.
@ DATA_IS_CONSTANT
Treat all memory as if it were constant.
std::vector< BasicBlockSuccessor > BasicBlockSuccessors
All successors in no particular order.
EdgeType
Partitioner control flow edge types.
@ E_FUNCTION_CALL
Edge is a function call.
@ E_FUNCTION_XFER
Edge is a function call transfer.
@ E_CALL_RETURN
Edge is a function return from the call site.
@ E_FUNCTION_RETURN
Edge is a function return.
@ E_USER_DEFINED
User defined edge.
@ E_NORMAL
Normal control flow edge, nothing special.
Confidence
How sure are we of something.
@ PROVED
The value was somehow proved.
@ ASSUMED
The value is an assumption without any proof.
SemanticMemoryParadigm
Organization of semantic memory.
@ LIST_BASED_MEMORY
Precise but slow.
@ MAP_BASED_MEMORY
Fast but not precise.
FunctionReturnAnalysis
Controls whether the function may-return analysis runs.
@ MAYRETURN_ALWAYS_NO
Assume that a function cannot return without ever running the may-return analysis.
@ MAYRETURN_DEFAULT_YES
Assume a function returns if the may-return analysis cannot decide whether it may return.
@ MAYRETURN_ALWAYS_YES
Assume that all functions return without ever running the may-return analysis.
@ MAYRETURN_DEFAULT_NO
Assume a function cannot return if the may-return analysis cannot decide whether it may return.
std::set< Reference > ReferenceSet
Set of references.
VertexType
Partitioner control flow vertex types.
@ V_USER_DEFINED
User defined vertex.
@ V_BASIC_BLOCK
A basic block or placeholder for a basic block.
@ V_UNDISCOVERED
The special "undiscovered" vertex.
@ V_INDETERMINATE
Special vertex destination for indeterminate edges.
@ V_NONEXISTING
Special vertex destination for non-existing basic blocks.
Settings that control building the AST.
bool allowFunctionWithNoBasicBlocks
Whether to allow functions with no basic blocks.
bool allowEmptyBasicBlocks
Whether to allow a basic block to be empty.
static AstConstructionSettings strict()
Default strict settings.
bool allowEmptyGlobalBlock
Whether to allow an empty global block.
static AstConstructionSettings permissive()
Default permissive settings.
bool copyAllInstructions
Whether to allow shared instructions in the AST.
Settings that directly control a partitioner.
bool checkingCallBranch
Whether to look for function calls used as branches.
bool basicBlockSemanticsAutoDrop
Whether to automatically drop semantics for attached basic blocks.
bool usingSemantics
Whether instruction semantics are used.
bool ignoringUnknownInsns
Whether unknown instructions are ignored.
Settings that control the disassembler.
std::string isaName
Instruction set architecture name.
bool doDisassemble
Whether to disassemble instructions.
Settings for controling the engine behavior.
bool exitOnError
Setting: Error handling.
std::vector< std::string > configurationNames
Configuration files names.
Settings for loading specimens.
std::vector< boost::regex > envErasePatterns
Patterns to erase from the environment.
bool memoryIsExecutable
Whether all of memory should be made executable.
MemoryDataAdjustment memoryDataAdjustment
How to globally adjust memory segment access bits for data areas.
size_t deExecuteZerosLeaveAtFront
When to remove execute permission from zero bytes.
std::vector< std::string > envInsert
Environment variables to insert.
std::string linker
Linker command.
bool linkStaticArchives
Whether to link library archives before parsing.
bool linkObjectFiles
Whether to link object files before parsing.
size_t deExecuteZerosThreshold
When to remove execute permission from zero bytes.
size_t deExecuteZerosLeaveAtBack
When to remove execute permission from zero bytes.
std::vector< std::string > envEraseNames
Names to erase from the environment.
Settings that control the engine partitioning.
bool demangleNames
Whether to demangle names.
bool findingSymbolFunctions
Whether to make functions according to symbol tables.
bool findingFunctionPadding
Whether to find function padding.
bool doingPostFunctionStackDelta
Whether to run the function stack delta analysis.
std::vector< rose_addr_t > functionStartingVas
Starting addresses for disassembly.
size_t functionReturnAnalysisMaxSorts
Maximum number of function may-return sorting operations.
size_t maxBasicBlockSize
Maximum size for basic blocks.
bool doingPostFunctionNoop
Whether to run no-op function analysis.
bool splittingThunks
Whether to split thunk instructions into mini functions.
bool doingPostCallingConvention
Whether to run calling-convention analysis.
AddressInterval namingStrings
Addresses where strings might start.
AddressInterval namingConstants
Whether to give names to constants.
bool findingDataFunctionPointers
Whether to search static data for function pointers.
SemanticMemoryParadigm semanticMemoryParadigm
Type of container for semantic memory.
bool findingIntraFunctionData
Whether to find intra-function data.
bool discontiguousBlocks
Whether to allow discontiguous basic blocks.
bool findingEntryFunctions
Whether to make functions at program entry points.
bool findingImportFunctions
Whether to make functions at import addresses.
AddressInterval interruptVector
Property: Location of machine interrupt vector.
BasePartitionerSettings base
Base partitioner settings.
bool followingGhostEdges
Whether to follow ghost edges.
FunctionReturnAnalysis functionReturnAnalysis
How to run the function may-return analysis.
bool findingErrorFunctions
Whether to make error handling functions.
bool doingPostFunctionMayReturn
Whether to run the function may-return analysis.
bool doingPostAnalysis
Whether to perform any post-partitioning analysis steps.
size_t findingIntraFunctionCode
Whether to find intra-function code.
bool findingInterFunctionCalls
Whether to search for function calls between exiting functions.
bool findingDeadCode
Whether to find dead code.
bool findingThunks
Whether to match thunk patterns.
bool findingCodeFunctionPointers
Whether to search existing instructions for function pointers.
bool findingFunctionCallFunctions
Whether to turn function call targets into functions.
std::vector< rose_addr_t > ipRewrites
CFG edge rewrite pairs.
bool findingExportFunctions
Whether to make functions at export addresses.
boost::filesystem::path syscallHeader
Header file in which system calls are defined.
bool namingSyscalls
Whether to give names to system calls.
rose_addr_t peScramblerDispatcherVa
PE-Scrambler dispatcher address.