[NFC][Coroutines] Use structured binding with llvm::enumerate in CoroSplit (#116879)
[llvm-project.git] / lldb / tools / lldb-dap / ExceptionBreakpoint.cpp
blob0fb865c19e574f21c509cb319be699c7be64910c
1 //===-- ExceptionBreakpoint.cpp ---------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "ExceptionBreakpoint.h"
10 #include "BreakpointBase.h"
11 #include "DAP.h"
12 #include "lldb/API/SBTarget.h"
14 namespace lldb_dap {
16 void ExceptionBreakpoint::SetBreakpoint() {
17 if (bp.IsValid())
18 return;
19 bool catch_value = filter.find("_catch") != std::string::npos;
20 bool throw_value = filter.find("_throw") != std::string::npos;
21 bp = dap.target.BreakpointCreateForException(language, catch_value,
22 throw_value);
23 // See comments in BreakpointBase::GetBreakpointLabel() for details of why
24 // we add a label to our breakpoints.
25 bp.AddName(BreakpointBase::GetBreakpointLabel());
28 void ExceptionBreakpoint::ClearBreakpoint() {
29 if (!bp.IsValid())
30 return;
31 dap.target.BreakpointDelete(bp.GetID());
32 bp = lldb::SBBreakpoint();
35 } // namespace lldb_dap