#ifndef LLDB_TOOLS_LLDB_DAP_SOURCEBREAKPOINT_H
#define LLDB_TOOLS_LLDB_DAP_SOURCEBREAKPOINT_H
#include "Breakpoint.h"
#include "llvm/ADT/StringRef.h"
namespace lldb_dap {
struct SourceBreakpoint : public Breakpoint {
struct LogMessagePart {
LogMessagePart(llvm::StringRef text, bool is_expr)
: text(text), is_expr(is_expr) {}
std::string text;
bool is_expr;
};
std::string logMessage;
std::vector<LogMessagePart> logMessageParts;
uint32_t line;
uint32_t column;
SourceBreakpoint() : Breakpoint(), line(0), column(0) {}
SourceBreakpoint(const llvm::json::Object &obj);
void SetBreakpoint(const llvm::StringRef source_path);
void UpdateBreakpoint(const SourceBreakpoint &request_bp);
void SetLogMessage();
lldb::SBError FormatLogText(llvm::StringRef text, std::string &formatted);
lldb::SBError AppendLogMessagePart(llvm::StringRef part, bool is_expr);
void NotifyLogMessageError(llvm::StringRef error);
static bool BreakpointHitCallback(void *baton, lldb::SBProcess &process,
lldb::SBThread &thread,
lldb::SBBreakpointLocation &location);
};
inline bool operator<(const SourceBreakpoint &lhs,
const SourceBreakpoint &rhs) {
if (lhs.line == rhs.line)
return lhs.column < rhs.column;
return lhs.line < rhs.line;
}
}
#endif