xref: /freebsd/contrib/llvm-project/lldb/include/lldb/Target/ProcessTrace.h (revision fe6060f10f634930ff71b7c50291ddc610da2475)
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 
18*fe6060f1SDimitry Andric /// Class that represents a defunct process loaded on memory via the "trace
19*fe6060f1SDimitry 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 
26e8d8bef9SDimitry Andric   static ConstString GetPluginNameStatic();
27e8d8bef9SDimitry Andric 
28e8d8bef9SDimitry Andric   static const char *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 
43e8d8bef9SDimitry Andric   ConstString GetPluginName() override;
44e8d8bef9SDimitry Andric 
45e8d8bef9SDimitry Andric   uint32_t GetPluginVersion() override;
46e8d8bef9SDimitry Andric 
47e8d8bef9SDimitry Andric   Status DoDestroy() override;
48e8d8bef9SDimitry Andric 
49e8d8bef9SDimitry Andric   void RefreshStateAfterStop() override;
50e8d8bef9SDimitry Andric 
51e8d8bef9SDimitry Andric   Status WillResume() override {
52e8d8bef9SDimitry Andric     Status error;
53e8d8bef9SDimitry Andric     error.SetErrorStringWithFormat(
54e8d8bef9SDimitry Andric         "error: %s does not support resuming processes",
55e8d8bef9SDimitry Andric         GetPluginName().GetCString());
56e8d8bef9SDimitry Andric     return error;
57e8d8bef9SDimitry Andric   }
58e8d8bef9SDimitry Andric 
59e8d8bef9SDimitry Andric   bool WarnBeforeDetach() const override { return false; }
60e8d8bef9SDimitry Andric 
61e8d8bef9SDimitry Andric   size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
62e8d8bef9SDimitry Andric                     Status &error) override;
63e8d8bef9SDimitry Andric 
64e8d8bef9SDimitry Andric   size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
65e8d8bef9SDimitry Andric                       Status &error) override;
66e8d8bef9SDimitry Andric 
67e8d8bef9SDimitry Andric   ArchSpec GetArchitecture();
68e8d8bef9SDimitry Andric 
69e8d8bef9SDimitry Andric   bool GetProcessInfo(ProcessInstanceInfo &info) override;
70e8d8bef9SDimitry Andric 
71e8d8bef9SDimitry Andric protected:
72e8d8bef9SDimitry Andric   void Clear();
73e8d8bef9SDimitry Andric 
74e8d8bef9SDimitry Andric   bool DoUpdateThreadList(ThreadList &old_thread_list,
75e8d8bef9SDimitry Andric                           ThreadList &new_thread_list) override;
76e8d8bef9SDimitry Andric 
77e8d8bef9SDimitry Andric private:
78e8d8bef9SDimitry Andric   static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
79e8d8bef9SDimitry Andric                                         lldb::ListenerSP listener_sp,
80e8d8bef9SDimitry Andric                                         const FileSpec *crash_file_path,
81e8d8bef9SDimitry Andric                                         bool can_connect);
82e8d8bef9SDimitry Andric };
83e8d8bef9SDimitry Andric 
84e8d8bef9SDimitry Andric } // namespace lldb_private
85e8d8bef9SDimitry Andric 
86e8d8bef9SDimitry Andric #endif // LLDB_TARGET_PROCESSTRACE_H
87