diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp @@ -610,9 +610,9 @@ if (m_supports_jLoadedDynamicLibrariesInfos == eLazyBoolCalculate) { StringExtractorGDBRemote response; m_supports_jLoadedDynamicLibrariesInfos = eLazyBoolNo; - if (SendPacketAndWaitForResponse("jGetLoadedDynamicLibrariesInfos:", - response, - false) == PacketResult::Success) { + if (SendPacketAndWaitForResponse( + "jGetLoadedDynamicLibrariesInfos:", response, false) == + PacketResult::Success) { if (response.IsOKResponse()) { m_supports_jLoadedDynamicLibrariesInfos = eLazyBoolYes; } @@ -1124,8 +1124,8 @@ Log *log(ProcessGDBRemoteLog::GetLogIfAnyCategoryIsSet(GDBR_LOG_PROCESS)); if (force || m_qHostInfo_is_valid == eLazyBoolCalculate) { - // host info computation can require DNS traffic and shelling out to external processes. - // Increase the timeout to account for that. + // host info computation can require DNS traffic and shelling out to + // external processes. Increase the timeout to account for that. ScopedTimeout timeout(*this, seconds(10)); m_qHostInfo_is_valid = eLazyBoolNo; StringExtractorGDBRemote response; @@ -1199,10 +1199,9 @@ if (!value.getAsInteger(0, pointer_byte_size)) ++num_keys_decoded; } else if (name.equals("os_version") || - name.equals( - "version")) // Older debugserver binaries used the - // "version" key instead of - // "os_version"... + name.equals("version")) // Older debugserver binaries used + // the "version" key instead of + // "os_version"... { if (!m_os_version.tryParse(value)) ++num_keys_decoded; @@ -1889,6 +1888,7 @@ uint32_t sub = 0; std::string vendor; std::string os_type; + std::string args_command; while (response.GetNameColonValue(name, value)) { if (name.equals("pid")) { @@ -1927,6 +1927,9 @@ std::string name; extractor.GetHexByteString(name); process_info.GetExecutableFile().SetFile(name, FileSpec::Style::native); + } else if (name.equals("args")) { + StringExtractor extractor(value); + extractor.GetHexByteString(args_command); } else if (name.equals("cputype")) { value.getAsInteger(0, cpu); } else if (name.equals("cpusubtype")) { @@ -1938,6 +1941,12 @@ } } + if (!process_info.GetExecutableFile().GetPath().empty()) { + process_info.SetArguments( + Args(process_info.GetExecutableFile().GetPath() + args_command), + true); + } + if (cpu != LLDB_INVALID_CPUTYPE && !vendor.empty() && !os_type.empty()) { if (vendor == "apple") { process_info.GetArchitecture().SetArchitecture(eArchTypeMachO, cpu, @@ -2067,7 +2076,7 @@ !vendor_name.empty()) { llvm::Triple triple(llvm::Twine("-") + vendor_name + "-" + os_name); if (!environment.empty()) - triple.setEnvironmentName(environment); + triple.setEnvironmentName(environment); assert(triple.getObjectFormat() != llvm::Triple::UnknownObjectFormat); assert(triple.getObjectFormat() != llvm::Triple::Wasm); @@ -2099,10 +2108,12 @@ } m_process_arch.GetTriple().setVendorName(llvm::StringRef(vendor_name)); m_process_arch.GetTriple().setOSName(llvm::StringRef(os_name)); - m_process_arch.GetTriple().setEnvironmentName(llvm::StringRef(environment)); + m_process_arch.GetTriple().setEnvironmentName( + llvm::StringRef(environment)); m_host_arch.GetTriple().setVendorName(llvm::StringRef(vendor_name)); m_host_arch.GetTriple().setOSName(llvm::StringRef(os_name)); - m_host_arch.GetTriple().setEnvironmentName(llvm::StringRef(environment)); + m_host_arch.GetTriple().setEnvironmentName( + llvm::StringRef(environment)); } return true; } @@ -2581,7 +2592,7 @@ * The reply from '?' packet could be as simple as 'S05'. There is no packet * which can * give us pid and/or tid. Assume pid=tid=1 in such cases. - */ + */ if (response.IsUnsupportedResponse() && IsConnected()) { m_curr_tid = 1; return true; @@ -2617,7 +2628,7 @@ * The reply from '?' packet could be as simple as 'S05'. There is no packet * which can * give us pid and/or tid. Assume pid=tid=1 in such cases. - */ + */ if (response.IsUnsupportedResponse() && IsConnected()) { m_curr_tid_run = 1; return true; @@ -2754,7 +2765,7 @@ * be as simple as 'S05'. There is no packet which can give us pid and/or * tid. * Assume pid=tid=1 in such cases. - */ + */ if ((response.IsUnsupportedResponse() || response.IsNormalResponse()) && thread_ids.size() == 0 && IsConnected()) { thread_ids.push_back(1); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp @@ -1176,6 +1176,11 @@ response.PutCString("name:"); response.PutStringAsRawHex8(proc_info.GetExecutableFile().GetCString()); response.PutChar(';'); + response.PutCString("args:"); + std::string command_string; + proc_info.GetArguments().GetCommandString(command_string); + response.PutStringAsRawHex8(command_string.c_str()); + response.PutChar(';'); const ArchSpec &proc_arch = proc_info.GetArchitecture(); if (proc_arch.IsValid()) { const llvm::Triple &proc_triple = proc_arch.GetTriple();