1
//! \file
2
/*
3
**  Copyright (C) - Triton
4
**
5
**  This program is under the terms of the Apache License 2.0.
6
*/
7

8
#ifndef TRITON_SYMBOLICVARIABLE_H
9
#define TRITON_SYMBOLICVARIABLE_H
10

11
#include <memory>
12
#include <string>
13

14
#include <triton/dllexport.hpp>
15
#include <triton/symbolicEnums.hpp>
16
#include <triton/tritonTypes.hpp>
17

18

19

20
//! The Triton namespace
21
namespace triton {
22
/*!
23
 *  \addtogroup triton
24
 *  @{
25
 */
26

27
  //! The Engines namespace
28
  namespace engines {
29
  /*!
30
   *  \ingroup triton
31
   *  \addtogroup engines
32
   *  @{
33
   */
34

35
    //! The Symbolic Execution namespace
36
    namespace symbolic {
37
    /*!
38
     *  \ingroup engines
39
     *  \addtogroup symbolic
40
     *  @{
41
     */
42

43
      class SymbolicVariable;
44

45
      //! Shared Symbolic variable
46
      using SharedSymbolicVariable = std::shared_ptr<triton::engines::symbolic::SymbolicVariable>;
47

48
      //! Weak Symbolic variable
49
      using WeakSymbolicVariable = std::weak_ptr<triton::engines::symbolic::SymbolicVariable>;
50

51
      /*! \class SymbolicVariable
52
          \brief The symbolic variable class. */
53 1
      class SymbolicVariable {
54
        protected:
55
          //! The symbolic variable type assignment.
56
          triton::engines::symbolic::variable_e type;
57

58
          //! The alias of the symbolic variable.
59
          std::string alias;
60

61
          //! The comment of the symbolic variable.
62
          std::string comment;
63

64
          //! The name of the symbolic variable. Names are always something like this: SymVar_X. \sa TRITON_SYMVAR_NAME
65
          std::string name;
66

67
          //! The id of the symbolic variable. This id is unique.
68
          triton::usize id;
69

70
          /*! \brief The origin of the symbolic variable.
71
           *
72
           * \details If the symbolic varialbe is a triton::engines::symbolic::REG, this value contains the register ID.
73
           * Otherwise, if the symbolic varialbe is a triton::engines::symbolic::MEM, this value contains the address of the
74
           * memory access.
75
           */
76
          triton::uint64 origin;
77

78
          //! The size (in bits) of the symbolic variable.
79
          triton::uint32 size;
80

81
        public:
82
          //! Constructor.
83
          TRITON_EXPORT SymbolicVariable(triton::engines::symbolic::variable_e type,
84
                                         triton::uint64 origin,
85
                                         triton::usize id,
86
                                         triton::uint32 size,
87
                                         const std::string& alias);
88

89
          //! Constructor by copy.
90
          TRITON_EXPORT SymbolicVariable(const SymbolicVariable& other);
91

92
          //! Operator.
93
          TRITON_EXPORT SymbolicVariable& operator=(const SymbolicVariable& other);
94

95
          //! Returns the symbolic variable type assignment.
96
          TRITON_EXPORT triton::engines::symbolic::variable_e getType(void) const;
97

98
          //! Returns the alias of the symbolic variable.
99
          TRITON_EXPORT const std::string& getAlias(void) const;
100

101
          //! Returns the comment of the symbolic variable.
102
          TRITON_EXPORT const std::string& getComment(void) const;
103

104
          //! Returns the name of the symbolic variable.
105
          TRITON_EXPORT const std::string& getName(void) const;
106

107
          //! Returns the id of the symbolic variable. This id is unique.
108
          TRITON_EXPORT triton::usize getId(void) const;
109

110
          //! Returns the source value of the symbolic variable.
111
          TRITON_EXPORT triton::uint64 getOrigin(void) const;
112

113
          //! Returns the size (in bits) of the symbolic variable.
114
          TRITON_EXPORT triton::uint32 getSize(void) const;
115

116
          //! Sets the alias of the symbolic variable.
117
          TRITON_EXPORT void setAlias(const std::string& alias);
118

119
          //! Sets the comment of the symbolic variable.
120
          TRITON_EXPORT void setComment(const std::string& comment);
121
      };
122

123
      //! Displays a symbolic variable.
124
      TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const SymbolicVariable& symVar);
125

126
      //! Displays a symbolic variable.
127
      TRITON_EXPORT std::ostream& operator<<(std::ostream& stream, const SymbolicVariable* symVar);
128

129
    /*! @} End of symbolic namespace */
130
    };
131
  /*! @} End of engines namespace */
132
  };
133
/*! @} End of triton namespace */
134
};
135

136
#endif /* TRITON_SYMBOLICVARIABLE_H */

Read our documentation on viewing source code .

Loading