Skip to content

Commit f3aa765

Browse files
committed
[lldb] Add interface to check if UserExpression::Parse() is cacheable
When setting conditional breakpoints, we currently assume that a call to UserExpression::Parse() can be cached and resued multiple times. This may not be true for every user expression. Add a new method so subclasses of UserExpression can customize if they are parseable or not.
1 parent 282eafe commit f3aa765

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lldb/include/lldb/Expression/UserExpression.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ class UserExpression : public Expression {
192192
/// expression. Text() should contain the definition of this function.
193193
const char *FunctionName() override { return "$__lldb_expr"; }
194194

195+
/// Returns whether the call to Parse on this user expression is cacheable.
196+
virtual bool IsParseCacheable() { return true; }
195197
/// Return the language that should be used when parsing. To use the
196198
/// default, return eLanguageTypeUnknown.
197199
lldb::LanguageType Language() const override { return m_language; }

lldb/source/Breakpoint/BreakpointLocation.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext &exe_ctx,
250250
DiagnosticManager diagnostics;
251251

252252
if (condition_hash != m_condition_hash || !m_user_expression_sp ||
253+
!m_user_expression_sp->IsParseCacheable() ||
253254
!m_user_expression_sp->MatchesContext(exe_ctx)) {
254255
LanguageType language = eLanguageTypeUnknown;
255256
// See if we can figure out the language from the frame, otherwise use the

0 commit comments

Comments
 (0)