Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 10 additions & 17 deletions lldb/source/API/SBFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1012,33 +1012,26 @@ bool SBFrame::GetDescription(SBStream &description) {
SBValue SBFrame::EvaluateExpression(const char *expr) {
LLDB_INSTRUMENT_VA(this, expr);

SBValue result;
std::unique_lock<std::recursive_mutex> lock;
ExecutionContext exe_ctx(m_opaque_sp.get(), lock);

StackFrame *frame = exe_ctx.GetFramePtr();
Target *target = exe_ctx.GetTargetPtr();
SBExpressionOptions options;
if (frame && target) {
SBExpressionOptions options;
lldb::DynamicValueType fetch_dynamic_value =
frame->CalculateTarget()->GetPreferDynamicValue();
options.SetFetchDynamicValue(fetch_dynamic_value);
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
SourceLanguage language = target->GetLanguage();
if (!language)
language = frame->GetLanguage();
options.SetLanguage((SBSourceLanguageName)language.name, language.version);
return EvaluateExpression(expr, options);
} else {
Status error;
error = Status::FromErrorString("can't evaluate expressions when the "
"process is running.");
ValueObjectSP error_val_sp =
ValueObjectConstResult::Create(nullptr, std::move(error));
result.SetSP(error_val_sp, false);
}
return result;
options.SetUnwindOnError(true);
options.SetIgnoreBreakpoints(true);
SourceLanguage language;
if (target)
language = target->GetLanguage();
if (!language && frame)
language = frame->GetLanguage();
options.SetLanguage((SBSourceLanguageName)language.name, language.version);
return EvaluateExpression(expr, options);
}

SBValue
Expand Down
4 changes: 1 addition & 3 deletions lldb/test/API/python_api/run_locker/TestRunLocker.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,4 @@ def runlocker_test(self, stop_at_entry):
"script var = lldb.frame.EvaluateExpression('SomethingToCall()'); var.GetError().GetCString()",
result,
)
self.assertIn(
"can't evaluate expressions when the process is running", result.GetOutput()
)
self.assertIn("sbframe object is not valid", result.GetOutput())
Loading