summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2017-05-14 19:19:11 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2017-05-14 19:19:11 (GMT)
commitcb36603eb37330ab6c956095c1ce175acb751e03 (patch)
treee20d2e60c8947fddd34db543e41fa4287fc0db29 /plugins
parent198ba09ef74a02a727ac3e679edfa328b2508152 (diff)
Begun to clean the symbol interface.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/pychrysa/format/symbol.c208
-rw-r--r--plugins/stackvars/stackvars.c3
2 files changed, 2 insertions, 209 deletions
diff --git a/plugins/pychrysa/format/symbol.c b/plugins/pychrysa/format/symbol.c
index 75f226a..008aeb3 100644
--- a/plugins/pychrysa/format/symbol.c
+++ b/plugins/pychrysa/format/symbol.c
@@ -48,15 +48,9 @@ static PyObject *py_binary_symbol_richcompare(PyObject *, PyObject *, int);
/* Définit un autre nom pour le symbole. */
static PyObject *py_binary_symbol_set_alt_label(PyObject *, PyObject *);
-/* Raffine la définition de l'emplacement d'un symbole. */
-static PyObject *py_binary_symbol_fix_range(PyObject *, PyObject *);
-
/* Attache la routine associée au symbole. */
static PyObject *py_binary_symbol_attach_routine(PyObject *, PyObject *);
-/* Attache l'instruction associée au symbole. */
-static PyObject *py_binary_symbol_attach_instruction(PyObject *, PyObject *);
-
/* Fournit le type du symbole. */
static PyObject *py_binary_symbol_get_target_type(PyObject *, void *);
@@ -69,15 +63,6 @@ static PyObject *py_binary_symbol_get_range(PyObject *, void *);
/* Fournit l'éventuelle routine associée au symbole. */
static PyObject *py_binary_symbol_get_routine(PyObject *, void *);
-/* Fournit l'éventuelle instruction associée au symbole. */
-static PyObject *py_binary_symbol_get_instruction(PyObject *, void *);
-
-/* Fournit l'éventuel commentaire associé au symbole. */
-static PyObject *py_binary_symbol_get_comment(PyObject *, void *);
-
-/* Ajoute un commentaire facultatif au symbole. */
-static int py_binary_symbol_set_comment(PyObject *, PyObject *, void *);
-
/* Définit les constantes pour les symboles binaires. */
static bool py_binary_symbol_define_constants(PyTypeObject *);
@@ -204,39 +189,6 @@ static PyObject *py_binary_symbol_set_alt_label(PyObject *self, PyObject *args)
* Paramètres : self = classe représentant un binaire. *
* args = arguments fournis à l'appel. *
* *
-* Description : Raffine la définition de l'emplacement d'un symbole. *
-* *
-* Retour : None. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_symbol_fix_range(PyObject *self, PyObject *args)
-{
- PyObject *py_vmpa; /* Localisation version Python */
- int ret; /* Bilan de lecture des args. */
- GBinSymbol *symbol; /* Elément à consulter */
-
- ret = PyArg_ParseTuple(args, "O", &py_vmpa);
- if (!ret) return NULL;
-
- ret = PyObject_IsInstance(py_vmpa, (PyObject *)get_python_vmpa_type());
- if (!ret) return NULL;
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
- g_binary_symbol_fix_range(symbol, get_internal_vmpa(py_vmpa));
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = classe représentant un binaire. *
-* args = arguments fournis à l'appel. *
-* *
* Description : Attache la routine associée au symbole. *
* *
* Retour : None. *
@@ -270,42 +222,6 @@ static PyObject *py_binary_symbol_attach_routine(PyObject *self, PyObject *args)
/******************************************************************************
* *
-* Paramètres : self = classe représentant un binaire. *
-* args = arguments fournis à l'appel. *
-* *
-* Description : Attache l'instruction associée au symbole. *
-* *
-* Retour : None. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_symbol_attach_instruction(PyObject *self, PyObject *args)
-{
- PyObject *py_instr; /* Instruction version Python */
- int ret; /* Bilan de lecture des args. */
- GBinSymbol *symbol; /* Elément à consulter */
- GArchInstruction *instr; /* Instruction à attacher */
-
- ret = PyArg_ParseTuple(args, "O", &py_instr);
- if (!ret) return NULL;
-
- ret = PyObject_IsInstance(py_instr, (PyObject *)get_python_arch_instruction_type());
- if (!ret) return NULL;
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
- instr = G_ARCH_INSTRUCTION(pygobject_get(py_instr));
-
- g_binary_symbol_attach_instruction(symbol, instr);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
@@ -427,112 +343,6 @@ static PyObject *py_binary_symbol_get_routine(PyObject *self, void *closure)
}
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit l'éventuelle instruction associée au symbole. *
-* *
-* Retour : Instance en place ou None si aucune. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_symbol_get_instruction(PyObject *self, void *closure)
-{
- PyObject *result; /* Valeur à retourner */
- GBinSymbol *symbol; /* Elément à consulter */
- GArchInstruction *instr; /* Routine attachée */
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
- instr = g_binary_symbol_get_instruction(symbol);
-
- result = pygobject_new(G_OBJECT(instr));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit l'éventuel commentaire associé au symbole. *
-* *
-* Retour : Instance Python du commentaire GLib ou None si aucun. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_symbol_get_comment(PyObject *self, void *closure)
-{
- PyObject *result; /* Valeur à retourner */
- GBinSymbol *symbol; /* Elément à consulter */
- GDbComment *comment; /* Commentaire à associé */
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
- comment = g_binary_symbol_get_comment(symbol);
-
- if (comment != NULL)
- result = pygobject_new(G_OBJECT(comment));
- else
- {
- result = Py_None;
- Py_INCREF(result);
- }
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* value = valeur fournie à intégrer ou prendre en compte. *
-* closure = non utilisé ici. *
-* *
-* Description : Ajoute un commentaire facultatif au symbole. *
-* *
-* Retour : Bilan de l'opération pour Python. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static int py_binary_symbol_set_comment(PyObject *self, PyObject *value, void *closure)
-{
- GBinSymbol *symbol; /* Elément à consulter */
- int ret; /* Bilan de lecture des args. */
- GDbComment *comment; /* Commentaire à associer */
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
-
- if (value == Py_None)
- g_binary_symbol_set_comment(symbol, NULL);
-
- else
- {
- ret = PyObject_IsInstance(value, (PyObject *)get_python_db_comment_type());
- if (!ret) return -1;
-
- comment = G_DB_COMMENT(pygobject_get(value));
-
- g_binary_symbol_set_comment(symbol, comment);
-
- }
-
- return 0;
-
-}
-
-
/******************************************************************************
* *
* Paramètres : obj_type = type dont le dictionnaire est à compléter. *
@@ -586,20 +396,10 @@ PyTypeObject *get_python_binary_symbol_type(void)
"set_alt_label($self, alt, /)\n--\n\nSet an alternative label for the symbol."
},
{
- "fix_range", py_binary_symbol_fix_range,
- METH_VARARGS,
- "fix_range($self, range, /)\n--\n\nRefine the location of the current symbol."
- },
- {
"attach_routine", py_binary_symbol_attach_routine,
METH_VARARGS,
"attach_routine($self, instr, /)\n--\n\nAttach a provided routine to the current symbol."
},
- {
- "attach_instruction", py_binary_symbol_attach_instruction,
- METH_VARARGS,
- "attach_instruction($self, instr, /)\n--\n\nAttach a provided instruction to the current symbol."
- },
{ NULL }
};
@@ -620,14 +420,6 @@ PyTypeObject *get_python_binary_symbol_type(void)
"routine", py_binary_symbol_get_routine, NULL,
"Potential routine attached to the symbol.", NULL
},
- {
- "instruction", py_binary_symbol_get_instruction, NULL,
- "Potential instruction attached to the symbol.", NULL
- },
- {
- "comment", py_binary_symbol_get_comment, py_binary_symbol_set_comment,
- "Optional comment linked to the symbol.", NULL
- },
{ NULL }
};
diff --git a/plugins/stackvars/stackvars.c b/plugins/stackvars/stackvars.c
index 4e07035..ce9d539 100644
--- a/plugins/stackvars/stackvars.c
+++ b/plugins/stackvars/stackvars.c
@@ -110,7 +110,8 @@ G_MODULE_EXPORT bool execute_action_on_binary(GLoadedBinary *binary, PluginActio
lines = g_loaded_binary_get_lines(binary);
format = g_loaded_binary_get_format(binary);
- routines = g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
+ routines = NULL;//g_binary_format_get_routines(G_BIN_FORMAT(format), &routines_count);
+ routines_count = 0; //
for (i = 0; i < routines_count; i++)
result |= replace_stack_vars_in_routine(routines[i], lines);