diff options
author | Tom Tromey <tromey@adacore.com> | 2021-10-22 10:49:19 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2021-10-29 07:52:31 -0600 |
commit | d3771fe234b74d60cfa553940bce9d047bd38e8d (patch) | |
tree | 9ad43197c7905e0f64bf6b77e526e0c34fa3035b /gdb/testsuite/gdb.python/py-arch.exp | |
parent | 7a72f09da5c62a213952752c9659e7686e1dd4ab (diff) | |
download | gdb-d3771fe234b74d60cfa553940bce9d047bd38e8d.zip gdb-d3771fe234b74d60cfa553940bce9d047bd38e8d.tar.gz gdb-d3771fe234b74d60cfa553940bce9d047bd38e8d.tar.bz2 |
Add gdb.Architecture.integer_type Python function
This adds a new Python function, gdb.Architecture.integer_type, which
can be used to look up an integer type of a given size and
signed-ness. This is useful to avoid dependency on debuginfo when a
particular integer type would be useful.
v2 moves this to be a method on gdb.Architecture and addresses other
review comments.
Diffstat (limited to 'gdb/testsuite/gdb.python/py-arch.exp')
-rw-r--r-- | gdb/testsuite/gdb.python/py-arch.exp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/py-arch.exp b/gdb/testsuite/gdb.python/py-arch.exp index 415fbd4..f3bf01d 100644 --- a/gdb/testsuite/gdb.python/py-arch.exp +++ b/gdb/testsuite/gdb.python/py-arch.exp @@ -63,6 +63,20 @@ if { ![is_address_zero_readable] } { "test bad memory access" } +foreach size {0 1 2 3 4 8 16} { + foreach sign {"" ", True" ", False"} { + set fullsize [expr 8 * $size] + gdb_test_no_output "python t = arch.integer_type($fullsize$sign)" \ + "get integer type for $size$sign" + gdb_test "python print(t.sizeof)" "$size" \ + "print size of integer type for $size$sign" + } +} + +gdb_test "python arch.integer_type(95)" \ + ".*ValueError: no integer type of that size is available.*" \ + "call integer_type with invalid size" + # Test for gdb.architecture_names(). First we're going to grab the # complete list of architecture names using the 'complete' command. set arch_names [] |