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 <tom@tromey.com> PR python/19399: * python/py-inferior.c: Add "architecture" entry. (infpy_architecture): New function. gdb/doc/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> PR python/19399: * python.texi (Inferiors In Python): Document Inferior.Architecture. gdb/testsuite/ChangeLog 2018-10-06 Tom Tromey <tom@tromey.com> PR python/19399: * gdb.python/py-inferior.exp: Add architecture test.
This commit is contained in:
parent
51e78fc5fa
commit
add5ded5e4
6 changed files with 47 additions and 0 deletions
|
@ -299,3 +299,11 @@ with_test_prefix "__repr__" {
|
|||
"\\\(<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"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue