ROSE  0.9.10.91
TraceSemantics2.h
1 #ifndef Rose_TraceSemantics2_H
2 #define Rose_TraceSemantics2_H
3 
4 #include "BaseSemantics2.h"
5 #include "Diagnostics.h"
6 
7 namespace Rose {
8 namespace BinaryAnalysis { // documented elsewhere
9 namespace InstructionSemantics2 { // documented elsewhere
10 
50 namespace TraceSemantics {
51 
52 
54 // Semantic values
56 
57 typedef void SValue;
58 
60 typedef boost::shared_ptr<void> SValuePtr;
61 
62 
64 // Register state
66 
67 typedef void RegisterState;
68 
70 typedef boost::shared_ptr<void> RegisterStatePtr;
71 
72 
74 // Memory state
76 
77 typedef void MemoryState;
78 
80 typedef boost::shared_ptr<void> MemoryStatePtr;
81 
82 
84 // RISC operators
86 
88 typedef boost::shared_ptr<class RiscOperators> RiscOperatorsPtr;
89 
92  BaseSemantics::RiscOperatorsPtr subdomain_; // Domain to which all our RISC operators chain
93  Sawyer::Message::Stream stream_; // stream to which output is emitted
94  std::string indentation_; // string to print at start of each line
95  bool showingSubdomain_; // show subdomain name and address on each line of output?
96  bool showingInstructionVa_; // show instruction VA on each line of output?
97 
99  // Real constructors.
100 protected:
101  // use the version that takes a subdomain instead of this c'tor
103  : BaseSemantics::RiscOperators(protoval, solver), stream_(mlog[Diagnostics::INFO]), showingSubdomain_(true),
104  showingInstructionVa_(true) {
105  name("Trace");
106  }
107 
108  // use the version that takes a subdomain instead of this c'tor.
109  explicit RiscOperators(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr())
110  : BaseSemantics::RiscOperators(state, solver), stream_(mlog[Diagnostics::INFO]), showingSubdomain_(true),
111  showingInstructionVa_(true) {
112  name("Trace");
113  }
114 
116  : BaseSemantics::RiscOperators(subdomain->currentState(), subdomain->solver()),
117  subdomain_(subdomain), stream_(mlog[Diagnostics::INFO]), showingSubdomain_(true),
118  showingInstructionVa_(true) {
119  name("Trace");
120  }
121 
122 public:
123  virtual ~RiscOperators() {
124  linePrefix();
125  stream_ <<"operators destroyed\n";
126  }
127 
129  // Static allocating constructors.
130 public:
134  static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver = SmtSolverPtr()) {
135  return RiscOperatorsPtr(new RiscOperators(protoval, solver));
136  }
137 
141  static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver = SmtSolverPtr()) {
142  return RiscOperatorsPtr(new RiscOperators(state, solver));
143  }
144 
147  static RiscOperatorsPtr instance(const BaseSemantics::RiscOperatorsPtr &subdomain) {
148  ASSERT_not_null(subdomain);
149  RiscOperatorsPtr self = subdomain->currentState()!=NULL ?
150  RiscOperatorsPtr(new RiscOperators(subdomain->currentState(), subdomain->solver())) :
151  RiscOperatorsPtr(new RiscOperators(subdomain->protoval(), subdomain->solver()));
152  self->subdomain_ = subdomain;
153  return self;
154  }
155 
157  // Virtual constructors
158 public:
160  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
161  return instance(protoval, solver);
162  }
163 
165  const SmtSolverPtr &solver = SmtSolverPtr()) const ROSE_OVERRIDE {
166  return instance(state, solver);
167  }
168 
171  return instance(subdomain);
172  }
173 
175  // Dynamic pointer casts
176 public:
179  static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x) {
180  RiscOperatorsPtr retval = boost::dynamic_pointer_cast<RiscOperators>(x);
181  ASSERT_not_null(retval);
182  return retval;
183  }
184 
186  // Methods first defined at this level of the class hierarchy
187 public:
189  virtual BaseSemantics::RiscOperatorsPtr get_subdomain() const ROSE_DEPRECATED("use subdomain instead") {
190  return subdomain();
191  }
192 
193 
195  void set_subdomain(const BaseSemantics::RiscOperatorsPtr &sd) ROSE_DEPRECATED("use subdomain instead") {
196  subdomain(sd);
197  }
198 
202  const BaseSemantics::RiscOperatorsPtr& subdomain() const { return subdomain_; }
203  void subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain) { subdomain_ = subdomain; }
209  void check_subdomain() const ROSE_DEPRECATED("use checkSubodmain instead") {
210  checkSubdomain();
211  }
212  void checkSubdomain() const {
213  if (subdomain_==NULL)
214  throw BaseSemantics::Exception("subdomain is not set; nothing to trace", NULL);
215  }
222  Sawyer::Message::Stream& stream() { return stream_; }
223  void stream(Sawyer::Message::Stream &s) { stream_ = s; }
231  const std::string& indentation() const { return indentation_; }
232  void indentation(const std::string &s) { indentation_ = s; }
240  bool showingSubdomain() const { return showingSubdomain_; }
241  void showingSubdomain(bool b) { showingSubdomain_ = b; }
249  bool showingInstructionVa() const { return showingInstructionVa_; }
250  void showingInstructionVa(bool b) { showingInstructionVa_ = b; }
253 protected:
254  void linePrefix();
255  std::string toString(const BaseSemantics::SValuePtr&);
256  std::string toString(SgAsmFloatType*);
257  void check_equal_widths(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
258  const BaseSemantics::SValuePtr &check_width(const BaseSemantics::SValuePtr &a, size_t nbits,
259  const std::string &what="result");
260  std::string register_name(RegisterDescriptor);
261 
262  void before(const std::string&);
263  void before(const std::string&, RegisterDescriptor);
264  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&);
265  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
266  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
267  size_t);
268  void before(const std::string&, RegisterDescriptor, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
269  const BaseSemantics::SValuePtr&);
270  void before(const std::string&, SgAsmInstruction*, bool showAddress);
271  void before(const std::string&, size_t);
272  void before(const std::string&, size_t, uint64_t);
273  void before(const std::string&, const BaseSemantics::SValuePtr&);
274  void before(const std::string&, const BaseSemantics::SValuePtr&, size_t);
275  void before(const std::string&, const BaseSemantics::SValuePtr&, size_t, size_t);
276  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&);
277  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
278  const BaseSemantics::SValuePtr&);
279  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*);
280  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*, const BaseSemantics::SValuePtr&);
281  void before(const std::string&, const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*);
282  void before(const std::string&, const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&, SgAsmFloatType*);
283 
284  void after();
287  void after(const BaseSemantics::Exception&);
288  void after_exception();
289 
291  // Methods we override from our super class
292 public:
293  virtual BaseSemantics::SValuePtr protoval() const ROSE_OVERRIDE;
294  virtual void solver(const SmtSolverPtr&) ROSE_OVERRIDE;
295  virtual SmtSolverPtr solver() const ROSE_OVERRIDE;
296  virtual BaseSemantics::StatePtr currentState() const ROSE_OVERRIDE;
297  virtual void currentState(const BaseSemantics::StatePtr&) ROSE_OVERRIDE;
298  virtual void print(std::ostream&, BaseSemantics::Formatter&) const ROSE_OVERRIDE;
299  virtual size_t nInsns() const ROSE_OVERRIDE;
300  virtual void nInsns(size_t n) ROSE_OVERRIDE;
301  virtual SgAsmInstruction* currentInstruction() const ROSE_OVERRIDE;
302  virtual void startInstruction(SgAsmInstruction*) ROSE_OVERRIDE;
303  virtual void finishInstruction(SgAsmInstruction*) ROSE_OVERRIDE;
304 
305  virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE;
306  virtual BaseSemantics::SValuePtr unspecified_(size_t nbits) ROSE_OVERRIDE;
307  virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE;
308  virtual BaseSemantics::SValuePtr boolean_(bool value) ROSE_OVERRIDE;
309  virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE;
310 
311  virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
312  virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
313  virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
314  virtual void hlt() ROSE_OVERRIDE;
315  virtual void cpuid() ROSE_OVERRIDE;
316  virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE;
317 
318  // The actual RISC operators. These are pure virtual in the base class
319  virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
320  virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
321  virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
322  virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
323  virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr&, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE;
324  virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
325  virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
326  virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
327  virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
328  virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
329  virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
330  virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
331  virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr&,
332  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
333  virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
334  virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
335  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
336  virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr&, size_t nbits) ROSE_OVERRIDE;
337  virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr&, size_t nbits) ROSE_OVERRIDE;
338  virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
339  virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
340  const BaseSemantics::SValuePtr&,
341  BaseSemantics::SValuePtr&/*out*/) ROSE_OVERRIDE;
342  virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
343  virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
344  virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
345  virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr&,
346  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
347  virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr&,
348  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
349  virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr&,
350  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
351  virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr&,
352  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
353 
354  virtual void interrupt(int majr, int minr) ROSE_OVERRIDE;
355 
356  virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
357  virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr&, SgAsmFloatType*,
358  const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
359  virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr&, SgAsmFloatType*, SgAsmFloatType*) ROSE_OVERRIDE;
360  virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
361  virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
362  virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
363  virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
364  virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
365  virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
366  virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
367  SgAsmFloatType*) ROSE_OVERRIDE;
368  virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
369  SgAsmFloatType*) ROSE_OVERRIDE;
370  virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
371  SgAsmFloatType*) ROSE_OVERRIDE;
372  virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr&, const BaseSemantics::SValuePtr&,
373  SgAsmFloatType*) ROSE_OVERRIDE;
374  virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
375  virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr&, SgAsmFloatType*) ROSE_OVERRIDE;
376 
377  virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor,
378  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
379  virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor,
380  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
381  virtual void writeRegister(RegisterDescriptor, const BaseSemantics::SValuePtr&) ROSE_OVERRIDE;
382  virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
383  const BaseSemantics::SValuePtr &dflt,
384  const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
385  virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
386  const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE;
387  virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr,
388  const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE;
389 };
390 
391 } // namespace
392 } // namespace
393 } // namespace
394 } // namespace
395 
396 #endif
virtual BaseSemantics::SValuePtr fpMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Multiply two floating-point values.
virtual BaseSemantics::SValuePtr fpSubtract(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Subtract one floating-point value from another.
boost::shared_ptr< void > RegisterStatePtr
Shared-ownership pointer to trace-semantics register state.
virtual BaseSemantics::SValuePtr peekRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Obtain a register value without side effects.
virtual BaseSemantics::SValuePtr rotateRight(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Rotate bits to the right.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::RiscOperatorsPtr &subdomain)
Wraps a subdomain's RISC operators to add tracing.
virtual SmtSolverPtr solver() const ROSE_OVERRIDE
Property: Satisfiability module theory (SMT) solver.
virtual BaseSemantics::SValuePtr fpDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Divide one floating-point value by another.
virtual BaseSemantics::SValuePtr rdtsc() ROSE_OVERRIDE
Invoked for the x86 RDTSC instruction.
virtual BaseSemantics::SValuePtr fpSign(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Sign of floating-point value.
virtual BaseSemantics::SValuePtr signedDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Divides two signed values.
virtual BaseSemantics::SValuePtr rotateLeft(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Rotate bits to the left.
virtual SgAsmInstruction * currentInstruction() const ROSE_OVERRIDE
Returns current instruction.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual void startInstruction(SgAsmInstruction *) ROSE_OVERRIDE
Called at the beginning of every instruction.
virtual BaseSemantics::SValuePtr xor_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise XOR of two values.
void subdomain(const BaseSemantics::RiscOperatorsPtr &subdomain)
Property: Subdomain to which operations are forwarded.
virtual BaseSemantics::SValuePtr signExtend(const BaseSemantics::SValuePtr &, size_t nbits) ROSE_OVERRIDE
Sign extends a value.
virtual BaseSemantics::SValuePtr extract(const BaseSemantics::SValuePtr &, size_t begin_bit, size_t end_bit) ROSE_OVERRIDE
Extracts bits from a value.
Base class for machine instructions.
virtual BaseSemantics::SValuePtr ite(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
If-then-else.
virtual BaseSemantics::RiscOperatorsPtr create(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr()) const ROSE_OVERRIDE
Virtual allocating constructor.
virtual BaseSemantics::SValuePtr invert(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
One's complement.
virtual void writeMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &data, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Writes a value to memory.
virtual BaseSemantics::SValuePtr mostSignificantSetBit(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns position of most significant set bit; zero when no bits are set.
static RiscOperatorsPtr instance(const BaseSemantics::StatePtr &state, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object.
virtual BaseSemantics::RiscOperatorsPtr get_subdomain() const ROSE_DEPRECATED("use subdomain instead")
Obtain a pointer to the subdomain's RISC operators.
virtual BaseSemantics::SValuePtr fpAdd(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Add two floating-point values.
STL namespace.
virtual BaseSemantics::SValuePtr signedModulo(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Calculates modulo with signed values.
virtual BaseSemantics::SValuePtr fpEffectiveExponent(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Exponent of floating-point value.
virtual BaseSemantics::SValuePtr fpIsNan(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is a special not-a-number bit pattern.
virtual BaseSemantics::SValuePtr concat(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Concatenates the bits of two values.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to trace-semantics RISC operations.
virtual BaseSemantics::SValuePtr unsignedDivide(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Divides two unsigned values.
virtual BaseSemantics::SValuePtr negate(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Two's complement.
void showingInstructionVa(bool b)
Property: Show instruction in output.
void showingSubdomain(bool b)
Property: Show subdomain name in output.
void set_subdomain(const BaseSemantics::RiscOperatorsPtr &sd) ROSE_DEPRECATED("use subdomain instead")
Set the subdomain that is to be traced.
virtual BaseSemantics::SValuePtr fpIsInfinity(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is infinity.
Main namespace for the ROSE library.
virtual BaseSemantics::SValuePtr boolean_(bool value) ROSE_OVERRIDE
Returns a Boolean value.
virtual void interrupt(int majr, int minr) ROSE_OVERRIDE
Invoked for instructions that cause an interrupt.
Describes (part of) a physical CPU register.
virtual BaseSemantics::SValuePtr fpToInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Construct an integer value from a floating-point value.
virtual void cpuid() ROSE_OVERRIDE
Invoked for the x86 CPUID instruction.
boost::shared_ptr< void > MemoryStatePtr
Shared-ownership pointer to trace-semantics memory state.
bool showingSubdomain() const
Property: Show subdomain name in output.
void stream(Sawyer::Message::Stream &s)
Property: output stream to which tracing is emitted.
Sawyer::SharedPointer< class SmtSolver > SmtSolverPtr
Reference-counting pointer for SMT solvers.
virtual BaseSemantics::SValuePtr and_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise AND of two values.
virtual BaseSemantics::SValuePtr protoval() const ROSE_OVERRIDE
Property: Prototypical semantic value.
Sawyer::Message::Stream & stream()
Property: output stream to which tracing is emitted.
boost::shared_ptr< class State > StatePtr
Shared-ownership pointer to a semantic state.
virtual BaseSemantics::SValuePtr number_(size_t nbits, uint64_t value) ROSE_OVERRIDE
Returns a number of the specified bit width.
Base classes for instruction semantics.
virtual BaseSemantics::SValuePtr signedMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Multiplies two signed values.
virtual BaseSemantics::SValuePtr fpSquareRoot(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Square root.
boost::shared_ptr< class RiscOperators > RiscOperatorsPtr
Shared-ownership pointer to a RISC operators object.
static RiscOperatorsPtr promote(const BaseSemantics::RiscOperatorsPtr &x)
Run-time promotion of a base RiscOperators pointer to trace operators.
virtual BaseSemantics::SValuePtr undefined_(size_t nbits) ROSE_OVERRIDE
Returns a new undefined value.
virtual BaseSemantics::SValuePtr shiftRightArithmetic(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted right arithmetically (with sign bit).
virtual BaseSemantics::SValuePtr shiftRight(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted right logically (no sign bit).
Sawyer::Message::Facility mlog
Diagnostics logging facility for instruction semantics.
virtual BaseSemantics::SValuePtr filterCallTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter call targets.
void indentation(const std::string &s)
Property: Line prefix string.
virtual void print(std::ostream &, BaseSemantics::Formatter &) const ROSE_OVERRIDE
Print multi-line output for this object.
virtual BaseSemantics::SValuePtr addWithCarries(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &, BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Add two values of equal size and a carry bit.
virtual void writeRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Writes a value to a register.
Base class for most instruction semantics RISC operators.
void check_subdomain() const ROSE_DEPRECATED("use checkSubodmain instead")
Check that we have a valid subdomain.
virtual BaseSemantics::SValuePtr fpConvert(const BaseSemantics::SValuePtr &, SgAsmFloatType *, SgAsmFloatType *) ROSE_OVERRIDE
Convert from one floating-point type to another.
virtual BaseSemantics::SValuePtr shiftLeft(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns arg shifted left.
static RiscOperatorsPtr instance(const BaseSemantics::SValuePtr &protoval, const SmtSolverPtr &solver=SmtSolverPtr())
Instantiates a new RiscOperators object.
virtual void finishInstruction(SgAsmInstruction *) ROSE_OVERRIDE
Called at the end of every instruction.
virtual BaseSemantics::SValuePtr filterIndirectJumpTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter indirect jumps.
virtual BaseSemantics::StatePtr currentState() const ROSE_OVERRIDE
Property: Current semantic state.
const std::string & indentation() const
Property: Line prefix string.
virtual BaseSemantics::SValuePtr filterReturnTarget(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Invoked to filter return targets.
virtual BaseSemantics::SValuePtr bottom_(size_t nbits) ROSE_OVERRIDE
Returns a data-flow bottom value.
virtual size_t nInsns() const ROSE_OVERRIDE
Property: Number of instructions processed.
virtual BaseSemantics::SValuePtr fpIsZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is equal to zero.
const BaseSemantics::RiscOperatorsPtr & subdomain() const
Property: Subdomain to which operations are forwarded.
virtual BaseSemantics::SValuePtr unsignedModulo(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Calculates modulo with unsigned values.
virtual BaseSemantics::SValuePtr add(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Adds two integers of equal size.
virtual BaseSemantics::SValuePtr readMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt, const BaseSemantics::SValuePtr &cond) ROSE_OVERRIDE
Reads a value from memory.
Converts text to messages.
Definition: Message.h:1394
virtual BaseSemantics::SValuePtr unsignedExtend(const BaseSemantics::SValuePtr &, size_t nbits) ROSE_OVERRIDE
Extend (or shrink) operand a so it is nbits wide by adding or removing high-order bits...
virtual const std::string & name() const
Property: Name used for debugging.
virtual void hlt() ROSE_OVERRIDE
Invoked for the x86 HLT instruction.
virtual BaseSemantics::SValuePtr fpRoundTowardZero(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Round toward zero.
virtual BaseSemantics::SValuePtr peekMemory(RegisterDescriptor segreg, const BaseSemantics::SValuePtr &addr, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Read memory without side effects.
Base class for exceptions thrown by instruction semantics.
void checkSubdomain() const
Check that we have a valid subdomain.
boost::shared_ptr< void > SValuePtr
Shared-ownership pointer to trace-semantics values.
static RiscOperatorsPtr instance(const BaseSemantics::RiscOperatorsPtr &subdomain)
Instantiate a new RiscOperators object.
virtual BaseSemantics::SValuePtr or_(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Computes bit-wise OR of two values.
virtual BaseSemantics::SValuePtr equalToZero(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Determines whether a value is equal to zero.
Floating point types.
virtual BaseSemantics::SValuePtr fpFromInteger(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Construct a floating-point value from an integer value.
virtual BaseSemantics::SValuePtr unsignedMultiply(const BaseSemantics::SValuePtr &, const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Multiply two unsigned values.
bool showingInstructionVa() const
Property: Show instruction in output.
virtual BaseSemantics::SValuePtr fpIsDenormalized(const BaseSemantics::SValuePtr &, SgAsmFloatType *) ROSE_OVERRIDE
Whether a floating-point value is denormalized.
virtual BaseSemantics::SValuePtr readRegister(RegisterDescriptor, const BaseSemantics::SValuePtr &dflt) ROSE_OVERRIDE
Reads a value from a register.
virtual BaseSemantics::SValuePtr leastSignificantSetBit(const BaseSemantics::SValuePtr &) ROSE_OVERRIDE
Returns position of least significant set bit; zero when no bits are set.