mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-12-19 01:19:41 +08:00
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>
This commit is contained in:
@@ -761,7 +761,7 @@ static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
|
||||
gdbpy_initialize_frames (void)
|
||||
{
|
||||
frame_object_type.tp_new = PyType_GenericNew;
|
||||
if (PyType_Ready (&frame_object_type) < 0)
|
||||
if (gdbpy_type_ready (&frame_object_type) < 0)
|
||||
return -1;
|
||||
|
||||
/* Note: These would probably be best exposed as class attributes of
|
||||
@@ -785,8 +785,7 @@ gdbpy_initialize_frames (void)
|
||||
#include "unwind_stop_reasons.def"
|
||||
#undef SET
|
||||
|
||||
return gdb_pymodule_addobject (gdb_module, "Frame",
|
||||
(PyObject *) &frame_object_type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDBPY_INITIALIZE_FILE (gdbpy_initialize_frames);
|
||||
|
||||
Reference in New Issue
Block a user