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 "VSCode.h"
11 
12 namespace lldb_vscode {
13 
14 void ExceptionBreakpoint::SetBreakpoint() {
15   if (bp.IsValid())
16     return;
17   bool catch_value = filter.find("_catch") != std::string::npos;
18   bool throw_value = filter.find("_throw") != std::string::npos;
19   bp = g_vsc.target.BreakpointCreateForException(language, catch_value,
20                                                  throw_value);
21 }
22 
23 void ExceptionBreakpoint::ClearBreakpoint() {
24   if (!bp.IsValid())
25     return;
26   g_vsc.target.BreakpointDelete(bp.GetID());
27   bp = lldb::SBBreakpoint();
28 }
29 
30 } // namespace lldb_vscode
31 
32