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