diff options
author | Tom Tromey <tromey@adacore.com> | 2024-09-11 10:35:20 -0600 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2024-09-23 13:44:59 -0600 |
commit | 336bb2a1c1d24f5db07394a109f7cd6c5b58b10d (patch) | |
tree | 5a8d54ecc8d127a2113712203f1c66aa9c5d8c0e /gdb/testsuite/gdb.python | |
parent | b9155b800c6be57a7f4933a4fd8c5c5d51414e77 (diff) | |
download | gdb-336bb2a1c1d24f5db07394a109f7cd6c5b58b10d.zip gdb-336bb2a1c1d24f5db07394a109f7cd6c5b58b10d.tar.gz gdb-336bb2a1c1d24f5db07394a109f7cd6c5b58b10d.tar.bz2 |
Automatically add types to Python modules
PR python/32163 points out that various types provided by gdb are not
added to the gdb module, so they aren't available for interactive
inspection. I think this is just an oversight.
This patch fixes the problem by introducing a new helper function that
both readies the type and then adds it to the appropriate module. The
patch also poisons PyType_Ready, the idea being to avoid this bug in
the future.
v2:
* Fixed a bug in original patch in gdb.Architecture registration
* Added regression test for the types mentioned in the bug
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32163
Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com>
Diffstat (limited to 'gdb/testsuite/gdb.python')
-rw-r--r-- | gdb/testsuite/gdb.python/python.exp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.python/python.exp b/gdb/testsuite/gdb.python/python.exp index 175a6de..e8eb9ec 100644 --- a/gdb/testsuite/gdb.python/python.exp +++ b/gdb/testsuite/gdb.python/python.exp @@ -561,3 +561,12 @@ if { [use_gdb_stub] == 0 } { } } } + +# Regression test for PR python/32163: several types were not +# previously registered with the module, so could not be inspected +# directly. +foreach type {Instruction LazyString Membuf Record RecordFunctionSegment \ + RecordGap RecordInstruction TuiWindow} { + gdb_test "python print(type(gdb.$type))" "<class 'type'>" \ + "gdb.$type is registered" +} |