[Lldb-commits] [lldb] Make breakpoint stop reason more accurate for function breakpoints (PR #130841)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Mar 25 12:59:54 PDT 2025
================
@@ -962,28 +962,43 @@ llvm::json::Value CreateThreadStopped(DAP &dap, lldb::SBThread &thread,
body.try_emplace("reason", "step");
break;
case lldb::eStopReasonBreakpoint: {
- ExceptionBreakpoint *exc_bp = dap.GetExceptionBPFromStopReason(thread);
+ const auto *exc_bp =
+ dap.GetBreakpointFromStopReason<ExceptionBreakpoint>(thread);
if (exc_bp) {
body.try_emplace("reason", "exception");
EmplaceSafeString(body, "description", exc_bp->label);
} else {
- InstructionBreakpoint *inst_bp =
- dap.GetInstructionBPFromStopReason(thread);
+ llvm::StringRef reason = "breakpoint";
+ const auto *inst_bp =
+ dap.GetBreakpointFromStopReason<InstructionBreakpoint>(thread);
if (inst_bp) {
- body.try_emplace("reason", "instruction breakpoint");
+ reason = "instruction breakpoint";
} else {
- body.try_emplace("reason", "breakpoint");
+ const auto *function_bp =
+ dap.GetBreakpointFromStopReason<FunctionBreakpoint>(thread);
+ if (function_bp) {
+ reason = "function breakpoint";
+ }
}
+ body.try_emplace("reason", reason);
lldb::break_id_t bp_id = thread.GetStopReasonDataAtIndex(0);
lldb::break_id_t bp_loc_id = thread.GetStopReasonDataAtIndex(1);
std::string desc_str =
- llvm::formatv("breakpoint {0}.{1}", bp_id, bp_loc_id);
+ llvm::formatv("{0} {1}.{2}", reason, bp_id, bp_loc_id);
body.try_emplace("hitBreakpointIds",
llvm::json::Array{llvm::json::Value(bp_id)});
EmplaceSafeString(body, "description", desc_str);
}
} break;
- case lldb::eStopReasonWatchpoint:
+ case lldb::eStopReasonWatchpoint: {
+ // Assuming that all watch points are data breakpoints.
+ body.try_emplace("reason", "data breakpoint");
----------------
satyajanga wrote:
VS Code also calls them watchpoints.
"data breakpoint" is a DAP terminology.
https://microsoft.github.io/debug-adapter-protocol/specification#Requests_SetDataBreakpoints and they trigger SetDataBreakpointsRequestHandler
https://github.com/llvm/llvm-project/blob/main/lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp
https://github.com/llvm/llvm-project/pull/130841
More information about the lldb-commits
mailing list