mirror of
https://github.com/intel/llvm.git
synced 2026-01-21 20:53:29 +08:00
[Reproducer] Support dumping the reproducer CWD
Add support for dumping the current working directory with `reproducer dump -p cwd`. llvm-svn: 375061
This commit is contained in:
@@ -9,8 +9,8 @@
|
||||
#include "CommandObjectReproducer.h"
|
||||
|
||||
#include "lldb/Host/OptionParser.h"
|
||||
#include "lldb/Utility/Reproducer.h"
|
||||
#include "lldb/Utility/GDBRemote.h"
|
||||
#include "lldb/Utility/Reproducer.h"
|
||||
|
||||
#include "lldb/Interpreter/CommandInterpreter.h"
|
||||
#include "lldb/Interpreter/CommandReturnObject.h"
|
||||
@@ -27,6 +27,7 @@ enum ReproducerProvider {
|
||||
eReproducerProviderFiles,
|
||||
eReproducerProviderGDB,
|
||||
eReproducerProviderVersion,
|
||||
eReproducerProviderWorkingDirectory,
|
||||
eReproducerProviderNone
|
||||
};
|
||||
|
||||
@@ -51,6 +52,11 @@ static constexpr OptionEnumValueElement g_reproducer_provider_type[] = {
|
||||
"version",
|
||||
"Version",
|
||||
},
|
||||
{
|
||||
eReproducerProviderWorkingDirectory,
|
||||
"cwd",
|
||||
"Working Directory",
|
||||
},
|
||||
{
|
||||
eReproducerProviderNone,
|
||||
"none",
|
||||
@@ -274,6 +280,17 @@ protected:
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
return true;
|
||||
}
|
||||
case eReproducerProviderWorkingDirectory: {
|
||||
Expected<std::string> cwd =
|
||||
loader->LoadBuffer<WorkingDirectoryProvider>();
|
||||
if (!cwd) {
|
||||
SetError(result, cwd.takeError());
|
||||
return false;
|
||||
}
|
||||
result.AppendMessage(*cwd);
|
||||
result.SetStatus(eReturnStatusSuccessFinishResult);
|
||||
return true;
|
||||
}
|
||||
case eReproducerProviderCommands: {
|
||||
// Create a new command loader.
|
||||
std::unique_ptr<repro::CommandLoader> command_loader =
|
||||
@@ -320,7 +337,7 @@ protected:
|
||||
return false;
|
||||
}
|
||||
|
||||
for (GDBRemotePacket& packet : packets) {
|
||||
for (GDBRemotePacket &packet : packets) {
|
||||
packet.Dump(result.GetOutputStream());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user