Index: lldb/include/lldb/Utility/Args.h =================================================================== --- lldb/include/lldb/Utility/Args.h +++ lldb/include/lldb/Utility/Args.h @@ -14,6 +14,7 @@ #include "lldb/lldb-types.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" +#include "llvm/Support/YAMLTraits.h" #include #include #include @@ -373,4 +374,14 @@ } // namespace lldb_private +namespace llvm { +namespace yaml { +template <> struct ScalarTraits { + static void output(const lldb_private::Args &, void *, raw_ostream &); + static StringRef input(StringRef, void *, lldb_private::Args &); + static QuotingType mustQuote(StringRef S) { return QuotingType::Double; } +}; +} // namespace yaml +} // namespace llvm + #endif // LLDB_UTILITY_ARGS_H Index: lldb/source/Utility/Args.cpp =================================================================== --- lldb/source/Utility/Args.cpp +++ lldb/source/Utility/Args.cpp @@ -684,3 +684,16 @@ m_suffix = std::string(original_args); } } + +void llvm::yaml::ScalarTraits::output(const Args &Val, void *, + llvm::raw_ostream &Out) { + std::string str; + Val.GetCommandString(str); + Out << str; +} + +llvm::StringRef llvm::yaml::ScalarTraits::input(llvm::StringRef Scalar, + void *, Args &Val) { + Val.SetCommandString(Scalar); + return {}; +} Index: lldb/source/Utility/ProcessInfo.cpp =================================================================== --- lldb/source/Utility/ProcessInfo.cpp +++ lldb/source/Utility/ProcessInfo.cpp @@ -337,6 +337,7 @@ IO &io, ProcessInstanceInfo &Info) { io.mapRequired("executable", Info.m_executable); io.mapRequired("arg0", Info.m_arg0); + io.mapRequired("args", Info.m_arguments); io.mapRequired("arch", Info.m_arch); io.mapRequired("uid", Info.m_uid); io.mapRequired("gid", Info.m_gid); Index: lldb/test/Shell/Reproducer/TestProcessList.test =================================================================== --- /dev/null +++ lldb/test/Shell/Reproducer/TestProcessList.test @@ -0,0 +1,21 @@ +# UNSUPPORTED: system-freebsd + +# Test that ProcessInfo is correctly serialized by comparing the output of +# 'platform process list -v' during capture and replay. The test assumes that +# there's at least two processes. + +# RUN: %lldb -x -b -o 'platform process list -v' -o 'reproducer generate' --capture --capture-path %t.repro > %t.log +# RUN: %lldb --replay %t.repro >> %t.log +# RUN: cat %t.log | FileCheck %s + +# CHECK: [[PROCS:[0-9]+]] matching processes were found +# CHECK: PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE ARGUMENTS +# CHECK-NEXT: ====== ====== ========== ========== ========== ========== ============================== ============================ +# CHECK-NEXT: [[PID0:[0-9]+]] [[PROC0:.*]] +# CHECK-NEXT: [[PID1:[0-9]+]] [[PROC1:.*]] +# CHECK: Reproducer written to +# CHECK: [[PROCS]] matching processes were found +# CHECK: PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE ARGUMENTS +# CHECK-NEXT: ====== ====== ========== ========== ========== ========== ============================== ============================ +# CHECK-NEXT: [[PID0]] [[PROC0]] +# CHECK-NEXT: [[PID1]] [[PROC1]]