1 #ifndef ROSE_BinaryAnalysis_Partitioner2_Function_H
2 #define ROSE_BinaryAnalysis_Partitioner2_Function_H
3 #include <featureTests.h>
4 #ifdef ROSE_ENABLE_BINARY_ANALYSIS
5 #include <Rose/BinaryAnalysis/Partitioner2/BasicTypes.h>
7 #include <Rose/BinaryAnalysis/CallingConvention.h>
8 #include <Rose/BinaryAnalysis/InstructionSemantics/BaseSemantics.h>
9 #include <Rose/BinaryAnalysis/StackDelta.h>
10 #include <Rose/SourceLocation.h>
12 #include <Sawyer/Attribute.h>
13 #include <Sawyer/Cached.h>
14 #include <Sawyer/Map.h>
15 #include <Sawyer/Set.h>
16 #include <Sawyer/SharedPointer.h>
18 #include <boost/serialization/access.hpp>
19 #include <boost/serialization/set.hpp>
20 #include <boost/serialization/string.hpp>
21 #include <boost/serialization/vector.hpp>
24 namespace BinaryAnalysis {
25 namespace Partitioner2 {
50 typedef FunctionPtr
Ptr;
55 std::string demangledName_;
58 std::string reasonComment_;
59 std::set<rose_addr_t> bblockVas_;
60 std::vector<DataBlockPtr> dblocks_;
77 #ifdef ROSE_HAVE_BOOST_SERIALIZATION_LIB
79 friend class boost::serialization::access;
82 void serialize(S &s,
const unsigned version) {
84 s & BOOST_SERIALIZATION_NVP(entryVa_);
85 s & BOOST_SERIALIZATION_NVP(name_);
86 s & BOOST_SERIALIZATION_NVP(demangledName_);
87 s & BOOST_SERIALIZATION_NVP(comment_);
88 s & BOOST_SERIALIZATION_NVP(reasons_);
89 s & BOOST_SERIALIZATION_NVP(bblockVas_);
90 s & BOOST_SERIALIZATION_NVP(dblocks_);
91 s & BOOST_SERIALIZATION_NVP(isFrozen_);
92 s & BOOST_SERIALIZATION_NVP(ccAnalysis_);
93 s & BOOST_SERIALIZATION_NVP(ccDefinition_);
94 s & BOOST_SERIALIZATION_NVP(stackDeltaAnalysis_);
95 s & BOOST_SERIALIZATION_NVP(stackDeltaOverride_);
97 s & BOOST_SERIALIZATION_NVP(reasonComment_);
99 s & BOOST_SERIALIZATION_NVP(sourceLocation_);
132 const std::string&
name()
const;
133 void name(
const std::string&);
151 const std::string&
comment()
const;
152 void comment(
const std::string&);
218 const std::vector<DataBlockPtr>&
dataBlocks()
const;
353 friend class Partitioner;
CallingConvention::DefinitionPtr callingConventionDefinition()
Property: Best calling convention definition.
bool ownsBasicBlock(rose_addr_t bblockVa) const
Predicate to test whether a function owns a basic block address.
Information about a source location.
bool insertDataBlock(const DataBlockPtr &)
Add a data block to this function.
std::string printableName() const
A printable name for the function.
int64_t stackDeltaConcrete() const
Property: Stack delta.
void eraseReasons(unsigned reasons)
Remove function reason bits.
DataBlockPtr dataBlockExists(const DataBlockPtr &) const
Determine if this function contains the specified data block, or equivalent.
InstructionSemantics::BaseSemantics::SValuePtr stackDelta() const
Property: Stack delta.
const std::string & demangledName() const
Property: Optional demangled name.
Function calling convention.
const std::string & reasonComment() const
Property: Additional comment for why function was detected.
Main namespace for the ROSE library.
static Ptr instance(rose_addr_t entryVa, const std::string &name="", unsigned reasons=0)
Static allocating constructor.
size_t nBasicBlocks() const
Number of basic blocks in the function.
Reference-counting intrusive smart pointer.
bool insertBasicBlock(rose_addr_t bblockVa)
Add a basic block to this function.
Sawyer::SharedPointer< Function > FunctionPtr
Shared-ownership pointer for Function.
AddressIntervalSet dataAddresses() const
Addresses that are part of static data.
Function does not own the block.
unsigned reasons() const
Property: Bit vector of function reasons.
const Sawyer::Cached< bool > & isNoop() const
Cached results of function no-op analysis.
const SourceLocation & sourceLocation() const
Property: Location of function definition in source code, if known.
size_t nDataBlocks() const
Number of data blocks in the function.
Function might own the block in the future.
void clear() const
Remove cached value.
const std::set< rose_addr_t > & basicBlockAddresses() const
Returns basic block addresses.
Base class for reference counted objects.
void insertReasons(unsigned reasons)
Insert additional function reason bits.
const StackDelta::Analysis & stackDeltaAnalysis() const
Property: Stack delta analysis results.
DataBlockPtr eraseDataBlock(const DataBlockPtr &)
Remove specified or equivalent data block from this function.
Ownership
Manner in which a function owns a block.
bool isThunk() const
True if function is a thunk.
const std::string & name() const
Property: Optional function name.
API and storage for attributes.
const std::string & comment() const
Property: Optional function comment.
Sawyer::SharedPointer< DataBlock > DataBlockPtr
Shared-ownership pointer for DataBlock.
rose_addr_t address() const
Read-only property: Entry address.
void eraseBasicBlock(rose_addr_t bblockVa)
Remove a basic block from this function.
FunctionPtr Ptr
Shared-ownership pointer for function.
bool isFrozen() const
Determines whether a function is frozen.
InstructionSemantics::BaseSemantics::SValuePtr stackDeltaOverride() const
Property: Stack delta override.
const std::vector< DataBlockPtr > & dataBlocks() const
Returns data blocks owned by this function.
Function owns the block explicitly, the normal ownership.
const CallingConvention::Analysis & callingConventionAnalysis() const
Property: Calling convention analysis results.