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

8
#include <triton/pythonBindings.hpp>
9
#include <triton/pythonUtils.hpp>
10
#include <triton/pythonXFunctions.hpp>
11
#include <triton/callbacks.hpp>
12

13

14

15
/*! \page py_CALLBACK_page CALLBACK
16
    \brief [**python api**] All information about the CALLBACK Python namespace.
17

18
\tableofcontents
19

20
\section CALLBACK_py_description Description
21
<hr>
22

23
The CALLBACK namespace contains all kinds of callbacks.
24

25
\subsection CALLBACK_py_example Example
26

27
~~~~~~~~~~~~~{.py}
28
>>> addCallback(CALLBACK.GET_CONCRETE_MEMORY_VALUE, your_function)
29
~~~~~~~~~~~~~
30

31
\section CALLBACK_py_api Python API - Items of the CALLBACK namespace
32
<hr>
33

34
- **CALLBACK.GET_CONCRETE_MEMORY_VALUE**<br>
35
The callback takes as arguments a \ref py_TritonContext_page and a \ref py_MemoryAccess_page. Callbacks will be called each time that the
36
Triton library will need to LOAD a concrete memory value. The callback must return nothing.
37

38
- **CALLBACK.GET_CONCRETE_REGISTER_VALUE**<br>
39
The callback takes as arguments a \ref py_TritonContext_page and a \ref py_Register_page. Callbacks will be called each time that the
40
Triton library will need to GET a concrete register value. The callback must return nothing.
41

42
- **CALLBACK.SET_CONCRETE_MEMORY_VALUE**<br>
43
The callback takes as arguments a \ref py_TritonContext_page, a \ref py_MemoryAccess_page and an integer. Callbacks will be called
44
each time that the Triton library will need to STORE a concrete memory value. The callback must return nothing.
45

46
- **CALLBACK.SET_CONCRETE_REGISTER_VALUE**<br>
47
The callback takes as arguments a \ref py_TritonContext_page, \ref py_Register_page and an integer. Callbacks will be called each time that the
48
Triton library will need to PUT a concrete register value. The callback must return nothing.
49

50
- **CALLBACK.SYMBOLIC_SIMPLIFICATION**<br>
51
Defines a callback which will be called before all symbolic assignments. The callback takes as arguments
52
a \ref py_TritonContext_page and an \ref py_AstNode_page. This callback must return a valid \ref py_AstNode_page. The returned node is
53
used as assignment. See also the page about \ref SMT_simplification_page.
54

55
*/
56

57

58

59
namespace triton {
60
  namespace bindings {
61
    namespace python {
62

63 1
      void initCallbackNamespace(PyObject* callbackDict) {
64 1
        xPyDict_SetItemString(callbackDict, "GET_CONCRETE_MEMORY_VALUE",   PyLong_FromUint32(triton::callbacks::GET_CONCRETE_MEMORY_VALUE));
65 1
        xPyDict_SetItemString(callbackDict, "GET_CONCRETE_REGISTER_VALUE", PyLong_FromUint32(triton::callbacks::GET_CONCRETE_REGISTER_VALUE));
66 1
        xPyDict_SetItemString(callbackDict, "SET_CONCRETE_MEMORY_VALUE",   PyLong_FromUint32(triton::callbacks::SET_CONCRETE_MEMORY_VALUE));
67 1
        xPyDict_SetItemString(callbackDict, "SET_CONCRETE_REGISTER_VALUE", PyLong_FromUint32(triton::callbacks::SET_CONCRETE_REGISTER_VALUE));
68 1
        xPyDict_SetItemString(callbackDict, "SYMBOLIC_SIMPLIFICATION",     PyLong_FromUint32(triton::callbacks::SYMBOLIC_SIMPLIFICATION));
69
      }
70

71
    }; /* python namespace */
72
  }; /* bindings namespace */
73 1
}; /* triton namespace */

Read our documentation on viewing source code .

Loading