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.

llvm-svn: 247841
This commit is contained in:
Zachary Turner
2015-09-16 20:13:53 +00:00
parent 10c9ea51a0
commit ddf0661b38

View File

@@ -96,26 +96,32 @@ ProcessWindowsLog::DisableLog(const char **args, Stream *feedback_strm)
{
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);
flag_bits = log->GetMask().Get();
for (; args[0]; args++)
{
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);
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;