Skip to content

Commit e910a3d

Browse files
committed
[lldb-dap] Support thread focused function breakpoint
Summary: This is part of the DACU support. We can allow a adding a new function breakpoint following the current thread. Setting this without a current focused thread will stop for all thread. Test Plan: Tested with DACU workflow in D60535622 & D61629279 Reviewers: jsamouh, mbucko, #lldb_team Reviewed By: mbucko Subscribers: pdepetro, #lldb_team Differential Revision: https://phabricator.intern.facebook.com/D61959216
1 parent 3d59cef commit e910a3d

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

lldb/tools/lldb-dap/Breakpoint.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,3 +105,7 @@ void Breakpoint::SetBreakpoint() {
105105
if (!m_hit_condition.empty())
106106
SetHitCondition();
107107
}
108+
109+
void Breakpoint::SetThreadID(lldb::tid_t tid) {
110+
m_bp.SetThreadID(tid);
111+
}

lldb/tools/lldb-dap/Breakpoint.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class Breakpoint : public BreakpointBase {
3030

3131
bool MatchesName(const char *name);
3232
void SetBreakpoint();
33+
void SetThreadID(lldb::tid_t tid);
3334

3435
protected:
3536
/// The LLDB breakpoint associated wit this source breakpoint.

lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ llvm::Expected<protocol::SetFunctionBreakpointsResponseBody>
2121
SetFunctionBreakpointsRequestHandler::Run(
2222
const protocol::SetFunctionBreakpointsArguments &args) const {
2323
std::vector<protocol::Breakpoint> response_breakpoints;
24+
const bool focus_thread = args.focusThread;
2425

2526
// Disable any function breakpoints that aren't in this request.
2627
// There is no call to remove function breakpoints other than calling this
@@ -35,7 +36,9 @@ SetFunctionBreakpointsRequestHandler::Run(
3536
it->second.SetBreakpoint();
3637
else
3738
it->second.UpdateBreakpoint(fn_bp);
38-
39+
// LLDB_INVALID_THREAD_ID will set breakpoint for all thread
40+
if (focus_thread && dap.focus_tid != LLDB_INVALID_THREAD_ID)
41+
it->second.SetThreadID(dap.focus_tid);
3942
response_breakpoints.push_back(it->second.ToProtocolBreakpoint());
4043
seen.erase(fn_bp.GetFunctionName());
4144
}

lldb/tools/lldb-dap/Protocol/ProtocolRequests.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ llvm::json::Value toJSON(const SetBreakpointsResponseBody &);
648648
struct SetFunctionBreakpointsArguments {
649649
/// The function names of the breakpoints.
650650
std::vector<FunctionBreakpoint> breakpoints;
651+
bool focusThread = false;
651652
};
652653
bool fromJSON(const llvm::json::Value &, SetFunctionBreakpointsArguments &,
653654
llvm::json::Path);

0 commit comments

Comments
 (0)