diff options
| author | Cyrille Bagard <nocbos@gmail.com> | 2018-06-19 18:19:56 (GMT) | 
|---|---|---|
| committer | Cyrille Bagard <nocbos@gmail.com> | 2018-06-19 18:19:56 (GMT) | 
| commit | ceeba88cafc4c7d2c625e53fb175b763e480f6ba (patch) | |
| tree | f362ff9063a0733d7388ed6eacb3019a150a271d /plugins | |
| parent | 9b7924c7c5d97f83f589f4e185cfabe971f72bc4 (diff) | |
Provided instruction unique identifiers as requested.
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/pychrysalide/arch/instruction.c | 37 | 
1 files changed, 37 insertions, 0 deletions
diff --git a/plugins/pychrysalide/arch/instruction.c b/plugins/pychrysalide/arch/instruction.c index bb977ce..7d5462d 100644 --- a/plugins/pychrysalide/arch/instruction.c +++ b/plugins/pychrysalide/arch/instruction.c @@ -49,6 +49,9 @@ +/* Fournit l'identifiant unique pour un ensemble d'instructions. */ +static PyObject *py_arch_instruction_get_unique_id(PyObject *, void *); +  /* Fournit la place mémoire d'une instruction. */  static PyObject *py_arch_instruction_get_range(PyObject *, void *); @@ -207,6 +210,36 @@ static PyObject *py_arch_instruction_get_destinations(PyObject *self, void *unus  *  Paramètres  : self    = classe représentant une instruction.               *  *                closure = adresse non utilisée ici.                          *  *                                                                             * +*  Description : Fournit l'identifiant unique pour un ensemble d'instructions.* +*                                                                             * +*  Retour      : Identifiant unique par type d'instruction et architecture.   * +*                                                                             * +*  Remarques   : -                                                            * +*                                                                             * +******************************************************************************/ + +static PyObject *py_arch_instruction_get_unique_id(PyObject *self, void *closure) +{ +    PyObject *result;                       /* Conversion à retourner      */ +    GArchInstruction *instr;                /* Version native              */ +    itid_t uid;                             /* Identifiant unique associé  */ + +    instr = G_ARCH_INSTRUCTION(pygobject_get(self)); + +    uid = g_arch_instruction_get_unique_id(instr); + +    result = PyLong_FromUnsignedLong(uid); + +    return result; + +} + + +/****************************************************************************** +*                                                                             * +*  Paramètres  : self    = classe représentant une instruction.               * +*                closure = adresse non utilisée ici.                          * +*                                                                             *  *  Description : Fournit la place mémoire d'une instruction.                  *  *                                                                             *  *  Retour      : Valeur associée à la propriété consultée.                    * @@ -384,6 +417,10 @@ PyTypeObject *get_python_arch_instruction_type(void)      static PyGetSetDef py_arch_instruction_getseters[] = {          { +            "uid", py_arch_instruction_get_unique_id, NULL, +            "Provide the unique identification number given to this kind of instruction.", NULL +        }, +        {              "range", py_arch_instruction_get_range, py_arch_instruction_set_range,              "Give access to the memory range covered by the current instruction.", NULL          },  | 
