1 #ifndef ROSE_BinaryAnalysis_Partitioner2_Config_H
2 #define ROSE_BinaryAnalysis_Partitioner2_Config_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
6 #include <Rose/FileSystem.h>
7 #include <Rose/BinaryAnalysis/Partitioner2/Function.h>
8 #include <Sawyer/Map.h>
9 #include <Sawyer/Optional.h>
10 #include <Rose/SourceLocation.h>
16 namespace Partitioner2 {
20 rose_addr_t address_ = 0;
23 std::set<rose_addr_t> successorVas_;
36 rose_addr_t
address()
const {
return address_; }
43 const std::string&
comment()
const {
return comment_; }
72 const std::set<rose_addr_t>&
successorVas()
const {
return successorVas_; }
98 rose_addr_t
address()
const {
return address_; }
105 const std::string &
name()
const {
return name_; }
114 const std::string&
comment()
const {
return comment_; }
130 std::string name_, defaultName_, comment_;
172 const std::string&
name()
const {
return name_; }
190 const std::string&
comment()
const {
return comment_; }
240 rose_addr_t address_ = 0;
242 std::string comment_;
256 rose_addr_t
address()
const {
return address_; }
261 const std::string &
name()
const {
return name_; }
268 const std::string &
comment()
const {
return comment_; }
290 BasicBlockConfigs bblockConfigs_;
291 DataBlockConfigs dblockConfigs_;
292 FunctionConfigsByAddress functionConfigsByAddress_;
293 FunctionConfigsByName functionConfigsByName_;
294 AddressConfigs addressConfigs_;
306 const BasicBlockConfigs&
basicBlocks()
const {
return bblockConfigs_; }
319 const DataBlockConfigs&
dataBlocks()
const {
return dblockConfigs_; }
356 const AddressConfigs&
addresses()
const {
return addressConfigs_; }
512 std::string
comment(rose_addr_t va)
const;
515 void print(std::ostream&)
const;
FunctionConfig(const std::string &name)
Configuration information for a function.
const DataBlockConfig & dataBlock(rose_addr_t) const
Configuration for a particular data block.
std::string basicBlockComment(rose_addr_t bblockVa) const
Basic block comment.
Sawyer::Optional< int64_t > functionStackDelta(rose_addr_t functionVa) const
Function stack delta.
Sawyer::Optional< bool > functionMayReturn(rose_addr_t functionVa) const
Function may-return status.
BasicBlockConfig & finalInstructionVa(const Sawyer::Optional< rose_addr_t > &va)
Property: last instruction.
DataBlockConfig & comment(const std::string &s)
Property: comment.
std::string functionComment(rose_addr_t functionVa) const
Function comment.
DataBlockConfig & sourceLocation(const SourceLocation &loc)
Property: Location of data block in source code.
Sawyer::Optional< rose_addr_t > basicBlockFinalInstructionVa(rose_addr_t bblockVa) const
Basic block final instruction address.
std::set< rose_addr_t > & successorVas()
Property: control flow successors.
DataBlockConfig & insertMaybeDataBlock(rose_addr_t va)
Lookup or insert a data block.
std::string addressComment(rose_addr_t va) const
Address comment.
Information about a source location.
boost::filesystem::path Path
Name of entities in a filesystem.
static std::string fileFormatDoc()
Documentation string describing the file format.
Configuration information for a basic block.
DataBlockConfig(rose_addr_t va)
Configuration information for a data block.
const std::set< rose_addr_t > & successorVas() const
Property: control flow successors.
const BasicBlockConfig & basicBlock(rose_addr_t) const
Configuration for a particular basic block.
void loadFromFile(const FileSystem::Path &fileName)
Loads configuration from a file.
DataBlockConfigs & dataBlocks()
All data block configuration details.
FunctionConfig & sourceLocation(const SourceLocation &loc)
Property: Location of function in source code.
BasicBlockConfig & insertSuccessorVa(rose_addr_t va)
Property: control flow successors.
std::string dataBlockComment(rose_addr_t dblockVa) const
Data block comment.
std::string comment(rose_addr_t va) const
Address comment.
rose_addr_t address() const
Property: address.
BasicBlockConfig & clearSuccessorVas()
Property: control flow successors.
Sawyer::Optional< int64_t > stackDelta() const
Property: stack delta.
Main namespace for the ROSE library.
FunctionConfig & insertMaybeFunction(rose_addr_t va, const std::string &name="")
Lookup or insert a function.
const std::string & comment() const
Property: comment string.
const std::string & defaultName() const
Property: default name.
FunctionConfig(rose_addr_t va, const std::string &name="")
Configuration information for a function.
const std::string & comment() const
Property: comment.
const FunctionConfigsByAddress & functionConfigsByAddress() const
All function configuration details for function configs that have addresses.
bool insertConfiguration(const BasicBlockConfig &)
Insert basic block configuration information.
AddressConfig(rose_addr_t va)
Construct a new address configuration object.
DataBlockConfig & name(const std::string &s)
Property: name.
BasicBlockConfig & successorVas(const std::set< rose_addr_t > &vas)
Property: control flow successors.
const SourceLocation & sourceLocation() const
Property: location of basic block in source code.
std::string dataBlockName(rose_addr_t dblockVa) const
Data block name.
Sawyer::Optional< bool > mayReturn() const
Property: may-return.
const AddressConfigs & addresses() const
All address configuration details.
const SourceLocation & sourceLocation() const
Property: Location of address within source code.
const std::string & comment() const
Property: comment.
AddressConfigs & addresses()
All address configuration details.
FunctionConfig & stackDelta(const Sawyer::Optional< int64_t > &n)
Property: stack delta.
const BasicBlockConfigs & basicBlocks() const
All basic block configuration details.
std::string functionName(rose_addr_t functionVa) const
Function name.
const AddressConfig & address(rose_addr_t) const
Configuration for a particular address.
BasicBlockConfig & comment(const std::string &s)
Property: comment.
FunctionConfigsByAddress & functionConfigsByAddress()
All function configuration details for function configs that have addresses.
Sawyer::Optional< rose_addr_t > finalInstructionVa() const
Property: last instruction.
const std::string & name() const
Property: name.
const std::string & comment() const
Property: comment.
void print(std::ostream &) const
Generate a YAML file.
Sawyer::Optional< rose_addr_t > address() const
Property: address.
FunctionConfig(const Sawyer::Optional< rose_addr_t > &va, const std::string &name)
Configuration information for a function.
AddressConfig & insertMaybeAddress(rose_addr_t va)
Lookup or insert address details.
const FunctionConfigsByName & functionConfigsByName() const
All function configuration details for configs that have no address.
BasicBlockConfigs & basicBlocks()
All basic block configuration details.
AddressConfig & sourceLocation(const SourceLocation &loc)
Property: Location of address within source code.
const SourceLocation & sourceLocation() const
Property: Location of function in source code.
const std::string & name() const
Property: name.
BasicBlockConfig & sourceLocation(const SourceLocation &loc)
Property: location of basic block in source code.
BasicBlockConfig & insertMaybeBasicBlock(rose_addr_t va)
Lookup or insert a basic block.
const SourceLocation & sourceLocation() const
Property: Location of data block in source code.
AddressConfig & comment(const std::string &s)
Property: comment string.
rose_addr_t address() const
Property: starting address.
Configuration for individual addresses.
std::string functionDefaultName(rose_addr_t functionVa) const
Function default name.
FunctionConfig & mayReturn(const Sawyer::Optional< bool > &b)
Property: may-return.
FunctionConfigsByName & functionConfigsByName()
All function configuration details for configs that have no address.
Configuration information for a function.
AddressConfig & name(const std::string &s)
Property: name.
FunctionConfig & comment(const std::string &s)
Property: comment.
std::set< rose_addr_t > basicBlockSuccessorVas(rose_addr_t bblockVa) const
Basic block successor addresses.
Configuration information for a data block.
BasicBlockConfig(rose_addr_t va)
Configuration information for a basic block.
FunctionConfig & defaultName(const std::string &s)
Property: default name.
const std::string & name() const
Property: name.
rose_addr_t address() const
Property: starting address.
Holds configuration information.
const DataBlockConfigs & dataBlocks() const
All data block configuration details.