wallace created this revision.
wallace added reviewers: clayborg, aadsm, labath, xiaobai.
Herald added subscribers: lldb-commits, atanasyan, JDevlieghere, kristof.beyls,
arichardson, sdardis.
Herald added a project: LLDB.
wallace edited the summary of this revision.
The qfProcessInfo and qsProcessInfo packets currently don't set the processes'
arguments, however the `platform process list -v` command tries to print it.
In this diff I'm adding the arguments as part of the packet, and now the
command shows the arguments just like on mac.
On Mac:
507 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/libexec/secd
503 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/libexec/secinitd
501 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/libexec/languageassetd --firstLogin
497 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/libexec/trustd --agent
496 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/libexec/lsd
494 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/System/Library/Frameworks/CoreTelephony.framework/Support/CommCenter -L
491 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/sbin/distnoted agent
489 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/libexec/UserEventAgent (Aqua)
484 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/usr/sbin/cfprefsd agent
483 1 wallace 1876110778 wallace 1876110778 x86_64-apple-macosx
/System/Library/Frameworks/LocalAuthentication.framework/Support/coreauthd
On android:
1561 1016 root 0 0
aarch64-unknown-linux-android /system/bin/ip6tables-restore--noflush -w -v
1805 982 1000 1000 1000
android:drmService
1811 982 10189 10189 10189
com.qualcomm.embms:remote
1999 1 1000 1000 1000
aarch64-unknown-linux-android /system/bin/tlc_serverCCM
2332 982 10038 10038 10038
com.android.systemui
2378 983 1053 1053 1053
webview_zygote
2448 982 5013 5013 5013
com.sec.location.nsflp2
2465 982 10027 10027 10027
com.google.android.gms.persistent
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68293
Files:
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp
+++ 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();
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ 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);
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits