[Lldb-commits] [lldb] r200066 - Initialize the named_pipe_path in GDBRemoteCommunication::StartDebugserverProcess

Jason Molenda jmolenda at apple.com
Fri Jan 24 19:57:14 PST 2014


Author: jmolenda
Date: Fri Jan 24 21:57:13 2014
New Revision: 200066

URL: http://llvm.org/viewvc/llvm-project?rev=200066&view=rev
Log:
Initialize the named_pipe_path in GDBRemoteCommunication::StartDebugserverProcess 
right after the space for it is allocated on the stack, instead of trying
to initialize it in all the different places in this method.  It's too easy
for another uninitialized code path to sneak in as it is written right now.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp?rev=200066&r1=200065&r2=200066&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp Fri Jan 24 21:57:13 2014
@@ -669,6 +669,7 @@ GDBRemoteCommunication::StartDebugserver
         debugserver_args.AppendArgument("--setsid");
 
         char named_pipe_path[PATH_MAX];
+        named_pipe_path[0] = '\0';
 
         bool listen = false;
         if (host_and_port[0])
@@ -703,22 +704,15 @@ GDBRemoteCommunication::StartDebugserver
                         debugserver_args.AppendArgument("--named-pipe");
                         debugserver_args.AppendArgument(named_pipe_path);
                     }
-                    else
-                        named_pipe_path[0] = '\0';
                 }
-                else
-                    named_pipe_path[0] = '\0';
             }
             else
             {
-                named_pipe_path[0] = '\0';
                 listen = true;
             }
         }
         else
         {
-            named_pipe_path[0] = '\0';
-        
             // No host and port given, so lets listen on our end and make the debugserver
             // connect to us..
             error = StartListenThread ("localhost", 0);





More information about the lldb-commits mailing list