summaryrefslogtreecommitdiff
path: root/plugins/dex/python/method.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/dex/python/method.c')
-rw-r--r--plugins/dex/python/method.c59
1 files changed, 45 insertions, 14 deletions
diff --git a/plugins/dex/python/method.c b/plugins/dex/python/method.c
index 6cf9abd..fab8e2e 100644
--- a/plugins/dex/python/method.c
+++ b/plugins/dex/python/method.c
@@ -36,6 +36,11 @@
+#define DEX_METHOD_DOC \
+ "The DexMethod handles a method defined in a DEX format." \
+
+
+
/* Fournit les identifiants Dex concernant la méthode. */
static PyObject *py_dex_method_get_id_item(PyObject *, void *);
@@ -77,7 +82,7 @@ static PyObject *py_dex_method_get_id_item(PyObject *self, void *closure)
"All the fields are extracted from the Dex *method_id_item* structure:\n" \
"* class_idx: index into the *type_ids* list for the definer of the method ;\n" \
"* proto_idx: index into the *proto_ids* list for the prototype of the method ;\n" \
- "* name_idx: index into the *string_ids* list for the name of the method." \
+ "* name_idx: index into the *string_ids* list for the name of the method." \
)
method = G_DEX_METHOD(pygobject_get(self));
@@ -110,6 +115,17 @@ static PyObject *py_dex_method_get_encoded(PyObject *self, void *closure)
GDexMethod *method; /* Version native */
const encoded_method *info; /* Elément à traiter */
+#define DEX_METHOD_ENCODED_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ encoded, py_dex_method, \
+ "pychrysalide.PyStructObject instance for encoded information about the Dex method.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *encoded_method* structure:\n" \
+ "* method_idx_diff: index into the *method_ids* list for the identity of the method ;\n" \
+ "* access_flags: access flags for the method ;\n" \
+ "* code_off: offset from the start of the file to the code structure for the method." \
+)
+
method = G_DEX_METHOD(pygobject_get(self));
info = g_dex_method_get_dex_info(method);
@@ -140,6 +156,22 @@ static PyObject *py_dex_method_get_code_item(PyObject *self, void *closure)
GDexMethod *method; /* Version native */
const code_item *body; /* Elément à traiter */
+#define DEX_METHOD_CODE_ITEM_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ code_item, py_dex_method, \
+ "pychrysalide.PyStructObject instance of code information about the Dex method," \
+ " or None if none.\n" \
+ "\n" \
+ "All the fields are extracted from the Dex *code_item* structure:\n" \
+ "* registers_size: the number of registers used by the code ;\n" \
+ "* ins_size: number of words of incoming arguments to the method that the code is for ;\n" \
+ "* outs_size: number of words of outgoing argument space required for invocation ;\n" \
+ "* tries_size: number of *try_items* for the instance ;\n" \
+ "* debug_info_off: offset from the start of the file to the debug info sequence" \
+ " for this code, or 0 no such information ;\n" \
+ "* insns_size: size of the instructions list, in 16-bit code units." \
+)
+
method = G_DEX_METHOD(pygobject_get(self));
body = g_dex_method_get_dex_body(method);
@@ -177,6 +209,14 @@ static PyObject *py_dex_method_get_routine(PyObject *self, void *closure)
GDexMethod *method; /* Version native */
GBinRoutine *routine; /* Routine correspondante */
+#define DEX_METHOD_ROUTINE_ATTRIB PYTHON_GET_DEF_FULL \
+( \
+ routine, py_dex_method, \
+ "DEX method as seen from Chrysalide.\n" \
+ "\n" \
+ "The result is a pychrysalide.analysis.BinRoutine instance or None." \
+)
+
method = G_DEX_METHOD(pygobject_get(self));
routine = g_dex_method_get_routine(method);
@@ -210,18 +250,9 @@ PyTypeObject *get_python_dex_method_type(void)
static PyGetSetDef py_dex_method_getseters[] = {
DEX_METHOD_ID_ITEM_ATTRIB,
- {
- "encoded", py_dex_method_get_encoded, NULL,
- "Encoded information about the Dex method.", NULL
- },
- {
- "code_item", py_dex_method_get_code_item, NULL,
- "Code information about the Dex method, None if none.", NULL
- },
- {
- "routine", py_dex_method_get_routine, NULL,
- "Chrysalide routine for the Dex method.", NULL
- },
+ DEX_METHOD_ENCODED_ATTRIB,
+ DEX_METHOD_CODE_ITEM_ATTRIB,
+ DEX_METHOD_ROUTINE_ATTRIB,
{ NULL }
};
@@ -234,7 +265,7 @@ PyTypeObject *get_python_dex_method_type(void)
.tp_flags = Py_TPFLAGS_DEFAULT,
- .tp_doc = "PyChrysalide Dex method.",
+ .tp_doc = DEX_METHOD_DOC,
.tp_methods = py_dex_method_methods,
.tp_getset = py_dex_method_getseters