LLDB  mainline
ProcessTrace.h
Go to the documentation of this file.
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 
14 #include "lldb/Utility/Status.h"
15 
16 namespace lldb_private {
17 
18 /// Class that represents a defunct process loaded on memory via the "trace
19 /// load" command.
21 public:
22  static void Initialize();
23 
24  static void Terminate();
25 
26  static llvm::StringRef GetPluginNameStatic() { return "trace"; }
27 
28  static llvm::StringRef GetPluginDescriptionStatic();
29 
30  ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp);
31 
32  ~ProcessTrace() override;
33 
34  bool CanDebug(lldb::TargetSP target_sp,
35  bool plugin_specified_by_name) override;
36 
37  void DidAttach(ArchSpec &process_arch) override;
38 
39  DynamicLoader *GetDynamicLoader() override { return nullptr; }
40 
41  SystemRuntime *GetSystemRuntime() override { return nullptr; }
42 
43  llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
44 
45  Status DoDestroy() override;
46 
47  void RefreshStateAfterStop() override;
48 
49  Status WillResume() override {
50  Status error;
51  error.SetErrorStringWithFormatv(
52  "error: {0} does not support resuming processes", GetPluginName());
53  return error;
54  }
55 
56  bool WarnBeforeDetach() const override { return false; }
57 
58  size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
59  Status &error) override;
60 
61  size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
62  Status &error) override;
63 
65 
66  bool GetProcessInfo(ProcessInstanceInfo &info) override;
67 
68 protected:
69  void Clear();
70 
71  bool DoUpdateThreadList(ThreadList &old_thread_list,
72  ThreadList &new_thread_list) override;
73 
74 private:
75  static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp,
76  lldb::ListenerSP listener_sp,
77  const FileSpec *crash_file_path,
78  bool can_connect);
79 };
80 
81 } // namespace lldb_private
82 
83 #endif // LLDB_TARGET_PROCESSTRACE_H
lldb_private::ProcessTrace::Initialize
static void Initialize()
Definition: ProcessTrace.cpp:90
lldb_private::ProcessInstanceInfo
Definition: ProcessInfo.h:108
lldb_private::ArchSpec
Definition: ArchSpec.h:33
lldb_private::ProcessTrace
Class that represents a defunct process loaded on memory via the "trace load" command.
Definition: ProcessTrace.h:20
lldb_private::ProcessTrace::GetProcessInfo
bool GetProcessInfo(ProcessInstanceInfo &info) override
Definition: ProcessTrace.cpp:103
lldb_private::ProcessTrace::GetPluginName
llvm::StringRef GetPluginName() override
Definition: ProcessTrace.h:43
lldb_private::ProcessTrace::Terminate
static void Terminate()
Definition: ProcessTrace.cpp:26
lldb_private::ProcessTrace::GetArchitecture
ArchSpec GetArchitecture()
Definition: ProcessTrace.cpp:99
lldb_private::SystemRuntime
Definition: SystemRuntime.h:43
lldb::addr_t
uint64_t addr_t
Definition: lldb-types.h:83
lldb_private::ProcessTrace::ReadMemory
size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) override
Read of memory from a process.
Definition: ProcessTrace.cpp:81
lldb_private::ProcessTrace::CanDebug
bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override
Check if a plug-in instance can debug the file in module.
Definition: ProcessTrace.cpp:39
lldb_private::ProcessTrace::WarnBeforeDetach
bool WarnBeforeDetach() const override
Before lldb detaches from a process, it warns the user that they are about to lose their debug sessio...
Definition: ProcessTrace.h:56
lldb_private::ProcessTrace::DoUpdateThreadList
bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) override
Update the thread list following process plug-in's specific logic.
Definition: ProcessTrace.cpp:72
lldb_private::FileSpec
Definition: FileSpec.h:56
error
static llvm::raw_ostream & error(Stream &strm)
Definition: CommandReturnObject.cpp:17
lldb_private::ProcessTrace::DoReadMemory
size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) override
Actually do the reading of memory from a process.
Definition: ProcessTrace.cpp:116
lldb_private::ProcessTrace::GetSystemRuntime
SystemRuntime * GetSystemRuntime() override
Get the system runtime plug-in for this process.
Definition: ProcessTrace.h:41
lldb_private::ProcessTrace::WillResume
Status WillResume() override
Called before resuming to a process.
Definition: ProcessTrace.h:49
lldb_private::ThreadList
Definition: ThreadList.h:26
lldb_private::PostMortemProcess
Definition: PostMortemProcess.h:23
lldb_private::DynamicLoader
Definition: DynamicLoader.h:52
lldb_private::ProcessTrace::Clear
void Clear()
Definition: ProcessTrace.cpp:88
lldb_private::ProcessTrace::ProcessTrace
ProcessTrace(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp)
Definition: ProcessTrace.cpp:43
lldb_private::ProcessTrace::~ProcessTrace
~ProcessTrace() override
Definition: ProcessTrace.cpp:46
PostMortemProcess.h
lldb_private::ProcessTrace::GetPluginDescriptionStatic
static llvm::StringRef GetPluginDescriptionStatic()
Definition: ProcessTrace.cpp:22
lldb_private::Status
Definition: Status.h:44
lldb_private::ProcessTrace::GetDynamicLoader
DynamicLoader * GetDynamicLoader() override
Get the dynamic loader plug-in for this process.
Definition: ProcessTrace.h:39
lldb_private::ProcessTrace::DoDestroy
Status DoDestroy() override
Definition: ProcessTrace.cpp:79
lldb_private::ProcessTrace::DidAttach
void DidAttach(ArchSpec &process_arch) override
Called after attaching a process.
Definition: ProcessTrace.cpp:55
Status.h
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ProcessTrace::RefreshStateAfterStop
void RefreshStateAfterStop() override
Currently called as part of ShouldStop.
Definition: ProcessTrace.cpp:77
lldb_private::ProcessTrace::GetPluginNameStatic
static llvm::StringRef GetPluginNameStatic()
Definition: ProcessTrace.h:26
ConstString.h
lldb_private::ProcessTrace::CreateInstance
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
Definition: ProcessTrace.cpp:30