Skip to content

Commit 04d62ec

Browse files
authored
Merge pull request #1827 from JDevlieghere/cherrypick-reproducer-backlog
Cherrypick reproducer backlog
2 parents 3579f7f + 21ed509 commit 04d62ec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1275
-516
lines changed

lldb/include/lldb/API/SBReproducer.h

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,32 @@
1111

1212
#include "lldb/API/SBDefines.h"
1313

14+
namespace lldb_private {
15+
namespace repro {
16+
struct ReplayOptions;
17+
}
18+
} // namespace lldb_private
19+
1420
namespace lldb {
1521

22+
class LLDB_API SBReplayOptions {
23+
public:
24+
SBReplayOptions();
25+
SBReplayOptions(const SBReplayOptions &rhs);
26+
~SBReplayOptions();
27+
28+
SBReplayOptions &operator=(const SBReplayOptions &rhs);
29+
30+
void SetVerify(bool verify);
31+
bool GetVerify() const;
32+
33+
void SetCheckVersion(bool check);
34+
bool GetCheckVersion() const;
35+
36+
private:
37+
std::unique_ptr<lldb_private::repro::ReplayOptions> m_opaque_up;
38+
};
39+
1640
/// The SBReproducer class is special because it bootstraps the capture and
1741
/// replay of SB API calls. As a result we cannot rely on any other SB objects
1842
/// in the interface or implementation of this class.
@@ -22,6 +46,7 @@ class LLDB_API SBReproducer {
2246
static const char *Capture(const char *path);
2347
static const char *Replay(const char *path);
2448
static const char *Replay(const char *path, bool skip_version_check);
49+
static const char *Replay(const char *path, const SBReplayOptions &options);
2550
static const char *PassiveReplay(const char *path);
2651
static const char *GetPath();
2752
static bool SetAutoGenerate(bool b);

lldb/include/lldb/Core/IOHandler.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "lldb/Utility/ConstString.h"
1616
#include "lldb/Utility/Flags.h"
1717
#include "lldb/Utility/Predicate.h"
18-
#include "lldb/Utility/Reproducer.h"
1918
#include "lldb/Utility/Stream.h"
2019
#include "lldb/Utility/StringList.h"
2120
#include "lldb/lldb-defines.h"
@@ -32,6 +31,9 @@
3231

3332
namespace lldb_private {
3433
class Debugger;
34+
namespace repro {
35+
class DataRecorder;
36+
}
3537
}
3638

3739
namespace curses {

lldb/include/lldb/Host/FileSystem.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,14 @@ class FileSystem {
3333

3434
FileSystem()
3535
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(nullptr),
36-
m_mapped(false) {}
36+
m_home_directory(), m_mapped(false) {}
3737
FileSystem(std::shared_ptr<llvm::FileCollector> collector)
38-
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(collector),
39-
m_mapped(false) {}
38+
: m_fs(llvm::vfs::getRealFileSystem()), m_collector(std::move(collector)),
39+
m_home_directory(), m_mapped(false) {}
4040
FileSystem(llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> fs,
4141
bool mapped = false)
42-
: m_fs(fs), m_collector(nullptr), m_mapped(mapped) {}
42+
: m_fs(std::move(fs)), m_collector(nullptr), m_home_directory(),
43+
m_mapped(mapped) {}
4344

4445
FileSystem(const FileSystem &fs) = delete;
4546
FileSystem &operator=(const FileSystem &fs) = delete;
@@ -193,10 +194,13 @@ class FileSystem {
193194
void Collect(const FileSpec &file_spec);
194195
void Collect(const llvm::Twine &file);
195196

197+
void SetHomeDirectory(std::string home_directory);
198+
196199
private:
197200
static llvm::Optional<FileSystem> &InstanceImpl();
198201
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> m_fs;
199202
std::shared_ptr<llvm::FileCollector> m_collector;
203+
std::string m_home_directory;
200204
bool m_mapped;
201205
};
202206
} // namespace lldb_private

lldb/include/lldb/Utility/ArchSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ class ArchSpec {
505505

506506
void SetFlags(uint32_t flags) { m_flags = flags; }
507507

508-
void SetFlags(std::string elf_abi);
508+
void SetFlags(const std::string &elf_abi);
509509

510510
protected:
511511
bool IsEqualTo(const ArchSpec &rhs, bool exact_match) const;

lldb/include/lldb/Utility/Broadcaster.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace lldb_private {
3939
/// Debugger maintains a list of BroadcastEventSpec's and when it is made
4040
class BroadcastEventSpec {
4141
public:
42-
BroadcastEventSpec(ConstString broadcaster_class, uint32_t event_bits)
42+
BroadcastEventSpec(const ConstString &broadcaster_class, uint32_t event_bits)
4343
: m_broadcaster_class(broadcaster_class), m_event_bits(event_bits) {}
4444

4545
~BroadcastEventSpec() = default;
@@ -117,7 +117,7 @@ class BroadcasterManager
117117

118118
class BroadcasterClassMatches {
119119
public:
120-
BroadcasterClassMatches(ConstString broadcaster_class)
120+
BroadcasterClassMatches(const ConstString &broadcaster_class)
121121
: m_broadcaster_class(broadcaster_class) {}
122122

123123
~BroadcasterClassMatches() = default;

lldb/include/lldb/Utility/ConstString.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class ConstString {
133133
///
134134
/// \return
135135
/// A const reference to this object.
136-
ConstString operator=(ConstString rhs) {
136+
ConstString operator=(const ConstString &rhs) {
137137
m_string = rhs.m_string;
138138
return *this;
139139
}
@@ -150,7 +150,7 @@ class ConstString {
150150
/// \return
151151
/// true if this object is equal to \a rhs.
152152
/// false if this object is not equal to \a rhs.
153-
bool operator==(ConstString rhs) const {
153+
bool operator==(const ConstString &rhs) const {
154154
// We can do a pointer compare to compare these strings since they must
155155
// come from the same pool in order to be equal.
156156
return m_string == rhs.m_string;
@@ -192,7 +192,7 @@ class ConstString {
192192
/// \return
193193
/// \b true if this object is not equal to \a rhs.
194194
/// \b false if this object is equal to \a rhs.
195-
bool operator!=(ConstString rhs) const {
195+
bool operator!=(const ConstString &rhs) const {
196196
return m_string != rhs.m_string;
197197
}
198198

@@ -209,7 +209,7 @@ class ConstString {
209209
/// \return \b true if this object is not equal to \a rhs, false otherwise.
210210
bool operator!=(const char *rhs) const { return !(*this == rhs); }
211211

212-
bool operator<(ConstString rhs) const;
212+
bool operator<(const ConstString &rhs) const;
213213

214214
/// Get the string value as a C string.
215215
///
@@ -279,7 +279,7 @@ class ConstString {
279279
/// will be tested, otherwise character case will be ignored
280280
///
281281
/// \return \b true if this object is equal to \a rhs, \b false otherwise.
282-
static bool Equals(ConstString lhs, ConstString rhs,
282+
static bool Equals(const ConstString &lhs, const ConstString &rhs,
283283
const bool case_sensitive = true);
284284

285285
/// Compare two string objects.
@@ -303,7 +303,7 @@ class ConstString {
303303
/// will be performed, otherwise character case will be ignored
304304
///
305305
/// \return -1 if lhs < rhs, 0 if lhs == rhs, 1 if lhs > rhs
306-
static int Compare(ConstString lhs, ConstString rhs,
306+
static int Compare(const ConstString &lhs, const ConstString &rhs,
307307
const bool case_sensitive = true);
308308

309309
/// Dump the object description to a stream.
@@ -371,7 +371,7 @@ class ConstString {
371371
/// The already uniqued mangled ConstString to correlate the
372372
/// soon to be uniqued version of \a demangled.
373373
void SetStringWithMangledCounterpart(llvm::StringRef demangled,
374-
ConstString mangled);
374+
const ConstString &mangled);
375375

376376
/// Retrieve the mangled or demangled counterpart for a mangled or demangled
377377
/// ConstString.
@@ -452,7 +452,7 @@ class ConstString {
452452
};
453453

454454
/// Stream the string value \a str to the stream \a s
455-
Stream &operator<<(Stream &s, ConstString str);
455+
Stream &operator<<(Stream &s, const ConstString &str);
456456

457457
} // namespace lldb_private
458458

@@ -473,11 +473,11 @@ template <> struct DenseMapInfo<lldb_private::ConstString> {
473473
return lldb_private::ConstString::FromStringPoolPointer(
474474
DenseMapInfo<const char *>::getTombstoneKey());
475475
}
476-
static unsigned getHashValue(lldb_private::ConstString val) {
476+
static unsigned getHashValue(const lldb_private::ConstString &val) {
477477
return DenseMapInfo<const char *>::getHashValue(val.m_string);
478478
}
479-
static bool isEqual(lldb_private::ConstString LHS,
480-
lldb_private::ConstString RHS) {
479+
static bool isEqual(const lldb_private::ConstString &LHS,
480+
const lldb_private::ConstString &RHS) {
481481
return LHS == RHS;
482482
}
483483
};
@@ -491,7 +491,8 @@ template <> struct ScalarTraits<lldb_private::ConstString> {
491491
};
492492
} // namespace yaml
493493

494-
inline raw_ostream &operator<<(raw_ostream &os, lldb_private::ConstString s) {
494+
inline raw_ostream &operator<<(raw_ostream &os,
495+
const lldb_private::ConstString &s) {
495496
os << s.GetStringRef();
496497
return os;
497498
}

lldb/include/lldb/Utility/GDBRemote.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#define LLDB_UTILITY_GDBREMOTE_H
1111

1212
#include "lldb/Utility/FileSpec.h"
13-
#include "lldb/Utility/Reproducer.h"
13+
#include "lldb/Utility/ReproducerProvider.h"
1414
#include "lldb/Utility/StreamString.h"
1515
#include "lldb/lldb-enumerations.h"
1616
#include "lldb/lldb-public.h"

lldb/include/lldb/Utility/ProcessInfo.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include "lldb/Utility/Environment.h"
1515
#include "lldb/Utility/FileSpec.h"
1616
#include "lldb/Utility/NameMatches.h"
17-
#include "lldb/Utility/Reproducer.h"
1817
#include "llvm/Support/YAMLTraits.h"
1918
#include <vector>
2019

@@ -217,40 +216,7 @@ class ProcessInstanceInfoMatch {
217216
};
218217

219218
namespace repro {
220-
class ProcessInfoRecorder : public AbstractRecorder {
221-
public:
222-
ProcessInfoRecorder(const FileSpec &filename, std::error_code &ec)
223-
: AbstractRecorder(filename, ec) {}
224-
225-
static llvm::Expected<std::unique_ptr<ProcessInfoRecorder>>
226-
Create(const FileSpec &filename);
227-
228-
void Record(const ProcessInstanceInfoList &process_infos);
229-
};
230-
231-
class ProcessInfoProvider : public repro::Provider<ProcessInfoProvider> {
232-
public:
233-
struct Info {
234-
static const char *name;
235-
static const char *file;
236-
};
237-
238-
ProcessInfoProvider(const FileSpec &directory) : Provider(directory) {}
239-
240-
ProcessInfoRecorder *GetNewProcessInfoRecorder();
241-
242-
void Keep() override;
243-
void Discard() override;
244-
245-
static char ID;
246-
247-
private:
248-
std::unique_ptr<llvm::raw_fd_ostream> m_stream_up;
249-
std::vector<std::unique_ptr<ProcessInfoRecorder>> m_process_info_recorders;
250-
};
251-
252219
llvm::Optional<ProcessInstanceInfoList> GetReplayProcessInstanceInfoList();
253-
254220
} // namespace repro
255221
} // namespace lldb_private
256222

lldb/include/lldb/Utility/RegisterValue.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/ADT/StringRef.h"
1919
#include <cstdint>
2020
#include <cstring>
21+
#include <utility>
2122

2223
namespace lldb_private {
2324
class DataExtractor;
@@ -60,7 +61,7 @@ class RegisterValue {
6061
}
6162

6263
explicit RegisterValue(llvm::APInt inst) : m_type(eTypeUInt128) {
63-
m_scalar = llvm::APInt(inst);
64+
m_scalar = llvm::APInt(std::move(inst));
6465
}
6566

6667
explicit RegisterValue(float value) : m_type(eTypeFloat) { m_scalar = value; }
@@ -169,7 +170,7 @@ class RegisterValue {
169170

170171
void operator=(llvm::APInt uint) {
171172
m_type = eTypeUInt128;
172-
m_scalar = llvm::APInt(uint);
173+
m_scalar = llvm::APInt(std::move(uint));
173174
}
174175

175176
void operator=(float f) {
@@ -209,7 +210,7 @@ class RegisterValue {
209210

210211
void SetUInt128(llvm::APInt uint) {
211212
m_type = eTypeUInt128;
212-
m_scalar = uint;
213+
m_scalar = std::move(uint);
213214
}
214215

215216
bool SetUInt(uint64_t uint, uint32_t byte_size);

0 commit comments

Comments
 (0)