xref: /llvm-project/lldb/tools/lldb-dap/FunctionBreakpoint.cpp (revision b99d4112585302cbd01f9b851a04adc6e4fb5218)
101263c6cSJonas Devlieghere //===-- FunctionBreakpoint.cpp ----------------------------------*- C++ -*-===//
201263c6cSJonas Devlieghere //
301263c6cSJonas Devlieghere // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
401263c6cSJonas Devlieghere // See https://llvm.org/LICENSE.txt for license information.
501263c6cSJonas Devlieghere // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
601263c6cSJonas Devlieghere //
701263c6cSJonas Devlieghere //===----------------------------------------------------------------------===//
801263c6cSJonas Devlieghere 
901263c6cSJonas Devlieghere #include "FunctionBreakpoint.h"
1001263c6cSJonas Devlieghere #include "DAP.h"
1109c258efSAdrian Vogelsgesang #include "JSONUtils.h"
1201263c6cSJonas Devlieghere 
1301263c6cSJonas Devlieghere namespace lldb_dap {
1401263c6cSJonas Devlieghere 
15*b99d4112SJohn Harrison FunctionBreakpoint::FunctionBreakpoint(DAP &d, const llvm::json::Object &obj)
16*b99d4112SJohn Harrison     : Breakpoint(d, obj), functionName(std::string(GetString(obj, "name"))) {}
1701263c6cSJonas Devlieghere 
1801263c6cSJonas Devlieghere void FunctionBreakpoint::SetBreakpoint() {
1901263c6cSJonas Devlieghere   if (functionName.empty())
2001263c6cSJonas Devlieghere     return;
21*b99d4112SJohn Harrison   bp = dap.target.BreakpointCreateByName(functionName.c_str());
22d58c128bSZequan Wu   Breakpoint::SetBreakpoint();
2301263c6cSJonas Devlieghere }
2401263c6cSJonas Devlieghere 
2501263c6cSJonas Devlieghere } // namespace lldb_dap
26