[Lldb-commits] [lldb] r167202 - /lldb/trunk/tools/debugserver/source/debugserver.cpp

Jason Molenda jmolenda at apple.com
Wed Oct 31 19:02:59 PDT 2012


Author: jmolenda
Date: Wed Oct 31 21:02:59 2012
New Revision: 167202

URL: http://llvm.org/viewvc/llvm-project?rev=167202&view=rev
Log:
Fix an error message in debugserver so it doesn't print "Unable to
launch process (null)" because we changed argv while doing argument
parsing.


Modified:
    lldb/trunk/tools/debugserver/source/debugserver.cpp

Modified: lldb/trunk/tools/debugserver/source/debugserver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/debugserver.cpp?rev=167202&r1=167201&r2=167202&view=diff
==============================================================================
--- lldb/trunk/tools/debugserver/source/debugserver.cpp (original)
+++ lldb/trunk/tools/debugserver/source/debugserver.cpp Wed Oct 31 21:02:59 2012
@@ -787,6 +787,8 @@
 int
 main (int argc, char *argv[])
 {
+    const char *argv_sub_zero = argv[0]; // save a copy of argv[0] for error reporting post-launch
+
     g_isatty = ::isatty (STDIN_FILENO);
 
     //  ::printf ("uid=%u euid=%u gid=%u egid=%u\n",
@@ -1426,7 +1428,7 @@
                     else
                     {
                         const char *error_str = remote->Context().LaunchStatus().AsString();
-                        RNBLogSTDERR ("error: failed to launch process %s: %s\n", argv[0], error_str ? error_str : "unknown error.");
+                        RNBLogSTDERR ("error: failed to launch process %s: %s\n", argv_sub_zero, error_str ? error_str : "unknown error.");
                     }
                 }
                 break;





More information about the lldb-commits mailing list