aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-unwind.c
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2021-04-22 17:11:25 +0100
committerAndrew Burgess <andrew.burgess@embecosm.com>2021-04-28 09:56:20 +0100
commit8e3685bf250d9ecda5058912d6624e77d7a2b07e (patch)
tree558ae8b08940df7cd7754f42051319591900c249 /gdb/python/py-unwind.c
parent913832e99c5a1576663e52a4929b13bb263bd692 (diff)
downloadbinutils-8e3685bf250d9ecda5058912d6624e77d7a2b07e.zip
binutils-8e3685bf250d9ecda5058912d6624e77d7a2b07e.tar.gz
binutils-8e3685bf250d9ecda5058912d6624e77d7a2b07e.tar.bz2
gdb: delay python initialisation until gdbpy_finish_initialization
Delay Python initialisation until gdbpy_finish_initialization. This is mostly about splitting the existing gdbpy_initialize_* functions in two, all the calls to register_objfile_data_with_cleanup, gdbarch_data_register_post_init, etc are moved into new _initialize_* functions, but everything else is left in the gdbpy_initialize_* functions. Then the call to do_start_initialization (in python/python.c) is moved from the _initialize_python function into gdbpy_finish_initialization. There should be no user visible changes after this commit. gdb/ChangeLog: * python/py-arch.c (_initialize_py_arch): New function. (gdbpy_initialize_arch): Move code to _initialize_py_arch. * python/py-block.c (_initialize_py_block): New function. (gdbpy_initialize_blocks): Move code to _initialize_py_block. * python/py-inferior.c (_initialize_py_inferior): New function. (gdbpy_initialize_inferior): Move code to _initialize_py_inferior. * python/py-objfile.c (_initialize_py_objfile): New function. (gdbpy_initialize_objfile): Move code to _initialize_py_objfile. * python/py-progspace.c (_initialize_py_progspace): New function. (gdbpy_initialize_pspace): Move code to _initialize_py_progspace. * python/py-registers.c (_initialize_py_registers): New function. (gdbpy_initialize_registers): Move code to _initialize_py_registers. * python/py-symbol.c (_initialize_py_symbol): New function. (gdbpy_initialize_symbols): Move code to _initialize_py_symbol. * python/py-symtab.c (_initialize_py_symtab): New function. (gdbpy_initialize_symtabs): Move code to _initialize_py_symtab. * python/py-type.c (_initialize_py_type): New function. (gdbpy_initialize_types): Move code to _initialize_py_type. * python/py-unwind.c (_initialize_py_unwind): New function. (gdbpy_initialize_unwind): Move code to _initialize_py_unwind. * python/python.c (_initialize_python): Move call to do_start_initialization to gdbpy_finish_initialization. (gdbpy_finish_initialization): Add call to do_start_initialization.
Diffstat (limited to 'gdb/python/py-unwind.c')
-rw-r--r--gdb/python/py-unwind.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c
index 5dc8d33..4b25c48 100644
--- a/gdb/python/py-unwind.c
+++ b/gdb/python/py-unwind.c
@@ -614,12 +614,10 @@ pyuw_on_new_gdbarch (struct gdbarch *newarch)
}
}
-/* Initialize unwind machinery. */
-
-int
-gdbpy_initialize_unwind (void)
+void _initialize_py_unwind ();
+void
+_initialize_py_unwind ()
{
- int rc;
add_setshow_zuinteger_cmd
("py-unwind", class_maintenance, &pyuw_debug,
_("Set Python unwinder debugging."),
@@ -629,15 +627,22 @@ gdbpy_initialize_unwind (void)
NULL,
&setdebuglist, &showdebuglist);
pyuw_gdbarch_data
- = gdbarch_data_register_post_init (pyuw_gdbarch_data_init);
+ = gdbarch_data_register_post_init (pyuw_gdbarch_data_init);
+}
+
+/* Initialize unwind machinery. */
+
+int
+gdbpy_initialize_unwind (void)
+{
gdb::observers::architecture_changed.attach (pyuw_on_new_gdbarch,
"py-unwind");
if (PyType_Ready (&pending_frame_object_type) < 0)
return -1;
- rc = gdb_pymodule_addobject (gdb_module, "PendingFrame",
- (PyObject *) &pending_frame_object_type);
- if (rc)
+ int rc = gdb_pymodule_addobject (gdb_module, "PendingFrame",
+ (PyObject *) &pending_frame_object_type);
+ if (rc != 0)
return rc;
if (PyType_Ready (&unwind_info_object_type) < 0)