1 //===-- ProcessTrace.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 9 #ifndef LLDB_TARGET_PROCESSTRACE_H 10 #define LLDB_TARGET_PROCESSTRACE_H 11 12 #include "lldb/Target/PostMortemProcess.h" 13 #include "lldb/Utility/ConstString.h" 14 #include "lldb/Utility/Status.h" 15 16 namespace lldb_private { 17 18 class ProcessTrace : public PostMortemProcess { 19 public: 20 static void Initialize(); 21 22 static void Terminate(); 23 24 static ConstString GetPluginNameStatic(); 25 26 static const char *GetPluginDescriptionStatic(); 27 28 ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp); 29 30 ~ProcessTrace() override; 31 32 bool CanDebug(lldb::TargetSP target_sp, 33 bool plugin_specified_by_name) override; 34 35 void DidAttach(ArchSpec &process_arch) override; 36 37 DynamicLoader *GetDynamicLoader() override { return nullptr; } 38 39 SystemRuntime *GetSystemRuntime() override { return nullptr; } 40 41 ConstString GetPluginName() override; 42 43 uint32_t GetPluginVersion() override; 44 45 Status DoDestroy() override; 46 47 void RefreshStateAfterStop() override; 48 49 Status WillResume() override { 50 Status error; 51 error.SetErrorStringWithFormat( 52 "error: %s does not support resuming processes", 53 GetPluginName().GetCString()); 54 return error; 55 } 56 57 bool IsAlive() override; 58 59 bool WarnBeforeDetach() const override { return false; } 60 61 size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, 62 Status &error) override; 63 64 size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, 65 Status &error) override; 66 67 ArchSpec GetArchitecture(); 68 69 bool GetProcessInfo(ProcessInstanceInfo &info) override; 70 71 protected: 72 void Clear(); 73 74 bool DoUpdateThreadList(ThreadList &old_thread_list, 75 ThreadList &new_thread_list) override; 76 77 private: 78 static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, 79 lldb::ListenerSP listener_sp, 80 const FileSpec *crash_file_path, 81 bool can_connect); 82 }; 83 84 } // namespace lldb_private 85 86 #endif // LLDB_TARGET_PROCESSTRACE_H 87