LLDB  mainline
SBReproducerPrivate.h
Go to the documentation of this file.
1 //===-- SBReproducerPrivate.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_SOURCE_API_SBREPRODUCERPRIVATE_H
11 #define LLDB_SOURCE_API_SBREPRODUCERPRIVATE_H
12 
13 #include "lldb/API/SBReproducer.h"
14 
15 #include "lldb/Utility/FileSpec.h"
16 #include "lldb/Utility/Log.h"
20 
21 #include "llvm/ADT/DenseMap.h"
22 
23 #define LLDB_GET_INSTRUMENTATION_DATA() \
24  lldb_private::repro::InstrumentationData::Instance()
25 
26 namespace lldb_private {
27 namespace repro {
28 
29 class SBRegistry : public Registry {
30 public:
31  SBRegistry();
32 };
33 
34 class SBProvider : public Provider<SBProvider> {
35 public:
36  struct Info {
37  static const char *name;
38  static const char *file;
39  };
40 
41  SBProvider(const FileSpec &directory)
42  : Provider(directory),
43  m_stream(directory.CopyByAppendingPathComponent("sbapi.bin").GetPath(),
44  m_ec, llvm::sys::fs::OpenFlags::OF_None),
46 
49 
50  static char ID;
51 
52 private:
53  std::error_code m_ec;
54  llvm::raw_fd_ostream m_stream;
57 };
58 
59 class ReplayData {
60 public:
61  ReplayData(std::unique_ptr<llvm::MemoryBuffer> memory_buffer)
62  : m_memory_buffer(std::move(memory_buffer)), m_registry(),
63  m_deserializer(m_memory_buffer->getBuffer()) {}
66 
67 private:
68  std::unique_ptr<llvm::MemoryBuffer> m_memory_buffer;
71 };
72 
73 template <typename T> void RegisterMethods(Registry &R);
74 
75 } // namespace repro
76 } // namespace lldb_private
77 
78 #endif
lldb_private::repro::SBProvider::m_registry
SBRegistry m_registry
Definition: SBReproducerPrivate.h:56
llvm
Definition: Debugger.h:49
lldb_private::repro::SBProvider::Info::name
static const char * name
Definition: SBReproducerPrivate.h:37
lldb_private::repro::ReplayData::ReplayData
ReplayData(std::unique_ptr< llvm::MemoryBuffer > memory_buffer)
Definition: SBReproducerPrivate.h:61
lldb_private::repro::SBProvider::SBProvider
SBProvider(const FileSpec &directory)
Definition: SBReproducerPrivate.h:41
lldb_private::repro::SBProvider::m_serializer
Serializer m_serializer
Definition: SBReproducerPrivate.h:55
lldb_private::repro::SBRegistry::SBRegistry
SBRegistry()
Definition: SBReproducer.cpp:59
lldb_private::repro::SBRegistry
Definition: SBReproducerPrivate.h:29
lldb_private::repro::ReplayData::m_deserializer
Deserializer m_deserializer
Definition: SBReproducerPrivate.h:70
lldb_private::repro::Deserializer
Deserializes data from a buffer.
Definition: ReproducerInstrumentation.h:318
Reproducer.h
lldb_private::repro::Provider
Definition: Reproducer.h:75
lldb_private::repro::SBProvider::GetRegistry
Registry & GetRegistry()
Definition: SBReproducerPrivate.h:48
lldb_private::repro::SBProvider::Info
Definition: SBReproducerPrivate.h:36
lldb_private::repro::ReplayData::m_registry
SBRegistry m_registry
Definition: SBReproducerPrivate.h:69
ReproducerProvider.h
lldb_private::FileSpec
Definition: FileSpec.h:56
Log.h
lldb_private::repro::SBProvider::GetSerializer
Serializer & GetSerializer()
Definition: SBReproducerPrivate.h:47
lldb_private::repro::Serializer
Serializes functions, their arguments and their return type to a stream.
Definition: ReproducerInstrumentation.h:606
lldb_private::repro::SBProvider::m_ec
std::error_code m_ec
Definition: SBReproducerPrivate.h:53
lldb_private::repro::SBProvider::Info::file
static const char * file
Definition: SBReproducerPrivate.h:38
ReproducerInstrumentation.h
lldb_private::repro::Registry
The registry contains a unique mapping between functions and their ID.
Definition: ReproducerInstrumentation.h:517
lldb_private::repro::SBProvider
Definition: SBReproducerPrivate.h:34
lldb_private::repro::ReplayData
Definition: SBReproducerPrivate.h:59
lldb_private::repro::ReplayData::GetDeserializer
Deserializer & GetDeserializer()
Definition: SBReproducerPrivate.h:64
lldb_private::repro::SBProvider::m_stream
llvm::raw_fd_ostream m_stream
Definition: SBReproducerPrivate.h:54
lldb_private::repro::ReplayData::m_memory_buffer
std::unique_ptr< llvm::MemoryBuffer > m_memory_buffer
Definition: SBReproducerPrivate.h:68
SBReproducer.h
lldb_private::repro::SBProvider::ID
static char ID
Definition: SBReproducerPrivate.h:50
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
lldb_private::repro::ReplayData::GetRegistry
Registry & GetRegistry()
Definition: SBReproducerPrivate.h:65
FileSpec.h
lldb_private::repro::RegisterMethods
void RegisterMethods(Registry &R)