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 | //===----------------------------------------------------------------------===// |
8 | |
9 | #include "ExceptionBreakpoint.h" |
10 | #include "BreakpointBase.h" |
11 | #include "DAP.h" |
12 | |
13 | namespace lldb_dap { |
14 | |
15 | void ExceptionBreakpoint::SetBreakpoint() { |
16 | if (bp.IsValid()) |
17 | return; |
18 | bool catch_value = filter.find(s: "_catch") != std::string::npos; |
19 | bool throw_value = filter.find(s: "_throw") != std::string::npos; |
20 | bp = g_dap.target.BreakpointCreateForException(language, catch_bp: catch_value, |
21 | throw_bp: throw_value); |
22 | // See comments in BreakpointBase::GetBreakpointLabel() for details of why |
23 | // we add a label to our breakpoints. |
24 | bp.AddName(new_name: BreakpointBase::GetBreakpointLabel()); |
25 | } |
26 | |
27 | void ExceptionBreakpoint::ClearBreakpoint() { |
28 | if (!bp.IsValid()) |
29 | return; |
30 | g_dap.target.BreakpointDelete(break_id: bp.GetID()); |
31 | bp = lldb::SBBreakpoint(); |
32 | } |
33 | |
34 | } // namespace lldb_dap |
35 |