diff options
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r-- | gdb/python/python.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index 009c0c4..9eed258 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1388,11 +1388,10 @@ gdbpy_source_objfile_script (const struct extension_language_defn *extlang, return; gdbpy_enter enter_py (objfile->arch (), current_language); - gdbpy_current_objfile = objfile; + scoped_restore restire_current_objfile + = make_scoped_restore (&gdbpy_current_objfile, objfile); python_run_simple_file (file, filename); - - gdbpy_current_objfile = NULL; } /* Set the current objfile to OBJFILE and then execute SCRIPT @@ -1410,11 +1409,10 @@ gdbpy_execute_objfile_script (const struct extension_language_defn *extlang, return; gdbpy_enter enter_py (objfile->arch (), current_language); - gdbpy_current_objfile = objfile; + scoped_restore restire_current_objfile + = make_scoped_restore (&gdbpy_current_objfile, objfile); PyRun_SimpleString (script); - - gdbpy_current_objfile = NULL; } /* Return the current Objfile, or None if there isn't one. */ |