brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.7 KiB · ad8d0ed Raw
125 lines · c
1//===-- ProcessMinidump.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-exception6//7//===----------------------------------------------------------------------===//8 9#ifndef LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_PROCESSMINIDUMP_H10#define LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_PROCESSMINIDUMP_H11 12#include "MinidumpParser.h"13#include "MinidumpTypes.h"14 15#include "lldb/Target/PostMortemProcess.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"20 21#include "llvm/Support/Format.h"22#include "llvm/Support/raw_ostream.h"23#include <optional>24 25namespace lldb_private {26 27namespace minidump {28 29class ProcessMinidump : public PostMortemProcess {30public:31  static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,32                                        lldb::ListenerSP listener_sp,33                                        const FileSpec *crash_file_path,34                                        bool can_connect);35 36  static void Initialize();37 38  static void Terminate();39 40  static llvm::StringRef GetPluginNameStatic() { return "minidump"; }41 42  static llvm::StringRef GetPluginDescriptionStatic();43 44  ProcessMinidump(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp,45                  const FileSpec &core_file, lldb::DataBufferSP code_data);46 47  ~ProcessMinidump() override;48 49  bool CanDebug(lldb::TargetSP target_sp,50                bool plugin_specified_by_name) override;51 52  CommandObject *GetPluginCommandObject() override;53 54  Status DoLoadCore() override;55 56  DynamicLoader *GetDynamicLoader() override;57 58  // Returns AUXV structure found in the core file59  lldb_private::DataExtractor GetAuxvData() override;60 61  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }62 63  Status DoDestroy() override;64 65  void RefreshStateAfterStop() override;66 67  bool IsAlive() override;68 69  bool WarnBeforeDetach() const override;70 71  size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,72                    Status &error) override;73 74  size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,75                      Status &error) override;76 77  ArchSpec GetArchitecture();78 79  Status80  GetMemoryRegions(lldb_private::MemoryRegionInfos &region_list) override;81 82  bool GetProcessInfo(ProcessInstanceInfo &info) override;83 84  Status WillResume() override {85    return Status::FromErrorStringWithFormatv(86        "error: {0} does not support resuming processes", GetPluginName());87  }88 89  std::optional<MinidumpParser> m_minidump_parser;90 91protected:92  void Clear();93 94  bool DoUpdateThreadList(ThreadList &old_thread_list,95                          ThreadList &new_thread_list) override;96 97  Status DoGetMemoryRegionInfo(lldb::addr_t load_addr,98                               MemoryRegionInfo &range_info) override;99 100  void ReadModuleList();101 102  lldb::ModuleSP GetOrCreateModule(lldb_private::UUID minidump_uuid,103                                   llvm::StringRef name,104                                   lldb_private::ModuleSpec module_spec);105 106  JITLoaderList &GetJITLoaders() override;107 108private:109  lldb::DataBufferSP m_core_data;110  llvm::ArrayRef<minidump::Thread> m_thread_list;111  std::unordered_map<uint32_t, const minidump::ExceptionStream>112      m_exceptions_by_tid;113  lldb::CommandObjectSP m_command_sp;114  bool m_is_wow64;115  std::optional<MemoryRegionInfos> m_memory_regions;116 117  void BuildMemoryRegions();118  bool IsLLDBMinidump();119};120 121} // namespace minidump122} // namespace lldb_private123 124#endif // LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_PROCESSMINIDUMP_H125