Skip to content

Commit

Permalink
Add parseAPI/SymbolicExpression.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 78d42a5 commit a355126
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
27 changes: 25 additions & 2 deletions docs/parseAPI/developer/SymbolicExpression.h.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
.. _`sec:SymbolicExpression.h`:

SymbolicExpression.h
====================
####################

.. cpp:class:: SymbolicExpression

**Tracks the expanded assignments**

Also provides several helper functions for manipulating ASTs.

.. cpp:member:: Dyninst::ParseAPI::CodeSource* cs

.. cpp:member:: Dyninst::ParseAPI::CodeRegion* cr

For archive, there are overlapping regions. Need to use the right region.

.. cpp:namespace:: Dyninst::parseAPI
.. cpp:function:: Dyninst::AST::Ptr SimplifyRoot(Dyninst::AST::Ptr ast, Dyninst::Address addr, bool keepMultiOne = false)
.. cpp:function:: Dyninst::AST::Ptr SimplifyAnAST(Dyninst::AST::Ptr ast, Dyninst::Address addr, bool keepMultiOne = false)
.. cpp:function:: static Dyninst::AST::Ptr SubstituteAnAST(Dyninst::AST::Ptr ast, const std::map<Dyninst::AST::Ptr, Dyninst::AST::Ptr>& aliasMap)
.. cpp:function:: static Dyninst::AST::Ptr DeepCopyAnAST(Dyninst::AST::Ptr ast)
.. cpp:function:: static bool ContainAnAST(Dyninst::AST::Ptr root, Dyninst::AST::Ptr check)
.. cpp:function:: bool ReadMemory(Dyninst::Address addr, uint64_t &val, int size)
.. cpp:function:: std::pair<Dyninst::AST::Ptr, bool> ExpandAssignment(Dyninst::Assignment::Ptr, bool keepMultiOne = false)
.. cpp:function:: static Dyninst::Address PCValue(Dyninst::Address cur, size_t insnSize, Dyninst::Architecture a)

On x86 and x86-64, the value of PC is post-instruction which is the current address plus the length of the instruction.
On ARMv8, the value of PC is pre-instruction, which is the current address.
9 changes: 1 addition & 8 deletions parseAPI/src/SymbolicExpression.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#include <map>
using Dyninst::AST;
using namespace Dyninst;
// This class tracks the expanded assignments,
// and also provides several helper functions for manipulating ASTs

class SymbolicExpression {

dyn_hash_map<Assignment::Ptr, AST::Ptr, Assignment::AssignmentPtrHasher> expandCache;
Expand All @@ -25,15 +24,9 @@ class SymbolicExpression {
static bool ContainAnAST(AST::Ptr root, AST::Ptr check);
bool ReadMemory(Address addr, uint64_t &val, int size);
ParseAPI::CodeSource* cs;
// For archive, there are overlapping regions.
// Need to use the right region.
ParseAPI::CodeRegion* cr;
std::pair<AST::Ptr, bool> ExpandAssignment(Assignment::Ptr, bool keepMultiOne = false);

//On x86 and x86-64, the value of PC is post-instruction,
// which is the current address plus the length of the instruction.
// On ARMv8, the value of PC is pre-instruction,
// which is the current address
static Address PCValue(Address cur, size_t insnSize, Architecture a);


Expand Down

0 comments on commit a355126

Please sign in to comment.