LLDB mainline
DebuggerEvents.h
Go to the documentation of this file.
1//===-- DebuggerEvents.h ----------------------------------------*- 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//===----------------------------------------------------------------------===//
8
11#include "lldb/Utility/Event.h"
12
13#include <string>
14
15#ifndef LLDB_CORE_DEBUGGER_EVENTS_H
16#define LLDB_CORE_DEBUGGER_EVENTS_H
17
18namespace lldb_private {
19class Stream;
20
22public:
23 ProgressEventData(uint64_t progress_id, const std::string &message,
24 uint64_t completed, uint64_t total, bool debugger_specific)
25 : m_message(message), m_id(progress_id), m_completed(completed),
26 m_total(total), m_debugger_specific(debugger_specific) {}
27
29
30 ConstString GetFlavor() const override;
31
32 void Dump(Stream *s) const override;
33
34 static const ProgressEventData *GetEventDataFromEvent(const Event *event_ptr);
35 uint64_t GetID() const { return m_id; }
36 bool IsFinite() const { return m_total != UINT64_MAX; }
37 uint64_t GetCompleted() const { return m_completed; }
38 uint64_t GetTotal() const { return m_total; }
39 const std::string &GetMessage() const { return m_message; }
40 bool IsDebuggerSpecific() const { return m_debugger_specific; }
41
42private:
43 std::string m_message;
44 const uint64_t m_id;
45 uint64_t m_completed;
46 const uint64_t m_total;
50};
51
53public:
54 enum class Type {
55 Info,
56 Warning,
57 Error,
58 };
59 DiagnosticEventData(Type type, std::string message, bool debugger_specific)
60 : m_message(std::move(message)), m_type(type),
61 m_debugger_specific(debugger_specific) {}
62 ~DiagnosticEventData() override = default;
63
64 const std::string &GetMessage() const { return m_message; }
65 bool IsDebuggerSpecific() const { return m_debugger_specific; }
66 Type GetType() const { return m_type; }
67
68 llvm::StringRef GetPrefix() const;
69
70 void Dump(Stream *s) const override;
71
73 ConstString GetFlavor() const override;
74
75 static const DiagnosticEventData *
76 GetEventDataFromEvent(const Event *event_ptr);
77
78protected:
79 std::string m_message;
82
85};
86
88public:
89 SymbolChangeEventData(lldb::DebuggerWP debugger_wp, ModuleSpec module_spec)
90 : m_debugger_wp(debugger_wp), m_module_spec(std::move(module_spec)) {}
91
93 ConstString GetFlavor() const override;
94
95 static const SymbolChangeEventData *
96 GetEventDataFromEvent(const Event *event_ptr);
97
98 void DoOnRemoval(Event *event_ptr) override;
99
100private:
101 lldb::DebuggerWP m_debugger_wp;
103
107};
108
109} // namespace lldb_private
110
111#endif // LLDB_CORE_DEBUGGER_EVENTS_H
A uniqued constant string class.
Definition: ConstString.h:39
void Dump(Stream *s) const override
DiagnosticEventData(const DiagnosticEventData &)=delete
const DiagnosticEventData & operator=(const DiagnosticEventData &)=delete
static ConstString GetFlavorString()
const std::string & GetMessage() const
llvm::StringRef GetPrefix() const
~DiagnosticEventData() override=default
DiagnosticEventData(Type type, std::string message, bool debugger_specific)
static const DiagnosticEventData * GetEventDataFromEvent(const Event *event_ptr)
ConstString GetFlavor() const override
void Dump(Stream *s) const override
ProgressEventData(uint64_t progress_id, const std::string &message, uint64_t completed, uint64_t total, bool debugger_specific)
static const ProgressEventData * GetEventDataFromEvent(const Event *event_ptr)
ConstString GetFlavor() const override
const ProgressEventData & operator=(const ProgressEventData &)=delete
static ConstString GetFlavorString()
const std::string & GetMessage() const
ProgressEventData(const ProgressEventData &)=delete
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
ConstString GetFlavor() const override
static const SymbolChangeEventData * GetEventDataFromEvent(const Event *event_ptr)
const SymbolChangeEventData & operator=(const SymbolChangeEventData &)=delete
SymbolChangeEventData(const SymbolChangeEventData &)=delete
SymbolChangeEventData(lldb::DebuggerWP debugger_wp, ModuleSpec module_spec)
void DoOnRemoval(Event *event_ptr) override
#define UINT64_MAX
Definition: lldb-defines.h:23
A class that represents a running process on the host machine.