[Lldb-commits] [PATCH] D137684: Make sure we are stopped before we try to install functions into the target
Jim Ingham via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Tue Nov 8 18:12:54 PST 2022
jingham created this revision.
jingham added reviewers: JDevlieghere, jasonmolenda, labath, clayborg.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
It's actually fairly hard to get lldb to do this, since most ways you can access the expression evaluator already assert that you have to be stopped. But if you are unlucky you might end up doing that, for instance SBTarget::FindFirstType when called the first time for something that requires types from the ObjC runtime metadata can end up installing and calling the "metadata introspection" UtilityFunction. This fails, mostly in harmless ways, but if you happen to hit a breakpoint and stop while in the middle of making up the expression, you can mess up internal state. I really don't think it's worth the effort to make this work. It's easier to reason about if we just assert that you have to be stopped if you want to cons up a UtilityExpression.
The only subtle bit of this patch is that if code is running on the Internal State Thread, it is governed by the m_private_state, not the m_public_state. So I made Process::GetState behave the same way the target API lock does, with a separate entity for the private & public running code.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137684
Files:
lldb/source/Expression/FunctionCaller.cpp
lldb/source/Expression/UserExpression.cpp
lldb/source/Expression/UtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
lldb/source/Target/Process.cpp
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137684.474135.patch
Type: text/x-patch
Size: 5400 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20221109/f9fdc299/attachment.bin>
More information about the lldb-commits
mailing list