+2018-10-06 Tom Tromey <tom@tromey.com>
+
+ PR python/19399:
+ * python/py-inferior.c: Add "architecture" entry.
+ (infpy_architecture): New function.
+
2018-10-06 Tom Tromey <tom@tromey.com>
PR python/21765:
+2018-10-06 Tom Tromey <tom@tromey.com>
+
+ PR python/19399:
+ * python.texi (Inferiors In Python): Document
+ Inferior.Architecture.
+
2018-10-06 Tom Tromey <tom@tromey.com>
PR python/21765:
return an empty tuple.
@end defun
+@defun Inferior.architecture ()
+Return the @code{gdb.Architecture} (@pxref{Architectures In Python})
+for this inferior. This represents the architecture of the inferior
+as a whole. Some platforms can have multiple architectures in a
+single address space, so this may not match the architecture of a
+particular frame (@pxref{Frames in Python}).
+
@findex Inferior.read_memory
@defun Inferior.read_memory (address, length)
Read @var{length} addressable memory units from the inferior, starting at
Py_RETURN_NONE;
}
+/* Implementation of gdb.Inferior.architecture. */
+
+static PyObject *
+infpy_architecture (PyObject *self, PyObject *args)
+{
+ inferior_object *inf = (inferior_object *) self;
+
+ INFPY_REQUIRE_VALID (inf);
+
+ return gdbarch_to_arch_object (inf->inferior->gdbarch);
+}
+
/* Implement repr() for gdb.Inferior. */
static PyObject *
METH_VARARGS | METH_KEYWORDS,
"thread_from_thread_handle (handle) -> gdb.InferiorThread.\n\
Return thread object corresponding to thread handle." },
+ { "architecture", (PyCFunction) infpy_architecture, METH_NOARGS,
+ "architecture () -> gdb.Architecture\n\
+Return architecture of this inferior." },
{ NULL }
};
+2018-10-06 Tom Tromey <tom@tromey.com>
+
+ PR python/19399:
+ * gdb.python/py-inferior.exp: Add architecture test.
+
2018-10-06 Tom Tromey <tom@tromey.com>
* gdb.base/gnu-ifunc.exp (build): Use standard_output_file.
"\\\(<gdb.Inferior num=1, pid=$decimal>, <gdb.Inferior \\\(invalid\\\)>\\\)" \
"print all inferiors 2"
}
+
+# Test architecture.
+with_test_prefix "architecture" {
+ gdb_test "inferior 1" ".*" "switch to first inferior"
+ gdb_test "python print(gdb.selected_frame().architecture() is gdb.selected_inferior().architecture())" \
+ "True" \
+ "inferior architecture matches frame architecture"
+}