1e8d8bef9SDimitry Andric //===-- ProcessTrace.h ------------------------------------------*- C++ -*-===// 2e8d8bef9SDimitry Andric // 3e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 5e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6e8d8bef9SDimitry Andric // 7e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===// 8e8d8bef9SDimitry Andric 9e8d8bef9SDimitry Andric #ifndef LLDB_TARGET_PROCESSTRACE_H 10e8d8bef9SDimitry Andric #define LLDB_TARGET_PROCESSTRACE_H 11e8d8bef9SDimitry Andric 12e8d8bef9SDimitry Andric #include "lldb/Target/PostMortemProcess.h" 13e8d8bef9SDimitry Andric #include "lldb/Utility/ConstString.h" 14e8d8bef9SDimitry Andric #include "lldb/Utility/Status.h" 15e8d8bef9SDimitry Andric 16e8d8bef9SDimitry Andric namespace lldb_private { 17e8d8bef9SDimitry Andric 18fe6060f1SDimitry Andric /// Class that represents a defunct process loaded on memory via the "trace 19fe6060f1SDimitry Andric /// load" command. 20e8d8bef9SDimitry Andric class ProcessTrace : public PostMortemProcess { 21e8d8bef9SDimitry Andric public: 22e8d8bef9SDimitry Andric static void Initialize(); 23e8d8bef9SDimitry Andric 24e8d8bef9SDimitry Andric static void Terminate(); 25e8d8bef9SDimitry Andric GetPluginNameStatic()26349cc55cSDimitry Andric static llvm::StringRef GetPluginNameStatic() { return "trace"; } 27e8d8bef9SDimitry Andric 28349cc55cSDimitry Andric static llvm::StringRef GetPluginDescriptionStatic(); 29e8d8bef9SDimitry Andric 30*0fca6ea1SDimitry Andric ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, 31*0fca6ea1SDimitry Andric const FileSpec &core_file); 32e8d8bef9SDimitry Andric 33e8d8bef9SDimitry Andric ~ProcessTrace() override; 34e8d8bef9SDimitry Andric 35e8d8bef9SDimitry Andric bool CanDebug(lldb::TargetSP target_sp, 36e8d8bef9SDimitry Andric bool plugin_specified_by_name) override; 37e8d8bef9SDimitry Andric 38e8d8bef9SDimitry Andric void DidAttach(ArchSpec &process_arch) override; 39e8d8bef9SDimitry Andric GetDynamicLoader()40e8d8bef9SDimitry Andric DynamicLoader *GetDynamicLoader() override { return nullptr; } 41e8d8bef9SDimitry Andric GetSystemRuntime()42e8d8bef9SDimitry Andric SystemRuntime *GetSystemRuntime() override { return nullptr; } 43e8d8bef9SDimitry Andric GetPluginName()44349cc55cSDimitry Andric llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } 45e8d8bef9SDimitry Andric 46e8d8bef9SDimitry Andric Status DoDestroy() override; 47e8d8bef9SDimitry Andric 48e8d8bef9SDimitry Andric void RefreshStateAfterStop() override; 49e8d8bef9SDimitry Andric WillResume()50e8d8bef9SDimitry Andric Status WillResume() override { 51e8d8bef9SDimitry Andric Status error; 52349cc55cSDimitry Andric error.SetErrorStringWithFormatv( 53349cc55cSDimitry Andric "error: {0} does not support resuming processes", GetPluginName()); 54e8d8bef9SDimitry Andric return error; 55e8d8bef9SDimitry Andric } 56e8d8bef9SDimitry Andric WarnBeforeDetach()57e8d8bef9SDimitry Andric bool WarnBeforeDetach() const override { return false; } 58e8d8bef9SDimitry Andric 59e8d8bef9SDimitry Andric size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, 60e8d8bef9SDimitry Andric Status &error) override; 61e8d8bef9SDimitry Andric 62e8d8bef9SDimitry Andric size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, 63e8d8bef9SDimitry Andric Status &error) override; 64e8d8bef9SDimitry Andric 65e8d8bef9SDimitry Andric ArchSpec GetArchitecture(); 66e8d8bef9SDimitry Andric 67e8d8bef9SDimitry Andric bool GetProcessInfo(ProcessInstanceInfo &info) override; 68e8d8bef9SDimitry Andric 69e8d8bef9SDimitry Andric protected: 70e8d8bef9SDimitry Andric void Clear(); 71e8d8bef9SDimitry Andric 72e8d8bef9SDimitry Andric bool DoUpdateThreadList(ThreadList &old_thread_list, 73e8d8bef9SDimitry Andric ThreadList &new_thread_list) override; 74e8d8bef9SDimitry Andric 75e8d8bef9SDimitry Andric private: 76e8d8bef9SDimitry Andric static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, 77e8d8bef9SDimitry Andric lldb::ListenerSP listener_sp, 78e8d8bef9SDimitry Andric const FileSpec *crash_file_path, 79e8d8bef9SDimitry Andric bool can_connect); 80e8d8bef9SDimitry Andric }; 81e8d8bef9SDimitry Andric 82e8d8bef9SDimitry Andric } // namespace lldb_private 83e8d8bef9SDimitry Andric 84e8d8bef9SDimitry Andric #endif // LLDB_TARGET_PROCESSTRACE_H 85