summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2010-11-18 23:32:35 +0000
committerGreg Clayton <gclayton@apple.com>2010-11-18 23:32:35 +0000
commit99d0faf27e1c43022d919c29456643e57dd8574a (patch)
tree97c912b77daca459224f92f05b3866aafa2a6be9 /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
parent690fa953e1c7b49aad56d90cea2fb82b8068d34c (diff)
downloadbcm5719-llvm-99d0faf27e1c43022d919c29456643e57dd8574a.tar.gz
bcm5719-llvm-99d0faf27e1c43022d919c29456643e57dd8574a.zip
Cleaned up code that wasn't using the Initialize and Terminate paradigm by
changing it to use it. There was an extra parameter added to the static accessor global user settings controllers that wasn't needed. A bool was being used as a parameter to the accessor just so it could be used to clean up the global user settings controller which is now fixed by splitting up the initialization into the "static void Class::Initialize()", access into the "static UserSettingsControllerSP & Class::GetSettingsController()", and cleanup into "static void Class::Terminate()". Also added initialize and terminate calls to the logging code to avoid issues when LLDB is shutting down. There were cases after the logging was switched over to use shared pointers where we could crash if the global destructor chain was being run and it causes the log to be destroyed and any any logging occurred. llvm-svn: 119757
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp51
1 files changed, 28 insertions, 23 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
index 963a468b432..f07b11d3f99 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemoteLog.cpp
@@ -48,33 +48,38 @@ ProcessGDBRemoteLog::DisableLog (Args &args, Stream *feedback_strm)
LogSP log (GetLog ());
if (log)
{
- uint32_t flag_bits = log->GetMask().Get();
+ uint32_t flag_bits = 0;
+
const size_t argc = args.GetArgumentCount ();
- for (size_t i = 0; i < argc; ++i)
+ if (argc > 0)
{
- const char *arg = args.GetArgumentAtIndex (i);
-
-
- if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~GDBR_LOG_ALL;
- else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~GDBR_LOG_ASYNC;
- else if (::strcasestr (arg, "break") == arg ) flag_bits &= ~GDBR_LOG_BREAKPOINTS;
- else if (::strcasestr (arg, "comm") == arg ) flag_bits &= ~GDBR_LOG_COMM;
- else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~GDBR_LOG_DEFAULT;
- else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~GDBR_LOG_PACKETS;
- else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY;
- else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_SHORT;
- else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_LONG;
- else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~GDBR_LOG_PROCESS;
- else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~GDBR_LOG_STEP;
- else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~GDBR_LOG_THREAD;
- else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~GDBR_LOG_VERBOSE;
- else if (::strcasestr (arg, "watch") == arg ) flag_bits &= ~GDBR_LOG_WATCHPOINTS;
- else
+ flag_bits = log->GetMask().Get();
+ for (size_t i = 0; i < argc; ++i)
{
- feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
- ListLogCategories (feedback_strm);
+ const char *arg = args.GetArgumentAtIndex (i);
+
+
+ if (::strcasecmp (arg, "all") == 0 ) flag_bits &= ~GDBR_LOG_ALL;
+ else if (::strcasecmp (arg, "async") == 0 ) flag_bits &= ~GDBR_LOG_ASYNC;
+ else if (::strcasestr (arg, "break") == arg ) flag_bits &= ~GDBR_LOG_BREAKPOINTS;
+ else if (::strcasestr (arg, "comm") == arg ) flag_bits &= ~GDBR_LOG_COMM;
+ else if (::strcasecmp (arg, "default") == 0 ) flag_bits &= ~GDBR_LOG_DEFAULT;
+ else if (::strcasecmp (arg, "packets") == 0 ) flag_bits &= ~GDBR_LOG_PACKETS;
+ else if (::strcasecmp (arg, "memory") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY;
+ else if (::strcasecmp (arg, "data-short") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_SHORT;
+ else if (::strcasecmp (arg, "data-long") == 0 ) flag_bits &= ~GDBR_LOG_MEMORY_DATA_LONG;
+ else if (::strcasecmp (arg, "process") == 0 ) flag_bits &= ~GDBR_LOG_PROCESS;
+ else if (::strcasecmp (arg, "step") == 0 ) flag_bits &= ~GDBR_LOG_STEP;
+ else if (::strcasecmp (arg, "thread") == 0 ) flag_bits &= ~GDBR_LOG_THREAD;
+ else if (::strcasecmp (arg, "verbose") == 0 ) flag_bits &= ~GDBR_LOG_VERBOSE;
+ else if (::strcasestr (arg, "watch") == arg ) flag_bits &= ~GDBR_LOG_WATCHPOINTS;
+ else
+ {
+ feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
+ ListLogCategories (feedback_strm);
+ }
+
}
-
}
if (flag_bits == 0)
OpenPOWER on IntegriCloud