[all-commits] [llvm/llvm-project] 4125b4: Revert "[lldb] Add support for evaluating expressi...

Raphael Isemann via All-commits all-commits at lists.llvm.org
Fri Jun 11 06:01:08 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4125b46232caf6a558470670f87b56ccb46d61aa
      https://github.com/llvm/llvm-project/commit/4125b46232caf6a558470670f87b56ccb46d61aa
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-06-11 (Fri, 11 Jun 2021)

  Changed paths:
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
    M lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
    R lldb/test/API/lang/cpp/stopped_in_static_member_function/Makefile
    R lldb/test/API/lang/cpp/stopped_in_static_member_function/TestStoppedInStaticMemberFunction.py
    R lldb/test/API/lang/cpp/stopped_in_static_member_function/main.cpp

  Log Message:
  -----------
  Revert "[lldb] Add support for evaluating expressions in static member functions"

This reverts commit 00764c36edf88ae9806e8d57a6addb782e6ceae8 and the
follow up d2223c7a49973a61cc2de62992662afa8d19065a.

The original patch broke that one could use static member variables while
inside a static member functions without having a running target. It seems that
LLDB currently requires that static variables are only found via the global
variable lookup so that they can get materialized and mapped to the argument
struct of the expression.

After 00764c36edf88ae9806e8d57a6addb782e6ceae8 static variables of the current
class could be found via Clang's lookup which LLDB isn't observing. This
resulting in expressions actually containing these variables as normal
globals that can't be rewritten to a member of the argument struct.

More specifically, in the test TestCPPThis, the expression
`expr --j false -- s_a` is now only passing if we have a runnable target.

I'll revert the patch as the possible fixes aren't trivial and it degrades
the debugging experience more than the issue that the revert patch addressed.

The underlying bug can be reproduced before/after this patch by stopping
in `TestCPPThis` main function and running: `e -j false -- my_a; A<int>::s_a`.
The `my_a` will pull in the `A<int>` class and the second expression will
be resolved by Clang on its own (which causes LLDB to not materialize the
static variable).

Note: A workaround is to just do `::s_a` which will force LLDB to take the global
variable lookup.




More information about the All-commits mailing list