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 26*349cc55cSDimitry Andric static llvm::StringRef GetPluginNameStatic() { return "trace"; } 27e8d8bef9SDimitry Andric 28*349cc55cSDimitry Andric static llvm::StringRef GetPluginDescriptionStatic(); 29e8d8bef9SDimitry Andric 30e8d8bef9SDimitry Andric ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp); 31e8d8bef9SDimitry Andric 32e8d8bef9SDimitry Andric ~ProcessTrace() override; 33e8d8bef9SDimitry Andric 34e8d8bef9SDimitry Andric bool CanDebug(lldb::TargetSP target_sp, 35e8d8bef9SDimitry Andric bool plugin_specified_by_name) override; 36e8d8bef9SDimitry Andric 37e8d8bef9SDimitry Andric void DidAttach(ArchSpec &process_arch) override; 38e8d8bef9SDimitry Andric 39e8d8bef9SDimitry Andric DynamicLoader *GetDynamicLoader() override { return nullptr; } 40e8d8bef9SDimitry Andric 41e8d8bef9SDimitry Andric SystemRuntime *GetSystemRuntime() override { return nullptr; } 42e8d8bef9SDimitry Andric 43*349cc55cSDimitry Andric llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); } 44e8d8bef9SDimitry Andric 45e8d8bef9SDimitry Andric Status DoDestroy() override; 46e8d8bef9SDimitry Andric 47e8d8bef9SDimitry Andric void RefreshStateAfterStop() override; 48e8d8bef9SDimitry Andric 49e8d8bef9SDimitry Andric Status WillResume() override { 50e8d8bef9SDimitry Andric Status error; 51*349cc55cSDimitry Andric error.SetErrorStringWithFormatv( 52*349cc55cSDimitry Andric "error: {0} does not support resuming processes", GetPluginName()); 53e8d8bef9SDimitry Andric return error; 54e8d8bef9SDimitry Andric } 55e8d8bef9SDimitry Andric 56e8d8bef9SDimitry Andric bool WarnBeforeDetach() const override { return false; } 57e8d8bef9SDimitry Andric 58e8d8bef9SDimitry Andric size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, 59e8d8bef9SDimitry Andric Status &error) override; 60e8d8bef9SDimitry Andric 61e8d8bef9SDimitry Andric size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, 62e8d8bef9SDimitry Andric Status &error) override; 63e8d8bef9SDimitry Andric 64e8d8bef9SDimitry Andric ArchSpec GetArchitecture(); 65e8d8bef9SDimitry Andric 66e8d8bef9SDimitry Andric bool GetProcessInfo(ProcessInstanceInfo &info) override; 67e8d8bef9SDimitry Andric 68e8d8bef9SDimitry Andric protected: 69e8d8bef9SDimitry Andric void Clear(); 70e8d8bef9SDimitry Andric 71e8d8bef9SDimitry Andric bool DoUpdateThreadList(ThreadList &old_thread_list, 72e8d8bef9SDimitry Andric ThreadList &new_thread_list) override; 73e8d8bef9SDimitry Andric 74e8d8bef9SDimitry Andric private: 75e8d8bef9SDimitry Andric static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, 76e8d8bef9SDimitry Andric lldb::ListenerSP listener_sp, 77e8d8bef9SDimitry Andric const FileSpec *crash_file_path, 78e8d8bef9SDimitry Andric bool can_connect); 79e8d8bef9SDimitry Andric }; 80e8d8bef9SDimitry Andric 81e8d8bef9SDimitry Andric } // namespace lldb_private 82e8d8bef9SDimitry Andric 83e8d8bef9SDimitry Andric #endif // LLDB_TARGET_PROCESSTRACE_H 84