LLDB  mainline
ThreadPlanTracer.h
Go to the documentation of this file.
1 //===-- ThreadPlanTracer.h --------------------------------------------*- C++
2 //-*-===//
3 //
4 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 // See https://llvm.org/LICENSE.txt for license information.
6 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_TARGET_THREADPLANTRACER_H
11 #define LLDB_TARGET_THREADPLANTRACER_H
12 
14 #include "lldb/Target/Thread.h"
16 #include "lldb/lldb-private.h"
17 
18 namespace lldb_private {
19 
21  friend class ThreadPlan;
22 
23 public:
25  eLocation = 0,
29  };
30 
31  ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp);
32  ThreadPlanTracer(Thread &thread);
33 
34  virtual ~ThreadPlanTracer() = default;
35 
36  virtual void TracingStarted() {}
37 
38  virtual void TracingEnded() {}
39 
40  bool EnableTracing(bool value) {
41  bool old_value = m_enabled;
42  m_enabled = value;
43  if (old_value == false && value == true)
45  else if (old_value == true && value == false)
46  TracingEnded();
47 
48  return old_value;
49  }
50 
51  bool TracingEnabled() { return m_enabled; }
52 
53  bool EnableSingleStep(bool value) {
54  bool old_value = m_single_step;
55  m_single_step = value;
56  return old_value;
57  }
58 
59  bool SingleStepEnabled() { return m_single_step; }
60 
61  Thread &GetThread();
62 
63 protected:
66 
68 
69  virtual void Log();
70 
71 private:
72  bool TracerExplainsStop();
73 
75  bool m_enabled;
76  lldb::StreamSP m_stream_sp;
78 };
79 
81 public:
82  ThreadPlanAssemblyTracer(Thread &thread, lldb::StreamSP &stream_sp);
84  ~ThreadPlanAssemblyTracer() override;
85 
86  void TracingStarted() override;
87  void TracingEnded() override;
88  void Log() override;
89 
90 private:
91  Disassembler *GetDisassembler();
92 
93  TypeFromUser GetIntPointerType();
94 
95  lldb::DisassemblerSP m_disassembler_sp;
97  std::vector<RegisterValue> m_register_values;
98  lldb::DataBufferSP m_buffer_sp;
99 };
100 
101 } // namespace lldb_private
102 
103 #endif // LLDB_TARGET_THREADPLANTRACER_H
A class that represents a running process on the host machine.
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
uint64_t tid_t
Definition: lldb-types.h:86
A plug-in interface definition class for debugging a process.
Definition: Process.h:362
std::vector< RegisterValue > m_register_values
ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp)
virtual ~ThreadPlanTracer()=default