[lldb] Support specifying a language for breakpoint conditions (#147603)

LLDB breakpoint conditions take an expression that's evaluated using the
language of the code where the breakpoint is located. Users have asked
to have an option to tell it to evaluate the expression in a specific
language.

This is feature is especially helpful for Swift, for example for a
condition based on the value in memory at an offset from a register.
Such a condition is pretty difficult to write in Swift, but easy in C.

This PR adds a new argument (-Y) to specify the language of the
condition expression. We can't reuse the current -L option, since you
might want to break on only Swift symbols, but run a C expression there
as per the example above.

rdar://146119507
This commit is contained in:
Jonas Devlieghere
2025-07-10 15:24:27 -07:00
committed by GitHub
parent 4859b92b7f
commit f28a497a06
15 changed files with 176 additions and 96 deletions

View File

@@ -440,13 +440,13 @@ const char *Breakpoint::GetQueueName() const {
return m_options.GetThreadSpecNoCreate()->GetQueueName();
}
void Breakpoint::SetCondition(const char *condition) {
m_options.SetCondition(condition);
void Breakpoint::SetCondition(StopCondition condition) {
m_options.SetCondition(std::move(condition));
SendBreakpointChangedEvent(eBreakpointEventTypeConditionChanged);
}
const char *Breakpoint::GetConditionText() const {
return m_options.GetConditionText();
const StopCondition &Breakpoint::GetCondition() const {
return m_options.GetCondition();
}
// This function is used when "baton" doesn't need to be freed