[Lldb-commits] [lldb] r224540 - Display local kernel version only when non-remote in PlatformLinux.

Stephane Sezer sas at cd80.net
Thu Dec 18 12:24:32 PST 2014


Author: sas
Date: Thu Dec 18 14:24:32 2014
New Revision: 224540

URL: http://llvm.org/viewvc/llvm-project?rev=224540&view=rev
Log:
Display local kernel version only when non-remote in PlatformLinux.

Summary:
This is part of the Linux remote platform work. Displaying the local
kernel information when remote debugging doesn't make sense, so we
should verify if we are in host mode before doing so.

Test Plan:
Connect to a remote linux platform mode daemon with `platform select
remote-linux` followed by `platform connect ...`, and look at the output
of `platform status`.

Reviewers: tfiala, clayborg, vharron, compnerd

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D5928

Modified:
    lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp

Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=224540&r1=224539&r2=224540&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Thu Dec 18 14:24:32 2014
@@ -503,14 +503,20 @@ PlatformLinux::GetStatus (Stream &strm)
     Platform::GetStatus(strm);
 
 #ifndef LLDB_DISABLE_POSIX
-    struct utsname un;
+    // Display local kernel information only when we are running in host mode.
+    // Otherwise, we would end up printing non-Linux information (when running
+    // on Mac OS for example).
+    if (IsHost())
+    {
+        struct utsname un;
 
-    if (uname(&un))
-        return;
+        if (uname(&un))
+            return;
 
-    strm.Printf ("    Kernel: %s\n", un.sysname);
-    strm.Printf ("   Release: %s\n", un.release);
-    strm.Printf ("   Version: %s\n", un.version);
+        strm.Printf ("    Kernel: %s\n", un.sysname);
+        strm.Printf ("   Release: %s\n", un.release);
+        strm.Printf ("   Version: %s\n", un.version);
+    }
 #endif
 }
 





More information about the lldb-commits mailing list