xref: /openbsd-src/gnu/llvm/lldb/tools/lldb-vscode/FunctionBreakpoint.cpp (revision 46035553bfdd96e63c94e32da0210227ec2e3cf1)
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 "VSCode.h"
11 
12 namespace lldb_vscode {
13 
14 FunctionBreakpoint::FunctionBreakpoint(const llvm::json::Object &obj)
15     : BreakpointBase(obj), functionName(GetString(obj, "name")) {}
16 
17 void FunctionBreakpoint::SetBreakpoint() {
18   if (functionName.empty())
19     return;
20   bp = g_vsc.target.BreakpointCreateByName(functionName.c_str());
21   if (!condition.empty())
22     SetCondition();
23   if (!hitCondition.empty())
24     SetHitCondition();
25 }
26 
27 }
28