xref: /llvm-project/lldb/tools/lldb-dap/FunctionBreakpoint.cpp (revision b99d4112585302cbd01f9b851a04adc6e4fb5218)
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 "JSONUtils.h"
12 
13 namespace lldb_dap {
14 
15 FunctionBreakpoint::FunctionBreakpoint(DAP &d, const llvm::json::Object &obj)
16     : Breakpoint(d, obj), functionName(std::string(GetString(obj, "name"))) {}
17 
18 void FunctionBreakpoint::SetBreakpoint() {
19   if (functionName.empty())
20     return;
21   bp = dap.target.BreakpointCreateByName(functionName.c_str());
22   Breakpoint::SetBreakpoint();
23 }
24 
25 } // namespace lldb_dap
26