Coverage Report

Created: 2022-01-25 06:29

/Users/buildslave/jenkins/workspace/coverage/llvm-project/lldb/include/lldb/Target/ThreadPlanTracer.h
Line
Count
Source (jump to first uncovered line)
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
13
#include "lldb/Symbol/TaggedASTType.h"
14
#include "lldb/Target/Thread.h"
15
#include "lldb/Utility/RegisterValue.h"
16
#include "lldb/lldb-private.h"
17
18
namespace lldb_private {
19
20
class ThreadPlanTracer {
21
  friend class ThreadPlan;
22
23
public:
24
  enum ThreadPlanTracerStyle {
25
    eLocation = 0,
26
    eStateChange,
27
    eCheckFrames,
28
    ePython
29
  };
30
31
  ThreadPlanTracer(Thread &thread, lldb::StreamSP &stream_sp);
32
  ThreadPlanTracer(Thread &thread);
33
34
3.34k
  virtual ~ThreadPlanTracer() = default;
35
36
0
  virtual void TracingStarted() {}
37
38
0
  virtual void TracingEnded() {}
39
40
3.34k
  bool EnableTracing(bool value) {
41
3.34k
    bool old_value = m_enabled;
42
3.34k
    m_enabled = value;
43
3.34k
    if (old_value == false && value == true)
44
0
      TracingStarted();
45
3.34k
    else if (old_value == true && 
value == false0
)
46
0
      TracingEnded();
47
48
3.34k
    return old_value;
49
3.34k
  }
50
51
51.7k
  bool TracingEnabled() { return m_enabled; }
52
53
  Thread &GetThread();
54
55
protected:
56
  Process &m_process;
57
  lldb::tid_t m_tid;
58
59
  Stream *GetLogStream();
60
61
  virtual void Log();
62
63
private:
64
  bool TracerExplainsStop();
65
66
  bool m_enabled;
67
  lldb::StreamSP m_stream_sp;
68
  Thread *m_thread;
69
};
70
71
class ThreadPlanAssemblyTracer : public ThreadPlanTracer {
72
public:
73
  ThreadPlanAssemblyTracer(Thread &thread, lldb::StreamSP &stream_sp);
74
  ThreadPlanAssemblyTracer(Thread &thread);
75
  ~ThreadPlanAssemblyTracer() override;
76
77
  void TracingStarted() override;
78
  void TracingEnded() override;
79
  void Log() override;
80
81
private:
82
  Disassembler *GetDisassembler();
83
84
  TypeFromUser GetIntPointerType();
85
86
  lldb::DisassemblerSP m_disassembler_sp;
87
  TypeFromUser m_intptr_type;
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