Skip to content

Commit

Permalink
Expose dd_unpack_coredump() via Python binding
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Srb <michal@redhat.com>
  • Loading branch information
msrb committed Feb 4, 2024
1 parent 0f85350 commit b5889b7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/report-python/report/dump_dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,24 @@ static PyObject *p_dd_delete_item(PyObject *pself, PyObject *args)
return Py_BuildValue("i", dd_delete_item(self->dd, name));
}

/* int dd_unpack_coredump(struct dump_dir *dd, const char *coredump_archive_filename); */
static PyObject *p_dd_unpack_coredump(PyObject *pself, PyObject *args)
{
p_dump_dir *self = (p_dump_dir*)pself;
if (!self->dd)
{
PyErr_SetString(ReportError, "dump dir is not open");
return NULL;
}
const char *coredump_archive_filename;
if (!PyArg_ParseTuple(args, "s", &coredump_archive_filename))
{
return NULL;
}

return Py_BuildValue("i", dd_unpack_coredump(self->dd, coredump_archive_filename));
}

/*** attribute getters/setters ***/

static PyObject *get_name(PyObject *pself, void *unused)
Expand Down Expand Up @@ -261,6 +279,7 @@ static PyMethodDef p_dump_dir_methods[] = {
{ "save_binary", p_dd_save_binary, METH_VARARGS, NULL },
{ "copy_file" , p_dd_copy_file, METH_VARARGS, NULL },
{ "delete_item", p_dd_delete_item, METH_VARARGS, NULL },
{ "unpack_coredump", p_dd_unpack_coredump, METH_VARARGS, NULL },
{ NULL, NULL, 0, NULL }
};

Expand Down

0 comments on commit b5889b7

Please sign in to comment.