Author: Raphael Isemann Date: 2021-02-02T14:41:48+01:00 New Revision: 0f2be195d5e5fc79d28692266eae226cd42678b0
URL: https://github.com/llvm/llvm-project/commit/0f2be195d5e5fc79d28692266eae226cd42678b0 DIFF: https://github.com/llvm/llvm-project/commit/0f2be195d5e5fc79d28692266eae226cd42678b0.diff LOG: Revert "[lldb] Use current execution context in SBDebugger" This reverts commit 754ab803b8dc659e3645d369d1b5d6d2f97be29e. As pointed out in https://reviews.llvm.org/D95761, this patch could lead to having the wrong execution context in some situations (thanks Jim!). D92164 is addressing the same issue and will replace this patch, so I'll revert this one. Added: Modified: lldb/source/API/SBDebugger.cpp lldb/test/API/python_api/debugger/TestDebuggerAPI.py Removed: ################################################################################ diff --git a/lldb/source/API/SBDebugger.cpp b/lldb/source/API/SBDebugger.cpp index e3d2e4728a87..6245b3a83565 100644 --- a/lldb/source/API/SBDebugger.cpp +++ b/lldb/source/API/SBDebugger.cpp @@ -1278,7 +1278,8 @@ SBError SBDebugger::SetInternalVariable(const char *var_name, const char *value, ConstString(debugger_instance_name))); Status error; if (debugger_sp) { - ExecutionContext exe_ctx(debugger_sp->GetSelectedExecutionContext()); + ExecutionContext exe_ctx( + debugger_sp->GetCommandInterpreter().GetExecutionContext()); error = debugger_sp->SetPropertyValue(&exe_ctx, eVarSetOperationAssign, var_name, value); } else { @@ -1302,7 +1303,8 @@ SBDebugger::GetInternalVariableValue(const char *var_name, ConstString(debugger_instance_name))); Status error; if (debugger_sp) { - ExecutionContext exe_ctx(debugger_sp->GetSelectedExecutionContext()); + ExecutionContext exe_ctx( + debugger_sp->GetCommandInterpreter().GetExecutionContext()); lldb::OptionValueSP value_sp( debugger_sp->GetPropertyValue(&exe_ctx, var_name, false, error)); if (value_sp) { diff --git a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py index 5d0311eb1b0c..32202acbe072 100644 --- a/lldb/test/API/python_api/debugger/TestDebuggerAPI.py +++ b/lldb/test/API/python_api/debugger/TestDebuggerAPI.py @@ -43,35 +43,3 @@ def test_debugger_delete_invalid_target(self): target = lldb.SBTarget() self.assertFalse(target.IsValid()) self.dbg.DeleteTarget(target) - - @add_test_categories(['pyapi']) - def test_debugger_internal_variables(self): - debugger_name = self.dbg.GetInstanceName() - - # Set a variable and check it was written successfully. - error = lldb.SBDebugger.SetInternalVariable( - 'target.prefer-dynamic-value', 'no-dynamic-values', debugger_name) - self.assertTrue(error.Success()) - ret = lldb.SBDebugger.GetInternalVariableValue( - 'target.prefer-dynamic-value', debugger_name) - self.assertEqual(ret.GetSize(), 1) - self.assertEqual(ret.GetStringAtIndex(0), 'no-dynamic-values') - - # Set a variable with a diff erent value. - error = lldb.SBDebugger.SetInternalVariable( - 'target.prefer-dynamic-value', 'no-run-target', debugger_name) - self.assertTrue(error.Success()) - ret = lldb.SBDebugger.GetInternalVariableValue( - 'target.prefer-dynamic-value', debugger_name) - self.assertEqual(ret.GetSize(), 1) - self.assertEqual(ret.GetStringAtIndex(0), 'no-run-target') - - # Try setting invalid value, check for error. - error = lldb.SBDebugger.SetInternalVariable( - 'target.prefer-dynamic-value', 'dummy-value', debugger_name) - self.assertTrue(error.Fail()) - # Check that the value didn't change. - ret = lldb.SBDebugger.GetInternalVariableValue( - 'target.prefer-dynamic-value', debugger_name) - self.assertEqual(ret.GetSize(), 1) - self.assertEqual(ret.GetStringAtIndex(0), 'no-run-target') _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits