summaryrefslogtreecommitdiff
path: root/plugins/pychrysalide/mangling
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2020-01-05 23:04:45 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2020-01-05 23:04:45 (GMT)
commit24398cb372624bf281ee4d9eb07f2a076b3cc664 (patch)
treee5fab56d61b9a03fb8dd56e63b56c3ee404ac490 /plugins/pychrysalide/mangling
parent9ce85bcdf8da124ad9538875f945ab5c4bb09e1e (diff)
Refreshed the Python documentation for the demanglers.
Diffstat (limited to 'plugins/pychrysalide/mangling')
-rw-r--r--plugins/pychrysalide/mangling/demangler.c39
-rw-r--r--plugins/pychrysalide/mangling/module.c11
2 files changed, 38 insertions, 12 deletions
diff --git a/plugins/pychrysalide/mangling/demangler.c b/plugins/pychrysalide/mangling/demangler.c
index 15c9c62..d1209d1 100644
--- a/plugins/pychrysalide/mangling/demangler.c
+++ b/plugins/pychrysalide/mangling/demangler.c
@@ -36,6 +36,11 @@
+#define COMPILER_DEMANGLER_DOC \
+ "CompDemangler is an abstract class for demangling names."
+
+
+
/* Tente de décoder une chaîne de caractères donnée en type. */
static PyObject *py_compiler_demangler_decode_type(PyObject *, PyObject *);
@@ -65,6 +70,16 @@ static PyObject *py_compiler_demangler_decode_type(PyObject *self, PyObject *arg
GCompDemangler *demangler; /* Décodeur mis en place */
GDataType *type; /* Type de données obtenu */
+#define COMPILER_DEMANGLER_DECODED_TYPE_METHOD PYTHON_METHOD_DEF \
+( \
+ decode_type, "$self, desc, /", \
+ METH_VARARGS, py_compiler_demangler, \
+ "Demangle a type definition from its string mangled description.\n" \
+ "\n" \
+ "The result is an instance of type pychrysalide.analysis.DataType" \
+ " on success, None otherwise." \
+)
+
ret = PyArg_ParseTuple(args, "s", &desc);
if (!ret) return NULL;
@@ -112,6 +127,16 @@ static PyObject *py_compiler_demangler_decode_routine(PyObject *self, PyObject *
GCompDemangler *demangler; /* Décodeur mis en place */
GBinRoutine *routine; /* Routine obtenue */
+#define COMPILER_DEMANGLER_DECODED_ROUTINE_METHOD PYTHON_METHOD_DEF \
+( \
+ decode_routine, "$self, desc, /", \
+ METH_VARARGS, py_compiler_demangler, \
+ "Demangle a routine definition from its string mangled description.\n" \
+ "\n" \
+ "The result is an instance of type pychrysalide.analysis.BinRoutine" \
+ " on success, None otherwise." \
+)
+
ret = PyArg_ParseTuple(args, "s", &desc);
if (!ret) return NULL;
@@ -153,16 +178,8 @@ static PyObject *py_compiler_demangler_decode_routine(PyObject *self, PyObject *
PyTypeObject *get_python_compiler_demangler_type(void)
{
static PyMethodDef py_comp_demangler_methods[] = {
- {
- "decode_type", py_compiler_demangler_decode_type,
- METH_VARARGS,
- "decode_type(self, desc/)\n--\n\nDemangle a type definition from its string mangled description."
- },
- {
- "decode_routine", py_compiler_demangler_decode_routine,
- METH_VARARGS,
- "decode_routine(self, desc/)\n--\n\nDemangle a routine definition from its string mangled description."
- },
+ COMPILER_DEMANGLER_DECODED_TYPE_METHOD,
+ COMPILER_DEMANGLER_DECODED_ROUTINE_METHOD,
{ NULL }
};
@@ -179,7 +196,7 @@ PyTypeObject *get_python_compiler_demangler_type(void)
.tp_flags = Py_TPFLAGS_DEFAULT,
- .tp_doc = "PyChrysalide generic demangler",
+ .tp_doc = COMPILER_DEMANGLER_DOC,
.tp_methods = py_comp_demangler_methods,
.tp_getset = py_comp_demangler_getseters,
diff --git a/plugins/pychrysalide/mangling/module.c b/plugins/pychrysalide/mangling/module.c
index 2b2aef7..fe9487e 100644
--- a/plugins/pychrysalide/mangling/module.c
+++ b/plugins/pychrysalide/mangling/module.c
@@ -50,12 +50,21 @@ bool add_mangling_module(PyObject *super)
bool result; /* Bilan à retourner */
PyObject *module; /* Sous-module mis en place */
+#define PYCHRYSALIDE_MANGLING_DOC \
+ "This module provides facilities to decode function or type names" \
+ " mangled by a compiler.\n" \
+ "\n" \
+ "The benefit of using these facilities instead of external tools such" \
+ " as *c++filt* resides in the quantity of recovered information: not" \
+ " only the mangled name is restored in a human readable form, but all" \
+ " the involved inner types get available for further processing."
+
static PyModuleDef py_chrysalide_mangling_module = {
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "pychrysalide.mangling",
- .m_doc = "Python module for Chrysalide.mangling",
+ .m_doc = PYCHRYSALIDE_MANGLING_DOC,
.m_size = -1,