From e6479978d42b5f3289aefea6df2f7d16ff78cb4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Tue, 2 Jun 2015 14:46:22 +0200 Subject: [PATCH] Add support for `Application#pid` --- src/_frida.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/_frida.c b/src/_frida.c index 3a2bb77..da22af1 100644 --- a/src/_frida.c +++ b/src/_frida.c @@ -89,6 +89,7 @@ struct _PyApplication const gchar * identifier; const gchar * name; + guint pid; }; struct _PyProcess @@ -235,6 +236,7 @@ static PyMemberDef PyApplication_members[] = { { "identifier", T_STRING, G_STRUCT_OFFSET (PyApplication, identifier), READONLY, "Application identifier."}, { "name", T_STRING, G_STRUCT_OFFSET (PyApplication, name), READONLY, "Human-readable process name."}, + { "pid", T_UINT, G_STRUCT_OFFSET (PyApplication, pid), READONLY, "Process ID, or 0 if not running."}, { NULL } }; @@ -1073,6 +1075,7 @@ PyApplication_from_handle (FridaApplication * handle) application->handle = handle; application->identifier = frida_application_get_identifier (handle); application->name = frida_application_get_name (handle); + application->pid = frida_application_get_pid (handle); return result; } @@ -1100,7 +1103,10 @@ PyApplication_dealloc (PyApplication * self) static PyObject * PyApplication_repr (PyApplication * self) { - return PyRepr_FromFormat ("Application(identifier=\"%s\", name=\"%s\")", self->identifier, self->name); + if (self->pid != 0) + return PyRepr_FromFormat ("Application(identifier=\"%s\", name=\"%s\", pid=%u)", self->identifier, self->name, self->pid); + else + return PyRepr_FromFormat ("Application(identifier=\"%s\", name=\"%s\")", self->identifier, self->name); } static PyObject *