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 const FileSpec &core_file);
32
33 ~ProcessTrace() override;
34
35 bool CanDebug(lldb::TargetSP target_sp,
36 bool plugin_specified_by_name) override;
37
38 void DidAttach(ArchSpec &process_arch) override;
39
40 DynamicLoader *GetDynamicLoader() override { return nullptr; }
41
42 SystemRuntime *GetSystemRuntime() override { return nullptr; }
43
44 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
45
46 Status DoDestroy() override;
47
48 void RefreshStateAfterStop() override;
49
50 Status WillResume() override {
52 error.SetErrorStringWithFormatv(
53 "error: {0} does not support resuming processes", GetPluginName());
54 return error;
55 }
56
57 bool WarnBeforeDetach() const override { return false; }
58
59 size_t ReadMemory(lldb::addr_t addr, void *buf, size_t size,
60 Status &error) override;
61
62 size_t DoReadMemory(lldb::addr_t addr, void *buf, size_t size,
63 Status &error) override;
64
66
67 bool GetProcessInfo(ProcessInstanceInfo &info) override;
68
69protected:
70 void Clear();
71
72 bool DoUpdateThreadList(ThreadList &old_thread_list,
73 ThreadList &new_thread_list) override;
74
75private:
77 lldb::ListenerSP listener_sp,
78 const FileSpec *crash_file_path,
79 bool can_connect);
80};
81
82} // namespace lldb_private
83
84#endif // LLDB_TARGET_PROCESSTRACE_H
static llvm::raw_ostream & error(Stream &strm)
An architecture specification class.
Definition: ArchSpec.h:31
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:42
Status WillResume() override
Called before resuming to a process.
Definition: ProcessTrace.h:50
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:57
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:44
DynamicLoader * GetDynamicLoader() override
Get the dynamic loader plug-in for this process.
Definition: ProcessTrace.h:40
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.
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:384
std::shared_ptr< lldb_private::Listener > ListenerSP
Definition: lldb-forward.h:363
uint64_t addr_t
Definition: lldb-types.h:80
std::shared_ptr< lldb_private::Target > TargetSP
Definition: lldb-forward.h:439