[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
Loading
Please sign in to comment