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  Thread &GetThread();
54 
55 protected:
58 
60 
61  virtual void Log();
62 
63 private:
64  bool TracerExplainsStop();
65 
66  bool m_enabled;
67  lldb::StreamSP m_stream_sp;
69 };
70 
72 public:
73  ThreadPlanAssemblyTracer(Thread &thread, lldb::StreamSP &stream_sp);
75  ~ThreadPlanAssemblyTracer() override;
76 
77  void TracingStarted() override;
78  void TracingEnded() override;
79  void Log() override;
80 
81 private:
83 
85 
86  lldb::DisassemblerSP m_disassembler_sp;
88  std::vector<RegisterValue> m_register_values;
89  lldb::DataBufferSP m_buffer_sp;
90 };
91 
92 } // namespace lldb_private
93 
94 #endif // LLDB_TARGET_THREADPLANTRACER_H
lldb_private::ThreadPlanTracer::m_stream_sp
lldb::StreamSP m_stream_sp
Definition: ThreadPlanTracer.h:67
lldb_private::ThreadPlanAssemblyTracer::TracingStarted
void TracingStarted() override
Definition: ThreadPlanTracer.cpp:125
lldb_private::ThreadPlanAssemblyTracer::GetIntPointerType
TypeFromUser GetIntPointerType()
Definition: ThreadPlanTracer.cpp:104
lldb_private::ThreadPlanTracer::m_enabled
bool m_enabled
Definition: ThreadPlanTracer.h:66
lldb_private::ThreadPlanTracer::eLocation
@ eLocation
Definition: ThreadPlanTracer.h:25
lldb_private::Process
Definition: Process.h:338
lldb_private::ThreadPlanTracer
Definition: ThreadPlanTracer.h:20
RegisterValue.h
lldb_private::Stream
Definition: Stream.h:28
lldb_private::ThreadPlanTracer::TracingEnabled
bool TracingEnabled()
Definition: ThreadPlanTracer.h:51
lldb_private::ThreadPlanTracer::GetLogStream
Stream * GetLogStream()
Definition: ThreadPlanTracer.cpp:45
lldb_private::ThreadPlanTracer::eStateChange
@ eStateChange
Definition: ThreadPlanTracer.h:26
lldb_private::ThreadPlanAssemblyTracer::m_intptr_type
TypeFromUser m_intptr_type
Definition: ThreadPlanTracer.h:87
lldb_private::ThreadPlanTracer::Log
virtual void Log()
Definition: ThreadPlanTracer.cpp:64
lldb_private::ThreadPlan
Definition: ThreadPlan.h:287
lldb_private::ThreadPlanTracer::eCheckFrames
@ eCheckFrames
Definition: ThreadPlanTracer.h:27
lldb_private::ThreadPlanTracer::ePython
@ ePython
Definition: ThreadPlanTracer.h:28
lldb_private::Thread
Definition: Thread.h:61
lldb_private::TaggedASTType< 1 >
lldb_private::ThreadPlanAssemblyTracer
Definition: ThreadPlanTracer.h:71
lldb_private::ThreadPlanAssemblyTracer::GetDisassembler
Disassembler * GetDisassembler()
Definition: ThreadPlanTracer.cpp:97
lldb_private::ThreadPlanAssemblyTracer::ThreadPlanAssemblyTracer
ThreadPlanAssemblyTracer(Thread &thread, lldb::StreamSP &stream_sp)
Definition: ThreadPlanTracer.cpp:88
lldb_private::ThreadPlanTracer::m_tid
lldb::tid_t m_tid
Definition: ThreadPlanTracer.h:57
Thread.h
lldb_private::ThreadPlanAssemblyTracer::~ThreadPlanAssemblyTracer
~ThreadPlanAssemblyTracer() override
lldb-private.h
lldb_private::ThreadPlanAssemblyTracer::m_buffer_sp
lldb::DataBufferSP m_buffer_sp
Definition: ThreadPlanTracer.h:89
lldb_private::ThreadPlanAssemblyTracer::m_register_values
std::vector< RegisterValue > m_register_values
Definition: ThreadPlanTracer.h:88
lldb_private::ThreadPlanTracer::EnableTracing
bool EnableTracing(bool value)
Definition: ThreadPlanTracer.h:40
lldb_private::ThreadPlanAssemblyTracer::Log
void Log() override
Definition: ThreadPlanTracer.cpp:130
lldb_private::ThreadPlanAssemblyTracer::TracingEnded
void TracingEnded() override
Definition: ThreadPlanTracer.cpp:128
TaggedASTType.h
lldb_private::ThreadPlanTracer::m_process
Process & m_process
Definition: ThreadPlanTracer.h:56
lldb_private::ThreadPlanTracer::~ThreadPlanTracer
virtual ~ThreadPlanTracer()=default
lldb_private::Disassembler
Definition: Disassembler.h:378
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::ThreadPlanTracer::ThreadPlanTracer
ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp)
Definition: ThreadPlanTracer.cpp:37
lldb_private::ThreadPlanAssemblyTracer::m_disassembler_sp
lldb::DisassemblerSP m_disassembler_sp
Definition: ThreadPlanTracer.h:86
lldb_private::ThreadPlanTracer::ThreadPlanTracerStyle
ThreadPlanTracerStyle
Definition: ThreadPlanTracer.h:24
lldb_private::ThreadPlanTracer::TracingStarted
virtual void TracingStarted()
Definition: ThreadPlanTracer.h:36
lldb_private::ThreadPlanTracer::TracingEnded
virtual void TracingEnded()
Definition: ThreadPlanTracer.h:38
lldb_private::ThreadPlanTracer::TracerExplainsStop
bool TracerExplainsStop()
Definition: ThreadPlanTracer.cpp:78
lldb_private::ThreadPlanTracer::GetThread
Thread & GetThread()
Definition: ThreadPlanTracer.cpp:56
lldb_private::ThreadPlanTracer::m_thread
Thread * m_thread
Definition: ThreadPlanTracer.h:68
lldb::tid_t
uint64_t tid_t
Definition: lldb-types.h:86