diff options
Diffstat (limited to 'gdb/python/py-symbol.c')
-rw-r--r-- | gdb/python/py-symbol.c | 79 |
1 files changed, 48 insertions, 31 deletions
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c index def0fdd..7629f70 100644 --- a/gdb/python/py-symbol.c +++ b/gdb/python/py-symbol.c @@ -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); } |