diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2025-07-10 15:24:27 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-10 15:24:27 -0700 |
commit | f28a497a06c2d9202638d753e1cd2e247814d180 (patch) | |
tree | 5599ddef580f55fbf72b8f47f2ad8a516a2cf319 /lldb/source/API | |
parent | 4859b92b7f4e0365517acd464cec29721f469461 (diff) | |
download | llvm-f28a497a06c2d9202638d753e1cd2e247814d180.zip llvm-f28a497a06c2d9202638d753e1cd2e247814d180.tar.gz llvm-f28a497a06c2d9202638d753e1cd2e247814d180.tar.bz2 |
[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
Diffstat (limited to 'lldb/source/API')
-rw-r--r-- | lldb/source/API/SBBreakpoint.cpp | 4 | ||||
-rw-r--r-- | lldb/source/API/SBBreakpointLocation.cpp | 4 | ||||
-rw-r--r-- | lldb/source/API/SBBreakpointName.cpp | 5 |
3 files changed, 7 insertions, 6 deletions
diff --git a/lldb/source/API/SBBreakpoint.cpp b/lldb/source/API/SBBreakpoint.cpp index 397afc1..07c0a2e 100644 --- a/lldb/source/API/SBBreakpoint.cpp +++ b/lldb/source/API/SBBreakpoint.cpp @@ -275,7 +275,7 @@ void SBBreakpoint::SetCondition(const char *condition) { if (bkpt_sp) { std::lock_guard<std::recursive_mutex> guard( bkpt_sp->GetTarget().GetAPIMutex()); - bkpt_sp->SetCondition(condition); + bkpt_sp->SetCondition(StopCondition(condition)); } } @@ -288,7 +288,7 @@ const char *SBBreakpoint::GetCondition() { std::lock_guard<std::recursive_mutex> guard( bkpt_sp->GetTarget().GetAPIMutex()); - return ConstString(bkpt_sp->GetConditionText()).GetCString(); + return ConstString(bkpt_sp->GetCondition().GetText()).GetCString(); } void SBBreakpoint::SetAutoContinue(bool auto_continue) { diff --git a/lldb/source/API/SBBreakpointLocation.cpp b/lldb/source/API/SBBreakpointLocation.cpp index 479354a..e786435 100644 --- a/lldb/source/API/SBBreakpointLocation.cpp +++ b/lldb/source/API/SBBreakpointLocation.cpp @@ -160,7 +160,7 @@ void SBBreakpointLocation::SetCondition(const char *condition) { if (loc_sp) { std::lock_guard<std::recursive_mutex> guard( loc_sp->GetTarget().GetAPIMutex()); - loc_sp->SetCondition(condition); + loc_sp->SetCondition(StopCondition(condition)); } } @@ -173,7 +173,7 @@ const char *SBBreakpointLocation::GetCondition() { std::lock_guard<std::recursive_mutex> guard( loc_sp->GetTarget().GetAPIMutex()); - return ConstString(loc_sp->GetConditionText()).GetCString(); + return ConstString(loc_sp->GetCondition().GetText()).GetCString(); } void SBBreakpointLocation::SetAutoContinue(bool auto_continue) { diff --git a/lldb/source/API/SBBreakpointName.cpp b/lldb/source/API/SBBreakpointName.cpp index 831260d..0b588c3 100644 --- a/lldb/source/API/SBBreakpointName.cpp +++ b/lldb/source/API/SBBreakpointName.cpp @@ -303,7 +303,7 @@ void SBBreakpointName::SetCondition(const char *condition) { std::lock_guard<std::recursive_mutex> guard( m_impl_up->GetTarget()->GetAPIMutex()); - bp_name->GetOptions().SetCondition(condition); + bp_name->GetOptions().SetCondition(StopCondition(condition)); UpdateName(*bp_name); } @@ -317,7 +317,8 @@ const char *SBBreakpointName::GetCondition() { std::lock_guard<std::recursive_mutex> guard( m_impl_up->GetTarget()->GetAPIMutex()); - return ConstString(bp_name->GetOptions().GetConditionText()).GetCString(); + return ConstString(bp_name->GetOptions().GetCondition().GetText()) + .GetCString(); } void SBBreakpointName::SetAutoContinue(bool auto_continue) { |