1#ifndef ROSE_BinaryAnalysis_InstructionSemantics_NativeSemantics_H
2#define ROSE_BinaryAnalysis_InstructionSemantics_NativeSemantics_H
3#include <featureTests.h>
4#if defined(ROSE_ENABLE_BINARY_ANALYSIS) && defined(ROSE_ENABLE_DEBUGGER_LINUX)
6#include <Rose/BinaryAnalysis/BasicTypes.h>
7#include <Rose/BinaryAnalysis/Debugger/Linux.h>
8#include <Rose/BinaryAnalysis/InstructionSemantics/ConcreteSemantics.h>
10#include <boost/noncopyable.hpp>
11#include <boost/filesystem.hpp>
14namespace BinaryAnalysis {
15namespace InstructionSemantics {
18namespace NativeSemantics {
25typedef ConcreteSemantics::SValue SValue;
28typedef ConcreteSemantics::SValuePtr
SValuePtr;
31typedef ConcreteSemantics::Formatter
Formatter;
38typedef boost::shared_ptr<class RegisterState> RegisterStatePtr;
49 using Ptr = RegisterStatePtr;
52 Debugger::Linux::Ptr process_;
69 static RegisterStatePtr instance();
79 const RegisterDictionaryPtr&)
const override;
94 Debugger::Linux::Ptr process()
const;
100 virtual void clear()
override {}
102 virtual void zero()
override {
103 TODO(
"[Robb Matzke 2019-09-05]");
108 ASSERT_not_implemented(
"[Robb Matzke 2019-09-05]");
113 return peekRegister(reg, dflt, ops);
122 virtual void updateReadProperties(RegisterDescriptor)
override {}
127 virtual void print(std::ostream&, Formatter&)
const override;
149 Debugger::Linux::Ptr process_;
158 const Debugger::Linux::Ptr &process);
171 const Debugger::Linux::Ptr &process);
193 Debugger::Linux::Ptr process()
const;
199 virtual void clear()
override {}
203 ASSERT_not_implemented(
"not applicable for this class");
209 return peekMemory(address, dflt, addrOps, valOps);
218 ASSERT_not_implemented(
"[Robb Matzke 2019-09-05]");
223 ASSERT_not_implemented(
"[Robb Matzke 2021-03-26]");
227 ASSERT_not_implemented(
"[Robb Matzke 2019-09-05]");
236typedef boost::shared_ptr<class State> StatePtr;
242class State:
public ConcreteSemantics::State, boost::noncopyable {
245 using Super = ConcreteSemantics::State;
248 using Ptr = StatePtr;
255 : ConcreteSemantics::
State(registers, memory) {
256 (void) RegisterState::promote(registers);
257 (void) MemoryState::promote(memory);
265 return StatePtr(
new State(registers, memory));
276class RiscOperators:
public ConcreteSemantics::RiscOperators {
279 using Super = ConcreteSemantics::RiscOperators;
315 const SmtSolverPtr &solver =
SmtSolverPtr())
const override;
333 Debugger::Linux::Ptr process()
const {
334 return RegisterState::promote(currentState()->registerState())->process();
354 Debugger::Linux::Ptr process_;
360 Dispatcher(
const Architecture::BaseConstPtr&,
const Debugger::Linux::Ptr &process,
const BaseSemantics::SValuePtr &protoval);
371 static DispatcherPtr instance(
const Architecture::BaseConstPtr&,
const Debugger::Linux::Ptr &process,
375 static DispatcherPtr instance(
const Architecture::BaseConstPtr&,
const Debugger::Linux::Specimen&,
403 void processInstruction(rose_addr_t va);
411 virtual RegisterDescriptor instructionPointerRegister()
const override;
412 virtual RegisterDescriptor stackPointerRegister()
const override;
413 virtual RegisterDescriptor stackFrameRegister()
const override;
414 virtual RegisterDescriptor callReturnRegister()
const override;
420 notApplicable(
"iprocReplace");
423 notApplicable(
"iprocSet");
426 notApplicable(
"iprocKey");
431 [[noreturn]]
void notApplicable(
const std::string &what)
const {
432 ASSERT_not_implemented(what +
" is not applicable for this class");
Dispatches instructions through the RISC layer.
Functor that knows how to dispatch a single kind of instruction.
Represents all memory in the state.
The set of all registers and their values.
Base class for most instruction semantics RISC operators.
Base class for machine instructions.
ROSE_DLL_API void clear()
Empties the memory pool of all nodes.
ROSE_DLL_API void merge(SgProject *project)
Performs sharing of AST nodes followed by linking accross translation units.
boost::shared_ptr< RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
boost::shared_ptr< MemoryState > MemoryStatePtr
Shared-ownership pointer to a memory state.
boost::shared_ptr< Dispatcher > DispatcherPtr
Shared-ownership pointer to a semantics instruction dispatcher.
InputOutputProperty
Boolean properties related to I/O.
boost::shared_ptr< State > StatePtr
Shared-ownership pointer to a semantic state.
boost::shared_ptr< AddressSpace > AddressSpacePtr
Shared-ownership pointer for AddressSpace objects.
boost::shared_ptr< RegisterState > RegisterStatePtr
Shared-ownership pointer to a register state.
boost::shared_ptr< class MemoryState > MemoryStatePtr
Shared-ownership pointer to a concrete memory state.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to concrete RISC operations.
BaseSemantics::Formatter Formatter
Formatter for symbolic values.
Sawyer::SharedPointer< class SValue > SValuePtr
Smart-ownership pointer to a concrete semantic value.
Sawyer::SharedPointer< Node > Ptr
Reference counting pointer.
Hash hash(const std::vector< Ptr > &)
Hash zero or more expressions.
void print(const GlobalVariables &, const Partitioner2::PartitionerConstPtr &, std::ostream &out, const std::string &prefix="")
Print info about multiple global variables.
std::shared_ptr< SmtSolver > SmtSolverPtr
Reference counting pointer.