1 | //===-- FunctionBreakpoint.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 "FunctionBreakpoint.h" |
10 | #include "DAP.h" |
11 | #include "lldb/API/SBMutex.h" |
12 | #include <mutex> |
13 | |
14 | namespace lldb_dap { |
15 | |
16 | FunctionBreakpoint::FunctionBreakpoint( |
17 | DAP &d, const protocol::FunctionBreakpoint &breakpoint) |
18 | : Breakpoint(d, breakpoint.condition, breakpoint.hitCondition), |
19 | m_function_name(breakpoint.name) {} |
20 | |
21 | void FunctionBreakpoint::SetBreakpoint() { |
22 | lldb::SBMutex lock = m_dap.GetAPIMutex(); |
23 | std::lock_guard<lldb::SBMutex> guard(lock); |
24 | |
25 | if (m_function_name.empty()) |
26 | return; |
27 | m_bp = m_dap.target.BreakpointCreateByName(symbol_name: m_function_name.c_str()); |
28 | Breakpoint::SetBreakpoint(); |
29 | } |
30 | |
31 | } // namespace lldb_dap |
32 |