[Lldb-commits] [PATCH] D53309: Return a useful "Error" for an expression that completes but produces no result

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 15 18:37:16 PDT 2018


jingham created this revision.
Herald added subscribers: lldb-commits, abidh, JDevlieghere.

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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D53309

Files:
  include/lldb/Expression/UserExpression.h
  include/lldb/lldb-enumerations.h
  packages/Python/lldbsuite/test/expression_command/no-result/Makefile
  packages/Python/lldbsuite/test/expression_command/no-result/TestNoResult.py
  packages/Python/lldbsuite/test/expression_command/no-result/main.c
  source/Commands/CommandObjectExpression.cpp
  source/Expression/REPL.cpp
  source/Expression/UserExpression.cpp
  source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53309.169778.patch
Type: text/x-patch
Size: 7219 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181016/6ae5e7fc/attachment.bin>


More information about the lldb-commits mailing list