From add5ded5e476918ef8b05823801531de2f51fa9c Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 6 Oct 2018 22:57:19 -0600 Subject: Add Inferior.architecture method I've written a couple of gdb unwinders in Python, and while doing so, I wanted to find the architecture of the inferior. (In an unwinder in particular, one can't use the frame's architecture, because there is no frame.) This patch adds Inferior.architecture to allow this. Normally I think I would have chosen an attribute and not a method here, but seeing that Frame.architecture is a method, I chose a method as well, for consistency. gdb/ChangeLog 2018-10-06 Tom Tromey PR python/19399: * python/py-inferior.c: Add "architecture" entry. (infpy_architecture): New function. gdb/doc/ChangeLog 2018-10-06 Tom Tromey PR python/19399: * python.texi (Inferiors In Python): Document Inferior.Architecture. gdb/testsuite/ChangeLog 2018-10-06 Tom Tromey PR python/19399: * gdb.python/py-inferior.exp: Add architecture test. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.python/py-inferior.exp | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'gdb/testsuite') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f43936b..9473646 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2018-10-06 Tom Tromey + PR python/19399: + * gdb.python/py-inferior.exp: Add architecture test. + +2018-10-06 Tom Tromey + * gdb.base/gnu-ifunc.exp (build): Use standard_output_file. * gdb.trace/unavailable-dwarf-piece.exp: Use standard_output_file. diff --git a/gdb/testsuite/gdb.python/py-inferior.exp b/gdb/testsuite/gdb.python/py-inferior.exp index 38f5257..7b1a01b 100644 --- a/gdb/testsuite/gdb.python/py-inferior.exp +++ b/gdb/testsuite/gdb.python/py-inferior.exp @@ -299,3 +299,11 @@ with_test_prefix "__repr__" { "\\\(, \\\)" \ "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" +} -- cgit v1.1