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 | |
12 | #include "lldb/Target/PostMortemProcess.h" |
13 | #include "lldb/Utility/ConstString.h" |
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. |
20 | class ProcessTrace : public PostMortemProcess { |
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 | 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 { |
51 | Status error; |
52 | error.SetErrorStringWithFormatv( |
53 | format: "error: {0} does not support resuming processes" , args: 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 | |
65 | ArchSpec GetArchitecture(); |
66 | |
67 | bool GetProcessInfo(ProcessInstanceInfo &info) override; |
68 | |
69 | protected: |
70 | void Clear(); |
71 | |
72 | bool DoUpdateThreadList(ThreadList &old_thread_list, |
73 | ThreadList &new_thread_list) override; |
74 | |
75 | private: |
76 | static lldb::ProcessSP CreateInstance(lldb::TargetSP target_sp, |
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 |
85 | |