xref: /openbsd-src/gnu/llvm/lldb/tools/lldb-vscode/SourceBreakpoint.h (revision be691f3bb6417f04a68938fadbcaee2d5795e764)
1061da546Spatrick //===-- SourceBreakpoint.h --------------------------------------*- C++ -*-===//
2061da546Spatrick //
3061da546Spatrick // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4061da546Spatrick // See https://llvm.org/LICENSE.txt for license information.
5061da546Spatrick // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6061da546Spatrick //
7061da546Spatrick //===----------------------------------------------------------------------===//
8061da546Spatrick 
9dda28197Spatrick #ifndef LLDB_TOOLS_LLDB_VSCODE_SOURCEBREAKPOINT_H
10dda28197Spatrick #define LLDB_TOOLS_LLDB_VSCODE_SOURCEBREAKPOINT_H
11061da546Spatrick 
12061da546Spatrick #include "BreakpointBase.h"
13*be691f3bSpatrick #include "llvm/ADT/StringRef.h"
14061da546Spatrick 
15061da546Spatrick namespace lldb_vscode {
16061da546Spatrick 
17061da546Spatrick struct SourceBreakpoint : public BreakpointBase {
18061da546Spatrick 
19061da546Spatrick   uint32_t line;   ///< The source line of the breakpoint or logpoint
20061da546Spatrick   uint32_t column; ///< An optional source column of the breakpoint
21061da546Spatrick 
SourceBreakpointSourceBreakpoint22061da546Spatrick   SourceBreakpoint() : BreakpointBase(), line(0), column(0) {}
23061da546Spatrick   SourceBreakpoint(const llvm::json::Object &obj);
24061da546Spatrick 
25061da546Spatrick   // Set this breakpoint in LLDB as a new breakpoint
26061da546Spatrick   void SetBreakpoint(const llvm::StringRef source_path);
27061da546Spatrick };
28061da546Spatrick 
29061da546Spatrick inline bool operator<(const SourceBreakpoint &lhs,
30061da546Spatrick                       const SourceBreakpoint &rhs) {
31061da546Spatrick   if (lhs.line == rhs.line)
32061da546Spatrick     return lhs.column < rhs.column;
33061da546Spatrick   return lhs.line < rhs.line;
34061da546Spatrick }
35061da546Spatrick 
36061da546Spatrick } // namespace lldb_vscode
37061da546Spatrick 
38061da546Spatrick #endif
39