This is an archive of the discontinued LLVM Phabricator instance.

Return a useful "Error" for an expression that completes but produces no result
ClosedPublic

Authored by jingham on Oct 15 2018, 6:36 PM.

Details

Summary

When you run an expression like:

(lldb) expr int $x = 10

the expression has no result. The ValueObject (and then SBValue) you get back from the expression signals that by putting an error indicating this in the Status object returned by SBValue::GetError(). Unfortunately, this error was not terribly helpful. The error number was a private constant that only UserExpression knew about, and the error string was unset. This meant you couldn't really trust the result of SBValue.GetError().Success() when you ran an expression.

This commit adds an eExpressionProducedNoResult constant to the ExpressionResults enum, and used that and an appropriate string in the error object. So now you can usefully tell the difference between an expression that produces no result and one that failed.

Diff Detail

Repository
rLLDB LLDB

Event Timeline

jingham created this revision.Oct 15 2018, 6:36 PM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 16 2018, 3:00 PM
This revision was automatically updated to reflect the committed changes.