[all-commits] [llvm/llvm-project] 71536f: [lldb] Fix that running a top level expression wit...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Thu Feb 11 08:07:45 PST 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 71536fd031084b25ffc9ad0a26c8471a68f5ad7c
      https://github.com/llvm/llvm-project/commit/71536fd031084b25ffc9ad0a26c8471a68f5ad7c
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-02-11 (Thu, 11 Feb 2021)

  Changed paths:
    M lldb/source/Expression/UserExpression.cpp
    M lldb/test/API/commands/expression/static-initializers/TestStaticInitializers.py
    M lldb/test/API/commands/expression/top-level/TestTopLevelExprs.py
    M lldb/test/API/lang/cpp/elaborated-types/TestElaboratedTypes.py

  Log Message:
  -----------
  [lldb] Fix that running a top level expression without a process fails with a cryptic error

Right now when running `expr --top-level -- void foo() {}`, LLDB just prints a cryptic
`error: Couldn't find $__lldb_expr() in the module` error. The reason for that is
that if we don't have a running process, we try to set our execution policy to always use the
IR interpreter (ExecutionPolicyNever) which works even without a process. However
that code didn't consider the special ExecutionPolicyTopLevel which we use for
top-level expressions. By changing the execution policy to ExecutionPolicyNever,
LLDB thinks we're actually trying to interpret a normal expression inside our
`$__lldb_expr` function and then fails when looking for it.

This just adds an exception for top-level expressions to that code and a bunch of tests.

Reviewed By: shafik

Differential Revision: https://reviews.llvm.org/D91723




More information about the All-commits mailing list