Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / tools / lldb-dap / FunctionBreakpoint.cpp
blobd4bdb976500ecd826493e360b3f22b5986f40cd9
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 //===----------------------------------------------------------------------===//
9 #include "FunctionBreakpoint.h"
10 #include "DAP.h"
12 namespace lldb_dap {
14 FunctionBreakpoint::FunctionBreakpoint(const llvm::json::Object &obj)
15 : BreakpointBase(obj), functionName(std::string(GetString(obj, "name"))) {}
17 void FunctionBreakpoint::SetBreakpoint() {
18 if (functionName.empty())
19 return;
20 bp = g_dap.target.BreakpointCreateByName(functionName.c_str());
21 // See comments in BreakpointBase::GetBreakpointLabel() for details of why
22 // we add a label to our breakpoints.
23 bp.AddName(GetBreakpointLabel());
24 if (!condition.empty())
25 SetCondition();
26 if (!hitCondition.empty())
27 SetHitCondition();
28 if (!logMessage.empty())
29 SetLogMessage();
32 } // namespace lldb_dap