1 //===-- ProcessMinidump.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 #ifndef liblldb_ProcessMinidump_h_
10 #define liblldb_ProcessMinidump_h_
12 #include "MinidumpParser.h"
13 #include "MinidumpTypes.h"
15 #include "lldb/Target/Process.h"
16 #include "lldb/Target/StopInfo.h"
17 #include "lldb/Target/Target.h"
18 #include "lldb/Utility/ConstString.h"
19 #include "lldb/Utility/Status.h"
21 #include "llvm/Support/Format.h"
22 #include "llvm/Support/raw_ostream.h"
25 namespace lldb_private {
29 class ProcessMinidump : public Process {
31 static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
32 lldb::ListenerSP listener_sp,
33 const FileSpec *crash_file_path);
35 static void Initialize();
37 static void Terminate();
39 static ConstString GetPluginNameStatic();
41 static const char *GetPluginDescriptionStatic();
43 ProcessMinidump(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,
44 const FileSpec &core_file, lldb::DataBufferSP code_data);
46 ~ProcessMinidump() override;
48 bool CanDebug(lldb::TargetSP target_sp,
49 bool plugin_specified_by_name) override;
51 CommandObject *GetPluginCommandObject() override;
53 Status DoLoadCore() override;
55 DynamicLoader *GetDynamicLoader() override { return nullptr; }
57 ConstString GetPluginName() override;
59 uint32_t GetPluginVersion() override;
61 SystemRuntime *GetSystemRuntime() override { return nullptr; }
63 Status DoDestroy() override;
65 void RefreshStateAfterStop() override;
67 bool IsAlive() override;
69 bool WarnBeforeDetach() const override;
71 size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
72 Status &error) override;
74 size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
75 Status &error) override;
77 ArchSpec GetArchitecture();
79 Status GetMemoryRegionInfo(lldb::addr_t load_addr,
80 MemoryRegionInfo &range_info) override;
82 Status GetMemoryRegions(
83 lldb_private::MemoryRegionInfos ®ion_list) override;
85 bool GetProcessInfo(ProcessInstanceInfo &info) override;
87 Status WillResume() override {
89 error.SetErrorStringWithFormat(
90 "error: %s does not support resuming processes",
91 GetPluginName().GetCString());
95 llvm::Optional<MinidumpParser> m_minidump_parser;
100 bool UpdateThreadList(ThreadList &old_thread_list,
101 ThreadList &new_thread_list) override;
103 void ReadModuleList();
105 JITLoaderList &GetJITLoaders() override;
108 FileSpec m_core_file;
109 lldb::DataBufferSP m_core_data;
110 llvm::ArrayRef<minidump::Thread> m_thread_list;
111 const MinidumpExceptionStream *m_active_exception;
112 lldb::CommandObjectSP m_command_sp;
116 } // namespace minidump
117 } // namespace lldb_private
119 #endif // liblldb_ProcessMinidump_h_