1 //===-- DebuggerEvents.h ----------------------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
9 #include "lldb/Utility/ConstString.h"
10 #include "lldb/Utility/Event.h"
14 #ifndef LLDB_CORE_DEBUGGER_EVENTS_H
15 #define LLDB_CORE_DEBUGGER_EVENTS_H
17 namespace lldb_private {
20 class ProgressEventData : public EventData {
22 ProgressEventData(uint64_t progress_id, const std::string &message,
23 uint64_t completed, uint64_t total, bool debugger_specific)
24 : m_message(message), m_id(progress_id), m_completed(completed),
25 m_total(total), m_debugger_specific(debugger_specific) {}
27 static ConstString GetFlavorString();
29 ConstString GetFlavor() const override;
31 void Dump(Stream *s) const override;
33 static const ProgressEventData *GetEventDataFromEvent(const Event *event_ptr);
34 uint64_t GetID() const { return m_id; }
35 bool IsFinite() const { return m_total != UINT64_MAX; }
36 uint64_t GetCompleted() const { return m_completed; }
37 uint64_t GetTotal() const { return m_total; }
38 const std::string &GetMessage() const { return m_message; }
39 bool IsDebuggerSpecific() const { return m_debugger_specific; }
42 std::string m_message;
45 const uint64_t m_total;
46 const bool m_debugger_specific;
47 ProgressEventData(const ProgressEventData &) = delete;
48 const ProgressEventData &operator=(const ProgressEventData &) = delete;
51 class DiagnosticEventData : public EventData {
57 DiagnosticEventData(Type type, std::string message, bool debugger_specific)
58 : m_message(std::move(message)), m_type(type),
59 m_debugger_specific(debugger_specific) {}
60 ~DiagnosticEventData() override = default;
62 const std::string &GetMessage() const { return m_message; }
63 bool IsDebuggerSpecific() const { return m_debugger_specific; }
64 Type GetType() const { return m_type; }
66 llvm::StringRef GetPrefix() const;
68 void Dump(Stream *s) const override;
70 static ConstString GetFlavorString();
71 ConstString GetFlavor() const override;
73 static const DiagnosticEventData *
74 GetEventDataFromEvent(const Event *event_ptr);
77 std::string m_message;
79 const bool m_debugger_specific;
81 DiagnosticEventData(const DiagnosticEventData &) = delete;
82 const DiagnosticEventData &operator=(const DiagnosticEventData &) = delete;
85 } // namespace lldb_private
87 #endif // LLDB_CORE_DEBUGGER_EVENTS_H