llvm-project/lldb/tools/lldb-vscode/SourceBreakpoint.cpp
Greg Clayton 9cb227f561 Stop emitting a breakpoint for each location in a breakpoint when responding to breakpoint commands.
Summary: The VS Code DAP expects on response for each breakpoint that was requested. If we responsd with multiple entries for one breakpoint the VS Code UI gets out of date. Currently the VS code DAP doesn't handle one breakpoint with multiple locations. If this ever gets fixed we can modify our code.

Reviewers: labath

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D73665
2020-02-13 08:23:19 -08:00

30 lines
1.0 KiB
C++

//===-- SourceBreakpoint.cpp ------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "SourceBreakpoint.h"
#include "VSCode.h"
namespace lldb_vscode {
SourceBreakpoint::SourceBreakpoint(const llvm::json::Object &obj)
: BreakpointBase(obj), line(GetUnsigned(obj, "line", 0)),
column(GetUnsigned(obj, "column", 0)) {}
void SourceBreakpoint::SetBreakpoint(const llvm::StringRef source_path) {
bp = g_vsc.target.BreakpointCreateByLocation(source_path.str().c_str(), line);
// See comments in BreakpointBase::GetBreakpointLabel() for details of why
// we add a label to our breakpoints.
bp.AddName(GetBreakpointLabel());
if (!condition.empty())
SetCondition();
if (!hitCondition.empty())
SetHitCondition();
}
} // namespace lldb_vscode