2018-08-17 01:59:38 +08:00
|
|
|
//===-- ExceptionBreakpoint.cpp ---------------------------------*- C++ -*-===//
|
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// 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
|
2018-08-17 01:59:38 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "ExceptionBreakpoint.h"
|
2020-01-30 06:11:40 +08:00
|
|
|
#include "BreakpointBase.h"
|
2018-08-17 01:59:38 +08:00
|
|
|
#include "VSCode.h"
|
|
|
|
|
|
|
|
namespace lldb_vscode {
|
|
|
|
|
|
|
|
void ExceptionBreakpoint::SetBreakpoint() {
|
|
|
|
if (bp.IsValid())
|
|
|
|
return;
|
|
|
|
bool catch_value = filter.find("_catch") != std::string::npos;
|
|
|
|
bool throw_value = filter.find("_throw") != std::string::npos;
|
|
|
|
bp = g_vsc.target.BreakpointCreateForException(language, catch_value,
|
|
|
|
throw_value);
|
2020-01-30 06:11:40 +08:00
|
|
|
// See comments in BreakpointBase::GetBreakpointLabel() for details of why
|
|
|
|
// we add a label to our breakpoints.
|
|
|
|
bp.AddName(BreakpointBase::GetBreakpointLabel());
|
2018-08-17 01:59:38 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ExceptionBreakpoint::ClearBreakpoint() {
|
|
|
|
if (!bp.IsValid())
|
|
|
|
return;
|
|
|
|
g_vsc.target.BreakpointDelete(bp.GetID());
|
|
|
|
bp = lldb::SBBreakpoint();
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace lldb_vscode
|