* python/py-arch.c (gdbpy_initialize_arch): Return 'int'.

Check errors.
	* python/py-auto-load.c (gdbpy_initialize_auto_load): Return 'int'.
	* python/py-block.c (gdbpy_initialize_blocks): Return 'int'.
	Check errors.
	* python/py-breakpoint.c (gdbpy_initialize_breakpoints): Return 'int'.
	Check errors.
	* python/py-cmd.c (gdbpy_initialize_commands): Return 'int'.
	Check errors.
	* python/py-event.c (gdbpy_initialize_event): Return 'int'.
	Check errors.
	* python/py-event.h (GDBPY_NEW_EVENT_TYPE): Change generated
	init function to return 'int'.
	* python/py-evtregistry.c (gdbpy_initialize_eventregistry):
	Return 'int'.  Check errors.
	* python/py-evts.c (gdbpy_initialize_py_events): Return 'int'.
	Check errors.
	* python/py-finishbreakpoint.c (gdbpy_initialize_finishbreakpoints):
	Return 'int'.  Check errors.
	* python/py-frame.c (gdbpy_initialize_frames): Return 'int'.
	Check errors.
	* python/py-function.c (gdbpy_initialize_functions): Return 'int'.
	Check errors.
	* python/py-gdb-readline.c (gdbpy_initialize_gdb_readline):
	Check errors.
	* python/py-inferior.c (gdbpy_initialize_inferior): Return 'int'.
	Check errors.
	* python/py-infthread.c (gdbpy_initialize_thread): Return 'int'.
	Check errors.
	* python/py-lazy-string.c (gdbpy_initialize_lazy_string): Return 'int'.
	Check errors.
	* python/py-objfile.c (gdbpy_initialize_objfile): Return 'int'.
	Check errors.
	* python/py-param.c (gdbpy_initialize_parameters): Return 'int'.
	Check errors.
	* python/py-progspace.c (gdbpy_initialize_pspace): Return 'int'.
	Check errors.
	* python/py-symbol.c (gdbpy_initialize_symbols): Return 'int'.
	Check errors.
	* python/py-symtab.c (gdbpy_initialize_symtabs): Return 'int'.
	Check errors.
	* python/py-type.c (gdbpy_initialize_types): Return 'int'.
	Check errors.
	* python/py-value.c (gdbpy_initialize_values): Return 'int'.
	Check errors.
	* python/python-internal.h (gdbpy_initialize_auto_load,
	gdbpy_initialize_values, gdbpy_initialize_frames,
	gdbpy_initialize_symtabs, gdbpy_initialize_commands,
	gdbpy_initialize_symbols, gdbpy_initialize_symtabs,
	gdbpy_initialize_blocks, gdbpy_initialize_types,
	gdbpy_initialize_functions, gdbpy_initialize_pspace,
	gdbpy_initialize_objfile, gdbpy_initialize_breakpoints,
	gdbpy_initialize_finishbreakpoints,
	gdbpy_initialize_lazy_string, gdbpy_initialize_parameters,
	gdbpy_initialize_thread, gdbpy_initialize_inferior,
	gdbpy_initialize_eventregistry, gdbpy_initialize_event,
	gdbpy_initialize_py_events, gdbpy_initialize_stop_event,
	gdbpy_initialize_signal_event,
	gdbpy_initialize_breakpoint_event,
	gdbpy_initialize_continue_event,
	gdbpy_initialize_exited_event, gdbpy_initialize_thread_event,
	gdbpy_initialize_new_objfile_event, gdbpy_initialize_arch):
	Update.  Use CPYCHECKER_NEGATIVE_RESULT_SETS_EXCEPTION.
	* python/python.c (gdb_python_initialized): New global.
	(gdbpy_initialize_events): Return 'int'.  Check errors.
	(_initialize_python): Check errors.  Set
	gdb_python_initialized.
This commit is contained in:
Tom Tromey 2013-05-20 20:28:52 +00:00
parent 1886886089
commit 999633ede7
26 changed files with 400 additions and 216 deletions

View file

@ -474,11 +474,11 @@ del_objfile_symbols (struct objfile *objfile, void *datum)
}
}
void
int
gdbpy_initialize_symbols (void)
{
if (PyType_Ready (&symbol_object_type) < 0)
return;
return -1;
/* Register an objfile "free" callback so we can properly
invalidate symbol when an object file that is about to be
@ -486,37 +486,54 @@ gdbpy_initialize_symbols (void)
sympy_objfile_data_key
= register_objfile_data_with_cleanup (NULL, del_objfile_symbols);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST", LOC_CONST);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC", LOC_STATIC);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER", LOC_REGISTER);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG", LOC_ARG);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG", LOC_REF_ARG);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL", LOC_LOCAL);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF", LOC_TYPEDEF);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL", LOC_LABEL);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK", LOC_BLOCK);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
LOC_CONST_BYTES);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
LOC_UNRESOLVED);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
LOC_OPTIMIZED_OUT);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED", LOC_COMPUTED);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
LOC_REGPARM_ADDR);
PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN", UNDEF_DOMAIN);
PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN", VAR_DOMAIN);
PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN", STRUCT_DOMAIN);
PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN", LABEL_DOMAIN);
PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
VARIABLES_DOMAIN);
PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
FUNCTIONS_DOMAIN);
PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN", TYPES_DOMAIN);
if (PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNDEF", LOC_UNDEF) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST",
LOC_CONST) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_STATIC",
LOC_STATIC) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGISTER",
LOC_REGISTER) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_ARG",
LOC_ARG) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REF_ARG",
LOC_REF_ARG) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LOCAL",
LOC_LOCAL) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_TYPEDEF",
LOC_TYPEDEF) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_LABEL",
LOC_LABEL) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_BLOCK",
LOC_BLOCK) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_CONST_BYTES",
LOC_CONST_BYTES) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_UNRESOLVED",
LOC_UNRESOLVED) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_OPTIMIZED_OUT",
LOC_OPTIMIZED_OUT) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_COMPUTED",
LOC_COMPUTED) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LOC_REGPARM_ADDR",
LOC_REGPARM_ADDR) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_UNDEF_DOMAIN",
UNDEF_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_VAR_DOMAIN",
VAR_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_STRUCT_DOMAIN",
STRUCT_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_LABEL_DOMAIN",
LABEL_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_VARIABLES_DOMAIN",
VARIABLES_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_FUNCTIONS_DOMAIN",
FUNCTIONS_DOMAIN) < 0
|| PyModule_AddIntConstant (gdb_module, "SYMBOL_TYPES_DOMAIN",
TYPES_DOMAIN) < 0)
return -1;
Py_INCREF (&symbol_object_type);
PyModule_AddObject (gdb_module, "Symbol", (PyObject *) &symbol_object_type);
return PyModule_AddObject (gdb_module, "Symbol",
(PyObject *) &symbol_object_type);
}