Index: include/lldb/Interpreter/Args.h =================================================================== --- include/lldb/Interpreter/Args.h +++ include/lldb/Interpreter/Args.h @@ -93,12 +93,31 @@ //------------------------------------------------------------------ /// Dump all arguments to the stream \a s. /// + /// This is equivalent to calling Dump (s, "argv"). + /// + /// @param[in] s + /// The stream to which to dump all arguments in the argument + /// vector. + //------------------------------------------------------------------ + void + Dump (Stream *s) const; + + //------------------------------------------------------------------ + /// Dump all arguments to the stream \a s. + /// + /// If either \a s or \a label_name is nullptr, the dump operation + /// is skipped. + /// /// @param[in] s /// The stream to which to dump all arguments in the argument /// vector. + /// @param[in] label_name + /// Use the label_name as the name printed for each + /// entry of the args like so: + /// {label_name}[{index}]={value} //------------------------------------------------------------------ void - Dump (Stream *s); + Dump (Stream *s, const char *label_name) const; //------------------------------------------------------------------ /// Sets the command string contained by this object. Index: source/Interpreter/Args.cpp =================================================================== --- source/Interpreter/Args.cpp +++ source/Interpreter/Args.cpp @@ -83,17 +83,26 @@ } void -Args::Dump (Stream *s) +Args::Dump (Stream *s) const { + Dump(s, "argv"); +} + +void +Args::Dump (Stream *s, const char *label_name) const +{ + if (!s || !label_name) + return; + const size_t argc = m_argv.size(); for (size_t i=0; iIndent(); const char *arg_cstr = m_argv[i]; if (arg_cstr) - s->Printf("argv[%zi]=\"%s\"\n", i, arg_cstr); + s->Printf("%s[%zi]=\"%s\"\n", label_name, i, arg_cstr); else - s->Printf("argv[%zi]=NULL\n", i); + s->Printf("%s[%zi]=NULL\n", label_name, i); } s->EOL(); } Index: source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp =================================================================== --- source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -1120,7 +1120,7 @@ { Log *log (ProcessGDBRemoteLog::GetLogIfAllCategoriesSet (GDBR_LOG_PROCESS)); if (log) - log->Printf ("GDBRemoteCommunication::%s(url=%s, port=%" PRIu16, __FUNCTION__, url ? url : "", port ? *port : uint16_t(0)); + log->Printf ("GDBRemoteCommunication::%s(url=%s, port=%" PRIu16 ")", __FUNCTION__, url ? url : "", port ? *port : uint16_t(0)); Error error; // If we locate debugserver, keep that located version around @@ -1352,7 +1352,14 @@ launch_info.AppendSuppressFileAction (STDIN_FILENO, true, false); launch_info.AppendSuppressFileAction (STDOUT_FILENO, false, true); launch_info.AppendSuppressFileAction (STDERR_FILENO, false, true); - + + if (log) + { + StreamString string_stream; + Platform *const platform = nullptr; + launch_info.Dump(string_stream, platform); + log->Printf("launch info for gdb-remote stub:\n%s", string_stream.GetString().c_str()); + } error = Host::LaunchProcess(launch_info); if (error.Success() && Index: source/Target/ProcessInfo.cpp =================================================================== --- source/Target/ProcessInfo.cpp +++ source/Target/ProcessInfo.cpp @@ -15,6 +15,8 @@ // Project includes #include "lldb/Target/ProcessInfo.h" +#include "lldb/Core/Stream.h" + using namespace lldb; using namespace lldb_private; @@ -65,6 +67,21 @@ } void +ProcessInfo::Dump (Stream &s, Platform *platform) const +{ + s << "Executable: " << GetName() << "\n"; + s << "Triple: "; + m_arch.DumpTriple(s); + s << "\n"; + + s << "Arguments:\n"; + m_arguments.Dump(&s); + + s << "Environment:\n"; + m_environment.Dump(&s, "env"); +} + +void ProcessInfo::SetExecutableFile (const FileSpec &exe_file, bool add_exe_file_as_first_arg) { if (exe_file)