/* Initializes the Architecture class in the gdb module. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_arch (void)
{
arch_object_type.tp_new = PyType_GenericNew;
(PyObject *) &arch_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_arch);
+
+\f
+
static PyMethodDef arch_object_methods [] = {
{ "name", archpy_name, METH_NOARGS,
"name () -> String.\n\
auto_load_info_scripts (pattern, from_tty, &extension_language_python);
}
\f
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_auto_load (void)
{
add_setshow_boolean_cmd ("python-scripts", class_support,
return 0;
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_auto_load);
Py_RETURN_TRUE;
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_blocks (void)
{
block_object_type.tp_new = PyType_GenericNew;
(PyObject *) &block_syms_iterator_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_blocks);
+
\f
static PyMethodDef block_object_methods[] = {
\f
/* Initialize the Python breakpoint code. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_breakpoints (void)
{
int i;
/* Initialize the Python BreakpointLocation code. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_breakpoint_locations ()
{
if (PyType_Ready (&breakpoint_location_object_type) < 0)
&setdebuglist, &showdebuglist);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_breakpoints);
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_breakpoint_locations);
+
/* Python function to set the enabled state of a breakpoint location. */
static int
/* Initialize the 'commands' code. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_commands (void)
{
int i;
return 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_commands);
+
\f
static PyMethodDef cmdpy_object_methods[] =
/* Python specific initialization for this file. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_connection (void)
{
if (PyType_Ready (&connection_object_type) < 0)
"py-connection");
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_connection);
+
/* Methods for the gdb.TargetConnection object type. */
static PyMethodDef connection_object_methods[] =
/* Called to initialize the Python structures in this file. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_disasm ()
{
/* Create the _gdb.disassembler module, and add it to the _gdb module. */
return 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_disasm);
+
+\f
+
/* Describe the gdb.disassembler.DisassembleInfo type. */
PyTypeObject disasm_info_object_type = {
/* Initialize the Python event code. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_event (void)
{
return gdbpy_initialize_event_generic (&event_object_type,
return 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_event);
+
static gdb_PyGetSetDef event_object_getset[] =
{
{ "__dict__", gdb_py_generic_dict, NULL,
/* Initialize the Python event registry code. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_eventregistry (void)
{
if (PyType_Ready (&eventregistry_object_type) < 0)
return registry == nullptr || PyList_Size (registry->callbacks) == 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_eventregistry);
+
static PyMethodDef eventregistry_object_methods[] =
{
{ "connect", evregpy_connect, METH_VARARGS, "Add function" },
/* Initialize the Python finish breakpoint code. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_finishbreakpoints (void)
{
if (!gdbpy_breakpoint_init_breakpoint_type ())
return 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_finishbreakpoints);
+
+\f
+
static gdb_PyGetSetDef finish_breakpoint_object_getset[] = {
{ "return_value", bpfinishpy_get_returnvalue, NULL,
"gdb.Value object representing the return value, if any. \
/* Sets up the Frame API in the gdb module. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_frames (void)
{
frame_object_type.tp_new = PyType_GenericNew;
(PyObject *) &frame_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_frames);
+
\f
static PyMethodDef frame_object_methods[] = {
/* Initialize internal function support. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_functions (void)
{
fnpy_object_type.tp_new = PyType_GenericNew;
(PyObject *) &fnpy_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_functions);
+
\f
PyTypeObject fnpy_object_type =
/* Initialize Python readline support. */
-void
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_gdb_readline (void)
{
/* Python's readline module conflicts with GDB's use of readline
sys.meta_path.append(GdbRemoveReadlineFinder())\n\
") == 0)
PyOS_ReadlineFunctionPointer = gdbpy_readline_wrapper;
+
+ return 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_gdb_readline);
inferior_to_inferior_object (current_inferior ()).release ());
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_inferior (void)
{
if (PyType_Ready (&inferior_object_type) < 0)
return 0;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_inferior);
+
+\f
+
static gdb_PyGetSetDef inferior_object_getset[] =
{
{ "num", infpy_get_num, NULL, "ID of inferior, as assigned by GDB.", NULL },
Py_RETURN_NONE;
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_thread (void)
{
if (PyType_Ready (&thread_object_type) < 0)
(PyObject *) &thread_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_thread);
+
+\f
+
static gdb_PyGetSetDef thread_object_getset[] =
{
{ "name", thpy_get_name, thpy_set_name,
/* Sets up the gdb.Instruction type. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_instruction (void)
{
if (py_insn_get_insn_type () == nullptr)
return -1;
return 0;
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_instruction);
return (PyObject *) str_obj;
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_lazy_string (void)
{
if (PyType_Ready (&lazy_string_object_type) < 0)
encoding->reset (lazy->encoding ? xstrdup (lazy->encoding) : NULL);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_lazy_string);
+
\f
static PyMethodDef lazy_string_object_methods[] = {
/* Initialize LineTable, LineTableEntry and LineTableIterator
objects. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_linetable (void)
{
if (PyType_Ready (&linetable_object_type) < 0)
Py_RETURN_TRUE;
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_linetable);
+
\f
static PyMethodDef linetable_object_methods[] = {
/* General Python initialization callback. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_membuf (void)
{
membuf_object_type.tp_new = PyType_GenericNew;
(PyObject *) &membuf_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_membuf);
+
+\f
+
static PyBufferProcs buffer_procs =
{
get_buffer
/* Python initialization for the MI commands components. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_micommands ()
{
micmdpy_object_type.tp_new = PyType_GenericNew;
return 0;
}
-void
+/* Cleanup just before GDB shuts down the Python interpreter. */
+
+static void
gdbpy_finalize_micommands ()
{
/* mi_command_py objects hold references to micmdpy_object objects. They must
show_pymicmd_debug,
&setdebuglist, &showdebuglist);
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_micommands, gdbpy_finalize_micommands);
return gdbpy_ref<>::new_reference (result);
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_objfile (void)
{
if (PyType_Ready (&objfile_object_type) < 0)
(PyObject *) &objfile_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_objfile);
+
\f
static PyMethodDef objfile_object_methods[] =
}
/* Initialize the 'parameters' module. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_parameters (void)
{
int i;
(PyObject *) &parmpy_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_parameters);
+
\f
PyTypeObject parmpy_object_type =
return PyObject_TypeCheck (obj, &pspace_object_type);
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_pspace (void)
{
if (PyType_Ready (&pspace_object_type) < 0)
(PyObject *) &pspace_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_pspace);
+
\f
static gdb_PyGetSetDef pspace_getset[] =
/* Sets up the btrace record API. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_btrace (void)
{
btpy_list_type.tp_new = PyType_GenericNew;
return PyType_Ready (&btpy_list_type);
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_btrace);
/* Sets up the record API in the gdb module. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_record (void)
{
recpy_record_type.tp_new = PyType_GenericNew;
Py_RETURN_NONE;
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_record);
/* Initializes the new Python classes from this file in the gdb module. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_registers ()
{
register_descriptor_object_type.tp_new = PyType_GenericNew;
(PyObject *) ®ister_descriptor_iterator_object_type));
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_registers);
+
+\f
+
static PyMethodDef register_descriptor_iterator_object_methods [] = {
{ "find", (PyCFunction) register_descriptor_iter_find,
METH_VARARGS | METH_KEYWORDS,
return return_list.release ();
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_symbols (void)
{
if (PyType_Ready (&symbol_object_type) < 0)
(PyObject *) &symbol_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_symbols);
+
\f
static gdb_PyGetSetDef symbol_object_getset[] = {
return ((symtab_object *) obj)->symtab;
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_symtabs (void)
{
symtab_object_type.tp_new = PyType_GenericNew;
(PyObject *) &sal_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_symtabs);
+
\f
static gdb_PyGetSetDef symtab_object_getset[] = {
/* Initialize this module. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_tui ()
{
#ifdef TUI
/* Finalize this module. */
-void
+static void
gdbpy_finalize_tui ()
{
#ifdef TUI
gdbpy_tui_window_maker::invalidate_all ();
#endif /* TUI */
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_tui, gdbpy_finalize_tui);
return type_to_type_object (type);
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_types (void)
{
if (PyType_Ready (&type_object_type) < 0)
(PyObject *) &field_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_types);
+
\f
static gdb_PyGetSetDef type_object_getset[] =
}
}
-void _initialize_py_unwind ();
-void
-_initialize_py_unwind ()
-{
- add_setshow_boolean_cmd
- ("py-unwind", class_maintenance, &pyuw_debug,
- _("Set Python unwinder debugging."),
- _("Show Python unwinder debugging."),
- _("When on, Python unwinder debugging is enabled."),
- NULL,
- show_pyuw_debug,
- &setdebuglist, &showdebuglist);
-}
-
/* Initialize unwind machinery. */
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_unwind (void)
{
gdb::observers::architecture_changed.attach (pyuw_on_new_gdbarch,
(PyObject *) &unwind_info_object_type);
}
+void _initialize_py_unwind ();
+void
+_initialize_py_unwind ()
+{
+ add_setshow_boolean_cmd
+ ("py-unwind", class_maintenance, &pyuw_debug,
+ _("Set Python unwinder debugging."),
+ _("Show Python unwinder debugging."),
+ _("When on, Python unwinder debugging is enabled."),
+ NULL,
+ show_pyuw_debug,
+ &setdebuglist, &showdebuglist);
+}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_unwind);
+
+\f
+
static PyMethodDef pending_frame_object_methods[] =
{
{ "read_register", (PyCFunction) pending_framepy_read_register,
return PyObject_TypeCheck (obj, &value_object_type);
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_values (void)
{
if (PyType_Ready (&value_object_type) < 0)
(PyObject *) &value_object_type);
}
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_values);
+
\f
static gdb_PyGetSetDef value_object_getset[] = {
Py_INCREF (this_type);
}
-int
+static int CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION
gdbpy_initialize_xmethods (void)
{
py_match_method_name = PyUnicode_FromString (match_method_name);
return 1;
}
+
+GDBPY_INITIALIZE_FILE (gdbpy_initialize_xmethods);
extern struct program_space *progspace_object_to_program_space (PyObject *obj);
-void gdbpy_initialize_gdb_readline (void);
-int gdbpy_initialize_auto_load (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_values (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_frames (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_instruction (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_btrace (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_record (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_symtabs (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_commands (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_symbols (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_symtabs (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_blocks (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_types (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_functions (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_pspace (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_objfile (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_breakpoints (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_breakpoint_locations ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_finishbreakpoints (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_lazy_string (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_linetable (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_parameters (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_thread (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_inferior (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_eventregistry (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_event (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_arch (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_registers ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_xmethods (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_unwind (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_tui ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-void gdbpy_finalize_tui ();
-int gdbpy_initialize_membuf ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_connection ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-int gdbpy_initialize_micommands (void)
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
-void gdbpy_finalize_micommands ();
-int gdbpy_initialize_disasm ()
- CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION;
+/* A class for managing the initialization, and finalization functions
+ from all Python files (e.g. gdb/python/py-*.c).
+
+ Within any Python file, create an instance of this class, passing in
+ the initialization function, and, optionally, the finalization
+ function.
+
+ These functions are added to a single global list of functions, which
+ can then be called from do_start_initialization and finalize_python
+ (see python.c) to initialize all the Python files within GDB. */
+
+class gdbpy_initialize_file
+{
+ /* The type of a function that can be called just after GDB has setup the
+ Python interpreter. This function will setup any additional Python
+ state required by a particular subsystem. Return 0 if the setup was
+ successful, or return -1 if setup failed, in which case a Python
+ exception should have been raised. */
+
+ using gdbpy_initialize_file_ftype = int (*) (void);
+
+ /* The type of a function that can be called just before GDB shuts down
+ the Python interpreter. This function can cleanup an Python state
+ that is cached within GDB, for example, if GDB is holding any
+ references to Python objects, these should be released before the
+ Python interpreter is shut down.
+
+ There is no error return in this case. This function is only called
+ when GDB is already shutting down. The function should make a best
+ effort to clean up, and then return. */
+
+ using gdbpy_finalize_file_ftype = void (*) (void);
+
+ /* The type for an initialization and finalization function pair. */
+
+ using callback_pair_t = std::pair<gdbpy_initialize_file_ftype,
+ gdbpy_finalize_file_ftype>;
+
+ /* Return the vector of callbacks. The vector is defined as a static
+ variable within this function so that it will be initialized the first
+ time this function is called. This is important, as this function is
+ called as part of the global object initialization process; if the
+ vector was a static variable within this class then we could not
+ guarantee that it had been initialized before it was used. */
+
+ static std::vector<callback_pair_t> &
+ callbacks ()
+ {
+ static std::vector<callback_pair_t> list;
+ return list;
+ }
+
+public:
+
+ /* Register the initialization (INIT) and finalization (FINI) functions
+ for a Python file. See the comments on the function types above for
+ when these functions will be called.
+
+ Either of these functions can be nullptr, in which case no function
+ will be called.
+
+ The FINI argument is optional, and defaults to nullptr (no function to
+ call). */
+
+ gdbpy_initialize_file (gdbpy_initialize_file_ftype init,
+ gdbpy_finalize_file_ftype fini = nullptr)
+ {
+ callbacks ().emplace_back (init, fini);
+ }
+
+ /* Run all the Python file initialize functions and return true. If any
+ of the initialize functions fails then this function returns false.
+ In the case of failure it is undefined how many of the initialize
+ functions will have been called. */
+
+ static bool
+ initialize_all ()
+ {
+ /* The initialize_all function should only be called once. The
+ following check reverses the global list, which will effect this
+ initialize_all call, as well as the later finalize_all call.
+
+ The environment variable checked here is the same as the one checked
+ in the generated init.c file. */
+ if (getenv ("GDB_REVERSE_INIT_FUNCTIONS") != nullptr)
+ std::reverse (callbacks ().begin (), callbacks ().end ());
+
+ for (const auto &p : gdbpy_initialize_file::callbacks ())
+ {
+ if (p.first != nullptr && p.first () < 0)
+ return false;
+ }
+ return true;
+ }
+
+ /* Run all the Python file finalize functions. */
+
+ static void
+ finalize_all ()
+ {
+ for (const auto &p : gdbpy_initialize_file::callbacks ())
+ {
+ if (p.second != nullptr)
+ p.second ();
+ }
+ }
+};
+
+/* Macro to simplify registering the initialization and finalization
+ functions for a Python file. */
+
+#define GDBPY_INITIALIZE_FILE(INIT, ...) \
+ static gdbpy_initialize_file \
+ CONCAT(gdbpy_initialize_file_obj_, __LINE__) (INIT, ##__VA_ARGS__)
PyMODINIT_FUNC gdbpy_events_mod_func ();
(void) PyGILState_Ensure ();
gdbpy_enter::finalize ();
- gdbpy_finalize_micommands ();
- gdbpy_finalize_tui ();
+ /* Call the gdbpy_finalize_* functions from every *.c file. */
+ gdbpy_initialize_file::finalize_all ();
Py_Finalize ();
gdbpy_gdberror_exc) < 0)
return false;
- gdbpy_initialize_gdb_readline ();
-
- if (gdbpy_initialize_auto_load () < 0
- || gdbpy_initialize_values () < 0
- || gdbpy_initialize_disasm () < 0
- || gdbpy_initialize_frames () < 0
- || gdbpy_initialize_commands () < 0
- || gdbpy_initialize_instruction () < 0
- || gdbpy_initialize_record () < 0
- || gdbpy_initialize_btrace () < 0
- || gdbpy_initialize_symbols () < 0
- || gdbpy_initialize_symtabs () < 0
- || gdbpy_initialize_blocks () < 0
- || gdbpy_initialize_functions () < 0
- || gdbpy_initialize_parameters () < 0
- || gdbpy_initialize_types () < 0
- || gdbpy_initialize_pspace () < 0
- || gdbpy_initialize_objfile () < 0
- || gdbpy_initialize_breakpoints () < 0
- || gdbpy_initialize_breakpoint_locations () < 0
- || gdbpy_initialize_finishbreakpoints () < 0
- || gdbpy_initialize_lazy_string () < 0
- || gdbpy_initialize_linetable () < 0
- || gdbpy_initialize_thread () < 0
- || gdbpy_initialize_inferior () < 0
- || gdbpy_initialize_eventregistry () < 0
- || gdbpy_initialize_event () < 0
- || gdbpy_initialize_arch () < 0
- || gdbpy_initialize_registers () < 0
- || gdbpy_initialize_xmethods () < 0
- || gdbpy_initialize_unwind () < 0
- || gdbpy_initialize_membuf () < 0
- || gdbpy_initialize_connection () < 0
- || gdbpy_initialize_tui () < 0
- || gdbpy_initialize_micommands () < 0)
+ /* Call the gdbpy_initialize_* functions from every *.c file. */
+ if (!gdbpy_initialize_file::initialize_all ())
return false;
#define GDB_PY_DEFINE_EVENT_TYPE(name, py_name, doc, base) \