summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mobicore/symbols.c9
-rw-r--r--plugins/pychrysa/format/symbol.c95
-rw-r--r--plugins/readdex/ids.c8
-rw-r--r--plugins/readelf/strtab.c14
4 files changed, 33 insertions, 93 deletions
diff --git a/plugins/mobicore/symbols.c b/plugins/mobicore/symbols.c
index dc0a950..ec2dd34 100644
--- a/plugins/mobicore/symbols.c
+++ b/plugins/mobicore/symbols.c
@@ -79,12 +79,13 @@ static void register_mclf_entry_point(GMCLFFormat *format, virt_t vaddr, phys_t
init_vmpa(&addr, vaddr - format->header.v1.text.start, vaddr);
init_vmpa(&addr, VMPA_NO_PHYSICAL, vaddr);
- init_mrange(&range, &addr, len);
+ init_mrange(&range, &addr, len);
- g_binary_routine_set_range(routine, &range);
+ symbol = G_BIN_SYMBOL(routine);
+
+ g_binary_symbol_set_range(symbol, &range);
+ g_binary_symbol_set_target_type(symbol, STP_ENTRY_POINT);
- symbol = g_binary_symbol_new(STP_ENTRY_POINT);
- g_binary_symbol_attach_routine(symbol, routine);
g_binary_format_add_symbol(base, symbol);
}
diff --git a/plugins/pychrysa/format/symbol.c b/plugins/pychrysa/format/symbol.c
index 008aeb3..e337ea1 100644
--- a/plugins/pychrysa/format/symbol.c
+++ b/plugins/pychrysa/format/symbol.c
@@ -48,9 +48,6 @@ 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 *);
-/* Attache la routine associée au symbole. */
-static PyObject *py_binary_symbol_attach_routine(PyObject *, PyObject *);
-
/* Fournit le type du symbole. */
static PyObject *py_binary_symbol_get_target_type(PyObject *, void *);
@@ -60,9 +57,6 @@ static PyObject *py_binary_symbol_get_label(PyObject *, void *);
/* Fournit l'emplacement où se situe un symbole. */
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 *);
-
/* Définit les constantes pour les symboles binaires. */
static bool py_binary_symbol_define_constants(PyTypeObject *);
@@ -131,10 +125,12 @@ static PyObject *py_binary_symbol_new(PyTypeObject *type, PyObject *args, PyObje
{
PyObject *result; /* Bilan à retourner */
SymbolType stype; /* Type prévu pour le symbole */
+ PyObject *range_obj; /* Objet pour la couverture */
int ret; /* Bilan de lecture des args. */
+ mrange_t *range; /* Version native d'un espace */
GBinSymbol *symbol; /* Version GLib du symble */
- ret = PyArg_ParseTuple(args, "l", &stype);
+ ret = PyArg_ParseTuple(args, "lO", &stype, &range_obj);
if (!ret) return NULL;
if (stype >= STP_COUNT)
@@ -143,7 +139,16 @@ static PyObject *py_binary_symbol_new(PyTypeObject *type, PyObject *args, PyObje
return NULL;
}
- symbol = g_binary_symbol_new(stype);
+ ret = PyObject_IsInstance(range_obj, (PyObject *)get_python_mrange_type());
+ if (!ret)
+ {
+ PyErr_SetString(PyExc_TypeError, _("The second argument must be an instance of mrange."));
+ return NULL;
+ }
+
+ range = get_internal_mrange(range_obj);
+
+ symbol = g_binary_symbol_new(range, stype);
result = pygobject_new(G_OBJECT(symbol));
g_object_unref(symbol);
@@ -186,42 +191,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 : Attache la routine associée au symbole. *
-* *
-* Retour : None. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_symbol_attach_routine(PyObject *self, PyObject *args)
-{
- PyObject *py_routine; /* Routine version Python */
- int ret; /* Bilan de lecture des args. */
- GBinSymbol *symbol; /* Elément à consulter */
- GBinRoutine *routine; /* Routine à attacher */
-
- ret = PyArg_ParseTuple(args, "O", &py_routine);
- if (!ret) return NULL;
-
- ret = PyObject_IsInstance(py_routine, (PyObject *)get_python_binary_routine_type());
- if (!ret) return NULL;
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
- routine = G_BIN_ROUTINE(pygobject_get(py_routine));
-
- g_binary_symbol_attach_routine(symbol, routine);
-
- Py_RETURN_NONE;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : self = objet Python concerné par l'appel. *
* closure = non utilisé ici. *
* *
@@ -316,35 +285,6 @@ static PyObject *py_binary_symbol_get_range(PyObject *self, void *closure)
/******************************************************************************
* *
-* Paramètres : self = objet Python concerné par l'appel. *
-* closure = non utilisé ici. *
-* *
-* Description : Fournit l'éventuelle routine associée au symbole. *
-* *
-* Retour : Instance en place ou None si aucune. *
-* *
-* Remarques : - *
-* *
-******************************************************************************/
-
-static PyObject *py_binary_symbol_get_routine(PyObject *self, void *closure)
-{
- PyObject *result; /* Valeur à retourner */
- GBinSymbol *symbol; /* Elément à consulter */
- GBinRoutine *routine; /* Routine attachée */
-
- symbol = G_BIN_SYMBOL(pygobject_get(self));
- routine = g_binary_symbol_get_routine(symbol);
-
- result = pygobject_new(G_OBJECT(routine));
-
- return result;
-
-}
-
-
-/******************************************************************************
-* *
* Paramètres : obj_type = type dont le dictionnaire est à compléter. *
* *
* Description : Définit les constantes pour les symboles binaires. *
@@ -395,11 +335,6 @@ PyTypeObject *get_python_binary_symbol_type(void)
METH_VARARGS,
"set_alt_label($self, alt, /)\n--\n\nSet an alternative label for the symbol."
},
- {
- "attach_routine", py_binary_symbol_attach_routine,
- METH_VARARGS,
- "attach_routine($self, instr, /)\n--\n\nAttach a provided routine to the current symbol."
- },
{ NULL }
};
@@ -416,10 +351,6 @@ PyTypeObject *get_python_binary_symbol_type(void)
"range", py_binary_symbol_get_range, NULL,
"Range covered by the symbol.", NULL
},
- {
- "routine", py_binary_symbol_get_routine, NULL,
- "Potential routine attached to the symbol.", NULL
- },
{ NULL }
};
diff --git a/plugins/readdex/ids.c b/plugins/readdex/ids.c
index 14ad6fb..f65f5ec 100644
--- a/plugins/readdex/ids.c
+++ b/plugins/readdex/ids.c
@@ -254,6 +254,7 @@ bool annotate_dex_string_ids(const GDexFormat *format, GPreloadInfo *info, GtkSt
vmpa2t item_pos; /* Position d'un élément */
uleb128_t length; /* Taille de la chaîne en cours*/
GArchInstruction *instr; /* Instruction décodée */
+ const mrange_t *range; /* Espace occupé par une chaîne*/
GBinSymbol *symbol; /* Symbole à intégrer */
content = g_binary_format_get_content(G_BIN_FORMAT(format));
@@ -330,8 +331,11 @@ bool annotate_dex_string_ids(const GDexFormat *format, GPreloadInfo *info, GtkSt
g_preload_info_add_instruction(info, instr);
- g_object_ref(G_OBJECT(instr));
- ADD_STR_AS_SYM(format, symbol, instr);
+ range = g_arch_instruction_get_range(instr);
+
+ symbol = g_binary_symbol_new(range, STP_RO_STRING);
+ g_binary_format_add_symbol(bformat, symbol);
+
}
diff --git a/plugins/readelf/strtab.c b/plugins/readelf/strtab.c
index f8ab2c7..1564674 100644
--- a/plugins/readelf/strtab.c
+++ b/plugins/readelf/strtab.c
@@ -59,9 +59,11 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
vmpa2t pos; /* Tête de lecture */
const bin_t *data; /* Donnés à parcourir */
bool cut; /* Séparation nette ? */
+ GBinFormat *base; /* Autre version du format */
phys_t i; /* Boucle de parcours */
phys_t end; /* Position de fin de chaîne */
GArchInstruction *instr; /* Instruction décodée */
+ const mrange_t *irange; /* Espace occupé par une chaîne*/
GBinSymbol *symbol; /* Symbole à intégrer */
char *label; /* Désignation de la chaîne */
@@ -76,12 +78,12 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
*/
if (data == NULL) return;
- cut = true;
-
/* Boucle de parcours */
cut = true;
+ base = G_BIN_FORMAT(format);
+
for (i = 0; i < length; i++)
if (isprint(data[i]))
{
@@ -103,8 +105,10 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
g_preload_info_add_instruction(info, instr);
- g_object_ref(G_OBJECT(instr));
- ADD_STR_AS_SYM(format, symbol, instr);
+ irange = g_arch_instruction_get_range(instr);
+
+ symbol = g_binary_symbol_new(irange, STP_RO_STRING);
+ g_binary_format_add_symbol(base, symbol);
/* Jointure avec la chaîne précédente ? */
@@ -113,7 +117,7 @@ static void parse_elf_string_table(GElfFormat *format, GPreloadInfo *info, const
copy_vmpa(&pos, get_mrange_addr(range));
advance_vmpa(&pos, i);
- label = create_string_label(G_BIN_FORMAT(format), &pos, end - i);
+ label = create_string_label(base, get_mrange_addr(irange), end - i);
g_binary_symbol_set_alt_label(symbol, label);