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 liblldb_ThreadPlanTracer_h_
11 #define liblldb_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:
24  typedef enum ThreadPlanTracerStyle {
25  eLocation = 0,
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 protected:
63 
65 
66  virtual void Log();
67 
68 private:
69  bool TracerExplainsStop();
70 
71  bool m_single_step;
72  bool m_enabled;
73  lldb::StreamSP m_stream_sp;
74 };
75 
77 public:
78  ThreadPlanAssemblyTracer(Thread &thread, lldb::StreamSP &stream_sp);
80  ~ThreadPlanAssemblyTracer() override;
81 
82  void TracingStarted() override;
83  void TracingEnded() override;
84  void Log() override;
85 
86 private:
87  Disassembler *GetDisassembler();
88 
89  TypeFromUser GetIntPointerType();
90 
91  lldb::DisassemblerSP m_disassembler_sp;
92  TypeFromUser m_intptr_type;
93  std::vector<RegisterValue> m_register_values;
94  lldb::DataBufferSP m_buffer_sp;
95 };
96 
97 } // namespace lldb_private
98 
99 #endif // liblldb_ThreadPlanTracer_h_
Enumerations for broadcasting.
Definition: SBLaunchInfo.h:14
A stream class that can stream formatted output to a file.
Definition: Stream.h:28
ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp)
virtual ~ThreadPlanTracer()=default