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
16namespace lldb_private {
17
18/// Class that represents a defunct process loaded on memory via the "trace
19/// load" command.
21public:
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 {
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
68protected:
69 void Clear();
70
71 bool DoUpdateThreadList(ThreadList &old_thread_list,
72 ThreadList &new_thread_list) override;
73
74private:
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
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:32
A plug-in interface definition class for dynamic loaders.
Definition: DynamicLoader.h:52
A file utility class.
Definition: FileSpec.h:56
Base class for all processes that don't represent a live process, such as coredumps or processes trac...
Class that represents a defunct process loaded on memory via the "trace load" command.
Definition: ProcessTrace.h:20
static llvm::StringRef GetPluginNameStatic()
Definition: ProcessTrace.h:26
void RefreshStateAfterStop() override
Currently called as part of ShouldStop.
bool GetProcessInfo(ProcessInstanceInfo &info) override
size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) override
Actually do the reading of memory from a process.
bool CanDebug(lldb::TargetSP target_sp, bool plugin_specified_by_name) override
Check if a plug-in instance can debug the file in module.
static llvm::StringRef GetPluginDescriptionStatic()
static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path, bool can_connect)
bool DoUpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) override
Update the thread list following process plug-in's specific logic.
SystemRuntime * GetSystemRuntime() override
Get the system runtime plug-in for this process.
Definition: ProcessTrace.h:41
Status WillResume() override
Called before resuming to a process.
Definition: ProcessTrace.h:49
Status DoDestroy() override
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
size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size, Status &error) override
Read of memory from a process.
void DidAttach(ArchSpec &process_arch) override
Called after attaching a process.
llvm::StringRef GetPluginName() override
Definition: ProcessTrace.h:43
DynamicLoader * GetDynamicLoader() override
Get the dynamic loader plug-in for this process.
Definition: ProcessTrace.h:39
An error handling class.
Definition: Status.h:44
A plug-in interface definition class for system runtimes.
Definition: SystemRuntime.h:43
A class that represents a running process on the host machine.
uint64_t addr_t
Definition: lldb-types.h:83