aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-block.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-block.c')
-rw-r--r--gdb/python/py-block.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/gdb/python/py-block.c b/gdb/python/py-block.c
index d257545..244ff9a 100644
--- a/gdb/python/py-block.c
+++ b/gdb/python/py-block.c
@@ -427,6 +427,17 @@ del_objfile_blocks (struct objfile *objfile, void *datum)
}
}
+void _initialize_py_block ();
+void
+_initialize_py_block ()
+{
+ /* Register an objfile "free" callback so we can properly
+ invalidate blocks when an object file is about to be
+ deleted. */
+ blpy_objfile_data_key
+ = register_objfile_data_with_cleanup (NULL, del_objfile_blocks);
+}
+
int
gdbpy_initialize_blocks (void)
{
@@ -438,12 +449,6 @@ gdbpy_initialize_blocks (void)
if (PyType_Ready (&block_syms_iterator_object_type) < 0)
return -1;
- /* Register an objfile "free" callback so we can properly
- invalidate blocks when an object file is about to be
- deleted. */
- blpy_objfile_data_key
- = register_objfile_data_with_cleanup (NULL, del_objfile_blocks);
-
if (gdb_pymodule_addobject (gdb_module, "Block",
(PyObject *) &block_object_type) < 0)
return -1;