Author: zturner
Date: Wed Sep 16 15:13:53 2015
New Revision: 247841

URL: http://llvm.org/viewvc/llvm-project?rev=247841&view=rev
Log:
Fix log disable command in ProcessWindowsLog.

The implications of this bug where that "log disable windows" would
not actually disable the log, and worse it would lock the file handle
making it impossible to delete the file until lldb was shut down.

This was then causing the test suite to fail, because the test suite
tries to delete log files in certain situations.

Modified:
    lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLog.cpp

Modified: lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLog.cpp?rev=247841&r1=247840&r2=247841&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLog.cpp 
(original)
+++ lldb/trunk/source/Plugins/Process/Windows/Live/ProcessWindowsLog.cpp Wed 
Sep 16 15:13:53 2015
@@ -96,26 +96,32 @@ ProcessWindowsLog::DisableLog(const char
     {
         uint32_t flag_bits = 0;
 
-        flag_bits = log->GetMask().Get();
-        for (; args[0]; args++)
+        if (args[0] != nullptr)
         {
-            const char *arg = args[0];
-            uint32_t bits = GetFlagBits(arg);
-
-            if (bits)
-            {
-                flag_bits &= ~bits;
-            }
-            else
+            flag_bits = log->GetMask().Get();
+            for (; args[0]; args++)
             {
-                feedback_strm->Printf("error: unrecognized log category 
'%s'\n", arg);
-                ListLogCategories(feedback_strm);
+                const char *arg = args[0];
+                uint32_t bits = GetFlagBits(arg);
+
+                if (bits)
+                {
+                    flag_bits &= ~bits;
+                }
+                else
+                {
+                    feedback_strm->Printf("error: unrecognized log category 
'%s'\n", arg);
+                    ListLogCategories(feedback_strm);
+                }
             }
         }
 
         log->GetMask().Reset(flag_bits);
         if (flag_bits == 0)
+        {
             g_log_enabled = false;
+            log->SetStream(lldb::StreamSP());
+        }
     }
 
     return;


_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to