[Lldb-commits] [PATCH] D98370: [lldb] Fix SBValue::Persist() for constant values

Andy Yankovsky via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 10 13:43:51 PST 2021


werat created this revision.
werat added a reviewer: teemperor.
werat requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Right now `SBValue::Persist()` works properly only for values that refere to variables (refer to unit-tests for an example). Constant values (e.g. values created by `EvaluateExpression` or `CreateValueFromData`) can be persisted, but using them in the expressions leads to an error:

  >>> v = lldb.frame.EvaluateExpression("1+2")
  >>> vp = v.Persist()
  >>> vp.GetName()
  '$1'
  >>> v = lldb.frame.EvaluateExpression("$1")
  >>> v.GetValue()
  '3'
  >>> v = lldb.frame.EvaluateExpression("$1+1")
  >>> v.GetError().GetCString()
  "error: supposed to interpret, but failed: Interpreter couldn't read from memory\n"

In this patch we mark constant values as "required materialization" and fix up the dematerialization logic to apply side-effects.

Also move Windows-failing use cases to a separate test, so that other tests can be executed on Windows too.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98370

Files:
  lldb/source/Core/ValueObject.cpp
  lldb/source/Expression/Materializer.cpp
  lldb/test/API/python_api/sbvalue_persist/TestSBValuePersist.py
  lldb/test/API/python_api/sbvalue_persist/main.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98370.329762.patch
Type: text/x-patch
Size: 8695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20210310/a2689cb3/attachment-0001.bin>


More information about the lldb-commits mailing list