aboutsummaryrefslogtreecommitdiff
path: root/gdb/python
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python')
-rw-r--r--gdb/python/py-symbol.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index 62fde64..fdff53f 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -87,6 +87,9 @@ sympy_get_symtab (PyObject *self, void *closure)
SYMPY_REQUIRE_VALID (self, symbol);
+ if (!SYMBOL_OBJFILE_OWNED (symbol))
+ Py_RETURN_NONE;
+
return symtab_to_symtab_object (symbol_symtab (symbol));
}
@@ -290,7 +293,8 @@ set_symbol (symbol_object *obj, struct symbol *symbol)
{
obj->symbol = symbol;
obj->prev = NULL;
- if (symbol_symtab (symbol) != NULL)
+ if (SYMBOL_OBJFILE_OWNED (symbol)
+ && symbol_symtab (symbol) != NULL)
{
struct objfile *objfile = symbol_objfile (symbol);
@@ -334,6 +338,7 @@ sympy_dealloc (PyObject *obj)
if (sym_obj->prev)
sym_obj->prev->next = sym_obj->next;
else if (sym_obj->symbol != NULL
+ && SYMBOL_OBJFILE_OWNED (sym_obj->symbol)
&& symbol_symtab (sym_obj->symbol) != NULL)
{
set_objfile_data (symbol_objfile (sym_obj->symbol),