aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-inferior.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-inferior.c')
-rw-r--r--gdb/python/py-inferior.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gdb/python/py-inferior.c b/gdb/python/py-inferior.c
index 222e4d9..3b2d470 100644
--- a/gdb/python/py-inferior.c
+++ b/gdb/python/py-inferior.c
@@ -415,6 +415,20 @@ infpy_get_num (PyObject *self, void *closure)
return gdb_py_object_from_longest (inf->inferior->num).release ();
}
+/* Return the gdb.TargetConnection object for this inferior, or None if a
+ connection does not exist. */
+
+static PyObject *
+infpy_get_connection (PyObject *self, void *closure)
+{
+ inferior_object *inf = (inferior_object *) self;
+
+ INFPY_REQUIRE_VALID (inf);
+
+ process_stratum_target *target = inf->inferior->process_target ();
+ return target_to_connection_object (target).release ();
+}
+
/* Return the connection number of the given inferior, or None if a
connection does not exist. */
@@ -849,6 +863,8 @@ gdbpy_initialize_inferior (void)
static gdb_PyGetSetDef inferior_object_getset[] =
{
{ "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
+ { "connection", infpy_get_connection, NULL,
+ "The gdb.TargetConnection for this inferior.", NULL },
{ "connection_num", infpy_get_connection_num, NULL,
"ID of inferior's connection, as assigned by GDB.", NULL },
{ "pid", infpy_get_pid, NULL, "PID of inferior, as assigned by the OS.",