[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code

Kate Stone via lldb-commits lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016


Modified: lldb/trunk/source/Breakpoint/BreakpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointOptions.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointOptions.cpp Tue Sep  6 15:57:50 2016
@@ -13,10 +13,10 @@
 // Project includes
 #include "lldb/Breakpoint/BreakpointOptions.h"
 
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StringList.h"
 #include "lldb/Core/Value.h"
-#include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
@@ -24,78 +24,66 @@
 using namespace lldb;
 using namespace lldb_private;
 
-bool
-BreakpointOptions::NullCallback (void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id, lldb::user_id_t break_loc_id)
-{
-    return true;
+bool BreakpointOptions::NullCallback(void *baton,
+                                     StoppointCallbackContext *context,
+                                     lldb::user_id_t break_id,
+                                     lldb::user_id_t break_loc_id) {
+  return true;
 }
 
 //----------------------------------------------------------------------
 // BreakpointOptions constructor
 //----------------------------------------------------------------------
-BreakpointOptions::BreakpointOptions() :
-    m_callback (BreakpointOptions::NullCallback),
-    m_callback_baton_sp (),
-    m_callback_is_synchronous (false),
-    m_enabled (true),
-    m_one_shot (false),
-    m_ignore_count (0),
-    m_thread_spec_ap (),
-    m_condition_text (),
-    m_condition_text_hash (0)
-{
-}
+BreakpointOptions::BreakpointOptions()
+    : m_callback(BreakpointOptions::NullCallback), m_callback_baton_sp(),
+      m_callback_is_synchronous(false), m_enabled(true), m_one_shot(false),
+      m_ignore_count(0), m_thread_spec_ap(), m_condition_text(),
+      m_condition_text_hash(0) {}
 
 //----------------------------------------------------------------------
 // BreakpointOptions copy constructor
 //----------------------------------------------------------------------
-BreakpointOptions::BreakpointOptions(const BreakpointOptions& rhs) :
-    m_callback (rhs.m_callback),
-    m_callback_baton_sp (rhs.m_callback_baton_sp),
-    m_callback_is_synchronous (rhs.m_callback_is_synchronous),
-    m_enabled (rhs.m_enabled),
-    m_one_shot (rhs.m_one_shot),
-    m_ignore_count (rhs.m_ignore_count),
-    m_thread_spec_ap ()
-{
-    if (rhs.m_thread_spec_ap.get() != nullptr)
-        m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get()));
-    m_condition_text = rhs.m_condition_text;
-    m_condition_text_hash = rhs.m_condition_text_hash;
+BreakpointOptions::BreakpointOptions(const BreakpointOptions &rhs)
+    : m_callback(rhs.m_callback), m_callback_baton_sp(rhs.m_callback_baton_sp),
+      m_callback_is_synchronous(rhs.m_callback_is_synchronous),
+      m_enabled(rhs.m_enabled), m_one_shot(rhs.m_one_shot),
+      m_ignore_count(rhs.m_ignore_count), m_thread_spec_ap() {
+  if (rhs.m_thread_spec_ap.get() != nullptr)
+    m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+  m_condition_text = rhs.m_condition_text;
+  m_condition_text_hash = rhs.m_condition_text_hash;
 }
 
 //----------------------------------------------------------------------
 // BreakpointOptions assignment operator
 //----------------------------------------------------------------------
-const BreakpointOptions&
-BreakpointOptions::operator=(const BreakpointOptions& rhs)
-{
-    m_callback = rhs.m_callback;
-    m_callback_baton_sp = rhs.m_callback_baton_sp;
-    m_callback_is_synchronous = rhs.m_callback_is_synchronous;
-    m_enabled = rhs.m_enabled;
-    m_one_shot = rhs.m_one_shot;
-    m_ignore_count = rhs.m_ignore_count;
-    if (rhs.m_thread_spec_ap.get() != nullptr)
-        m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
-    m_condition_text = rhs.m_condition_text;
-    m_condition_text_hash = rhs.m_condition_text_hash;
-    return *this;
+const BreakpointOptions &BreakpointOptions::
+operator=(const BreakpointOptions &rhs) {
+  m_callback = rhs.m_callback;
+  m_callback_baton_sp = rhs.m_callback_baton_sp;
+  m_callback_is_synchronous = rhs.m_callback_is_synchronous;
+  m_enabled = rhs.m_enabled;
+  m_one_shot = rhs.m_one_shot;
+  m_ignore_count = rhs.m_ignore_count;
+  if (rhs.m_thread_spec_ap.get() != nullptr)
+    m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+  m_condition_text = rhs.m_condition_text;
+  m_condition_text_hash = rhs.m_condition_text_hash;
+  return *this;
 }
 
 BreakpointOptions *
-BreakpointOptions::CopyOptionsNoCallback (BreakpointOptions &orig)
-{
-    BreakpointHitCallback orig_callback = orig.m_callback;
-    lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp;
-    bool orig_is_sync = orig.m_callback_is_synchronous;
-    
-    orig.ClearCallback();
-    BreakpointOptions *ret_val = new BreakpointOptions(orig);
-    
-    orig.SetCallback (orig_callback, orig_callback_baton_sp, orig_is_sync);
-    
-    return ret_val;
+BreakpointOptions::CopyOptionsNoCallback(BreakpointOptions &orig) {
+  BreakpointHitCallback orig_callback = orig.m_callback;
+  lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp;
+  bool orig_is_sync = orig.m_callback_is_synchronous;
+
+  orig.ClearCallback();
+  BreakpointOptions *ret_val = new BreakpointOptions(orig);
+
+  orig.SetCallback(orig_callback, orig_callback_baton_sp, orig_is_sync);
+
+  return ret_val;
 }
 
 //----------------------------------------------------------------------
@@ -106,187 +94,148 @@ BreakpointOptions::~BreakpointOptions()
 //------------------------------------------------------------------
 // Callbacks
 //------------------------------------------------------------------
-void
-BreakpointOptions::SetCallback (BreakpointHitCallback callback, const BatonSP &callback_baton_sp, bool callback_is_synchronous)
-{
-    m_callback_is_synchronous = callback_is_synchronous;
-    m_callback = callback;
-    m_callback_baton_sp = callback_baton_sp;
-}
-
-void
-BreakpointOptions::ClearCallback ()
-{
-    m_callback = BreakpointOptions::NullCallback;
-    m_callback_is_synchronous = false;
-    m_callback_baton_sp.reset();
-}
-
-Baton *
-BreakpointOptions::GetBaton ()
-{
-    return m_callback_baton_sp.get();
-}
-
-const Baton *
-BreakpointOptions::GetBaton () const
-{
-    return m_callback_baton_sp.get();
-}
-
-bool
-BreakpointOptions::InvokeCallback (StoppointCallbackContext *context, 
-                                   lldb::user_id_t break_id,
-                                   lldb::user_id_t break_loc_id)
-{
-    if (m_callback && context->is_synchronous == IsCallbackSynchronous())
-    {
-        return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data : nullptr,
-                          context,
-                          break_id,
-                          break_loc_id);
-    }
-    else
-        return true;
+void BreakpointOptions::SetCallback(BreakpointHitCallback callback,
+                                    const BatonSP &callback_baton_sp,
+                                    bool callback_is_synchronous) {
+  m_callback_is_synchronous = callback_is_synchronous;
+  m_callback = callback;
+  m_callback_baton_sp = callback_baton_sp;
+}
+
+void BreakpointOptions::ClearCallback() {
+  m_callback = BreakpointOptions::NullCallback;
+  m_callback_is_synchronous = false;
+  m_callback_baton_sp.reset();
+}
+
+Baton *BreakpointOptions::GetBaton() { return m_callback_baton_sp.get(); }
+
+const Baton *BreakpointOptions::GetBaton() const {
+  return m_callback_baton_sp.get();
+}
+
+bool BreakpointOptions::InvokeCallback(StoppointCallbackContext *context,
+                                       lldb::user_id_t break_id,
+                                       lldb::user_id_t break_loc_id) {
+  if (m_callback && context->is_synchronous == IsCallbackSynchronous()) {
+    return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data
+                                          : nullptr,
+                      context, break_id, break_loc_id);
+  } else
+    return true;
 }
 
-bool
-BreakpointOptions::HasCallback () const
-{
-    return m_callback != BreakpointOptions::NullCallback;
-}
-
-void 
-BreakpointOptions::SetCondition (const char *condition)
-{
-    if (!condition)
-        condition = "";
-    
-    m_condition_text.assign(condition);
-    std::hash<std::string> hasher;
-    m_condition_text_hash = hasher(m_condition_text);
-}
-
-const char *
-BreakpointOptions::GetConditionText (size_t *hash) const
-{
-    if (!m_condition_text.empty())
-    {
-        if (hash)
-            *hash = m_condition_text_hash;
-        
-        return m_condition_text.c_str();
-    }
-    else
-    {
-        return nullptr;
-    }
+bool BreakpointOptions::HasCallback() const {
+  return m_callback != BreakpointOptions::NullCallback;
 }
 
-const ThreadSpec *
-BreakpointOptions::GetThreadSpecNoCreate () const
-{
-    return m_thread_spec_ap.get();
-}
-
-ThreadSpec *
-BreakpointOptions::GetThreadSpec ()
-{
-    if (m_thread_spec_ap.get() == nullptr)
-        m_thread_spec_ap.reset (new ThreadSpec());
-        
-    return m_thread_spec_ap.get();
-}
-
-void
-BreakpointOptions::SetThreadID (lldb::tid_t thread_id)
-{
-    GetThreadSpec()->SetTID(thread_id);
-}
-
-void
-BreakpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) const
-{
-    // Figure out if there are any options not at their default value, and only print 
-    // anything if there are:
-    
-    if (m_ignore_count != 0 || !m_enabled || m_one_shot || (GetThreadSpecNoCreate() != nullptr && GetThreadSpecNoCreate()->HasSpecification ()))
-    {
-        if (level == lldb::eDescriptionLevelVerbose)
-        {
-            s->EOL ();
-            s->IndentMore();
-            s->Indent();
-            s->PutCString("Breakpoint Options:\n");
-            s->IndentMore();
-            s->Indent();
-        }
-        else
-            s->PutCString(" Options: ");
-                
-        if (m_ignore_count > 0)
-            s->Printf("ignore: %d ", m_ignore_count);
-        s->Printf("%sabled ", m_enabled ? "en" : "dis");
-        
-        if (m_one_shot)
-            s->Printf ("one-shot ");
-        
-        if (m_thread_spec_ap.get())
-            m_thread_spec_ap->GetDescription (s, level);
-
-        if (level == lldb::eDescriptionLevelFull)
-        {
-            s->IndentLess();
-            s->IndentMore();
-        }
-    }
-            
-    if (m_callback_baton_sp.get())
-    {
-        if (level != eDescriptionLevelBrief)
-        {
-            s->EOL();
-            m_callback_baton_sp->GetDescription (s, level);
-        }
+void BreakpointOptions::SetCondition(const char *condition) {
+  if (!condition)
+    condition = "";
+
+  m_condition_text.assign(condition);
+  std::hash<std::string> hasher;
+  m_condition_text_hash = hasher(m_condition_text);
+}
+
+const char *BreakpointOptions::GetConditionText(size_t *hash) const {
+  if (!m_condition_text.empty()) {
+    if (hash)
+      *hash = m_condition_text_hash;
+
+    return m_condition_text.c_str();
+  } else {
+    return nullptr;
+  }
+}
+
+const ThreadSpec *BreakpointOptions::GetThreadSpecNoCreate() const {
+  return m_thread_spec_ap.get();
+}
+
+ThreadSpec *BreakpointOptions::GetThreadSpec() {
+  if (m_thread_spec_ap.get() == nullptr)
+    m_thread_spec_ap.reset(new ThreadSpec());
+
+  return m_thread_spec_ap.get();
+}
+
+void BreakpointOptions::SetThreadID(lldb::tid_t thread_id) {
+  GetThreadSpec()->SetTID(thread_id);
+}
+
+void BreakpointOptions::GetDescription(Stream *s,
+                                       lldb::DescriptionLevel level) const {
+  // Figure out if there are any options not at their default value, and only
+  // print
+  // anything if there are:
+
+  if (m_ignore_count != 0 || !m_enabled || m_one_shot ||
+      (GetThreadSpecNoCreate() != nullptr &&
+       GetThreadSpecNoCreate()->HasSpecification())) {
+    if (level == lldb::eDescriptionLevelVerbose) {
+      s->EOL();
+      s->IndentMore();
+      s->Indent();
+      s->PutCString("Breakpoint Options:\n");
+      s->IndentMore();
+      s->Indent();
+    } else
+      s->PutCString(" Options: ");
+
+    if (m_ignore_count > 0)
+      s->Printf("ignore: %d ", m_ignore_count);
+    s->Printf("%sabled ", m_enabled ? "en" : "dis");
+
+    if (m_one_shot)
+      s->Printf("one-shot ");
+
+    if (m_thread_spec_ap.get())
+      m_thread_spec_ap->GetDescription(s, level);
+
+    if (level == lldb::eDescriptionLevelFull) {
+      s->IndentLess();
+      s->IndentMore();
     }
-    if (!m_condition_text.empty())
-    {
-       if (level != eDescriptionLevelBrief)
-       {
-            s->EOL();
-            s->Printf("Condition: %s\n", m_condition_text.c_str());
-        }
-    }    
-}
-
-void
-BreakpointOptions::CommandBaton::GetDescription (Stream *s, lldb::DescriptionLevel level) const
-{
-    CommandData *data = (CommandData *)m_data;
-
-    if (level == eDescriptionLevelBrief)
-    {
-        s->Printf (", commands = %s", (data && data->user_source.GetSize() > 0) ? "yes" : "no");
-        return;
+  }
+
+  if (m_callback_baton_sp.get()) {
+    if (level != eDescriptionLevelBrief) {
+      s->EOL();
+      m_callback_baton_sp->GetDescription(s, level);
     }
-    
-    s->IndentMore ();
-    s->Indent("Breakpoint commands:\n");
-    
-    s->IndentMore ();
-    if (data && data->user_source.GetSize() > 0)
-    {
-        const size_t num_strings = data->user_source.GetSize();
-        for (size_t i = 0; i < num_strings; ++i)
-        {
-            s->Indent(data->user_source.GetStringAtIndex(i));
-            s->EOL();
-        }
+  }
+  if (!m_condition_text.empty()) {
+    if (level != eDescriptionLevelBrief) {
+      s->EOL();
+      s->Printf("Condition: %s\n", m_condition_text.c_str());
     }
-    else
-    {
-        s->PutCString ("No commands.\n");
+  }
+}
+
+void BreakpointOptions::CommandBaton::GetDescription(
+    Stream *s, lldb::DescriptionLevel level) const {
+  CommandData *data = (CommandData *)m_data;
+
+  if (level == eDescriptionLevelBrief) {
+    s->Printf(", commands = %s",
+              (data && data->user_source.GetSize() > 0) ? "yes" : "no");
+    return;
+  }
+
+  s->IndentMore();
+  s->Indent("Breakpoint commands:\n");
+
+  s->IndentMore();
+  if (data && data->user_source.GetSize() > 0) {
+    const size_t num_strings = data->user_source.GetSize();
+    for (size_t i = 0; i < num_strings; ++i) {
+      s->Indent(data->user_source.GetStringAtIndex(i));
+      s->EOL();
     }
-    s->IndentLess ();
-    s->IndentLess ();
+  } else {
+    s->PutCString("No commands.\n");
+  }
+  s->IndentLess();
+  s->IndentLess();
 }

Modified: lldb/trunk/source/Breakpoint/BreakpointResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolver.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolver.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolver.cpp Tue Sep  6 15:57:50 2016
@@ -13,18 +13,18 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Core/Address.h"
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Core/Address.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/ModuleList.h"
 #include "lldb/Core/SearchFilter.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamString.h"
-#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Target/Target.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Function.h"
+#include "lldb/Symbol/SymbolContext.h"
+#include "lldb/Target/Target.h"
 
 using namespace lldb_private;
 using namespace lldb;
@@ -32,196 +32,169 @@ using namespace lldb;
 //----------------------------------------------------------------------
 // BreakpointResolver:
 //----------------------------------------------------------------------
-BreakpointResolver::BreakpointResolver (Breakpoint *bkpt, const unsigned char resolverTy, lldb::addr_t offset) :
-    m_breakpoint (bkpt),
-    m_offset(offset),
-    SubclassID (resolverTy)
-{
-}
-
-BreakpointResolver::~BreakpointResolver ()
-{
+BreakpointResolver::BreakpointResolver(Breakpoint *bkpt,
+                                       const unsigned char resolverTy,
+                                       lldb::addr_t offset)
+    : m_breakpoint(bkpt), m_offset(offset), SubclassID(resolverTy) {}
+
+BreakpointResolver::~BreakpointResolver() {}
+
+void BreakpointResolver::SetBreakpoint(Breakpoint *bkpt) {
+  m_breakpoint = bkpt;
+}
+
+void BreakpointResolver::ResolveBreakpointInModules(SearchFilter &filter,
+                                                    ModuleList &modules) {
+  filter.SearchInModuleList(*this, modules);
+}
+
+void BreakpointResolver::ResolveBreakpoint(SearchFilter &filter) {
+  filter.Search(*this);
+}
+
+void BreakpointResolver::SetSCMatchesByLine(SearchFilter &filter,
+                                            SymbolContextList &sc_list,
+                                            bool skip_prologue,
+                                            const char *log_ident) {
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+
+  while (sc_list.GetSize() > 0) {
+    SymbolContextList tmp_sc_list;
+    unsigned current_idx = 0;
+    SymbolContext sc;
+    bool first_entry = true;
+
+    FileSpec match_file_spec;
+    FileSpec match_original_file_spec;
+    uint32_t closest_line_number = UINT32_MAX;
+
+    // Pull out the first entry, and all the others that match its file spec,
+    // and stuff them in the tmp list.
+    while (current_idx < sc_list.GetSize()) {
+      bool matches;
+
+      sc_list.GetContextAtIndex(current_idx, sc);
+      if (first_entry) {
+        match_file_spec = sc.line_entry.file;
+        match_original_file_spec = sc.line_entry.original_file;
+        matches = true;
+        first_entry = false;
+      } else
+        matches = ((sc.line_entry.file == match_file_spec) ||
+                   (sc.line_entry.original_file == match_original_file_spec));
+
+      if (matches) {
+        tmp_sc_list.Append(sc);
+        sc_list.RemoveContextAtIndex(current_idx);
+
+        // ResolveSymbolContext will always return a number that is >= the line
+        // number you pass in.
+        // So the smaller line number is always better.
+        if (sc.line_entry.line < closest_line_number)
+          closest_line_number = sc.line_entry.line;
+      } else
+        current_idx++;
+    }
 
-}
+    // Okay, we've found the closest line number match, now throw away all the
+    // others:
 
-void
-BreakpointResolver::SetBreakpoint (Breakpoint *bkpt)
-{
-    m_breakpoint = bkpt;
-}
-
-void
-BreakpointResolver::ResolveBreakpointInModules (SearchFilter &filter, ModuleList &modules)
-{
-    filter.SearchInModuleList(*this, modules);
-}
-
-void
-BreakpointResolver::ResolveBreakpoint (SearchFilter &filter)
-{
-    filter.Search (*this);
-}
-
-void
-BreakpointResolver::SetSCMatchesByLine (SearchFilter &filter, SymbolContextList &sc_list, bool skip_prologue, const char *log_ident)
-{
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
-
-    while (sc_list.GetSize() > 0)
-    {
-        SymbolContextList tmp_sc_list;
-        unsigned current_idx = 0;
-        SymbolContext sc;
-        bool first_entry = true;
-        
-        FileSpec match_file_spec;
-        FileSpec match_original_file_spec;
-        uint32_t closest_line_number = UINT32_MAX;
-
-        // Pull out the first entry, and all the others that match its file spec, and stuff them in the tmp list.
-        while (current_idx < sc_list.GetSize())
-        {
-            bool matches;
-            
-            sc_list.GetContextAtIndex (current_idx, sc);
-            if (first_entry)
-            {
-                match_file_spec = sc.line_entry.file;
-                match_original_file_spec = sc.line_entry.original_file;
-                matches = true;
-                first_entry = false;
-            }
-            else
-                matches = ((sc.line_entry.file == match_file_spec) ||
-                           (sc.line_entry.original_file == match_original_file_spec));
-            
-            if (matches)
-            {
-                tmp_sc_list.Append (sc);
-                sc_list.RemoveContextAtIndex(current_idx);
-                
-                // ResolveSymbolContext will always return a number that is >= the line number you pass in.
-                // So the smaller line number is always better.
-                if (sc.line_entry.line < closest_line_number)
-                    closest_line_number = sc.line_entry.line;
-            }
-            else
-                current_idx++;
-        }
-            
-        // Okay, we've found the closest line number match, now throw away all the others:
-        
-        current_idx = 0;
-        while (current_idx < tmp_sc_list.GetSize())
-        {
-            if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
-            {
-                if (sc.line_entry.line != closest_line_number)
-                    tmp_sc_list.RemoveContextAtIndex(current_idx);
-                else
-                    current_idx++;
-            }
-        }
-        
-        // Next go through and see if there are line table entries that are contiguous, and if so keep only the
-        // first of the contiguous range:
-        
-        current_idx = 0;
-        std::map<Block *, lldb::addr_t> blocks_with_breakpoints;
-        
-        while (current_idx < tmp_sc_list.GetSize())
-        {
-            if (tmp_sc_list.GetContextAtIndex(current_idx, sc))
-            {
-                if (blocks_with_breakpoints.find (sc.block) != blocks_with_breakpoints.end())
-                    tmp_sc_list.RemoveContextAtIndex(current_idx);
-                else
-                {
-                    blocks_with_breakpoints.insert (std::pair<Block *, lldb::addr_t>(sc.block, sc.line_entry.range.GetBaseAddress().GetFileAddress()));
-                    current_idx++;
-                }
-            }
+    current_idx = 0;
+    while (current_idx < tmp_sc_list.GetSize()) {
+      if (tmp_sc_list.GetContextAtIndex(current_idx, sc)) {
+        if (sc.line_entry.line != closest_line_number)
+          tmp_sc_list.RemoveContextAtIndex(current_idx);
+        else
+          current_idx++;
+      }
+    }
+
+    // Next go through and see if there are line table entries that are
+    // contiguous, and if so keep only the
+    // first of the contiguous range:
+
+    current_idx = 0;
+    std::map<Block *, lldb::addr_t> blocks_with_breakpoints;
+
+    while (current_idx < tmp_sc_list.GetSize()) {
+      if (tmp_sc_list.GetContextAtIndex(current_idx, sc)) {
+        if (blocks_with_breakpoints.find(sc.block) !=
+            blocks_with_breakpoints.end())
+          tmp_sc_list.RemoveContextAtIndex(current_idx);
+        else {
+          blocks_with_breakpoints.insert(std::pair<Block *, lldb::addr_t>(
+              sc.block, sc.line_entry.range.GetBaseAddress().GetFileAddress()));
+          current_idx++;
         }
-        
-        // and make breakpoints out of the closest line number match.
-        
-        uint32_t tmp_sc_list_size = tmp_sc_list.GetSize();
-        
-        for (uint32_t i = 0; i < tmp_sc_list_size; i++)
-        {
-            if (tmp_sc_list.GetContextAtIndex(i, sc))
-            {
-                Address line_start = sc.line_entry.range.GetBaseAddress();
-                if (line_start.IsValid())
-                {
-                    if (filter.AddressPasses(line_start))
-                    {
-                        // If the line number is before the prologue end, move it there...
-                        bool skipped_prologue = false;
-                        if (skip_prologue)
-                        {
-                            if (sc.function)
-                            {
-                                Address prologue_addr(sc.function->GetAddressRange().GetBaseAddress());
-                                if (prologue_addr.IsValid() && (line_start == prologue_addr))
-                                {
-                                    const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
-                                    if (prologue_byte_size)
-                                    {
-                                        prologue_addr.Slide(prologue_byte_size);
-                 
-                                        if (filter.AddressPasses(prologue_addr))
-                                        {
-                                            skipped_prologue = true;
-                                            line_start = prologue_addr;
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                    
-                        BreakpointLocationSP bp_loc_sp (AddLocation(line_start));
-                        if (log && bp_loc_sp && !m_breakpoint->IsInternal())
-                        {
-                            StreamString s;
-                            bp_loc_sp->GetDescription (&s, lldb::eDescriptionLevelVerbose);
-                            log->Printf ("Added location (skipped prologue: %s): %s \n", skipped_prologue ? "yes" : "no", s.GetData());
-                        }
-                    }
-                    else if (log)
-                    {
-                        log->Printf ("Breakpoint %s at file address 0x%" PRIx64 " didn't pass the filter.\n",
-                                     log_ident ? log_ident : "",
-                                     line_start.GetFileAddress());
+      }
+    }
+
+    // and make breakpoints out of the closest line number match.
+
+    uint32_t tmp_sc_list_size = tmp_sc_list.GetSize();
+
+    for (uint32_t i = 0; i < tmp_sc_list_size; i++) {
+      if (tmp_sc_list.GetContextAtIndex(i, sc)) {
+        Address line_start = sc.line_entry.range.GetBaseAddress();
+        if (line_start.IsValid()) {
+          if (filter.AddressPasses(line_start)) {
+            // If the line number is before the prologue end, move it there...
+            bool skipped_prologue = false;
+            if (skip_prologue) {
+              if (sc.function) {
+                Address prologue_addr(
+                    sc.function->GetAddressRange().GetBaseAddress());
+                if (prologue_addr.IsValid() && (line_start == prologue_addr)) {
+                  const uint32_t prologue_byte_size =
+                      sc.function->GetPrologueByteSize();
+                  if (prologue_byte_size) {
+                    prologue_addr.Slide(prologue_byte_size);
+
+                    if (filter.AddressPasses(prologue_addr)) {
+                      skipped_prologue = true;
+                      line_start = prologue_addr;
                     }
+                  }
                 }
-                else
-                {
-                    if (log)
-                        log->Printf ("error: Unable to set breakpoint %s at file address 0x%" PRIx64 "\n",
-                                     log_ident ? log_ident : "",
-                                     line_start.GetFileAddress());
-                }
+              }
+            }
+
+            BreakpointLocationSP bp_loc_sp(AddLocation(line_start));
+            if (log && bp_loc_sp && !m_breakpoint->IsInternal()) {
+              StreamString s;
+              bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
+              log->Printf("Added location (skipped prologue: %s): %s \n",
+                          skipped_prologue ? "yes" : "no", s.GetData());
             }
+          } else if (log) {
+            log->Printf("Breakpoint %s at file address 0x%" PRIx64
+                        " didn't pass the filter.\n",
+                        log_ident ? log_ident : "",
+                        line_start.GetFileAddress());
+          }
+        } else {
+          if (log)
+            log->Printf(
+                "error: Unable to set breakpoint %s at file address 0x%" PRIx64
+                "\n",
+                log_ident ? log_ident : "", line_start.GetFileAddress());
         }
+      }
     }
+  }
 }
 
-BreakpointLocationSP
-BreakpointResolver::AddLocation(Address loc_addr, bool *new_location)
-{
-    loc_addr.Slide(m_offset);
-    return m_breakpoint->AddLocation(loc_addr, new_location);
-}
-    
-
-void
-BreakpointResolver::SetOffset (lldb::addr_t offset)
-{
-    // There may already be an offset, so we are actually adjusting location addresses by the difference.
-    // lldb::addr_t slide = offset - m_offset;
-    // FIXME: We should go fix up all the already set locations for the new slide.
-
-    m_offset = offset;
+BreakpointLocationSP BreakpointResolver::AddLocation(Address loc_addr,
+                                                     bool *new_location) {
+  loc_addr.Slide(m_offset);
+  return m_breakpoint->AddLocation(loc_addr, new_location);
 }
 
+void BreakpointResolver::SetOffset(lldb::addr_t offset) {
+  // There may already be an offset, so we are actually adjusting location
+  // addresses by the difference.
+  // lldb::addr_t slide = offset - m_offset;
+  // FIXME: We should go fix up all the already set locations for the new slide.
+
+  m_offset = offset;
+}

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverAddress.cpp Tue Sep  6 15:57:50 2016
@@ -27,149 +27,111 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // BreakpointResolverAddress:
 //----------------------------------------------------------------------
-BreakpointResolverAddress::BreakpointResolverAddress
-(
-    Breakpoint *bkpt,
-    const Address &addr,
-    const FileSpec &module_spec
-) :
-    BreakpointResolver (bkpt, BreakpointResolver::AddressResolver),
-    m_addr (addr),
-    m_resolved_addr(LLDB_INVALID_ADDRESS),
-    m_module_filespec(module_spec)
-{
-}
-
-BreakpointResolverAddress::BreakpointResolverAddress
-(
-    Breakpoint *bkpt,
-    const Address &addr
-) :
-    BreakpointResolver (bkpt, BreakpointResolver::AddressResolver),
-    m_addr (addr),
-    m_resolved_addr(LLDB_INVALID_ADDRESS),
-    m_module_filespec()
-{
-}
-
-BreakpointResolverAddress::~BreakpointResolverAddress ()
-{
+BreakpointResolverAddress::BreakpointResolverAddress(
+    Breakpoint *bkpt, const Address &addr, const FileSpec &module_spec)
+    : BreakpointResolver(bkpt, BreakpointResolver::AddressResolver),
+      m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS),
+      m_module_filespec(module_spec) {}
+
+BreakpointResolverAddress::BreakpointResolverAddress(Breakpoint *bkpt,
+                                                     const Address &addr)
+    : BreakpointResolver(bkpt, BreakpointResolver::AddressResolver),
+      m_addr(addr), m_resolved_addr(LLDB_INVALID_ADDRESS), m_module_filespec() {
+}
+
+BreakpointResolverAddress::~BreakpointResolverAddress() {}
+
+void BreakpointResolverAddress::ResolveBreakpoint(SearchFilter &filter) {
+  // If the address is not section relative, then we should not try to
+  // re-resolve it, it is just some
+  // random address and we wouldn't know what to do on reload.  But if it is
+  // section relative, we need to
+  // re-resolve it since the section it's in may have shifted on re-run.
+  bool re_resolve = false;
+  if (m_addr.GetSection() || m_module_filespec)
+    re_resolve = true;
+  else if (m_breakpoint->GetNumLocations() == 0)
+    re_resolve = true;
+
+  if (re_resolve)
+    BreakpointResolver::ResolveBreakpoint(filter);
+}
+
+void BreakpointResolverAddress::ResolveBreakpointInModules(
+    SearchFilter &filter, ModuleList &modules) {
+  // See comment in ResolveBreakpoint.
+  bool re_resolve = false;
+  if (m_addr.GetSection())
+    re_resolve = true;
+  else if (m_breakpoint->GetNumLocations() == 0)
+    re_resolve = true;
 
-}
-
-void
-BreakpointResolverAddress::ResolveBreakpoint (SearchFilter &filter)
-{
-    // If the address is not section relative, then we should not try to re-resolve it, it is just some
-    // random address and we wouldn't know what to do on reload.  But if it is section relative, we need to
-    // re-resolve it since the section it's in may have shifted on re-run.
-    bool re_resolve = false;
-    if (m_addr.GetSection() || m_module_filespec)
-        re_resolve = true;
-    else if (m_breakpoint->GetNumLocations() == 0)
-        re_resolve = true;
-    
-    if (re_resolve)
-        BreakpointResolver::ResolveBreakpoint(filter);
-}
-
-void
-BreakpointResolverAddress::ResolveBreakpointInModules
-(
-    SearchFilter &filter,
-    ModuleList &modules
-)
-{
-    // See comment in ResolveBreakpoint.
-    bool re_resolve = false;
-    if (m_addr.GetSection())
-        re_resolve = true;
-    else if (m_breakpoint->GetNumLocations() == 0)
-        re_resolve = true;
-    
-    if (re_resolve)
-        BreakpointResolver::ResolveBreakpointInModules (filter, modules);
+  if (re_resolve)
+    BreakpointResolver::ResolveBreakpointInModules(filter, modules);
 }
 
 Searcher::CallbackReturn
-BreakpointResolverAddress::SearchCallback
-(
-    SearchFilter &filter,
-    SymbolContext &context,
-    Address *addr,
-    bool containing
-)
-{
-    assert (m_breakpoint != NULL);
-
-    if (filter.AddressPasses (m_addr))
-    {
-        if (m_breakpoint->GetNumLocations() == 0)
-        {
-            // If the address is just an offset, and we're given a module, see if we can find the appropriate module
-            // loaded in the binary, and fix up m_addr to use that.
-            if (!m_addr.IsSectionOffset() && m_module_filespec)
-            {
-                Target &target = m_breakpoint->GetTarget();
-                ModuleSpec module_spec(m_module_filespec);
-                ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
-                if (module_sp)
-                {
-                    Address tmp_address;
-                    if (module_sp->ResolveFileAddress(m_addr.GetOffset(), tmp_address))
-                        m_addr = tmp_address;
-                }
-            }
-            
-            m_resolved_addr = m_addr.GetLoadAddress(&m_breakpoint->GetTarget());
-            BreakpointLocationSP bp_loc_sp(AddLocation(m_addr));
-            if (bp_loc_sp && !m_breakpoint->IsInternal())
-            {
-                    StreamString s;
-                    bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-                    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
-                    if (log)
-                        log->Printf ("Added location: %s\n", s.GetData());
-            }
-        }
-        else
-        {
-            BreakpointLocationSP loc_sp = m_breakpoint->GetLocationAtIndex(0);
-            lldb::addr_t cur_load_location = m_addr.GetLoadAddress(&m_breakpoint->GetTarget());
-            if (cur_load_location != m_resolved_addr)
-            {
-                m_resolved_addr = cur_load_location;
-                loc_sp->ClearBreakpointSite();
-                loc_sp->ResolveBreakpointSite();
-            }
+BreakpointResolverAddress::SearchCallback(SearchFilter &filter,
+                                          SymbolContext &context, Address *addr,
+                                          bool containing) {
+  assert(m_breakpoint != NULL);
+
+  if (filter.AddressPasses(m_addr)) {
+    if (m_breakpoint->GetNumLocations() == 0) {
+      // If the address is just an offset, and we're given a module, see if we
+      // can find the appropriate module
+      // loaded in the binary, and fix up m_addr to use that.
+      if (!m_addr.IsSectionOffset() && m_module_filespec) {
+        Target &target = m_breakpoint->GetTarget();
+        ModuleSpec module_spec(m_module_filespec);
+        ModuleSP module_sp = target.GetImages().FindFirstModule(module_spec);
+        if (module_sp) {
+          Address tmp_address;
+          if (module_sp->ResolveFileAddress(m_addr.GetOffset(), tmp_address))
+            m_addr = tmp_address;
         }
+      }
+
+      m_resolved_addr = m_addr.GetLoadAddress(&m_breakpoint->GetTarget());
+      BreakpointLocationSP bp_loc_sp(AddLocation(m_addr));
+      if (bp_loc_sp && !m_breakpoint->IsInternal()) {
+        StreamString s;
+        bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
+        Log *log(
+            lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+        if (log)
+          log->Printf("Added location: %s\n", s.GetData());
+      }
+    } else {
+      BreakpointLocationSP loc_sp = m_breakpoint->GetLocationAtIndex(0);
+      lldb::addr_t cur_load_location =
+          m_addr.GetLoadAddress(&m_breakpoint->GetTarget());
+      if (cur_load_location != m_resolved_addr) {
+        m_resolved_addr = cur_load_location;
+        loc_sp->ClearBreakpointSite();
+        loc_sp->ResolveBreakpointSite();
+      }
     }
-    return Searcher::eCallbackReturnStop;
+  }
+  return Searcher::eCallbackReturnStop;
 }
 
-Searcher::Depth
-BreakpointResolverAddress::GetDepth()
-{
-    return Searcher::eDepthTarget;
+Searcher::Depth BreakpointResolverAddress::GetDepth() {
+  return Searcher::eDepthTarget;
 }
 
-void
-BreakpointResolverAddress::GetDescription (Stream *s)
-{
-    s->PutCString ("address = ");
-    m_addr.Dump(s, m_breakpoint->GetTarget().GetProcessSP().get(), Address::DumpStyleModuleWithFileAddress, Address::DumpStyleLoadAddress);
+void BreakpointResolverAddress::GetDescription(Stream *s) {
+  s->PutCString("address = ");
+  m_addr.Dump(s, m_breakpoint->GetTarget().GetProcessSP().get(),
+              Address::DumpStyleModuleWithFileAddress,
+              Address::DumpStyleLoadAddress);
 }
 
-void
-BreakpointResolverAddress::Dump (Stream *s) const
-{
-
-}
+void BreakpointResolverAddress::Dump(Stream *s) const {}
 
 lldb::BreakpointResolverSP
-BreakpointResolverAddress::CopyForBreakpoint (Breakpoint &breakpoint)
-{
-    lldb::BreakpointResolverSP ret_sp(new BreakpointResolverAddress(&breakpoint, m_addr));
-    return ret_sp;
+BreakpointResolverAddress::CopyForBreakpoint(Breakpoint &breakpoint) {
+  lldb::BreakpointResolverSP ret_sp(
+      new BreakpointResolverAddress(&breakpoint, m_addr));
+  return ret_sp;
 }
-

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileLine.cpp Tue Sep  6 15:57:50 2016
@@ -26,102 +26,79 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // BreakpointResolverFileLine:
 //----------------------------------------------------------------------
-BreakpointResolverFileLine::BreakpointResolverFileLine
-(
-    Breakpoint *bkpt,
-    const FileSpec &file_spec,
-    uint32_t line_no,
-    lldb::addr_t offset,
-    bool check_inlines,
-    bool skip_prologue,
-    bool exact_match
-) :
-    BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver, offset),
-    m_file_spec (file_spec),
-    m_line_number (line_no),
-    m_inlines (check_inlines),
-    m_skip_prologue(skip_prologue),
-    m_exact_match(exact_match)
-{
-}
+BreakpointResolverFileLine::BreakpointResolverFileLine(
+    Breakpoint *bkpt, const FileSpec &file_spec, uint32_t line_no,
+    lldb::addr_t offset, bool check_inlines, bool skip_prologue,
+    bool exact_match)
+    : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver, offset),
+      m_file_spec(file_spec), m_line_number(line_no), m_inlines(check_inlines),
+      m_skip_prologue(skip_prologue), m_exact_match(exact_match) {}
 
-BreakpointResolverFileLine::~BreakpointResolverFileLine ()
-{
-}
+BreakpointResolverFileLine::~BreakpointResolverFileLine() {}
 
 Searcher::CallbackReturn
-BreakpointResolverFileLine::SearchCallback
-(
-    SearchFilter &filter,
-    SymbolContext &context,
-    Address *addr,
-    bool containing
-)
-{
-    SymbolContextList sc_list;
-
-    assert (m_breakpoint != NULL);
-    
-    // There is a tricky bit here.  You can have two compilation units that #include the same file, and
-    // in one of them the function at m_line_number is used (and so code and a line entry for it is generated) but in the
-    // other it isn't.  If we considered the CU's independently, then in the second inclusion, we'd move the breakpoint 
-    // to the next function that actually generated code in the header file.  That would end up being confusing.
-    // So instead, we do the CU iterations by hand here, then scan through the complete list of matches, and figure out 
-    // the closest line number match, and only set breakpoints on that match.
-    
-    // Note also that if file_spec only had a file name and not a directory, there may be many different file spec's in
-    // the resultant list.  The closest line match for one will not be right for some totally different file.
-    // So we go through the match list and pull out the sets that have the same file spec in their line_entry
-    // and treat each set separately.
-    
-    const size_t num_comp_units = context.module_sp->GetNumCompileUnits();
-    for (size_t i = 0; i < num_comp_units; i++)
-    {
-        CompUnitSP cu_sp (context.module_sp->GetCompileUnitAtIndex (i));
-        if (cu_sp)
-        {
-            if (filter.CompUnitPasses(*cu_sp))
-                cu_sp->ResolveSymbolContext (m_file_spec, m_line_number, m_inlines, m_exact_match, eSymbolContextEverything, sc_list);
-        }
+BreakpointResolverFileLine::SearchCallback(SearchFilter &filter,
+                                           SymbolContext &context,
+                                           Address *addr, bool containing) {
+  SymbolContextList sc_list;
+
+  assert(m_breakpoint != NULL);
+
+  // There is a tricky bit here.  You can have two compilation units that
+  // #include the same file, and
+  // in one of them the function at m_line_number is used (and so code and a
+  // line entry for it is generated) but in the
+  // other it isn't.  If we considered the CU's independently, then in the
+  // second inclusion, we'd move the breakpoint
+  // to the next function that actually generated code in the header file.  That
+  // would end up being confusing.
+  // So instead, we do the CU iterations by hand here, then scan through the
+  // complete list of matches, and figure out
+  // the closest line number match, and only set breakpoints on that match.
+
+  // Note also that if file_spec only had a file name and not a directory, there
+  // may be many different file spec's in
+  // the resultant list.  The closest line match for one will not be right for
+  // some totally different file.
+  // So we go through the match list and pull out the sets that have the same
+  // file spec in their line_entry
+  // and treat each set separately.
+
+  const size_t num_comp_units = context.module_sp->GetNumCompileUnits();
+  for (size_t i = 0; i < num_comp_units; i++) {
+    CompUnitSP cu_sp(context.module_sp->GetCompileUnitAtIndex(i));
+    if (cu_sp) {
+      if (filter.CompUnitPasses(*cu_sp))
+        cu_sp->ResolveSymbolContext(m_file_spec, m_line_number, m_inlines,
+                                    m_exact_match, eSymbolContextEverything,
+                                    sc_list);
     }
-    StreamString s;
-    s.Printf ("for %s:%d ",
-                        m_file_spec.GetFilename().AsCString("<Unknown>"),
-                        m_line_number);
+  }
+  StreamString s;
+  s.Printf("for %s:%d ", m_file_spec.GetFilename().AsCString("<Unknown>"),
+           m_line_number);
 
-    SetSCMatchesByLine (filter, sc_list, m_skip_prologue, s.GetData());
+  SetSCMatchesByLine(filter, sc_list, m_skip_prologue, s.GetData());
 
-    return Searcher::eCallbackReturnContinue;
+  return Searcher::eCallbackReturnContinue;
 }
 
-Searcher::Depth
-BreakpointResolverFileLine::GetDepth()
-{
-    return Searcher::eDepthModule;
+Searcher::Depth BreakpointResolverFileLine::GetDepth() {
+  return Searcher::eDepthModule;
 }
 
-void
-BreakpointResolverFileLine::GetDescription (Stream *s)
-{
-    s->Printf ("file = '%s', line = %u, exact_match = %d", m_file_spec.GetPath().c_str(), m_line_number, m_exact_match);
+void BreakpointResolverFileLine::GetDescription(Stream *s) {
+  s->Printf("file = '%s', line = %u, exact_match = %d",
+            m_file_spec.GetPath().c_str(), m_line_number, m_exact_match);
 }
 
-void
-BreakpointResolverFileLine::Dump (Stream *s) const
-{
-
-}
+void BreakpointResolverFileLine::Dump(Stream *s) const {}
 
 lldb::BreakpointResolverSP
-BreakpointResolverFileLine::CopyForBreakpoint (Breakpoint &breakpoint)
-{
-    lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine(&breakpoint,
-                                                                     m_file_spec,
-                                                                     m_line_number,
-                                                                     m_offset,
-                                                                     m_inlines,
-                                                                     m_skip_prologue,
-                                                                     m_exact_match));
+BreakpointResolverFileLine::CopyForBreakpoint(Breakpoint &breakpoint) {
+  lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileLine(
+      &breakpoint, m_file_spec, m_line_number, m_offset, m_inlines,
+      m_skip_prologue, m_exact_match));
 
-    return ret_sp;
+  return ret_sp;
 }

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverFileRegex.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- BreakpointResolverFileRegex.cpp --------------------------*- C++ -*-===//
+//===-- BreakpointResolverFileRegex.cpp --------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,8 +15,8 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Core/SourceManager.h"
 #include "lldb/Core/Log.h"
+#include "lldb/Core/SourceManager.h"
 #include "lldb/Core/StreamString.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Target/Target.h"
@@ -26,113 +27,90 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // BreakpointResolverFileRegex:
 //----------------------------------------------------------------------
-BreakpointResolverFileRegex::BreakpointResolverFileRegex
-(
-    Breakpoint *bkpt,
-    RegularExpression &regex,
-    const std::unordered_set<std::string> &func_names,
-    bool exact_match
-) :
-    BreakpointResolver (bkpt, BreakpointResolver::FileLineResolver),
-    m_regex (regex),
-    m_exact_match (exact_match),
-    m_function_names(func_names)
-{
+BreakpointResolverFileRegex::BreakpointResolverFileRegex(
+    Breakpoint *bkpt, RegularExpression &regex,
+    const std::unordered_set<std::string> &func_names, bool exact_match)
+    : BreakpointResolver(bkpt, BreakpointResolver::FileLineResolver),
+      m_regex(regex), m_exact_match(exact_match), m_function_names(func_names) {
 }
 
-BreakpointResolverFileRegex::~BreakpointResolverFileRegex ()
-{
-}
+BreakpointResolverFileRegex::~BreakpointResolverFileRegex() {}
 
 Searcher::CallbackReturn
-BreakpointResolverFileRegex::SearchCallback
-(
-    SearchFilter &filter,
-    SymbolContext &context,
-    Address *addr,
-    bool containing
-)
-{
-
-    assert (m_breakpoint != NULL);
-    if (!context.target_sp)
-        return eCallbackReturnContinue;
-
-    CompileUnit *cu = context.comp_unit;
-    FileSpec cu_file_spec = *(static_cast<FileSpec *>(cu));
-    std::vector<uint32_t> line_matches;
-    context.target_sp->GetSourceManager().FindLinesMatchingRegex(cu_file_spec, m_regex, 1, UINT32_MAX, line_matches);
-    
-    uint32_t num_matches = line_matches.size();
-    for (uint32_t i = 0; i < num_matches; i++)
-    {
-        SymbolContextList sc_list;
-        const bool search_inlines = false;
-        
-        cu->ResolveSymbolContext (cu_file_spec, line_matches[i], search_inlines, m_exact_match, eSymbolContextEverything, sc_list);
-        // Find all the function names:
-        if (!m_function_names.empty())
-        {
-            std::vector<size_t> sc_to_remove;
-            for (size_t i = 0; i < sc_list.GetSize(); i++)
-            {
-                SymbolContext sc_ctx;
-                sc_list.GetContextAtIndex(i, sc_ctx);
-                std::string name(sc_ctx.GetFunctionName(Mangled::NamePreference::ePreferDemangledWithoutArguments).AsCString());
-                if (!m_function_names.count(name))
-                {
-                    sc_to_remove.push_back(i);
-                }
-            }
-            
-            if (!sc_to_remove.empty())
-            {
-                std::vector<size_t>::reverse_iterator iter;
-                std::vector<size_t>::reverse_iterator rend = sc_to_remove.rend();
-                for (iter = sc_to_remove.rbegin(); iter != rend; iter++)
-                {
-                    sc_list.RemoveContextAtIndex(*iter);
-                }
-            }
+BreakpointResolverFileRegex::SearchCallback(SearchFilter &filter,
+                                            SymbolContext &context,
+                                            Address *addr, bool containing) {
+
+  assert(m_breakpoint != NULL);
+  if (!context.target_sp)
+    return eCallbackReturnContinue;
+
+  CompileUnit *cu = context.comp_unit;
+  FileSpec cu_file_spec = *(static_cast<FileSpec *>(cu));
+  std::vector<uint32_t> line_matches;
+  context.target_sp->GetSourceManager().FindLinesMatchingRegex(
+      cu_file_spec, m_regex, 1, UINT32_MAX, line_matches);
+
+  uint32_t num_matches = line_matches.size();
+  for (uint32_t i = 0; i < num_matches; i++) {
+    SymbolContextList sc_list;
+    const bool search_inlines = false;
+
+    cu->ResolveSymbolContext(cu_file_spec, line_matches[i], search_inlines,
+                             m_exact_match, eSymbolContextEverything, sc_list);
+    // Find all the function names:
+    if (!m_function_names.empty()) {
+      std::vector<size_t> sc_to_remove;
+      for (size_t i = 0; i < sc_list.GetSize(); i++) {
+        SymbolContext sc_ctx;
+        sc_list.GetContextAtIndex(i, sc_ctx);
+        std::string name(
+            sc_ctx
+                .GetFunctionName(
+                    Mangled::NamePreference::ePreferDemangledWithoutArguments)
+                .AsCString());
+        if (!m_function_names.count(name)) {
+          sc_to_remove.push_back(i);
+        }
+      }
+
+      if (!sc_to_remove.empty()) {
+        std::vector<size_t>::reverse_iterator iter;
+        std::vector<size_t>::reverse_iterator rend = sc_to_remove.rend();
+        for (iter = sc_to_remove.rbegin(); iter != rend; iter++) {
+          sc_list.RemoveContextAtIndex(*iter);
         }
-        
-        const bool skip_prologue = true;
-        
-        BreakpointResolver::SetSCMatchesByLine (filter, sc_list, skip_prologue, m_regex.GetText());
+      }
     }
-    assert (m_breakpoint != NULL);        
 
-    return Searcher::eCallbackReturnContinue;
-}
+    const bool skip_prologue = true;
 
-Searcher::Depth
-BreakpointResolverFileRegex::GetDepth()
-{
-    return Searcher::eDepthCompUnit;
-}
+    BreakpointResolver::SetSCMatchesByLine(filter, sc_list, skip_prologue,
+                                           m_regex.GetText());
+  }
+  assert(m_breakpoint != NULL);
 
-void
-BreakpointResolverFileRegex::GetDescription (Stream *s)
-{
-    s->Printf ("source regex = \"%s\", exact_match = %d", m_regex.GetText(), m_exact_match);
+  return Searcher::eCallbackReturnContinue;
 }
 
-void
-BreakpointResolverFileRegex::Dump (Stream *s) const
-{
+Searcher::Depth BreakpointResolverFileRegex::GetDepth() {
+  return Searcher::eDepthCompUnit;
+}
 
+void BreakpointResolverFileRegex::GetDescription(Stream *s) {
+  s->Printf("source regex = \"%s\", exact_match = %d", m_regex.GetText(),
+            m_exact_match);
 }
 
+void BreakpointResolverFileRegex::Dump(Stream *s) const {}
+
 lldb::BreakpointResolverSP
-BreakpointResolverFileRegex::CopyForBreakpoint (Breakpoint &breakpoint)
-{
-    lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(&breakpoint, m_regex, m_function_names, m_exact_match));
-    return ret_sp;
+BreakpointResolverFileRegex::CopyForBreakpoint(Breakpoint &breakpoint) {
+  lldb::BreakpointResolverSP ret_sp(new BreakpointResolverFileRegex(
+      &breakpoint, m_regex, m_function_names, m_exact_match));
+  return ret_sp;
 }
 
-void
-BreakpointResolverFileRegex::AddFunctionName(const char *func_name)
-{
-    m_function_names.insert(func_name);
+void BreakpointResolverFileRegex::AddFunctionName(const char *func_name) {
+  m_function_names.insert(func_name);
 }
-

Modified: lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointResolverName.cpp Tue Sep  6 15:57:50 2016
@@ -13,6 +13,8 @@
 // Project includes
 #include "lldb/Breakpoint/BreakpointResolverName.h"
 
+#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
+#include "Plugins/Language/ObjC/ObjCLanguage.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
@@ -21,372 +23,288 @@
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
 #include "lldb/Symbol/SymbolContext.h"
-#include "Plugins/Language/ObjC/ObjCLanguage.h"
-#include "Plugins/Language/CPlusPlus/CPlusPlusLanguage.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
-                                                const char *name_cstr,
-                                                uint32_t name_type_mask,
-                                                LanguageType language,
-                                                Breakpoint::MatchType type,
-                                                lldb::addr_t offset,
-                                                bool skip_prologue) :
-    BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
-    m_class_name (),
-    m_regex (),
-    m_match_type (type),
-    m_language (language),
-    m_skip_prologue (skip_prologue)
-{
-    if (m_match_type == Breakpoint::Regexp)
-    {
-        if (!m_regex.Compile (name_cstr))
-        {
-            Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
-
-            if (log)
-                log->Warning ("function name regexp: \"%s\" did not compile.", name_cstr);
-        }
-    }
-    else
-    {
-        AddNameLookup (ConstString(name_cstr), name_type_mask);
-    }
-}
-
-BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
-                                                const char *names[],
-                                                size_t num_names,
-                                                uint32_t name_type_mask,
-                                                LanguageType language,
-                                                lldb::addr_t offset,
-                                                bool skip_prologue) :
-    BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
-    m_match_type (Breakpoint::Exact),
-    m_language (language),
-    m_skip_prologue (skip_prologue)
-{
-    for (size_t i = 0; i < num_names; i++)
-    {
-        AddNameLookup (ConstString (names[i]), name_type_mask);
-    }
-}
-
-BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
-                                                std::vector<std::string> names,
-                                                uint32_t name_type_mask,
-                                                LanguageType language,
-                                                lldb::addr_t offset,
-                                                bool skip_prologue) :
-    BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
-    m_match_type (Breakpoint::Exact),
-    m_language (language),
-    m_skip_prologue (skip_prologue)
-{
-    for (const std::string& name : names)
-    {
-        AddNameLookup (ConstString (name.c_str(), name.size()), name_type_mask);
-    }
-}
-
-BreakpointResolverName::BreakpointResolverName (Breakpoint *bkpt,
-                                                RegularExpression &func_regex,
-                                                lldb::LanguageType language,
-                                                lldb::addr_t offset,
-                                                bool skip_prologue) :
-    BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
-    m_class_name (nullptr),
-    m_regex (func_regex),
-    m_match_type (Breakpoint::Regexp),
-    m_language (language),
-    m_skip_prologue (skip_prologue)
-{
-}
-
-BreakpointResolverName::BreakpointResolverName
-(
-    Breakpoint *bkpt,
-    const char *class_name,
-    const char *method,
-    Breakpoint::MatchType type,
-    lldb::addr_t offset,
-    bool skip_prologue
-) :
-    BreakpointResolver (bkpt, BreakpointResolver::NameResolver, offset),
-    m_class_name (class_name),
-    m_regex (),
-    m_match_type (type),
-    m_language (eLanguageTypeUnknown),
-    m_skip_prologue (skip_prologue)
-{
-    Module::LookupInfo lookup;
-    lookup.SetName(ConstString(method));
-    lookup.SetLookupName(lookup.GetName());
-    lookup.SetNameTypeMask(eFunctionNameTypeMethod);
-    m_lookups.push_back (lookup);
+BreakpointResolverName::BreakpointResolverName(
+    Breakpoint *bkpt, const char *name_cstr, uint32_t name_type_mask,
+    LanguageType language, Breakpoint::MatchType type, lldb::addr_t offset,
+    bool skip_prologue)
+    : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset),
+      m_class_name(), m_regex(), m_match_type(type), m_language(language),
+      m_skip_prologue(skip_prologue) {
+  if (m_match_type == Breakpoint::Regexp) {
+    if (!m_regex.Compile(name_cstr)) {
+      Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+
+      if (log)
+        log->Warning("function name regexp: \"%s\" did not compile.",
+                     name_cstr);
+    }
+  } else {
+    AddNameLookup(ConstString(name_cstr), name_type_mask);
+  }
+}
+
+BreakpointResolverName::BreakpointResolverName(
+    Breakpoint *bkpt, const char *names[], size_t num_names,
+    uint32_t name_type_mask, LanguageType language, lldb::addr_t offset,
+    bool skip_prologue)
+    : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset),
+      m_match_type(Breakpoint::Exact), m_language(language),
+      m_skip_prologue(skip_prologue) {
+  for (size_t i = 0; i < num_names; i++) {
+    AddNameLookup(ConstString(names[i]), name_type_mask);
+  }
+}
+
+BreakpointResolverName::BreakpointResolverName(
+    Breakpoint *bkpt, std::vector<std::string> names, uint32_t name_type_mask,
+    LanguageType language, lldb::addr_t offset, bool skip_prologue)
+    : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset),
+      m_match_type(Breakpoint::Exact), m_language(language),
+      m_skip_prologue(skip_prologue) {
+  for (const std::string &name : names) {
+    AddNameLookup(ConstString(name.c_str(), name.size()), name_type_mask);
+  }
+}
+
+BreakpointResolverName::BreakpointResolverName(Breakpoint *bkpt,
+                                               RegularExpression &func_regex,
+                                               lldb::LanguageType language,
+                                               lldb::addr_t offset,
+                                               bool skip_prologue)
+    : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset),
+      m_class_name(nullptr), m_regex(func_regex),
+      m_match_type(Breakpoint::Regexp), m_language(language),
+      m_skip_prologue(skip_prologue) {}
+
+BreakpointResolverName::BreakpointResolverName(
+    Breakpoint *bkpt, const char *class_name, const char *method,
+    Breakpoint::MatchType type, lldb::addr_t offset, bool skip_prologue)
+    : BreakpointResolver(bkpt, BreakpointResolver::NameResolver, offset),
+      m_class_name(class_name), m_regex(), m_match_type(type),
+      m_language(eLanguageTypeUnknown), m_skip_prologue(skip_prologue) {
+  Module::LookupInfo lookup;
+  lookup.SetName(ConstString(method));
+  lookup.SetLookupName(lookup.GetName());
+  lookup.SetNameTypeMask(eFunctionNameTypeMethod);
+  m_lookups.push_back(lookup);
 }
 
 BreakpointResolverName::~BreakpointResolverName() = default;
 
-BreakpointResolverName::BreakpointResolverName(const BreakpointResolverName &rhs) :
-    BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver, rhs.m_offset),
-    m_lookups(rhs.m_lookups),
-    m_class_name(rhs.m_class_name),
-    m_regex(rhs.m_regex),
-    m_match_type (rhs.m_match_type),
-    m_language (rhs.m_language),
-    m_skip_prologue (rhs.m_skip_prologue)
-{
-}
-
-void
-BreakpointResolverName::AddNameLookup (const ConstString &name, uint32_t name_type_mask)
-{
-    ObjCLanguage::MethodName objc_method(name.GetCString(), false);
-    if (objc_method.IsValid(false))
-    {
-        std::vector<ConstString> objc_names;
-        objc_method.GetFullNames(objc_names, true);
-        for (ConstString objc_name : objc_names)
-        {
-            Module::LookupInfo lookup;
-            lookup.SetName(name);
-            lookup.SetLookupName(objc_name);
-            lookup.SetNameTypeMask(eFunctionNameTypeFull);
-            m_lookups.push_back (lookup);
-        }
-    }
-    else
-    {
-        Module::LookupInfo lookup(name, name_type_mask, m_language);
-        m_lookups.push_back (lookup);
-    }
-}
-
-// FIXME: Right now we look at the module level, and call the module's "FindFunctions".
-// Greg says he will add function tables, maybe at the CompileUnit level to accelerate function
-// lookup.  At that point, we should switch the depth to CompileUnit, and look in these tables.
+BreakpointResolverName::BreakpointResolverName(
+    const BreakpointResolverName &rhs)
+    : BreakpointResolver(rhs.m_breakpoint, BreakpointResolver::NameResolver,
+                         rhs.m_offset),
+      m_lookups(rhs.m_lookups), m_class_name(rhs.m_class_name),
+      m_regex(rhs.m_regex), m_match_type(rhs.m_match_type),
+      m_language(rhs.m_language), m_skip_prologue(rhs.m_skip_prologue) {}
+
+void BreakpointResolverName::AddNameLookup(const ConstString &name,
+                                           uint32_t name_type_mask) {
+  ObjCLanguage::MethodName objc_method(name.GetCString(), false);
+  if (objc_method.IsValid(false)) {
+    std::vector<ConstString> objc_names;
+    objc_method.GetFullNames(objc_names, true);
+    for (ConstString objc_name : objc_names) {
+      Module::LookupInfo lookup;
+      lookup.SetName(name);
+      lookup.SetLookupName(objc_name);
+      lookup.SetNameTypeMask(eFunctionNameTypeFull);
+      m_lookups.push_back(lookup);
+    }
+  } else {
+    Module::LookupInfo lookup(name, name_type_mask, m_language);
+    m_lookups.push_back(lookup);
+  }
+}
+
+// FIXME: Right now we look at the module level, and call the module's
+// "FindFunctions".
+// Greg says he will add function tables, maybe at the CompileUnit level to
+// accelerate function
+// lookup.  At that point, we should switch the depth to CompileUnit, and look
+// in these tables.
 
 Searcher::CallbackReturn
 BreakpointResolverName::SearchCallback(SearchFilter &filter,
-                                       SymbolContext &context,
-                                       Address *addr,
-                                       bool containing)
-{
-    SymbolContextList func_list;
-    //SymbolContextList sym_list;
-    
-    uint32_t i;
-    bool new_location;
-    Address break_addr;
-    assert (m_breakpoint != nullptr);
-    
-    Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS));
-    
-    if (m_class_name)
-    {
-        if (log)
-            log->Warning ("Class/method function specification not supported yet.\n");
-        return Searcher::eCallbackReturnStop;
-    }
-    bool filter_by_cu = (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
-    bool filter_by_language = (m_language != eLanguageTypeUnknown);
-    const bool include_symbols = !filter_by_cu;
-    const bool include_inlines = true;
-    const bool append = true;
-
-    switch (m_match_type)
-    {
-        case Breakpoint::Exact:
-            if (context.module_sp)
-            {
-                for (const auto &lookup : m_lookups)
-                {
-                    const size_t start_func_idx = func_list.GetSize();
-                    context.module_sp->FindFunctions(lookup.GetLookupName(),
-                                                     nullptr,
-                                                     lookup.GetNameTypeMask(),
-                                                     include_symbols,
-                                                     include_inlines,
-                                                     append,
-                                                     func_list);
-
-                    const size_t end_func_idx = func_list.GetSize();
-
-                    if (start_func_idx < end_func_idx)
-                        lookup.Prune (func_list, start_func_idx);
-                }
-            }
-            break;
-        case Breakpoint::Regexp:
-            if (context.module_sp)
-            {
-                context.module_sp->FindFunctions (m_regex,
-                                                  !filter_by_cu, // include symbols only if we aren't filtering by CU
-                                                  include_inlines, 
-                                                  append, 
-                                                  func_list);
-            }
-            break;
-        case Breakpoint::Glob:
-            if (log)
-                log->Warning ("glob is not supported yet.");
-            break;
-    }
+                                       SymbolContext &context, Address *addr,
+                                       bool containing) {
+  SymbolContextList func_list;
+  // SymbolContextList sym_list;
+
+  uint32_t i;
+  bool new_location;
+  Address break_addr;
+  assert(m_breakpoint != nullptr);
+
+  Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
+
+  if (m_class_name) {
+    if (log)
+      log->Warning("Class/method function specification not supported yet.\n");
+    return Searcher::eCallbackReturnStop;
+  }
+  bool filter_by_cu =
+      (filter.GetFilterRequiredItems() & eSymbolContextCompUnit) != 0;
+  bool filter_by_language = (m_language != eLanguageTypeUnknown);
+  const bool include_symbols = !filter_by_cu;
+  const bool include_inlines = true;
+  const bool append = true;
+
+  switch (m_match_type) {
+  case Breakpoint::Exact:
+    if (context.module_sp) {
+      for (const auto &lookup : m_lookups) {
+        const size_t start_func_idx = func_list.GetSize();
+        context.module_sp->FindFunctions(
+            lookup.GetLookupName(), nullptr, lookup.GetNameTypeMask(),
+            include_symbols, include_inlines, append, func_list);
+
+        const size_t end_func_idx = func_list.GetSize();
+
+        if (start_func_idx < end_func_idx)
+          lookup.Prune(func_list, start_func_idx);
+      }
+    }
+    break;
+  case Breakpoint::Regexp:
+    if (context.module_sp) {
+      context.module_sp->FindFunctions(
+          m_regex,
+          !filter_by_cu, // include symbols only if we aren't filtering by CU
+          include_inlines, append, func_list);
+    }
+    break;
+  case Breakpoint::Glob:
+    if (log)
+      log->Warning("glob is not supported yet.");
+    break;
+  }
+
+  // If the filter specifies a Compilation Unit, remove the ones that don't pass
+  // at this point.
+  if (filter_by_cu || filter_by_language) {
+    uint32_t num_functions = func_list.GetSize();
+
+    for (size_t idx = 0; idx < num_functions; idx++) {
+      bool remove_it = false;
+      SymbolContext sc;
+      func_list.GetContextAtIndex(idx, sc);
+      if (filter_by_cu) {
+        if (!sc.comp_unit || !filter.CompUnitPasses(*sc.comp_unit))
+          remove_it = true;
+      }
+
+      if (filter_by_language) {
+        LanguageType sym_language = sc.GetLanguage();
+        if ((Language::GetPrimaryLanguage(sym_language) !=
+             Language::GetPrimaryLanguage(m_language)) &&
+            (sym_language != eLanguageTypeUnknown)) {
+          remove_it = true;
+        }
+      }
 
-    // If the filter specifies a Compilation Unit, remove the ones that don't pass at this point.
-    if (filter_by_cu || filter_by_language)
-    {
-        uint32_t num_functions = func_list.GetSize();
-        
-        for (size_t idx = 0; idx < num_functions; idx++)
-        {
-            bool remove_it = false;
-            SymbolContext sc;
-            func_list.GetContextAtIndex(idx, sc);
-            if (filter_by_cu)
-            {
-                if (!sc.comp_unit || !filter.CompUnitPasses(*sc.comp_unit))
-                    remove_it = true;
-            }
-            
-            if (filter_by_language)
-            {
-                LanguageType sym_language = sc.GetLanguage();
-                if ((Language::GetPrimaryLanguage(sym_language) !=
-                     Language::GetPrimaryLanguage(m_language)) &&
-                    (sym_language != eLanguageTypeUnknown))
-                {
-                    remove_it = true;
-                }
-            }
-            
-            if  (remove_it)
-            {
-                func_list.RemoveContextAtIndex(idx);
-                num_functions--;
-                idx--;
+      if (remove_it) {
+        func_list.RemoveContextAtIndex(idx);
+        num_functions--;
+        idx--;
+      }
+    }
+  }
+
+  // Remove any duplicates between the function list and the symbol list
+  SymbolContext sc;
+  if (func_list.GetSize()) {
+    for (i = 0; i < func_list.GetSize(); i++) {
+      if (func_list.GetContextAtIndex(i, sc)) {
+        bool is_reexported = false;
+
+        if (sc.block && sc.block->GetInlinedFunctionInfo()) {
+          if (!sc.block->GetStartAddress(break_addr))
+            break_addr.Clear();
+        } else if (sc.function) {
+          break_addr = sc.function->GetAddressRange().GetBaseAddress();
+          if (m_skip_prologue && break_addr.IsValid()) {
+            const uint32_t prologue_byte_size =
+                sc.function->GetPrologueByteSize();
+            if (prologue_byte_size)
+              break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
+          }
+        } else if (sc.symbol) {
+          if (sc.symbol->GetType() == eSymbolTypeReExported) {
+            const Symbol *actual_symbol =
+                sc.symbol->ResolveReExportedSymbol(m_breakpoint->GetTarget());
+            if (actual_symbol) {
+              is_reexported = true;
+              break_addr = actual_symbol->GetAddress();
             }
+          } else {
+            break_addr = sc.symbol->GetAddress();
+          }
+
+          if (m_skip_prologue && break_addr.IsValid()) {
+            const uint32_t prologue_byte_size =
+                sc.symbol->GetPrologueByteSize();
+            if (prologue_byte_size)
+              break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
+          }
         }
-    }
 
-    // Remove any duplicates between the function list and the symbol list
-    SymbolContext sc;
-    if (func_list.GetSize())
-    {
-        for (i = 0; i < func_list.GetSize(); i++)
-        {
-            if (func_list.GetContextAtIndex(i, sc))
-            {
-                bool is_reexported = false;
-                
-                if (sc.block && sc.block->GetInlinedFunctionInfo())
-                {
-                    if (!sc.block->GetStartAddress(break_addr))
-                        break_addr.Clear();
-                }
-                else if (sc.function)
-                {
-                    break_addr = sc.function->GetAddressRange().GetBaseAddress();
-                    if (m_skip_prologue && break_addr.IsValid())
-                    {
-                        const uint32_t prologue_byte_size = sc.function->GetPrologueByteSize();
-                        if (prologue_byte_size)
-                            break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
-                    }
-                }
-                else if (sc.symbol)
-                {
-                    if (sc.symbol->GetType() == eSymbolTypeReExported)
-                    {
-                        const Symbol *actual_symbol = sc.symbol->ResolveReExportedSymbol(m_breakpoint->GetTarget());
-                        if (actual_symbol)
-                        {
-                            is_reexported = true;
-                            break_addr = actual_symbol->GetAddress();
-                        }
-                    }
-                    else
-                    {
-                        break_addr = sc.symbol->GetAddress();
-                    }
-                    
-                    if (m_skip_prologue && break_addr.IsValid())
-                    {
-                        const uint32_t prologue_byte_size = sc.symbol->GetPrologueByteSize();
-                        if (prologue_byte_size)
-                            break_addr.SetOffset(break_addr.GetOffset() + prologue_byte_size);
-                    }
-                }
-                
-                if (break_addr.IsValid())
-                {
-                    if (filter.AddressPasses(break_addr))
-                    {
-                        BreakpointLocationSP bp_loc_sp (AddLocation(break_addr, &new_location));
-                        bp_loc_sp->SetIsReExported(is_reexported);
-                        if (bp_loc_sp && new_location && !m_breakpoint->IsInternal())
-                        {
-                            if (log)
-                            {
-                                StreamString s;
-                                bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
-                                log->Printf ("Added location: %s\n", s.GetData());
-                            }
-                        }
-                    }
-                }
+        if (break_addr.IsValid()) {
+          if (filter.AddressPasses(break_addr)) {
+            BreakpointLocationSP bp_loc_sp(
+                AddLocation(break_addr, &new_location));
+            bp_loc_sp->SetIsReExported(is_reexported);
+            if (bp_loc_sp && new_location && !m_breakpoint->IsInternal()) {
+              if (log) {
+                StreamString s;
+                bp_loc_sp->GetDescription(&s, lldb::eDescriptionLevelVerbose);
+                log->Printf("Added location: %s\n", s.GetData());
+              }
             }
+          }
         }
+      }
     }
-    
-    return Searcher::eCallbackReturnContinue;
+  }
+
+  return Searcher::eCallbackReturnContinue;
 }
 
-Searcher::Depth
-BreakpointResolverName::GetDepth()
-{
-    return Searcher::eDepthModule;
+Searcher::Depth BreakpointResolverName::GetDepth() {
+  return Searcher::eDepthModule;
 }
 
-void
-BreakpointResolverName::GetDescription (Stream *s)
-{
-    if (m_match_type == Breakpoint::Regexp)
-        s->Printf("regex = '%s'", m_regex.GetText());
-    else
-    {
-        size_t num_names = m_lookups.size();
-        if (num_names == 1)
-            s->Printf("name = '%s'", m_lookups[0].GetName().GetCString());
-        else
-        {
-            s->Printf("names = {");
-            for (size_t i = 0; i < num_names; i++)
-            {
-                s->Printf ("%s'%s'", (i == 0 ? "" : ", "), m_lookups[i].GetName().GetCString());
-            }
-            s->Printf ("}");
-        }
-    }
-    if (m_language != eLanguageTypeUnknown)
-    {
-        s->Printf (", language = %s", Language::GetNameForLanguageType(m_language));
+void BreakpointResolverName::GetDescription(Stream *s) {
+  if (m_match_type == Breakpoint::Regexp)
+    s->Printf("regex = '%s'", m_regex.GetText());
+  else {
+    size_t num_names = m_lookups.size();
+    if (num_names == 1)
+      s->Printf("name = '%s'", m_lookups[0].GetName().GetCString());
+    else {
+      s->Printf("names = {");
+      for (size_t i = 0; i < num_names; i++) {
+        s->Printf("%s'%s'", (i == 0 ? "" : ", "),
+                  m_lookups[i].GetName().GetCString());
+      }
+      s->Printf("}");
     }
+  }
+  if (m_language != eLanguageTypeUnknown) {
+    s->Printf(", language = %s", Language::GetNameForLanguageType(m_language));
+  }
 }
 
-void
-BreakpointResolverName::Dump (Stream *s) const
-{
-}
+void BreakpointResolverName::Dump(Stream *s) const {}
 
 lldb::BreakpointResolverSP
-BreakpointResolverName::CopyForBreakpoint (Breakpoint &breakpoint)
-{
-    lldb::BreakpointResolverSP ret_sp(new BreakpointResolverName(*this));
-    ret_sp->SetBreakpoint(&breakpoint);
-    return ret_sp;
+BreakpointResolverName::CopyForBreakpoint(Breakpoint &breakpoint) {
+  lldb::BreakpointResolverSP ret_sp(new BreakpointResolverName(*this));
+  ret_sp->SetBreakpoint(&breakpoint);
+  return ret_sp;
 }

Modified: lldb/trunk/source/Breakpoint/BreakpointSite.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSite.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSite.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSite.cpp Tue Sep  6 15:57:50 2016
@@ -23,240 +23,181 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointSite::BreakpointSite(BreakpointSiteList *list, const BreakpointLocationSP &owner, lldb::addr_t addr,
-                               bool use_hardware)
+BreakpointSite::BreakpointSite(BreakpointSiteList *list,
+                               const BreakpointLocationSP &owner,
+                               lldb::addr_t addr, bool use_hardware)
     : StoppointLocation(GetNextID(), addr, 0, use_hardware),
-      m_type(eSoftware), // Process subclasses need to set this correctly using SetType()
-      m_saved_opcode(),
-      m_trap_opcode(),
-      m_enabled(false), // Need to create it disabled, so the first enable turns it on.
-      m_owners(),
-      m_owners_mutex()
-{
-    m_owners.Add(owner);
-}
-
-BreakpointSite::~BreakpointSite()
-{
-    BreakpointLocationSP bp_loc_sp;
-    const size_t owner_count = m_owners.GetSize();
-    for (size_t i = 0; i < owner_count; i++)
-    {
-        m_owners.GetByIndex(i)->ClearBreakpointSite();
-    }
-}
-
-break_id_t
-BreakpointSite::GetNextID()
-{
-    static break_id_t g_next_id = 0;
-    return ++g_next_id;
+      m_type(eSoftware), // Process subclasses need to set this correctly using
+                         // SetType()
+      m_saved_opcode(), m_trap_opcode(),
+      m_enabled(false), // Need to create it disabled, so the first enable turns
+                        // it on.
+      m_owners(), m_owners_mutex() {
+  m_owners.Add(owner);
+}
+
+BreakpointSite::~BreakpointSite() {
+  BreakpointLocationSP bp_loc_sp;
+  const size_t owner_count = m_owners.GetSize();
+  for (size_t i = 0; i < owner_count; i++) {
+    m_owners.GetByIndex(i)->ClearBreakpointSite();
+  }
+}
+
+break_id_t BreakpointSite::GetNextID() {
+  static break_id_t g_next_id = 0;
+  return ++g_next_id;
 }
 
 // RETURNS - true if we should stop at this breakpoint, false if we
 // should continue.
 
-bool
-BreakpointSite::ShouldStop (StoppointCallbackContext *context)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    IncrementHitCount();
-    return m_owners.ShouldStop (context);
-}
-
-bool
-BreakpointSite::IsBreakpointAtThisSite (lldb::break_id_t bp_id)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    const size_t owner_count = m_owners.GetSize();
-    for (size_t i = 0; i < owner_count; i++)
-    {
-        if (m_owners.GetByIndex(i)->GetBreakpoint().GetID() == bp_id)
-            return true;
-    }
-    return false;
+bool BreakpointSite::ShouldStop(StoppointCallbackContext *context) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  IncrementHitCount();
+  return m_owners.ShouldStop(context);
 }
 
-void
-BreakpointSite::Dump(Stream *s) const
-{
-    if (s == nullptr)
-        return;
-
-    s->Printf("BreakpointSite %u: addr = 0x%8.8" PRIx64 "  type = %s breakpoint  hw_index = %i  hit_count = %-4u",
-            GetID(),
-            (uint64_t)m_addr,
-            IsHardware() ? "hardware" : "software",
-            GetHardwareIndex(),
-            GetHitCount());
+bool BreakpointSite::IsBreakpointAtThisSite(lldb::break_id_t bp_id) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  const size_t owner_count = m_owners.GetSize();
+  for (size_t i = 0; i < owner_count; i++) {
+    if (m_owners.GetByIndex(i)->GetBreakpoint().GetID() == bp_id)
+      return true;
+  }
+  return false;
 }
 
-void
-BreakpointSite::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    if (level != lldb::eDescriptionLevelBrief)
-        s->Printf ("breakpoint site: %d at 0x%8.8" PRIx64, GetID(), GetLoadAddress());
-    m_owners.GetDescription (s, level);
-}
+void BreakpointSite::Dump(Stream *s) const {
+  if (s == nullptr)
+    return;
 
-bool
-BreakpointSite::IsInternal() const
-{
-    return m_owners.IsInternal();
+  s->Printf("BreakpointSite %u: addr = 0x%8.8" PRIx64
+            "  type = %s breakpoint  hw_index = %i  hit_count = %-4u",
+            GetID(), (uint64_t)m_addr, IsHardware() ? "hardware" : "software",
+            GetHardwareIndex(), GetHitCount());
 }
 
-uint8_t *
-BreakpointSite::GetTrapOpcodeBytes()
-{
-    return &m_trap_opcode[0];
+void BreakpointSite::GetDescription(Stream *s, lldb::DescriptionLevel level) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  if (level != lldb::eDescriptionLevelBrief)
+    s->Printf("breakpoint site: %d at 0x%8.8" PRIx64, GetID(),
+              GetLoadAddress());
+  m_owners.GetDescription(s, level);
 }
 
-const uint8_t *
-BreakpointSite::GetTrapOpcodeBytes() const
-{
-    return &m_trap_opcode[0];
+bool BreakpointSite::IsInternal() const { return m_owners.IsInternal(); }
+
+uint8_t *BreakpointSite::GetTrapOpcodeBytes() { return &m_trap_opcode[0]; }
+
+const uint8_t *BreakpointSite::GetTrapOpcodeBytes() const {
+  return &m_trap_opcode[0];
 }
 
-size_t
-BreakpointSite::GetTrapOpcodeMaxByteSize() const
-{
-    return sizeof(m_trap_opcode);
+size_t BreakpointSite::GetTrapOpcodeMaxByteSize() const {
+  return sizeof(m_trap_opcode);
 }
 
-bool
-BreakpointSite::SetTrapOpcode (const uint8_t *trap_opcode, uint32_t trap_opcode_size)
-{
-    if (trap_opcode_size > 0 && trap_opcode_size <= sizeof(m_trap_opcode))
-    {
-        m_byte_size = trap_opcode_size;
-        ::memcpy (m_trap_opcode, trap_opcode, trap_opcode_size);
-        return true;
-    }
-    m_byte_size = 0;
-    return false;
+bool BreakpointSite::SetTrapOpcode(const uint8_t *trap_opcode,
+                                   uint32_t trap_opcode_size) {
+  if (trap_opcode_size > 0 && trap_opcode_size <= sizeof(m_trap_opcode)) {
+    m_byte_size = trap_opcode_size;
+    ::memcpy(m_trap_opcode, trap_opcode, trap_opcode_size);
+    return true;
+  }
+  m_byte_size = 0;
+  return false;
 }
 
-uint8_t *
-BreakpointSite::GetSavedOpcodeBytes()
-{
-    return &m_saved_opcode[0];
+uint8_t *BreakpointSite::GetSavedOpcodeBytes() { return &m_saved_opcode[0]; }
+
+const uint8_t *BreakpointSite::GetSavedOpcodeBytes() const {
+  return &m_saved_opcode[0];
 }
 
-const uint8_t *
-BreakpointSite::GetSavedOpcodeBytes() const
-{
-    return &m_saved_opcode[0];
+bool BreakpointSite::IsEnabled() const { return m_enabled; }
+
+void BreakpointSite::SetEnabled(bool enabled) { m_enabled = enabled; }
+
+void BreakpointSite::AddOwner(const BreakpointLocationSP &owner) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  m_owners.Add(owner);
 }
 
-bool
-BreakpointSite::IsEnabled () const
-{
-    return m_enabled;
+size_t BreakpointSite::RemoveOwner(lldb::break_id_t break_id,
+                                   lldb::break_id_t break_loc_id) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  m_owners.Remove(break_id, break_loc_id);
+  return m_owners.GetSize();
 }
 
-void
-BreakpointSite::SetEnabled (bool enabled)
-{
-    m_enabled = enabled;
+size_t BreakpointSite::GetNumberOfOwners() {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  return m_owners.GetSize();
 }
 
-void
-BreakpointSite::AddOwner (const BreakpointLocationSP &owner)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    m_owners.Add(owner);
+BreakpointLocationSP BreakpointSite::GetOwnerAtIndex(size_t index) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  return m_owners.GetByIndex(index);
 }
 
-size_t
-BreakpointSite::RemoveOwner (lldb::break_id_t break_id, lldb::break_id_t break_loc_id)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    m_owners.Remove(break_id, break_loc_id);
-    return m_owners.GetSize();
+bool BreakpointSite::ValidForThisThread(Thread *thread) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  return m_owners.ValidForThisThread(thread);
 }
 
-size_t
-BreakpointSite::GetNumberOfOwners ()
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    return m_owners.GetSize();
-}
-
-BreakpointLocationSP
-BreakpointSite::GetOwnerAtIndex (size_t index)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    return m_owners.GetByIndex (index);
-}
-
-bool
-BreakpointSite::ValidForThisThread (Thread *thread)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    return m_owners.ValidForThisThread(thread);
-}
-
-void
-BreakpointSite::BumpHitCounts()
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
-    {
-        loc_sp->BumpHitCount();
-    }
+void BreakpointSite::BumpHitCounts() {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations()) {
+    loc_sp->BumpHitCount();
+  }
 }
 
-bool
-BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size, lldb::addr_t *intersect_addr, size_t *intersect_size, size_t *opcode_offset) const
-{
-    // We only use software traps for software breakpoints
-    if (!IsHardware())
-    {
-        if (m_byte_size > 0)
-        {
-            const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
-            const lldb::addr_t end_addr = addr + size;
-            // Is the breakpoint end address before the passed in start address?
-            if (bp_end_addr <= addr)
-                return false;
-            // Is the breakpoint start address after passed in end address?
-            if (end_addr <= m_addr)
-                return false;
-            if (intersect_addr || intersect_size || opcode_offset)
-            {
-                if (m_addr < addr)
-                {
-                    if (intersect_addr)
-                        *intersect_addr = addr;
-                    if (intersect_size)
-                        *intersect_size = std::min<lldb::addr_t>(bp_end_addr, end_addr) - addr;
-                    if (opcode_offset)
-                        *opcode_offset = addr - m_addr;
-                }
-                else
-                {
-                    if (intersect_addr)
-                        *intersect_addr = m_addr;
-                    if (intersect_size)
-                        *intersect_size = std::min<lldb::addr_t>(bp_end_addr, end_addr) - m_addr;
-                    if (opcode_offset)
-                        *opcode_offset = 0;
-                }
-            }
-            return true;
+bool BreakpointSite::IntersectsRange(lldb::addr_t addr, size_t size,
+                                     lldb::addr_t *intersect_addr,
+                                     size_t *intersect_size,
+                                     size_t *opcode_offset) const {
+  // We only use software traps for software breakpoints
+  if (!IsHardware()) {
+    if (m_byte_size > 0) {
+      const lldb::addr_t bp_end_addr = m_addr + m_byte_size;
+      const lldb::addr_t end_addr = addr + size;
+      // Is the breakpoint end address before the passed in start address?
+      if (bp_end_addr <= addr)
+        return false;
+      // Is the breakpoint start address after passed in end address?
+      if (end_addr <= m_addr)
+        return false;
+      if (intersect_addr || intersect_size || opcode_offset) {
+        if (m_addr < addr) {
+          if (intersect_addr)
+            *intersect_addr = addr;
+          if (intersect_size)
+            *intersect_size =
+                std::min<lldb::addr_t>(bp_end_addr, end_addr) - addr;
+          if (opcode_offset)
+            *opcode_offset = addr - m_addr;
+        } else {
+          if (intersect_addr)
+            *intersect_addr = m_addr;
+          if (intersect_size)
+            *intersect_size =
+                std::min<lldb::addr_t>(bp_end_addr, end_addr) - m_addr;
+          if (opcode_offset)
+            *opcode_offset = 0;
         }
+      }
+      return true;
     }
-    return false;
+  }
+  return false;
 }
 
 size_t
-BreakpointSite::CopyOwnersList (BreakpointLocationCollection &out_collection)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
-    for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations())
-    {
-        out_collection.Add(loc_sp);
-    }
-    return out_collection.GetSize();
+BreakpointSite::CopyOwnersList(BreakpointLocationCollection &out_collection) {
+  std::lock_guard<std::recursive_mutex> guard(m_owners_mutex);
+  for (BreakpointLocationSP loc_sp : m_owners.BreakpointLocations()) {
+    out_collection.Add(loc_sp);
+  }
+  return out_collection.GetSize();
 }

Modified: lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp (original)
+++ lldb/trunk/source/Breakpoint/BreakpointSiteList.cpp Tue Sep  6 15:57:50 2016
@@ -19,220 +19,188 @@
 using namespace lldb;
 using namespace lldb_private;
 
-BreakpointSiteList::BreakpointSiteList() : m_mutex(), m_bp_site_list()
-{
-}
+BreakpointSiteList::BreakpointSiteList() : m_mutex(), m_bp_site_list() {}
 
-BreakpointSiteList::~BreakpointSiteList()
-{
-}
+BreakpointSiteList::~BreakpointSiteList() {}
 
-// Add breakpoint site to the list.  However, if the element already exists in the
+// Add breakpoint site to the list.  However, if the element already exists in
+// the
 // list, then we don't add it, and return LLDB_INVALID_BREAK_ID.
 
-lldb::break_id_t
-BreakpointSiteList::Add(const BreakpointSiteSP &bp)
-{
-    lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    collection::iterator iter = m_bp_site_list.find (bp_site_load_addr);
-
-    if (iter == m_bp_site_list.end())
-    {
-        m_bp_site_list.insert (iter, collection::value_type (bp_site_load_addr, bp));
-        return bp->GetID();
-    }
-    else
-    {
-        return LLDB_INVALID_BREAK_ID;
-    }
-}
-
-bool
-BreakpointSiteList::ShouldStop (StoppointCallbackContext *context, lldb::break_id_t site_id)
-{
-    BreakpointSiteSP site_sp (FindByID (site_id));
-    if (site_sp)
-    {
-        // Let the BreakpointSite decide if it should stop here (could not have
-        // reached it's target hit count yet, or it could have a callback
-        // that decided it shouldn't stop (shared library loads/unloads).
-        return site_sp->ShouldStop (context);
-    }
-    // We should stop here since this BreakpointSite isn't valid anymore or it
-    // doesn't exist.
-    return true;
-}
-lldb::break_id_t
-BreakpointSiteList::FindIDByAddress (lldb::addr_t addr)
-{
-    BreakpointSiteSP bp = FindByAddress (addr);
-    if (bp)
-    {
-        //DBLogIf(PD_LOG_BREAKPOINTS, "BreakpointSiteList::%s ( addr = 0x%8.8" PRIx64 " ) => %u", __FUNCTION__, (uint64_t)addr, bp->GetID());
-        return bp.get()->GetID();
-    }
-    //DBLogIf(PD_LOG_BREAKPOINTS, "BreakpointSiteList::%s ( addr = 0x%8.8" PRIx64 " ) => NONE", __FUNCTION__, (uint64_t)addr);
+lldb::break_id_t BreakpointSiteList::Add(const BreakpointSiteSP &bp) {
+  lldb::addr_t bp_site_load_addr = bp->GetLoadAddress();
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  collection::iterator iter = m_bp_site_list.find(bp_site_load_addr);
+
+  if (iter == m_bp_site_list.end()) {
+    m_bp_site_list.insert(iter, collection::value_type(bp_site_load_addr, bp));
+    return bp->GetID();
+  } else {
     return LLDB_INVALID_BREAK_ID;
+  }
 }
 
-bool
-BreakpointSiteList::Remove (lldb::break_id_t break_id)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    collection::iterator pos = GetIDIterator(break_id);    // Predicate
-    if (pos != m_bp_site_list.end())
-    {
-        m_bp_site_list.erase(pos);
-        return true;
-    }
-    return false;
+bool BreakpointSiteList::ShouldStop(StoppointCallbackContext *context,
+                                    lldb::break_id_t site_id) {
+  BreakpointSiteSP site_sp(FindByID(site_id));
+  if (site_sp) {
+    // Let the BreakpointSite decide if it should stop here (could not have
+    // reached it's target hit count yet, or it could have a callback
+    // that decided it shouldn't stop (shared library loads/unloads).
+    return site_sp->ShouldStop(context);
+  }
+  // We should stop here since this BreakpointSite isn't valid anymore or it
+  // doesn't exist.
+  return true;
+}
+lldb::break_id_t BreakpointSiteList::FindIDByAddress(lldb::addr_t addr) {
+  BreakpointSiteSP bp = FindByAddress(addr);
+  if (bp) {
+    // DBLogIf(PD_LOG_BREAKPOINTS, "BreakpointSiteList::%s ( addr = 0x%8.8"
+    // PRIx64 " ) => %u", __FUNCTION__, (uint64_t)addr, bp->GetID());
+    return bp.get()->GetID();
+  }
+  // DBLogIf(PD_LOG_BREAKPOINTS, "BreakpointSiteList::%s ( addr = 0x%8.8" PRIx64
+  // " ) => NONE", __FUNCTION__, (uint64_t)addr);
+  return LLDB_INVALID_BREAK_ID;
+}
+
+bool BreakpointSiteList::Remove(lldb::break_id_t break_id) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  collection::iterator pos = GetIDIterator(break_id); // Predicate
+  if (pos != m_bp_site_list.end()) {
+    m_bp_site_list.erase(pos);
+    return true;
+  }
+  return false;
 }
 
-bool
-BreakpointSiteList::RemoveByAddress (lldb::addr_t address)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    collection::iterator pos =  m_bp_site_list.find(address);
-    if (pos != m_bp_site_list.end())
-    {
-        m_bp_site_list.erase(pos);
-        return true;
-    }
-    return false;
+bool BreakpointSiteList::RemoveByAddress(lldb::addr_t address) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  collection::iterator pos = m_bp_site_list.find(address);
+  if (pos != m_bp_site_list.end()) {
+    m_bp_site_list.erase(pos);
+    return true;
+  }
+  return false;
 }
 
-class BreakpointSiteIDMatches
-{
+class BreakpointSiteIDMatches {
 public:
-    BreakpointSiteIDMatches (lldb::break_id_t break_id) :
-        m_break_id(break_id)
-    {
-    }
-
-    bool operator() (std::pair <lldb::addr_t, BreakpointSiteSP> val_pair) const
-    {
-        return m_break_id == val_pair.second.get()->GetID();
-    }
+  BreakpointSiteIDMatches(lldb::break_id_t break_id) : m_break_id(break_id) {}
+
+  bool operator()(std::pair<lldb::addr_t, BreakpointSiteSP> val_pair) const {
+    return m_break_id == val_pair.second.get()->GetID();
+  }
 
 private:
-   const lldb::break_id_t m_break_id;
+  const lldb::break_id_t m_break_id;
 };
 
 BreakpointSiteList::collection::iterator
-BreakpointSiteList::GetIDIterator (lldb::break_id_t break_id)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(),   // Search full range
-                        BreakpointSiteIDMatches(break_id));             // Predicate
+BreakpointSiteList::GetIDIterator(lldb::break_id_t break_id) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  return std::find_if(m_bp_site_list.begin(),
+                      m_bp_site_list.end(),               // Search full range
+                      BreakpointSiteIDMatches(break_id)); // Predicate
 }
 
 BreakpointSiteList::collection::const_iterator
-BreakpointSiteList::GetIDConstIterator (lldb::break_id_t break_id) const
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    return std::find_if(m_bp_site_list.begin(), m_bp_site_list.end(),   // Search full range
-                        BreakpointSiteIDMatches(break_id));             // Predicate
-}
-
-BreakpointSiteSP
-BreakpointSiteList::FindByID (lldb::break_id_t break_id)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    BreakpointSiteSP stop_sp;
-    collection::iterator pos = GetIDIterator(break_id);
-    if (pos != m_bp_site_list.end())
-        stop_sp = pos->second;
+BreakpointSiteList::GetIDConstIterator(lldb::break_id_t break_id) const {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  return std::find_if(m_bp_site_list.begin(),
+                      m_bp_site_list.end(),               // Search full range
+                      BreakpointSiteIDMatches(break_id)); // Predicate
+}
+
+BreakpointSiteSP BreakpointSiteList::FindByID(lldb::break_id_t break_id) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  BreakpointSiteSP stop_sp;
+  collection::iterator pos = GetIDIterator(break_id);
+  if (pos != m_bp_site_list.end())
+    stop_sp = pos->second;
 
-    return stop_sp;
+  return stop_sp;
 }
 
 const BreakpointSiteSP
-BreakpointSiteList::FindByID (lldb::break_id_t break_id) const
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    BreakpointSiteSP stop_sp;
-    collection::const_iterator pos = GetIDConstIterator(break_id);
-    if (pos != m_bp_site_list.end())
-        stop_sp = pos->second;
-
-    return stop_sp;
-}
-
-BreakpointSiteSP
-BreakpointSiteList::FindByAddress (lldb::addr_t addr)
-{
-    BreakpointSiteSP found_sp;
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    collection::iterator iter =  m_bp_site_list.find(addr);
-    if (iter != m_bp_site_list.end())
-        found_sp = iter->second;
-    return found_sp;
-}
-
-bool
-BreakpointSiteList::BreakpointSiteContainsBreakpoint (lldb::break_id_t bp_site_id, lldb::break_id_t bp_id)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    collection::const_iterator pos = GetIDConstIterator(bp_site_id);
-    if (pos != m_bp_site_list.end())
-        return pos->second->IsBreakpointAtThisSite (bp_id);
+BreakpointSiteList::FindByID(lldb::break_id_t break_id) const {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  BreakpointSiteSP stop_sp;
+  collection::const_iterator pos = GetIDConstIterator(break_id);
+  if (pos != m_bp_site_list.end())
+    stop_sp = pos->second;
+
+  return stop_sp;
+}
+
+BreakpointSiteSP BreakpointSiteList::FindByAddress(lldb::addr_t addr) {
+  BreakpointSiteSP found_sp;
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  collection::iterator iter = m_bp_site_list.find(addr);
+  if (iter != m_bp_site_list.end())
+    found_sp = iter->second;
+  return found_sp;
+}
+
+bool BreakpointSiteList::BreakpointSiteContainsBreakpoint(
+    lldb::break_id_t bp_site_id, lldb::break_id_t bp_id) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  collection::const_iterator pos = GetIDConstIterator(bp_site_id);
+  if (pos != m_bp_site_list.end())
+    return pos->second->IsBreakpointAtThisSite(bp_id);
+
+  return false;
+}
+
+void BreakpointSiteList::Dump(Stream *s) const {
+  s->Printf("%p: ", static_cast<const void *>(this));
+  // s->Indent();
+  s->Printf("BreakpointSiteList with %u BreakpointSites:\n",
+            (uint32_t)m_bp_site_list.size());
+  s->IndentMore();
+  collection::const_iterator pos;
+  collection::const_iterator end = m_bp_site_list.end();
+  for (pos = m_bp_site_list.begin(); pos != end; ++pos)
+    pos->second.get()->Dump(s);
+  s->IndentLess();
+}
+
+void BreakpointSiteList::ForEach(
+    std::function<void(BreakpointSite *)> const &callback) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  for (auto pair : m_bp_site_list)
+    callback(pair.second.get());
+}
+
+bool BreakpointSiteList::FindInRange(lldb::addr_t lower_bound,
+                                     lldb::addr_t upper_bound,
+                                     BreakpointSiteList &bp_site_list) const {
+  if (lower_bound > upper_bound)
+    return false;
 
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  collection::const_iterator lower, upper, pos;
+  lower = m_bp_site_list.lower_bound(lower_bound);
+  if (lower == m_bp_site_list.end() || (*lower).first >= upper_bound)
     return false;
-}
 
-void
-BreakpointSiteList::Dump (Stream *s) const
-{
-    s->Printf("%p: ", static_cast<const void*>(this));
-    //s->Indent();
-    s->Printf("BreakpointSiteList with %u BreakpointSites:\n", (uint32_t)m_bp_site_list.size());
-    s->IndentMore();
-    collection::const_iterator pos;
-    collection::const_iterator end = m_bp_site_list.end();
-    for (pos = m_bp_site_list.begin(); pos != end; ++pos)
-        pos->second.get()->Dump(s);
-    s->IndentLess();
-}
-
-void
-BreakpointSiteList::ForEach (std::function <void(BreakpointSite *)> const &callback)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    for (auto pair : m_bp_site_list)
-        callback (pair.second.get());
-}
-
-bool
-BreakpointSiteList::FindInRange (lldb::addr_t lower_bound, lldb::addr_t upper_bound, BreakpointSiteList &bp_site_list) const
-{
-    if (lower_bound > upper_bound)
-        return false;
-
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    collection::const_iterator lower, upper, pos;
-    lower = m_bp_site_list.lower_bound(lower_bound);
-    if (lower == m_bp_site_list.end()
-            || (*lower).first >= upper_bound)
-        return false;
-    
-    // This is one tricky bit.  The breakpoint might overlap the bottom end of the range.  So we grab the
-    // breakpoint prior to the lower bound, and check that that + its byte size isn't in our range.
-    if (lower != m_bp_site_list.begin())
-    {
-        collection::const_iterator prev_pos = lower;
-        prev_pos--;
-        const BreakpointSiteSP &prev_bp = (*prev_pos).second;
-        if (prev_bp->GetLoadAddress() + prev_bp->GetByteSize() > lower_bound)
-            bp_site_list.Add (prev_bp);
-        
-    }
-    
-    upper = m_bp_site_list.upper_bound(upper_bound);
-        
-    for (pos = lower; pos != upper; pos++)
-    {
-        bp_site_list.Add ((*pos).second);
-    }
-    return true;
+  // This is one tricky bit.  The breakpoint might overlap the bottom end of the
+  // range.  So we grab the
+  // breakpoint prior to the lower bound, and check that that + its byte size
+  // isn't in our range.
+  if (lower != m_bp_site_list.begin()) {
+    collection::const_iterator prev_pos = lower;
+    prev_pos--;
+    const BreakpointSiteSP &prev_bp = (*prev_pos).second;
+    if (prev_bp->GetLoadAddress() + prev_bp->GetByteSize() > lower_bound)
+      bp_site_list.Add(prev_bp);
+  }
+
+  upper = m_bp_site_list.upper_bound(upper_bound);
+
+  for (pos = lower; pos != upper; pos++) {
+    bp_site_list.Add((*pos).second);
+  }
+  return true;
 }

Modified: lldb/trunk/source/Breakpoint/Stoppoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Stoppoint.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Stoppoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Stoppoint.cpp Tue Sep  6 15:57:50 2016
@@ -7,8 +7,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "lldb/lldb-private.h"
 #include "lldb/Breakpoint/Stoppoint.h"
+#include "lldb/lldb-private.h"
 
 // C Includes
 // C++ Includes
@@ -21,26 +21,13 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // Stoppoint constructor
 //----------------------------------------------------------------------
-Stoppoint::Stoppoint() :
-    m_bid (LLDB_INVALID_BREAK_ID)
-{
-}
+Stoppoint::Stoppoint() : m_bid(LLDB_INVALID_BREAK_ID) {}
 
 //----------------------------------------------------------------------
 // Destructor
 //----------------------------------------------------------------------
-Stoppoint::~Stoppoint()
-{
-}
-
-break_id_t
-Stoppoint::GetID () const
-{
-    return m_bid;
-}
-
-void
-Stoppoint::SetID (break_id_t bid)
-{
-    m_bid = bid;
-}
+Stoppoint::~Stoppoint() {}
+
+break_id_t Stoppoint::GetID() const { return m_bid; }
+
+void Stoppoint::SetID(break_id_t bid) { m_bid = bid; }

Modified: lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp (original)
+++ lldb/trunk/source/Breakpoint/StoppointCallbackContext.cpp Tue Sep  6 15:57:50 2016
@@ -15,24 +15,15 @@
 
 using namespace lldb_private;
 
-StoppointCallbackContext::StoppointCallbackContext() :
-    event (nullptr),
-    exe_ctx_ref (),
-    is_synchronous (false)
-{
-}
+StoppointCallbackContext::StoppointCallbackContext()
+    : event(nullptr), exe_ctx_ref(), is_synchronous(false) {}
 
-StoppointCallbackContext::StoppointCallbackContext(Event *e, const ExecutionContext &exe_ctx, bool synchronously) :
-    event (e),
-    exe_ctx_ref (exe_ctx),
-    is_synchronous(synchronously)
-{
-}
+StoppointCallbackContext::StoppointCallbackContext(
+    Event *e, const ExecutionContext &exe_ctx, bool synchronously)
+    : event(e), exe_ctx_ref(exe_ctx), is_synchronous(synchronously) {}
 
-void
-StoppointCallbackContext::Clear()
-{
-    event = nullptr;
-    exe_ctx_ref.Clear();
-    is_synchronous = false;
+void StoppointCallbackContext::Clear() {
+  event = nullptr;
+  exe_ctx_ref.Clear();
+  is_synchronous = false;
 }

Modified: lldb/trunk/source/Breakpoint/StoppointLocation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/StoppointLocation.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/StoppointLocation.cpp (original)
+++ lldb/trunk/source/Breakpoint/StoppointLocation.cpp Tue Sep  6 15:57:50 2016
@@ -20,36 +20,22 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // StoppointLocation constructor
 //----------------------------------------------------------------------
-StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, bool hardware) :
-    m_loc_id(bid),
-    m_addr(addr),
-    m_hardware(hardware),
-    m_hardware_index(LLDB_INVALID_INDEX32),
-    m_byte_size(0),
-    m_hit_count(0)
-{
-}
+StoppointLocation::StoppointLocation(break_id_t bid, addr_t addr, bool hardware)
+    : m_loc_id(bid), m_addr(addr), m_hardware(hardware),
+      m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(0), m_hit_count(0) {}
 
-StoppointLocation::StoppointLocation (break_id_t bid, addr_t addr, uint32_t byte_size, bool hardware) :
-    m_loc_id(bid),
-    m_addr(addr),
-    m_hardware(hardware),
-    m_hardware_index(LLDB_INVALID_INDEX32),
-    m_byte_size(byte_size),
-    m_hit_count(0)
-{
-}
+StoppointLocation::StoppointLocation(break_id_t bid, addr_t addr,
+                                     uint32_t byte_size, bool hardware)
+    : m_loc_id(bid), m_addr(addr), m_hardware(hardware),
+      m_hardware_index(LLDB_INVALID_INDEX32), m_byte_size(byte_size),
+      m_hit_count(0) {}
 
 //----------------------------------------------------------------------
 // Destructor
 //----------------------------------------------------------------------
-StoppointLocation::~StoppointLocation()
-{
-}
+StoppointLocation::~StoppointLocation() {}
 
-void
-StoppointLocation::DecrementHitCount ()
-{
-    assert (m_hit_count > 0);
-    --m_hit_count;
+void StoppointLocation::DecrementHitCount() {
+  assert(m_hit_count > 0);
+  --m_hit_count;
 }

Modified: lldb/trunk/source/Breakpoint/Watchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/Watchpoint.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/Watchpoint.cpp (original)
+++ lldb/trunk/source/Breakpoint/Watchpoint.cpp Tue Sep  6 15:57:50 2016
@@ -18,487 +18,370 @@
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Core/ValueObjectMemory.h"
+#include "lldb/Expression/UserExpression.h"
 #include "lldb/Symbol/ClangASTContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
-#include "lldb/Expression/UserExpression.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-Watchpoint::Watchpoint (Target& target, lldb::addr_t addr, uint32_t size, const CompilerType *type, bool hardware) :
-    StoppointLocation (0, addr, size, hardware),
-    m_target(target),
-    m_enabled(false),
-    m_is_hardware(hardware),
-    m_is_watch_variable(false),
-    m_is_ephemeral(false),
-    m_disabled_count(0),
-    m_watch_read(0),
-    m_watch_write(0),
-    m_watch_was_read(0),
-    m_watch_was_written(0),
-    m_ignore_count(0),
-    m_false_alarms(0),
-    m_decl_str(),
-    m_watch_spec_str(),
-    m_type(),
-    m_error(),
-    m_options (),
-    m_being_created(true)
-{
-    if (type && type->IsValid())
-        m_type = *type;
-    else
-    {
-        // If we don't have a known type, then we force it to unsigned int of the right size.
-        ClangASTContext *ast_context = target.GetScratchClangASTContext();
-        m_type = ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint, 8 * size);
-    }
-    
-    // Set the initial value of the watched variable:
-    if (m_target.GetProcessSP())
-    {
-        ExecutionContext exe_ctx;
-        m_target.GetProcessSP()->CalculateExecutionContext(exe_ctx);
-        CaptureWatchedValue (exe_ctx);
-    }
-    m_being_created = false;
+Watchpoint::Watchpoint(Target &target, lldb::addr_t addr, uint32_t size,
+                       const CompilerType *type, bool hardware)
+    : StoppointLocation(0, addr, size, hardware), m_target(target),
+      m_enabled(false), m_is_hardware(hardware), m_is_watch_variable(false),
+      m_is_ephemeral(false), m_disabled_count(0), m_watch_read(0),
+      m_watch_write(0), m_watch_was_read(0), m_watch_was_written(0),
+      m_ignore_count(0), m_false_alarms(0), m_decl_str(), m_watch_spec_str(),
+      m_type(), m_error(), m_options(), m_being_created(true) {
+  if (type && type->IsValid())
+    m_type = *type;
+  else {
+    // If we don't have a known type, then we force it to unsigned int of the
+    // right size.
+    ClangASTContext *ast_context = target.GetScratchClangASTContext();
+    m_type = ast_context->GetBuiltinTypeForEncodingAndBitSize(eEncodingUint,
+                                                              8 * size);
+  }
+
+  // Set the initial value of the watched variable:
+  if (m_target.GetProcessSP()) {
+    ExecutionContext exe_ctx;
+    m_target.GetProcessSP()->CalculateExecutionContext(exe_ctx);
+    CaptureWatchedValue(exe_ctx);
+  }
+  m_being_created = false;
 }
 
 Watchpoint::~Watchpoint() = default;
 
 // This function is used when "baton" doesn't need to be freed
-void
-Watchpoint::SetCallback (WatchpointHitCallback callback, void *baton, bool is_synchronous)
-{
-    // The default "Baton" class will keep a copy of "baton" and won't free
-    // or delete it when it goes goes out of scope.
-    m_options.SetCallback(callback, BatonSP (new Baton(baton)), is_synchronous);
-    
-    SendWatchpointChangedEvent (eWatchpointEventTypeCommandChanged);
+void Watchpoint::SetCallback(WatchpointHitCallback callback, void *baton,
+                             bool is_synchronous) {
+  // The default "Baton" class will keep a copy of "baton" and won't free
+  // or delete it when it goes goes out of scope.
+  m_options.SetCallback(callback, BatonSP(new Baton(baton)), is_synchronous);
+
+  SendWatchpointChangedEvent(eWatchpointEventTypeCommandChanged);
 }
 
-// This function is used when a baton needs to be freed and therefore is 
+// This function is used when a baton needs to be freed and therefore is
 // contained in a "Baton" subclass.
-void
-Watchpoint::SetCallback (WatchpointHitCallback callback, const BatonSP &callback_baton_sp, bool is_synchronous)
-{
-    m_options.SetCallback(callback, callback_baton_sp, is_synchronous);
-    SendWatchpointChangedEvent (eWatchpointEventTypeCommandChanged);
+void Watchpoint::SetCallback(WatchpointHitCallback callback,
+                             const BatonSP &callback_baton_sp,
+                             bool is_synchronous) {
+  m_options.SetCallback(callback, callback_baton_sp, is_synchronous);
+  SendWatchpointChangedEvent(eWatchpointEventTypeCommandChanged);
 }
 
-void
-Watchpoint::ClearCallback ()
-{
-    m_options.ClearCallback ();
-    SendWatchpointChangedEvent (eWatchpointEventTypeCommandChanged);
+void Watchpoint::ClearCallback() {
+  m_options.ClearCallback();
+  SendWatchpointChangedEvent(eWatchpointEventTypeCommandChanged);
 }
 
-void
-Watchpoint::SetDeclInfo (const std::string &str)
-{
-    m_decl_str = str;
-}
+void Watchpoint::SetDeclInfo(const std::string &str) { m_decl_str = str; }
 
-std::string
-Watchpoint::GetWatchSpec()
-{
-    return m_watch_spec_str;
-}
+std::string Watchpoint::GetWatchSpec() { return m_watch_spec_str; }
 
-void
-Watchpoint::SetWatchSpec (const std::string &str)
-{
-    m_watch_spec_str = str;
+void Watchpoint::SetWatchSpec(const std::string &str) {
+  m_watch_spec_str = str;
 }
 
 // Override default impl of StoppointLocation::IsHardware() since m_is_hardware
 // member field is more accurate.
-bool
-Watchpoint::IsHardware () const
-{
-    return m_is_hardware;
-}
-
-bool
-Watchpoint::IsWatchVariable() const
-{
-    return m_is_watch_variable;
-}
-
-void
-Watchpoint::SetWatchVariable(bool val)
-{
-    m_is_watch_variable = val;
-}
-
-bool
-Watchpoint::CaptureWatchedValue (const ExecutionContext &exe_ctx)
-{
-    ConstString watch_name("$__lldb__watch_value");
-    m_old_value_sp = m_new_value_sp;
-    Address watch_address(GetLoadAddress());
-    if (!m_type.IsValid())
-    {
-        // Don't know how to report new & old values, since we couldn't make a scalar type for this watchpoint.
-        // This works around an assert in ValueObjectMemory::Create.
-        // FIXME: This should not happen, but if it does in some case we care about,
-        // we can go grab the value raw and print it as unsigned.
-        return false;
-    }
-    m_new_value_sp = ValueObjectMemory::Create (exe_ctx.GetBestExecutionContextScope(), watch_name.AsCString(), watch_address, m_type);
-    m_new_value_sp = m_new_value_sp->CreateConstantValue(watch_name);
-    return (m_new_value_sp && m_new_value_sp->GetError().Success());
-}
-
-void
-Watchpoint::IncrementFalseAlarmsAndReviseHitCount()
-{
-    ++m_false_alarms;
-    if (m_false_alarms)
-    {
-        if (m_hit_count >= m_false_alarms)
-        {
-            m_hit_count -= m_false_alarms;
-            m_false_alarms = 0;
-        }
-        else
-        {
-            m_false_alarms -= m_hit_count;
-            m_hit_count = 0;
-        }
+bool Watchpoint::IsHardware() const { return m_is_hardware; }
+
+bool Watchpoint::IsWatchVariable() const { return m_is_watch_variable; }
+
+void Watchpoint::SetWatchVariable(bool val) { m_is_watch_variable = val; }
+
+bool Watchpoint::CaptureWatchedValue(const ExecutionContext &exe_ctx) {
+  ConstString watch_name("$__lldb__watch_value");
+  m_old_value_sp = m_new_value_sp;
+  Address watch_address(GetLoadAddress());
+  if (!m_type.IsValid()) {
+    // Don't know how to report new & old values, since we couldn't make a
+    // scalar type for this watchpoint.
+    // This works around an assert in ValueObjectMemory::Create.
+    // FIXME: This should not happen, but if it does in some case we care about,
+    // we can go grab the value raw and print it as unsigned.
+    return false;
+  }
+  m_new_value_sp =
+      ValueObjectMemory::Create(exe_ctx.GetBestExecutionContextScope(),
+                                watch_name.AsCString(), watch_address, m_type);
+  m_new_value_sp = m_new_value_sp->CreateConstantValue(watch_name);
+  return (m_new_value_sp && m_new_value_sp->GetError().Success());
+}
+
+void Watchpoint::IncrementFalseAlarmsAndReviseHitCount() {
+  ++m_false_alarms;
+  if (m_false_alarms) {
+    if (m_hit_count >= m_false_alarms) {
+      m_hit_count -= m_false_alarms;
+      m_false_alarms = 0;
+    } else {
+      m_false_alarms -= m_hit_count;
+      m_hit_count = 0;
     }
+  }
 }
 
 // RETURNS - true if we should stop at this breakpoint, false if we
 // should continue.
 
-bool
-Watchpoint::ShouldStop (StoppointCallbackContext *context)
-{
-    IncrementHitCount();
+bool Watchpoint::ShouldStop(StoppointCallbackContext *context) {
+  IncrementHitCount();
 
-    if (!IsEnabled())
-        return false;
+  if (!IsEnabled())
+    return false;
 
-    return true;
+  return true;
 }
 
-void
-Watchpoint::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
-    DumpWithLevel(s, level);
+void Watchpoint::GetDescription(Stream *s, lldb::DescriptionLevel level) {
+  DumpWithLevel(s, level);
 }
 
-void
-Watchpoint::Dump(Stream *s) const
-{
-    DumpWithLevel(s, lldb::eDescriptionLevelBrief);
+void Watchpoint::Dump(Stream *s) const {
+  DumpWithLevel(s, lldb::eDescriptionLevelBrief);
 }
 
-// If prefix is nullptr, we display the watch id and ignore the prefix altogether.
-void
-Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const
-{
-    if (!prefix)
-    {
-        s->Printf("\nWatchpoint %u hit:", GetID());
-        prefix = "";
-    }
+// If prefix is nullptr, we display the watch id and ignore the prefix
+// altogether.
+void Watchpoint::DumpSnapshots(Stream *s, const char *prefix) const {
+  if (!prefix) {
+    s->Printf("\nWatchpoint %u hit:", GetID());
+    prefix = "";
+  }
 
-    if (m_old_value_sp)
-    {
-        const char *old_value_cstr =  m_old_value_sp->GetValueAsCString();
-        if (old_value_cstr && old_value_cstr[0])
-            s->Printf("\n%sold value: %s", prefix, old_value_cstr);
-        else
-        {
-            const char *old_summary_cstr =  m_old_value_sp-> GetSummaryAsCString();
-            if (old_summary_cstr && old_summary_cstr[0])
-                s->Printf("\n%sold value: %s", prefix, old_summary_cstr);
-        }
+  if (m_old_value_sp) {
+    const char *old_value_cstr = m_old_value_sp->GetValueAsCString();
+    if (old_value_cstr && old_value_cstr[0])
+      s->Printf("\n%sold value: %s", prefix, old_value_cstr);
+    else {
+      const char *old_summary_cstr = m_old_value_sp->GetSummaryAsCString();
+      if (old_summary_cstr && old_summary_cstr[0])
+        s->Printf("\n%sold value: %s", prefix, old_summary_cstr);
     }
+  }
 
-    if (m_new_value_sp)
-    {
-        const char *new_value_cstr =  m_new_value_sp->GetValueAsCString();
-        if (new_value_cstr && new_value_cstr[0])
-            s->Printf("\n%snew value: %s", prefix, new_value_cstr);
-        else
-        {
-            const char *new_summary_cstr =  m_new_value_sp-> GetSummaryAsCString();
-            if (new_summary_cstr && new_summary_cstr[0])
-                s->Printf("\n%snew value: %s", prefix, new_summary_cstr);
-        }
+  if (m_new_value_sp) {
+    const char *new_value_cstr = m_new_value_sp->GetValueAsCString();
+    if (new_value_cstr && new_value_cstr[0])
+      s->Printf("\n%snew value: %s", prefix, new_value_cstr);
+    else {
+      const char *new_summary_cstr = m_new_value_sp->GetSummaryAsCString();
+      if (new_summary_cstr && new_summary_cstr[0])
+        s->Printf("\n%snew value: %s", prefix, new_summary_cstr);
     }
+  }
 }
 
-void
-Watchpoint::DumpWithLevel(Stream *s, lldb::DescriptionLevel description_level) const
-{
-    if (s == nullptr)
-        return;
-
-    assert(description_level >= lldb::eDescriptionLevelBrief &&
-           description_level <= lldb::eDescriptionLevelVerbose);
-
-    s->Printf("Watchpoint %u: addr = 0x%8.8" PRIx64 " size = %u state = %s type = %s%s",
-              GetID(),
-              GetLoadAddress(),
-              m_byte_size,
-              IsEnabled() ? "enabled" : "disabled",
-              m_watch_read ? "r" : "",
-              m_watch_write ? "w" : "");
-
-    if (description_level >= lldb::eDescriptionLevelFull) {
-        if (!m_decl_str.empty())
-            s->Printf("\n    declare @ '%s'", m_decl_str.c_str());
-        if (!m_watch_spec_str.empty())
-            s->Printf("\n    watchpoint spec = '%s'", m_watch_spec_str.c_str());
-
-        // Dump the snapshots we have taken.
-        DumpSnapshots(s, "    ");
-
-        if (GetConditionText())
-            s->Printf("\n    condition = '%s'", GetConditionText());
-        m_options.GetCallbackDescription(s, description_level);
-    }
+void Watchpoint::DumpWithLevel(Stream *s,
+                               lldb::DescriptionLevel description_level) const {
+  if (s == nullptr)
+    return;
 
-    if (description_level >= lldb::eDescriptionLevelVerbose)
-    {
-        s->Printf("\n    hw_index = %i  hit_count = %-4u  ignore_count = %-4u",
-                  GetHardwareIndex(),
-                  GetHitCount(),
-                  GetIgnoreCount());
-    }
+  assert(description_level >= lldb::eDescriptionLevelBrief &&
+         description_level <= lldb::eDescriptionLevelVerbose);
+
+  s->Printf("Watchpoint %u: addr = 0x%8.8" PRIx64
+            " size = %u state = %s type = %s%s",
+            GetID(), GetLoadAddress(), m_byte_size,
+            IsEnabled() ? "enabled" : "disabled", m_watch_read ? "r" : "",
+            m_watch_write ? "w" : "");
+
+  if (description_level >= lldb::eDescriptionLevelFull) {
+    if (!m_decl_str.empty())
+      s->Printf("\n    declare @ '%s'", m_decl_str.c_str());
+    if (!m_watch_spec_str.empty())
+      s->Printf("\n    watchpoint spec = '%s'", m_watch_spec_str.c_str());
+
+    // Dump the snapshots we have taken.
+    DumpSnapshots(s, "    ");
+
+    if (GetConditionText())
+      s->Printf("\n    condition = '%s'", GetConditionText());
+    m_options.GetCallbackDescription(s, description_level);
+  }
+
+  if (description_level >= lldb::eDescriptionLevelVerbose) {
+    s->Printf("\n    hw_index = %i  hit_count = %-4u  ignore_count = %-4u",
+              GetHardwareIndex(), GetHitCount(), GetIgnoreCount());
+  }
 }
 
-bool
-Watchpoint::IsEnabled() const
-{
-    return m_enabled;
-}
-
-// Within StopInfo.cpp, we purposely turn on the ephemeral mode right before temporarily disable the watchpoint
-// in order to perform possible watchpoint actions without triggering further watchpoint events.
-// After the temporary disabled watchpoint is enabled, we then turn off the ephemeral mode.
-
-void
-Watchpoint::TurnOnEphemeralMode()
-{
-    m_is_ephemeral = true;
-}
-
-void
-Watchpoint::TurnOffEphemeralMode()
-{
-    m_is_ephemeral = false;
-    // Leaving ephemeral mode, reset the m_disabled_count!
-    m_disabled_count = 0;
-}
-
-bool
-Watchpoint::IsDisabledDuringEphemeralMode()
-{
-    return m_disabled_count > 1;
-}
-
-void
-Watchpoint::SetEnabled(bool enabled, bool notify)
-{
-    if (!enabled)
-    {
-        if (!m_is_ephemeral)
-            SetHardwareIndex(LLDB_INVALID_INDEX32);
-        else
-            ++m_disabled_count;
+bool Watchpoint::IsEnabled() const { return m_enabled; }
 
-        // Don't clear the snapshots for now.
-        // Within StopInfo.cpp, we purposely do disable/enable watchpoint while performing watchpoint actions.
-    }
-    bool changed = enabled != m_enabled;
-    m_enabled = enabled;
-    if (notify && !m_is_ephemeral && changed)
-        SendWatchpointChangedEvent (enabled ? eWatchpointEventTypeEnabled : eWatchpointEventTypeDisabled);
-}
-
-void
-Watchpoint::SetWatchpointType (uint32_t type, bool notify)
-{
-    int old_watch_read = m_watch_read;
-    int old_watch_write = m_watch_write;
-    m_watch_read = (type & LLDB_WATCH_TYPE_READ) != 0;
-    m_watch_write = (type & LLDB_WATCH_TYPE_WRITE) != 0;
-    if (notify && (old_watch_read != m_watch_read || old_watch_write != m_watch_write))
-        SendWatchpointChangedEvent (eWatchpointEventTypeTypeChanged);
-}
-
-bool
-Watchpoint::WatchpointRead () const
-{
-    return m_watch_read != 0;
-}
-
-bool
-Watchpoint::WatchpointWrite () const
-{
-    return m_watch_write != 0;
-}
-
-uint32_t
-Watchpoint::GetIgnoreCount () const
-{
-    return m_ignore_count;
-}
-
-void
-Watchpoint::SetIgnoreCount (uint32_t n)
-{
-    bool changed = m_ignore_count != n;
-    m_ignore_count = n;
-    if (changed)
-        SendWatchpointChangedEvent (eWatchpointEventTypeIgnoreChanged);
-}
-
-bool
-Watchpoint::InvokeCallback (StoppointCallbackContext *context)
-{
-    return m_options.InvokeCallback (context, GetID());
-}
-
-void 
-Watchpoint::SetCondition (const char *condition)
-{
-    if (condition == nullptr || condition[0] == '\0')
-    {
-        if (m_condition_ap.get())
-            m_condition_ap.reset();
-    }
-    else
-    {
-        // Pass nullptr for expr_prefix (no translation-unit level definitions).
-        Error error;
-        m_condition_ap.reset(m_target.GetUserExpressionForLanguage(condition,
-                                                                   nullptr,
-                                                                   lldb::eLanguageTypeUnknown,
-                                                                   UserExpression::eResultTypeAny,
-                                                                   EvaluateExpressionOptions(),
-                                                                   error));
-        if (error.Fail())
-        {
-            // FIXME: Log something...
-            m_condition_ap.reset();
-        }
-    }
-    SendWatchpointChangedEvent (eWatchpointEventTypeConditionChanged);
+// Within StopInfo.cpp, we purposely turn on the ephemeral mode right before
+// temporarily disable the watchpoint
+// in order to perform possible watchpoint actions without triggering further
+// watchpoint events.
+// After the temporary disabled watchpoint is enabled, we then turn off the
+// ephemeral mode.
+
+void Watchpoint::TurnOnEphemeralMode() { m_is_ephemeral = true; }
+
+void Watchpoint::TurnOffEphemeralMode() {
+  m_is_ephemeral = false;
+  // Leaving ephemeral mode, reset the m_disabled_count!
+  m_disabled_count = 0;
 }
 
-const char *
-Watchpoint::GetConditionText () const
-{
-    if (m_condition_ap.get())
-        return m_condition_ap->GetUserText();
+bool Watchpoint::IsDisabledDuringEphemeralMode() {
+  return m_disabled_count > 1;
+}
+
+void Watchpoint::SetEnabled(bool enabled, bool notify) {
+  if (!enabled) {
+    if (!m_is_ephemeral)
+      SetHardwareIndex(LLDB_INVALID_INDEX32);
     else
-        return nullptr;
+      ++m_disabled_count;
+
+    // Don't clear the snapshots for now.
+    // Within StopInfo.cpp, we purposely do disable/enable watchpoint while
+    // performing watchpoint actions.
+  }
+  bool changed = enabled != m_enabled;
+  m_enabled = enabled;
+  if (notify && !m_is_ephemeral && changed)
+    SendWatchpointChangedEvent(enabled ? eWatchpointEventTypeEnabled
+                                       : eWatchpointEventTypeDisabled);
 }
 
-void
-Watchpoint::SendWatchpointChangedEvent (lldb::WatchpointEventType eventKind)
-{
-    if (!m_being_created
-        && GetTarget().EventTypeHasListeners(Target::eBroadcastBitWatchpointChanged))
-    {
-        WatchpointEventData *data = new Watchpoint::WatchpointEventData (eventKind, shared_from_this());
-        GetTarget().BroadcastEvent (Target::eBroadcastBitWatchpointChanged, data);
-    }
+void Watchpoint::SetWatchpointType(uint32_t type, bool notify) {
+  int old_watch_read = m_watch_read;
+  int old_watch_write = m_watch_write;
+  m_watch_read = (type & LLDB_WATCH_TYPE_READ) != 0;
+  m_watch_write = (type & LLDB_WATCH_TYPE_WRITE) != 0;
+  if (notify &&
+      (old_watch_read != m_watch_read || old_watch_write != m_watch_write))
+    SendWatchpointChangedEvent(eWatchpointEventTypeTypeChanged);
 }
 
-void
-Watchpoint::SendWatchpointChangedEvent (WatchpointEventData *data)
-{
-    if (data == nullptr)
-        return;
-        
-    if (!m_being_created
-        && GetTarget().EventTypeHasListeners(Target::eBroadcastBitWatchpointChanged))
-        GetTarget().BroadcastEvent (Target::eBroadcastBitWatchpointChanged, data);
-    else
-        delete data;
+bool Watchpoint::WatchpointRead() const { return m_watch_read != 0; }
+
+bool Watchpoint::WatchpointWrite() const { return m_watch_write != 0; }
+
+uint32_t Watchpoint::GetIgnoreCount() const { return m_ignore_count; }
+
+void Watchpoint::SetIgnoreCount(uint32_t n) {
+  bool changed = m_ignore_count != n;
+  m_ignore_count = n;
+  if (changed)
+    SendWatchpointChangedEvent(eWatchpointEventTypeIgnoreChanged);
+}
+
+bool Watchpoint::InvokeCallback(StoppointCallbackContext *context) {
+  return m_options.InvokeCallback(context, GetID());
 }
 
-Watchpoint::WatchpointEventData::WatchpointEventData (WatchpointEventType sub_type, 
-                                                      const WatchpointSP &new_watchpoint_sp) :
-    EventData (),
-    m_watchpoint_event (sub_type),
-    m_new_watchpoint_sp (new_watchpoint_sp)
-{
+void Watchpoint::SetCondition(const char *condition) {
+  if (condition == nullptr || condition[0] == '\0') {
+    if (m_condition_ap.get())
+      m_condition_ap.reset();
+  } else {
+    // Pass nullptr for expr_prefix (no translation-unit level definitions).
+    Error error;
+    m_condition_ap.reset(m_target.GetUserExpressionForLanguage(
+        condition, nullptr, lldb::eLanguageTypeUnknown,
+        UserExpression::eResultTypeAny, EvaluateExpressionOptions(), error));
+    if (error.Fail()) {
+      // FIXME: Log something...
+      m_condition_ap.reset();
+    }
+  }
+  SendWatchpointChangedEvent(eWatchpointEventTypeConditionChanged);
+}
+
+const char *Watchpoint::GetConditionText() const {
+  if (m_condition_ap.get())
+    return m_condition_ap->GetUserText();
+  else
+    return nullptr;
 }
 
+void Watchpoint::SendWatchpointChangedEvent(
+    lldb::WatchpointEventType eventKind) {
+  if (!m_being_created &&
+      GetTarget().EventTypeHasListeners(
+          Target::eBroadcastBitWatchpointChanged)) {
+    WatchpointEventData *data =
+        new Watchpoint::WatchpointEventData(eventKind, shared_from_this());
+    GetTarget().BroadcastEvent(Target::eBroadcastBitWatchpointChanged, data);
+  }
+}
+
+void Watchpoint::SendWatchpointChangedEvent(WatchpointEventData *data) {
+  if (data == nullptr)
+    return;
+
+  if (!m_being_created &&
+      GetTarget().EventTypeHasListeners(Target::eBroadcastBitWatchpointChanged))
+    GetTarget().BroadcastEvent(Target::eBroadcastBitWatchpointChanged, data);
+  else
+    delete data;
+}
+
+Watchpoint::WatchpointEventData::WatchpointEventData(
+    WatchpointEventType sub_type, const WatchpointSP &new_watchpoint_sp)
+    : EventData(), m_watchpoint_event(sub_type),
+      m_new_watchpoint_sp(new_watchpoint_sp) {}
+
 Watchpoint::WatchpointEventData::~WatchpointEventData() = default;
 
-const ConstString &
-Watchpoint::WatchpointEventData::GetFlavorString ()
-{
-    static ConstString g_flavor ("Watchpoint::WatchpointEventData");
-    return g_flavor;
-}
-
-const ConstString &
-Watchpoint::WatchpointEventData::GetFlavor () const
-{
-    return WatchpointEventData::GetFlavorString ();
-}
-
-WatchpointSP &
-Watchpoint::WatchpointEventData::GetWatchpoint ()
-{
-    return m_new_watchpoint_sp;
+const ConstString &Watchpoint::WatchpointEventData::GetFlavorString() {
+  static ConstString g_flavor("Watchpoint::WatchpointEventData");
+  return g_flavor;
 }
 
-WatchpointEventType
-Watchpoint::WatchpointEventData::GetWatchpointEventType () const
-{
-    return m_watchpoint_event;
+const ConstString &Watchpoint::WatchpointEventData::GetFlavor() const {
+  return WatchpointEventData::GetFlavorString();
+}
+
+WatchpointSP &Watchpoint::WatchpointEventData::GetWatchpoint() {
+  return m_new_watchpoint_sp;
 }
 
-void
-Watchpoint::WatchpointEventData::Dump (Stream *s) const
-{
+WatchpointEventType
+Watchpoint::WatchpointEventData::GetWatchpointEventType() const {
+  return m_watchpoint_event;
 }
 
+void Watchpoint::WatchpointEventData::Dump(Stream *s) const {}
+
 const Watchpoint::WatchpointEventData *
-Watchpoint::WatchpointEventData::GetEventDataFromEvent (const Event *event)
-{
-    if (event)
-    {
-        const EventData *event_data = event->GetData();
-        if (event_data && event_data->GetFlavor() == WatchpointEventData::GetFlavorString())
-            return static_cast <const WatchpointEventData *> (event->GetData());
-    }
-    return nullptr;
+Watchpoint::WatchpointEventData::GetEventDataFromEvent(const Event *event) {
+  if (event) {
+    const EventData *event_data = event->GetData();
+    if (event_data &&
+        event_data->GetFlavor() == WatchpointEventData::GetFlavorString())
+      return static_cast<const WatchpointEventData *>(event->GetData());
+  }
+  return nullptr;
 }
 
 WatchpointEventType
-Watchpoint::WatchpointEventData::GetWatchpointEventTypeFromEvent (const EventSP &event_sp)
-{
-    const WatchpointEventData *data = GetEventDataFromEvent (event_sp.get());
+Watchpoint::WatchpointEventData::GetWatchpointEventTypeFromEvent(
+    const EventSP &event_sp) {
+  const WatchpointEventData *data = GetEventDataFromEvent(event_sp.get());
 
-    if (data == nullptr)
-        return eWatchpointEventTypeInvalidType;
-    else
-        return data->GetWatchpointEventType();
+  if (data == nullptr)
+    return eWatchpointEventTypeInvalidType;
+  else
+    return data->GetWatchpointEventType();
 }
 
-WatchpointSP
-Watchpoint::WatchpointEventData::GetWatchpointFromEvent (const EventSP &event_sp)
-{
-    WatchpointSP wp_sp;
+WatchpointSP Watchpoint::WatchpointEventData::GetWatchpointFromEvent(
+    const EventSP &event_sp) {
+  WatchpointSP wp_sp;
 
-    const WatchpointEventData *data = GetEventDataFromEvent (event_sp.get());
-    if (data)
-        wp_sp = data->m_new_watchpoint_sp;
+  const WatchpointEventData *data = GetEventDataFromEvent(event_sp.get());
+  if (data)
+    wp_sp = data->m_new_watchpoint_sp;
 
-    return wp_sp;
+  return wp_sp;
 }

Modified: lldb/trunk/source/Breakpoint/WatchpointList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointList.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointList.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointList.cpp Tue Sep  6 15:57:50 2016
@@ -7,7 +7,6 @@
 //
 //===----------------------------------------------------------------------===//
 
-
 // C Includes
 // C++ Includes
 // Other libraries and framework includes
@@ -18,291 +17,241 @@
 using namespace lldb;
 using namespace lldb_private;
 
-WatchpointList::WatchpointList() : m_watchpoints(), m_mutex(), m_next_wp_id(0)
-{
-}
+WatchpointList::WatchpointList()
+    : m_watchpoints(), m_mutex(), m_next_wp_id(0) {}
 
-WatchpointList::~WatchpointList()
-{
-}
+WatchpointList::~WatchpointList() {}
 
 // Add a watchpoint to the list.
-lldb::watch_id_t
-WatchpointList::Add (const WatchpointSP &wp_sp, bool notify)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    wp_sp->SetID(++m_next_wp_id);
-    m_watchpoints.push_back(wp_sp);
-    if (notify)
-    {
-        if (wp_sp->GetTarget().EventTypeHasListeners(Target::eBroadcastBitWatchpointChanged))
-            wp_sp->GetTarget().BroadcastEvent (Target::eBroadcastBitWatchpointChanged,
-                                               new Watchpoint::WatchpointEventData (eWatchpointEventTypeAdded, wp_sp));
+lldb::watch_id_t WatchpointList::Add(const WatchpointSP &wp_sp, bool notify) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  wp_sp->SetID(++m_next_wp_id);
+  m_watchpoints.push_back(wp_sp);
+  if (notify) {
+    if (wp_sp->GetTarget().EventTypeHasListeners(
+            Target::eBroadcastBitWatchpointChanged))
+      wp_sp->GetTarget().BroadcastEvent(Target::eBroadcastBitWatchpointChanged,
+                                        new Watchpoint::WatchpointEventData(
+                                            eWatchpointEventTypeAdded, wp_sp));
+  }
+  return wp_sp->GetID();
+}
+
+void WatchpointList::Dump(Stream *s) const {
+  DumpWithLevel(s, lldb::eDescriptionLevelBrief);
+}
+
+void WatchpointList::DumpWithLevel(
+    Stream *s, lldb::DescriptionLevel description_level) const {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  s->Printf("%p: ", static_cast<const void *>(this));
+  // s->Indent();
+  s->Printf("WatchpointList with %" PRIu64 " Watchpoints:\n",
+            (uint64_t)m_watchpoints.size());
+  s->IndentMore();
+  wp_collection::const_iterator pos, end = m_watchpoints.end();
+  for (pos = m_watchpoints.begin(); pos != end; ++pos)
+    (*pos)->DumpWithLevel(s, description_level);
+  s->IndentLess();
+}
+
+const WatchpointSP WatchpointList::FindByAddress(lldb::addr_t addr) const {
+  WatchpointSP wp_sp;
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  if (!m_watchpoints.empty()) {
+    wp_collection::const_iterator pos, end = m_watchpoints.end();
+    for (pos = m_watchpoints.begin(); pos != end; ++pos) {
+      lldb::addr_t wp_addr = (*pos)->GetLoadAddress();
+      uint32_t wp_bytesize = (*pos)->GetByteSize();
+      if ((wp_addr <= addr) && ((wp_addr + wp_bytesize) > addr)) {
+        wp_sp = *pos;
+        break;
+      }
     }
-    return wp_sp->GetID();
-}
+  }
 
-void
-WatchpointList::Dump (Stream *s) const
-{
-    DumpWithLevel(s, lldb::eDescriptionLevelBrief);
+  return wp_sp;
 }
 
-void
-WatchpointList::DumpWithLevel (Stream *s, lldb::DescriptionLevel description_level) const
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    s->Printf("%p: ", static_cast<const void*>(this));
-    //s->Indent();
-    s->Printf("WatchpointList with %" PRIu64 " Watchpoints:\n",
-              (uint64_t)m_watchpoints.size());
-    s->IndentMore();
+const WatchpointSP WatchpointList::FindBySpec(std::string spec) const {
+  WatchpointSP wp_sp;
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  if (!m_watchpoints.empty()) {
     wp_collection::const_iterator pos, end = m_watchpoints.end();
     for (pos = m_watchpoints.begin(); pos != end; ++pos)
-        (*pos)->DumpWithLevel(s, description_level);
-    s->IndentLess();
-}
-
-const WatchpointSP
-WatchpointList::FindByAddress (lldb::addr_t addr) const
-{
-    WatchpointSP wp_sp;
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    if (!m_watchpoints.empty())
-    {
-        wp_collection::const_iterator pos, end = m_watchpoints.end();
-        for (pos = m_watchpoints.begin(); pos != end; ++pos)
-        {
-            lldb::addr_t wp_addr = (*pos)->GetLoadAddress();
-            uint32_t wp_bytesize = (*pos)->GetByteSize();
-            if ((wp_addr <= addr) && ((wp_addr + wp_bytesize) > addr))
-            {
-                wp_sp = *pos;
-                break;
-            }
-        }
-    }
-
-    return wp_sp;
-}
-
-const WatchpointSP
-WatchpointList::FindBySpec (std::string spec) const
-{
-    WatchpointSP wp_sp;
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    if (!m_watchpoints.empty())
-    {
-        wp_collection::const_iterator pos, end = m_watchpoints.end();
-        for (pos = m_watchpoints.begin(); pos != end; ++pos)
-            if ((*pos)->GetWatchSpec() == spec) {
-                wp_sp = *pos;
-                break;
-            }
-    }
+      if ((*pos)->GetWatchSpec() == spec) {
+        wp_sp = *pos;
+        break;
+      }
+  }
 
-    return wp_sp;
+  return wp_sp;
 }
 
-class WatchpointIDMatches
-{
+class WatchpointIDMatches {
 public:
-    WatchpointIDMatches (lldb::watch_id_t watch_id) :
-        m_watch_id(watch_id)
-    {
-    }
+  WatchpointIDMatches(lldb::watch_id_t watch_id) : m_watch_id(watch_id) {}
 
-    bool operator() (const WatchpointSP &wp) const
-    {
-        return m_watch_id == wp->GetID();
-    }
+  bool operator()(const WatchpointSP &wp) const {
+    return m_watch_id == wp->GetID();
+  }
 
 private:
-   const lldb::watch_id_t m_watch_id;
+  const lldb::watch_id_t m_watch_id;
 };
 
 WatchpointList::wp_collection::iterator
-WatchpointList::GetIDIterator (lldb::watch_id_t watch_id)
-{
-    return std::find_if(m_watchpoints.begin(), m_watchpoints.end(), // Search full range
-                        WatchpointIDMatches(watch_id));             // Predicate
+WatchpointList::GetIDIterator(lldb::watch_id_t watch_id) {
+  return std::find_if(m_watchpoints.begin(),
+                      m_watchpoints.end(),            // Search full range
+                      WatchpointIDMatches(watch_id)); // Predicate
 }
 
 WatchpointList::wp_collection::const_iterator
-WatchpointList::GetIDConstIterator (lldb::watch_id_t watch_id) const
-{
-    return std::find_if(m_watchpoints.begin(), m_watchpoints.end(), // Search full range
-                        WatchpointIDMatches(watch_id));             // Predicate
+WatchpointList::GetIDConstIterator(lldb::watch_id_t watch_id) const {
+  return std::find_if(m_watchpoints.begin(),
+                      m_watchpoints.end(),            // Search full range
+                      WatchpointIDMatches(watch_id)); // Predicate
 }
 
-WatchpointSP
-WatchpointList::FindByID (lldb::watch_id_t watch_id) const
-{
-    WatchpointSP wp_sp;
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    wp_collection::const_iterator pos = GetIDConstIterator(watch_id);
-    if (pos != m_watchpoints.end())
-        wp_sp = *pos;
+WatchpointSP WatchpointList::FindByID(lldb::watch_id_t watch_id) const {
+  WatchpointSP wp_sp;
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  wp_collection::const_iterator pos = GetIDConstIterator(watch_id);
+  if (pos != m_watchpoints.end())
+    wp_sp = *pos;
 
-    return wp_sp;
-}
-
-lldb::watch_id_t
-WatchpointList::FindIDByAddress (lldb::addr_t addr)
-{
-    WatchpointSP wp_sp = FindByAddress (addr);
-    if (wp_sp)
-    {
-        return wp_sp->GetID();
-    }
-    return LLDB_INVALID_WATCH_ID;
+  return wp_sp;
 }
 
-lldb::watch_id_t
-WatchpointList::FindIDBySpec (std::string spec)
-{
-    WatchpointSP wp_sp = FindBySpec (spec);
-    if (wp_sp)
-    {
-        return wp_sp->GetID();
-    }
-    return LLDB_INVALID_WATCH_ID;
+lldb::watch_id_t WatchpointList::FindIDByAddress(lldb::addr_t addr) {
+  WatchpointSP wp_sp = FindByAddress(addr);
+  if (wp_sp) {
+    return wp_sp->GetID();
+  }
+  return LLDB_INVALID_WATCH_ID;
 }
 
-WatchpointSP
-WatchpointList::GetByIndex (uint32_t i)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    WatchpointSP wp_sp;
-    if (i < m_watchpoints.size())
-    {
-        wp_collection::const_iterator pos = m_watchpoints.begin();
-        std::advance(pos, i);
-        wp_sp = *pos;
-    }
-    return wp_sp;
+lldb::watch_id_t WatchpointList::FindIDBySpec(std::string spec) {
+  WatchpointSP wp_sp = FindBySpec(spec);
+  if (wp_sp) {
+    return wp_sp->GetID();
+  }
+  return LLDB_INVALID_WATCH_ID;
 }
 
-const WatchpointSP
-WatchpointList::GetByIndex (uint32_t i) const
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    WatchpointSP wp_sp;
-    if (i < m_watchpoints.size())
-    {
-        wp_collection::const_iterator pos = m_watchpoints.begin();
-        std::advance(pos, i);
-        wp_sp = *pos;
+WatchpointSP WatchpointList::GetByIndex(uint32_t i) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  WatchpointSP wp_sp;
+  if (i < m_watchpoints.size()) {
+    wp_collection::const_iterator pos = m_watchpoints.begin();
+    std::advance(pos, i);
+    wp_sp = *pos;
+  }
+  return wp_sp;
+}
+
+const WatchpointSP WatchpointList::GetByIndex(uint32_t i) const {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  WatchpointSP wp_sp;
+  if (i < m_watchpoints.size()) {
+    wp_collection::const_iterator pos = m_watchpoints.begin();
+    std::advance(pos, i);
+    wp_sp = *pos;
+  }
+  return wp_sp;
+}
+
+std::vector<lldb::watch_id_t> WatchpointList::GetWatchpointIDs() const {
+  std::vector<lldb::watch_id_t> IDs;
+  wp_collection::const_iterator pos, end = m_watchpoints.end();
+  for (pos = m_watchpoints.begin(); pos != end; ++pos)
+    IDs.push_back((*pos)->GetID());
+  return IDs;
+}
+
+bool WatchpointList::Remove(lldb::watch_id_t watch_id, bool notify) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  wp_collection::iterator pos = GetIDIterator(watch_id);
+  if (pos != m_watchpoints.end()) {
+    WatchpointSP wp_sp = *pos;
+    if (notify) {
+      if (wp_sp->GetTarget().EventTypeHasListeners(
+              Target::eBroadcastBitWatchpointChanged))
+        wp_sp->GetTarget().BroadcastEvent(
+            Target::eBroadcastBitWatchpointChanged,
+            new Watchpoint::WatchpointEventData(eWatchpointEventTypeRemoved,
+                                                wp_sp));
     }
-    return wp_sp;
+    m_watchpoints.erase(pos);
+    return true;
+  }
+  return false;
 }
 
-std::vector<lldb::watch_id_t>
-WatchpointList::GetWatchpointIDs() const
-{
-    std::vector<lldb::watch_id_t> IDs;
-    wp_collection::const_iterator pos, end = m_watchpoints.end();
-    for (pos = m_watchpoints.begin(); pos != end; ++pos)
-        IDs.push_back((*pos)->GetID());
-    return IDs;
+uint32_t WatchpointList::GetHitCount() const {
+  uint32_t hit_count = 0;
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  wp_collection::const_iterator pos, end = m_watchpoints.end();
+  for (pos = m_watchpoints.begin(); pos != end; ++pos)
+    hit_count += (*pos)->GetHitCount();
+  return hit_count;
 }
 
-bool
-WatchpointList::Remove (lldb::watch_id_t watch_id, bool notify)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    wp_collection::iterator pos = GetIDIterator(watch_id);
-    if (pos != m_watchpoints.end())
-    {
-        WatchpointSP wp_sp = *pos;
-        if (notify)
-        {
-            if (wp_sp->GetTarget().EventTypeHasListeners(Target::eBroadcastBitWatchpointChanged))
-                wp_sp->GetTarget().BroadcastEvent (Target::eBroadcastBitWatchpointChanged,
-                                                   new Watchpoint::WatchpointEventData (eWatchpointEventTypeRemoved, wp_sp));
-        }
-        m_watchpoints.erase(pos);
-        return true;
-    }
-    return false;
-}
+bool WatchpointList::ShouldStop(StoppointCallbackContext *context,
+                                lldb::watch_id_t watch_id) {
 
-uint32_t
-WatchpointList::GetHitCount () const
-{
-    uint32_t hit_count = 0;
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    wp_collection::const_iterator pos, end = m_watchpoints.end();
-    for (pos = m_watchpoints.begin(); pos != end; ++pos)
-        hit_count += (*pos)->GetHitCount();
-    return hit_count;
+  WatchpointSP wp_sp = FindByID(watch_id);
+  if (wp_sp) {
+    // Let the Watchpoint decide if it should stop here (could not have
+    // reached it's target hit count yet, or it could have a callback
+    // that decided it shouldn't stop.
+    return wp_sp->ShouldStop(context);
+  }
+  // We should stop here since this Watchpoint isn't valid anymore or it
+  // doesn't exist.
+  return true;
 }
 
-bool
-WatchpointList::ShouldStop (StoppointCallbackContext *context, lldb::watch_id_t watch_id)
-{
+void WatchpointList::GetDescription(Stream *s, lldb::DescriptionLevel level) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  wp_collection::iterator pos, end = m_watchpoints.end();
 
-    WatchpointSP wp_sp = FindByID (watch_id);
-    if (wp_sp)
-    {
-        // Let the Watchpoint decide if it should stop here (could not have
-        // reached it's target hit count yet, or it could have a callback
-        // that decided it shouldn't stop.
-        return wp_sp->ShouldStop (context);
-    }
-    // We should stop here since this Watchpoint isn't valid anymore or it
-    // doesn't exist.
-    return true;
+  for (pos = m_watchpoints.begin(); pos != end; ++pos) {
+    s->Printf(" ");
+    (*pos)->Dump(s);
+  }
 }
 
-void
-WatchpointList::GetDescription (Stream *s, lldb::DescriptionLevel level)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    wp_collection::iterator pos, end = m_watchpoints.end();
+void WatchpointList::SetEnabledAll(bool enabled) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
 
-    for (pos = m_watchpoints.begin(); pos != end; ++pos)
-    {
-        s->Printf(" ");
-        (*pos)->Dump(s);
-    }
+  wp_collection::iterator pos, end = m_watchpoints.end();
+  for (pos = m_watchpoints.begin(); pos != end; ++pos)
+    (*pos)->SetEnabled(enabled);
 }
 
-void
-WatchpointList::SetEnabledAll (bool enabled)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-
-    wp_collection::iterator pos, end = m_watchpoints.end();
-    for (pos = m_watchpoints.begin(); pos != end; ++pos)
-        (*pos)->SetEnabled (enabled);
-}
+void WatchpointList::RemoveAll(bool notify) {
+  std::lock_guard<std::recursive_mutex> guard(m_mutex);
+  if (notify) {
 
-void
-WatchpointList::RemoveAll (bool notify)
-{
-    std::lock_guard<std::recursive_mutex> guard(m_mutex);
-    if (notify)
     {
-        
-        {
-            wp_collection::iterator pos, end = m_watchpoints.end();
-            for (pos = m_watchpoints.begin(); pos != end; ++pos)
-            {
-                if ((*pos)->GetTarget().EventTypeHasListeners(Target::eBroadcastBitBreakpointChanged))
-                {
-                    (*pos)->GetTarget().BroadcastEvent (Target::eBroadcastBitWatchpointChanged,
-                                                        new Watchpoint::WatchpointEventData (eWatchpointEventTypeRemoved,
-                                                                                             *pos));
-                }
-            }
+      wp_collection::iterator pos, end = m_watchpoints.end();
+      for (pos = m_watchpoints.begin(); pos != end; ++pos) {
+        if ((*pos)->GetTarget().EventTypeHasListeners(
+                Target::eBroadcastBitBreakpointChanged)) {
+          (*pos)->GetTarget().BroadcastEvent(
+              Target::eBroadcastBitWatchpointChanged,
+              new Watchpoint::WatchpointEventData(eWatchpointEventTypeRemoved,
+                                                  *pos));
         }
+      }
     }
-    m_watchpoints.clear();
+  }
+  m_watchpoints.clear();
 }
 
-void
-WatchpointList::GetListMutex(std::unique_lock<std::recursive_mutex> &lock)
-{
-    lock = std::unique_lock<std::recursive_mutex>(m_mutex);
+void WatchpointList::GetListMutex(
+    std::unique_lock<std::recursive_mutex> &lock) {
+  lock = std::unique_lock<std::recursive_mutex>(m_mutex);
 }

Modified: lldb/trunk/source/Breakpoint/WatchpointOptions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Breakpoint/WatchpointOptions.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Breakpoint/WatchpointOptions.cpp (original)
+++ lldb/trunk/source/Breakpoint/WatchpointOptions.cpp Tue Sep  6 15:57:50 2016
@@ -13,10 +13,10 @@
 // Project includes
 #include "lldb/Breakpoint/WatchpointOptions.h"
 
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StringList.h"
 #include "lldb/Core/Value.h"
-#include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/ThreadSpec.h"
@@ -24,63 +24,55 @@
 using namespace lldb;
 using namespace lldb_private;
 
-bool
-WatchpointOptions::NullCallback (void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id)
-{
-    return true;
+bool WatchpointOptions::NullCallback(void *baton,
+                                     StoppointCallbackContext *context,
+                                     lldb::user_id_t watch_id) {
+  return true;
 }
 
 //----------------------------------------------------------------------
 // WatchpointOptions constructor
 //----------------------------------------------------------------------
-WatchpointOptions::WatchpointOptions() :
-    m_callback (WatchpointOptions::NullCallback),
-    m_callback_baton_sp (),
-    m_callback_is_synchronous (false),
-    m_thread_spec_ap ()
-{
-}
+WatchpointOptions::WatchpointOptions()
+    : m_callback(WatchpointOptions::NullCallback), m_callback_baton_sp(),
+      m_callback_is_synchronous(false), m_thread_spec_ap() {}
 
 //----------------------------------------------------------------------
 // WatchpointOptions copy constructor
 //----------------------------------------------------------------------
-WatchpointOptions::WatchpointOptions(const WatchpointOptions& rhs) :
-    m_callback (rhs.m_callback),
-    m_callback_baton_sp (rhs.m_callback_baton_sp),
-    m_callback_is_synchronous (rhs.m_callback_is_synchronous),
-    m_thread_spec_ap ()
-{
-    if (rhs.m_thread_spec_ap.get() != nullptr)
-        m_thread_spec_ap.reset (new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+WatchpointOptions::WatchpointOptions(const WatchpointOptions &rhs)
+    : m_callback(rhs.m_callback), m_callback_baton_sp(rhs.m_callback_baton_sp),
+      m_callback_is_synchronous(rhs.m_callback_is_synchronous),
+      m_thread_spec_ap() {
+  if (rhs.m_thread_spec_ap.get() != nullptr)
+    m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
 }
 
 //----------------------------------------------------------------------
 // WatchpointOptions assignment operator
 //----------------------------------------------------------------------
-const WatchpointOptions&
-WatchpointOptions::operator=(const WatchpointOptions& rhs)
-{
-    m_callback = rhs.m_callback;
-    m_callback_baton_sp = rhs.m_callback_baton_sp;
-    m_callback_is_synchronous = rhs.m_callback_is_synchronous;
-    if (rhs.m_thread_spec_ap.get() != nullptr)
-        m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
-    return *this;
+const WatchpointOptions &WatchpointOptions::
+operator=(const WatchpointOptions &rhs) {
+  m_callback = rhs.m_callback;
+  m_callback_baton_sp = rhs.m_callback_baton_sp;
+  m_callback_is_synchronous = rhs.m_callback_is_synchronous;
+  if (rhs.m_thread_spec_ap.get() != nullptr)
+    m_thread_spec_ap.reset(new ThreadSpec(*rhs.m_thread_spec_ap.get()));
+  return *this;
 }
 
 WatchpointOptions *
-WatchpointOptions::CopyOptionsNoCallback (WatchpointOptions &orig)
-{
-    WatchpointHitCallback orig_callback = orig.m_callback;
-    lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp;
-    bool orig_is_sync = orig.m_callback_is_synchronous;
-    
-    orig.ClearCallback();
-    WatchpointOptions *ret_val = new WatchpointOptions(orig);
-    
-    orig.SetCallback (orig_callback, orig_callback_baton_sp, orig_is_sync);
-    
-    return ret_val;
+WatchpointOptions::CopyOptionsNoCallback(WatchpointOptions &orig) {
+  WatchpointHitCallback orig_callback = orig.m_callback;
+  lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp;
+  bool orig_is_sync = orig.m_callback_is_synchronous;
+
+  orig.ClearCallback();
+  WatchpointOptions *ret_val = new WatchpointOptions(orig);
+
+  orig.SetCallback(orig_callback, orig_callback_baton_sp, orig_is_sync);
+
+  return ret_val;
 }
 
 //----------------------------------------------------------------------
@@ -91,147 +83,117 @@ WatchpointOptions::~WatchpointOptions()
 //------------------------------------------------------------------
 // Callbacks
 //------------------------------------------------------------------
-void
-WatchpointOptions::SetCallback (WatchpointHitCallback callback, const BatonSP &callback_baton_sp, bool callback_is_synchronous)
-{
-    m_callback_is_synchronous = callback_is_synchronous;
-    m_callback = callback;
-    m_callback_baton_sp = callback_baton_sp;
-}
-
-void
-WatchpointOptions::ClearCallback ()
-{
-    m_callback = WatchpointOptions::NullCallback;
-    m_callback_is_synchronous = false;
-    m_callback_baton_sp.reset();
-}
-
-Baton *
-WatchpointOptions::GetBaton ()
-{
-    return m_callback_baton_sp.get();
-}
-
-const Baton *
-WatchpointOptions::GetBaton () const
-{
-    return m_callback_baton_sp.get();
-}
-
-bool
-WatchpointOptions::InvokeCallback (StoppointCallbackContext *context, 
-                                   lldb::user_id_t watch_id)
-{
-    if (m_callback && context->is_synchronous == IsCallbackSynchronous())
-    {
-        return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data : nullptr,
-                          context,
-                          watch_id);
-    }
-    else
-        return true;
+void WatchpointOptions::SetCallback(WatchpointHitCallback callback,
+                                    const BatonSP &callback_baton_sp,
+                                    bool callback_is_synchronous) {
+  m_callback_is_synchronous = callback_is_synchronous;
+  m_callback = callback;
+  m_callback_baton_sp = callback_baton_sp;
 }
 
-bool
-WatchpointOptions::HasCallback ()
-{
-    return m_callback != WatchpointOptions::NullCallback;
+void WatchpointOptions::ClearCallback() {
+  m_callback = WatchpointOptions::NullCallback;
+  m_callback_is_synchronous = false;
+  m_callback_baton_sp.reset();
 }
 
-const ThreadSpec *
-WatchpointOptions::GetThreadSpecNoCreate () const
-{
-    return m_thread_spec_ap.get();
+Baton *WatchpointOptions::GetBaton() { return m_callback_baton_sp.get(); }
+
+const Baton *WatchpointOptions::GetBaton() const {
+  return m_callback_baton_sp.get();
 }
 
-ThreadSpec *
-WatchpointOptions::GetThreadSpec ()
-{
-    if (m_thread_spec_ap.get() == nullptr)
-        m_thread_spec_ap.reset (new ThreadSpec());
-        
-    return m_thread_spec_ap.get();
+bool WatchpointOptions::InvokeCallback(StoppointCallbackContext *context,
+                                       lldb::user_id_t watch_id) {
+  if (m_callback && context->is_synchronous == IsCallbackSynchronous()) {
+    return m_callback(m_callback_baton_sp ? m_callback_baton_sp->m_data
+                                          : nullptr,
+                      context, watch_id);
+  } else
+    return true;
 }
 
-void
-WatchpointOptions::SetThreadID (lldb::tid_t thread_id)
-{
-    GetThreadSpec()->SetTID(thread_id);
+bool WatchpointOptions::HasCallback() {
+  return m_callback != WatchpointOptions::NullCallback;
 }
 
-void
-WatchpointOptions::GetCallbackDescription (Stream *s, lldb::DescriptionLevel level) const
-{
-    if (m_callback_baton_sp.get())
-    {
-        s->EOL();
-        m_callback_baton_sp->GetDescription (s, level);
-    }
+const ThreadSpec *WatchpointOptions::GetThreadSpecNoCreate() const {
+  return m_thread_spec_ap.get();
 }
 
-void
-WatchpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) const
-{
-    // Figure out if there are any options not at their default value, and only print 
-    // anything if there are:
-    
-    if ((GetThreadSpecNoCreate() != nullptr && GetThreadSpecNoCreate()->HasSpecification ()))
-    {
-        if (level == lldb::eDescriptionLevelVerbose)
-        {
-            s->EOL ();
-            s->IndentMore();
-            s->Indent();
-            s->PutCString("Watchpoint Options:\n");
-            s->IndentMore();
-            s->Indent();
-        }
-        else
-            s->PutCString(" Options: ");
-                
-        if (m_thread_spec_ap.get())
-            m_thread_spec_ap->GetDescription (s, level);
-        else if (level == eDescriptionLevelBrief)
-            s->PutCString ("thread spec: no ");
-        if (level == lldb::eDescriptionLevelFull)
-        {
-            s->IndentLess();
-            s->IndentMore();
-        }
-    }
-            
-    GetCallbackDescription(s, level);
+ThreadSpec *WatchpointOptions::GetThreadSpec() {
+  if (m_thread_spec_ap.get() == nullptr)
+    m_thread_spec_ap.reset(new ThreadSpec());
+
+  return m_thread_spec_ap.get();
 }
 
-void
-WatchpointOptions::CommandBaton::GetDescription (Stream *s, lldb::DescriptionLevel level) const
-{
-    CommandData *data = (CommandData *)m_data;
-
-    if (level == eDescriptionLevelBrief)
-    {
-        s->Printf (", commands = %s", (data && data->user_source.GetSize() > 0) ? "yes" : "no");
-        return;
-    }
-    
-    s->IndentMore ();
-    s->Indent("watchpoint commands:\n");
-    
-    s->IndentMore ();
-    if (data && data->user_source.GetSize() > 0)
-    {
-        const size_t num_strings = data->user_source.GetSize();
-        for (size_t i = 0; i < num_strings; ++i)
-        {
-            s->Indent(data->user_source.GetStringAtIndex(i));
-            s->EOL();
-        }
+void WatchpointOptions::SetThreadID(lldb::tid_t thread_id) {
+  GetThreadSpec()->SetTID(thread_id);
+}
+
+void WatchpointOptions::GetCallbackDescription(
+    Stream *s, lldb::DescriptionLevel level) const {
+  if (m_callback_baton_sp.get()) {
+    s->EOL();
+    m_callback_baton_sp->GetDescription(s, level);
+  }
+}
+
+void WatchpointOptions::GetDescription(Stream *s,
+                                       lldb::DescriptionLevel level) const {
+  // Figure out if there are any options not at their default value, and only
+  // print
+  // anything if there are:
+
+  if ((GetThreadSpecNoCreate() != nullptr &&
+       GetThreadSpecNoCreate()->HasSpecification())) {
+    if (level == lldb::eDescriptionLevelVerbose) {
+      s->EOL();
+      s->IndentMore();
+      s->Indent();
+      s->PutCString("Watchpoint Options:\n");
+      s->IndentMore();
+      s->Indent();
+    } else
+      s->PutCString(" Options: ");
+
+    if (m_thread_spec_ap.get())
+      m_thread_spec_ap->GetDescription(s, level);
+    else if (level == eDescriptionLevelBrief)
+      s->PutCString("thread spec: no ");
+    if (level == lldb::eDescriptionLevelFull) {
+      s->IndentLess();
+      s->IndentMore();
     }
-    else
-    {
-        s->PutCString ("No commands.\n");
+  }
+
+  GetCallbackDescription(s, level);
+}
+
+void WatchpointOptions::CommandBaton::GetDescription(
+    Stream *s, lldb::DescriptionLevel level) const {
+  CommandData *data = (CommandData *)m_data;
+
+  if (level == eDescriptionLevelBrief) {
+    s->Printf(", commands = %s",
+              (data && data->user_source.GetSize() > 0) ? "yes" : "no");
+    return;
+  }
+
+  s->IndentMore();
+  s->Indent("watchpoint commands:\n");
+
+  s->IndentMore();
+  if (data && data->user_source.GetSize() > 0) {
+    const size_t num_strings = data->user_source.GetSize();
+    for (size_t i = 0; i < num_strings; ++i) {
+      s->Indent(data->user_source.GetStringAtIndex(i));
+      s->EOL();
     }
-    s->IndentLess ();
-    s->IndentLess ();
+  } else {
+    s->PutCString("No commands.\n");
+  }
+  s->IndentLess();
+  s->IndentLess();
 }

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Tue Sep  6 15:57:50 2016
@@ -37,447 +37,368 @@
 using namespace lldb_private;
 
 CommandCompletions::CommonCompletionElement
-CommandCompletions::g_common_completions[] =
-{
-    {eCustomCompletion,          nullptr},
-    {eSourceFileCompletion,      CommandCompletions::SourceFiles},
-    {eDiskFileCompletion,        CommandCompletions::DiskFiles},
-    {eDiskDirectoryCompletion,   CommandCompletions::DiskDirectories},
-    {eSymbolCompletion,          CommandCompletions::Symbols},
-    {eModuleCompletion,          CommandCompletions::Modules},
-    {eSettingsNameCompletion,    CommandCompletions::SettingsNames},
-    {ePlatformPluginCompletion,  CommandCompletions::PlatformPluginNames},
-    {eArchitectureCompletion,    CommandCompletions::ArchitectureNames},
-    {eVariablePathCompletion,    CommandCompletions::VariablePath},
-    {eNoCompletion,              nullptr}      // This one has to be last in the list.
+    CommandCompletions::g_common_completions[] = {
+        {eCustomCompletion, nullptr},
+        {eSourceFileCompletion, CommandCompletions::SourceFiles},
+        {eDiskFileCompletion, CommandCompletions::DiskFiles},
+        {eDiskDirectoryCompletion, CommandCompletions::DiskDirectories},
+        {eSymbolCompletion, CommandCompletions::Symbols},
+        {eModuleCompletion, CommandCompletions::Modules},
+        {eSettingsNameCompletion, CommandCompletions::SettingsNames},
+        {ePlatformPluginCompletion, CommandCompletions::PlatformPluginNames},
+        {eArchitectureCompletion, CommandCompletions::ArchitectureNames},
+        {eVariablePathCompletion, CommandCompletions::VariablePath},
+        {eNoCompletion, nullptr} // This one has to be last in the list.
 };
 
-bool
-CommandCompletions::InvokeCommonCompletionCallbacks(CommandInterpreter &interpreter,
-                                                    uint32_t completion_mask,
-                                                    const char *completion_str,
-                                                    int match_start_point,
-                                                    int max_return_elements,
-                                                    SearchFilter *searcher,
-                                                    bool &word_complete,
-                                                    StringList &matches)
-{
-    bool handled = false;
-
-    if (completion_mask & eCustomCompletion)
-        return false;
-
-    for (int i = 0; ; i++)
-    {
-        if (g_common_completions[i].type == eNoCompletion)
-            break;
-         else if ((g_common_completions[i].type & completion_mask) == g_common_completions[i].type
-                   && g_common_completions[i].callback != nullptr)
-         {
-            handled = true;
-            g_common_completions[i].callback (interpreter,
-                                              completion_str,
-                                              match_start_point,
-                                              max_return_elements,
-                                              searcher,
-                                              word_complete,
-                                              matches);
-        }
+bool CommandCompletions::InvokeCommonCompletionCallbacks(
+    CommandInterpreter &interpreter, uint32_t completion_mask,
+    const char *completion_str, int match_start_point, int max_return_elements,
+    SearchFilter *searcher, bool &word_complete, StringList &matches) {
+  bool handled = false;
+
+  if (completion_mask & eCustomCompletion)
+    return false;
+
+  for (int i = 0;; i++) {
+    if (g_common_completions[i].type == eNoCompletion)
+      break;
+    else if ((g_common_completions[i].type & completion_mask) ==
+                 g_common_completions[i].type &&
+             g_common_completions[i].callback != nullptr) {
+      handled = true;
+      g_common_completions[i].callback(interpreter, completion_str,
+                                       match_start_point, max_return_elements,
+                                       searcher, word_complete, matches);
     }
-    return handled;
+  }
+  return handled;
 }
 
-int
-CommandCompletions::SourceFiles(CommandInterpreter &interpreter,
-                                const char *partial_file_name,
-                                int match_start_point,
-                                int max_return_elements,
-                                SearchFilter *searcher,
-                                bool &word_complete,
-                                StringList &matches)
-{
-    word_complete = true;
-    // Find some way to switch "include support files..."
-    SourceFileCompleter completer (interpreter,
-                                   false, 
-                                   partial_file_name, 
-                                   match_start_point, 
-                                   max_return_elements,
-                                   matches);
-
-    if (searcher == nullptr)
-    {
-        lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
-        SearchFilterForUnconstrainedSearches null_searcher (target_sp);
-        completer.DoCompletion (&null_searcher);
-    }
-    else
-    {
-        completer.DoCompletion (searcher);
-    }
-    return matches.GetSize();
-}
-
-typedef struct DiskFilesOrDirectoriesBaton
-{
-    const char *remainder;
-    char *partial_name_copy;
-    bool only_directories;
-    bool *saw_directory;
-    StringList *matches;
-    char *end_ptr;
-    size_t baselen;
+int CommandCompletions::SourceFiles(CommandInterpreter &interpreter,
+                                    const char *partial_file_name,
+                                    int match_start_point,
+                                    int max_return_elements,
+                                    SearchFilter *searcher, bool &word_complete,
+                                    StringList &matches) {
+  word_complete = true;
+  // Find some way to switch "include support files..."
+  SourceFileCompleter completer(interpreter, false, partial_file_name,
+                                match_start_point, max_return_elements,
+                                matches);
+
+  if (searcher == nullptr) {
+    lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
+    SearchFilterForUnconstrainedSearches null_searcher(target_sp);
+    completer.DoCompletion(&null_searcher);
+  } else {
+    completer.DoCompletion(searcher);
+  }
+  return matches.GetSize();
+}
+
+typedef struct DiskFilesOrDirectoriesBaton {
+  const char *remainder;
+  char *partial_name_copy;
+  bool only_directories;
+  bool *saw_directory;
+  StringList *matches;
+  char *end_ptr;
+  size_t baselen;
 } DiskFilesOrDirectoriesBaton;
 
-FileSpec::EnumerateDirectoryResult DiskFilesOrDirectoriesCallback(void *baton, FileSpec::FileType file_type, const FileSpec &spec)
-{
-    const char *name = spec.GetFilename().AsCString();
-
-    const DiskFilesOrDirectoriesBaton *parameters = (DiskFilesOrDirectoriesBaton*)baton;
-    char *end_ptr = parameters->end_ptr;
-    char *partial_name_copy = parameters->partial_name_copy;
-    const char *remainder = parameters->remainder;
-
-    // Omit ".", ".." and any . files if the match string doesn't start with .
-    if (name[0] == '.')
-    {
-        if (name[1] == '\0')
-            return FileSpec::eEnumerateDirectoryResultNext;
-        else if (name[1] == '.' && name[2] == '\0')
-            return FileSpec::eEnumerateDirectoryResultNext;
-        else if (remainder[0] != '.')
-            return FileSpec::eEnumerateDirectoryResultNext;
-    }
+FileSpec::EnumerateDirectoryResult
+DiskFilesOrDirectoriesCallback(void *baton, FileSpec::FileType file_type,
+                               const FileSpec &spec) {
+  const char *name = spec.GetFilename().AsCString();
+
+  const DiskFilesOrDirectoriesBaton *parameters =
+      (DiskFilesOrDirectoriesBaton *)baton;
+  char *end_ptr = parameters->end_ptr;
+  char *partial_name_copy = parameters->partial_name_copy;
+  const char *remainder = parameters->remainder;
+
+  // Omit ".", ".." and any . files if the match string doesn't start with .
+  if (name[0] == '.') {
+    if (name[1] == '\0')
+      return FileSpec::eEnumerateDirectoryResultNext;
+    else if (name[1] == '.' && name[2] == '\0')
+      return FileSpec::eEnumerateDirectoryResultNext;
+    else if (remainder[0] != '.')
+      return FileSpec::eEnumerateDirectoryResultNext;
+  }
+
+  // If we found a directory, we put a "/" at the end of the name.
+
+  if (remainder[0] == '\0' || strstr(name, remainder) == name) {
+    if (strlen(name) + parameters->baselen >= PATH_MAX)
+      return FileSpec::eEnumerateDirectoryResultNext;
+
+    strcpy(end_ptr, name);
+
+    bool isa_directory = false;
+    if (file_type == FileSpec::eFileTypeDirectory)
+      isa_directory = true;
+    else if (file_type == FileSpec::eFileTypeSymbolicLink) {
+      if (FileSpec(partial_name_copy, false).IsDirectory())
+        isa_directory = true;
+    }
+
+    if (isa_directory) {
+      *parameters->saw_directory = true;
+      size_t len = strlen(parameters->partial_name_copy);
+      partial_name_copy[len] = '/';
+      partial_name_copy[len + 1] = '\0';
+    }
+    if (parameters->only_directories && !isa_directory)
+      return FileSpec::eEnumerateDirectoryResultNext;
+    parameters->matches->AppendString(partial_name_copy);
+  }
+
+  return FileSpec::eEnumerateDirectoryResultNext;
+}
+
+static int DiskFilesOrDirectories(const char *partial_file_name,
+                                  bool only_directories, bool &saw_directory,
+                                  StringList &matches) {
+  // I'm going to  use the "glob" function with GLOB_TILDE for user directory
+  // expansion.
+  // If it is not defined on your host system, you'll need to implement it
+  // yourself...
 
-    // If we found a directory, we put a "/" at the end of the name.
+  size_t partial_name_len = strlen(partial_file_name);
 
-    if (remainder[0] == '\0' || strstr(name, remainder) == name)
-    {
-        if (strlen(name) + parameters->baselen >= PATH_MAX)
-            return FileSpec::eEnumerateDirectoryResultNext;
-
-        strcpy(end_ptr, name);
-
-        bool isa_directory = false;
-        if (file_type == FileSpec::eFileTypeDirectory)
-            isa_directory = true;
-        else if (file_type == FileSpec::eFileTypeSymbolicLink)
-        {
-            if (FileSpec(partial_name_copy, false).IsDirectory())
-                isa_directory = true;
-        }
-
-        if (isa_directory)
-        {
-            *parameters->saw_directory = true;
-            size_t len = strlen(parameters->partial_name_copy);
-            partial_name_copy[len] = '/';
-            partial_name_copy[len + 1] = '\0';
-        }
-        if (parameters->only_directories && !isa_directory)
-            return FileSpec::eEnumerateDirectoryResultNext;
-        parameters->matches->AppendString(partial_name_copy);
-    }
-
-    return FileSpec::eEnumerateDirectoryResultNext;
-}
+  if (partial_name_len >= PATH_MAX)
+    return matches.GetSize();
 
-static int
-DiskFilesOrDirectories(const char *partial_file_name,
-                       bool only_directories,
-                       bool &saw_directory,
-                       StringList &matches)
-{
-    // I'm going to  use the "glob" function with GLOB_TILDE for user directory expansion.  
-    // If it is not defined on your host system, you'll need to implement it yourself...
-    
-    size_t partial_name_len = strlen(partial_file_name);
-    
-    if (partial_name_len >= PATH_MAX)
+  // This copy of the string will be cut up into the directory part, and the
+  // remainder.  end_ptr
+  // below will point to the place of the remainder in this string.  Then when
+  // we've resolved the
+  // containing directory, and opened it, we'll read the directory contents and
+  // overwrite the
+  // partial_name_copy starting from end_ptr with each of the matches.  Thus we
+  // will preserve
+  // the form the user originally typed.
+
+  char partial_name_copy[PATH_MAX];
+  memcpy(partial_name_copy, partial_file_name, partial_name_len);
+  partial_name_copy[partial_name_len] = '\0';
+
+  // We'll need to save a copy of the remainder for comparison, which we do
+  // here.
+  char remainder[PATH_MAX];
+
+  // end_ptr will point past the last / in partial_name_copy, or if there is no
+  // slash to the beginning of the string.
+  char *end_ptr;
+
+  end_ptr = strrchr(partial_name_copy, '/');
+
+  // This will store the resolved form of the containing directory
+  llvm::SmallString<64> containing_part;
+
+  if (end_ptr == nullptr) {
+    // There's no directory.  If the thing begins with a "~" then this is a bare
+    // user name.
+    if (*partial_name_copy == '~') {
+      // Nothing here but the user name.  We could just put a slash on the end,
+      // but for completeness sake we'll resolve the user name and only put a
+      // slash
+      // on the end if it exists.
+      llvm::SmallString<64> resolved_username(partial_name_copy);
+      FileSpec::ResolveUsername(resolved_username);
+
+      // Not sure how this would happen, a username longer than PATH_MAX?
+      // Still...
+      if (resolved_username.size() == 0) {
+        // The user name didn't resolve, let's look in the password database for
+        // matches.
+        // The user name database contains duplicates, and is not in
+        // alphabetical order, so
+        // we'll use a set to manage that for us.
+        FileSpec::ResolvePartialUsername(partial_name_copy, matches);
+        if (matches.GetSize() > 0)
+          saw_directory = true;
         return matches.GetSize();
-    
-    // This copy of the string will be cut up into the directory part, and the remainder.  end_ptr
-    // below will point to the place of the remainder in this string.  Then when we've resolved the
-    // containing directory, and opened it, we'll read the directory contents and overwrite the
-    // partial_name_copy starting from end_ptr with each of the matches.  Thus we will preserve
-    // the form the user originally typed.
-    
-    char partial_name_copy[PATH_MAX];
-    memcpy(partial_name_copy, partial_file_name, partial_name_len);
-    partial_name_copy[partial_name_len] = '\0';
-    
-    // We'll need to save a copy of the remainder for comparison, which we do here.
-    char remainder[PATH_MAX];
-    
-    // end_ptr will point past the last / in partial_name_copy, or if there is no slash to the beginning of the string.
-    char *end_ptr;
-    
-    end_ptr = strrchr(partial_name_copy, '/');
-    
-    // This will store the resolved form of the containing directory
-    llvm::SmallString<64> containing_part;
-    
-    if (end_ptr == nullptr)
-    {
-        // There's no directory.  If the thing begins with a "~" then this is a bare
-        // user name.
-        if (*partial_name_copy == '~')
-        {
-            // Nothing here but the user name.  We could just put a slash on the end, 
-            // but for completeness sake we'll resolve the user name and only put a slash
-            // on the end if it exists.
-            llvm::SmallString<64> resolved_username(partial_name_copy);
-            FileSpec::ResolveUsername (resolved_username);
-                                                          
-           // Not sure how this would happen, a username longer than PATH_MAX?  Still...
-            if (resolved_username.size() == 0)
-            {
-                // The user name didn't resolve, let's look in the password database for matches.
-                // The user name database contains duplicates, and is not in alphabetical order, so
-                // we'll use a set to manage that for us.
-                FileSpec::ResolvePartialUsername (partial_name_copy, matches);
-                if (matches.GetSize() > 0)
-                    saw_directory = true;
-                return matches.GetSize();
-            } 
-            else
-            {   
-                //The thing exists, put a '/' on the end, and return it...
-                // FIXME: complete user names here:
-                partial_name_copy[partial_name_len] = '/';
-                partial_name_copy[partial_name_len+1] = '\0';
-                matches.AppendString(partial_name_copy);
-                saw_directory = true;
-                return matches.GetSize();
-            }
-        }
-        else
-        {
-            // The containing part is the CWD, and the whole string is the remainder.
-            containing_part = ".";
-            strcpy(remainder, partial_name_copy);
-            end_ptr = partial_name_copy;
-        }
-    }
-    else
-    {
-        if (end_ptr == partial_name_copy)
-        {
-            // We're completing a file or directory in the root volume.
-            containing_part = "/";
-        }
-        else
-        {
-            containing_part.append(partial_name_copy, end_ptr);
-        }
-        // Push end_ptr past the final "/" and set remainder.
-        end_ptr++;
-        strcpy(remainder, end_ptr);
-    }
-    
-    // Look for a user name in the containing part, and if it's there, resolve it and stick the
-    // result back into the containing_part:
-
-    if (*partial_name_copy == '~')
-    {
-        FileSpec::ResolveUsername(containing_part);
-        // User name doesn't exist, we're not getting any further...
-        if (containing_part.empty())
-            return matches.GetSize();
-    }
-
-    // Okay, containing_part is now the directory we want to open and look for files:
-
-    size_t baselen = end_ptr - partial_name_copy;
-    
-    DiskFilesOrDirectoriesBaton parameters;
-    parameters.remainder = remainder;
-    parameters.partial_name_copy = partial_name_copy;
-    parameters.only_directories = only_directories;
-    parameters.saw_directory = &saw_directory;
-    parameters.matches = &matches;
-    parameters.end_ptr = end_ptr;
-    parameters.baselen = baselen;
-
-    FileSpec::EnumerateDirectory(containing_part.c_str(), true, true, true, DiskFilesOrDirectoriesCallback, &parameters);
-    
-    return matches.GetSize();
-}
+      } else {
+        // The thing exists, put a '/' on the end, and return it...
+        // FIXME: complete user names here:
+        partial_name_copy[partial_name_len] = '/';
+        partial_name_copy[partial_name_len + 1] = '\0';
+        matches.AppendString(partial_name_copy);
+        saw_directory = true;
+        return matches.GetSize();
+      }
+    } else {
+      // The containing part is the CWD, and the whole string is the remainder.
+      containing_part = ".";
+      strcpy(remainder, partial_name_copy);
+      end_ptr = partial_name_copy;
+    }
+  } else {
+    if (end_ptr == partial_name_copy) {
+      // We're completing a file or directory in the root volume.
+      containing_part = "/";
+    } else {
+      containing_part.append(partial_name_copy, end_ptr);
+    }
+    // Push end_ptr past the final "/" and set remainder.
+    end_ptr++;
+    strcpy(remainder, end_ptr);
+  }
+
+  // Look for a user name in the containing part, and if it's there, resolve it
+  // and stick the
+  // result back into the containing_part:
+
+  if (*partial_name_copy == '~') {
+    FileSpec::ResolveUsername(containing_part);
+    // User name doesn't exist, we're not getting any further...
+    if (containing_part.empty())
+      return matches.GetSize();
+  }
+
+  // Okay, containing_part is now the directory we want to open and look for
+  // files:
+
+  size_t baselen = end_ptr - partial_name_copy;
+
+  DiskFilesOrDirectoriesBaton parameters;
+  parameters.remainder = remainder;
+  parameters.partial_name_copy = partial_name_copy;
+  parameters.only_directories = only_directories;
+  parameters.saw_directory = &saw_directory;
+  parameters.matches = &matches;
+  parameters.end_ptr = end_ptr;
+  parameters.baselen = baselen;
 
-int
-CommandCompletions::DiskFiles(CommandInterpreter &interpreter,
-                              const char *partial_file_name,
-                              int match_start_point,
-                              int max_return_elements,
-                              SearchFilter *searcher,
-                              bool &word_complete,
-                              StringList &matches)
-{
-    int ret_val = DiskFilesOrDirectories (partial_file_name,
-                                          false,
-                                          word_complete,
-                                          matches);
-    word_complete = !word_complete;
-    return ret_val;
-}
+  FileSpec::EnumerateDirectory(containing_part.c_str(), true, true, true,
+                               DiskFilesOrDirectoriesCallback, &parameters);
 
-int
-CommandCompletions::DiskDirectories(CommandInterpreter &interpreter,
-                                    const char *partial_file_name,
-                                    int match_start_point,
-                                    int max_return_elements,
-                                    SearchFilter *searcher,
-                                    bool &word_complete,
-                                    StringList &matches)
-{
-    int ret_val =  DiskFilesOrDirectories (partial_file_name,
-                                           true,
-                                           word_complete,
-                                           matches); 
-    word_complete = false;
-    return ret_val;
-}
-
-int
-CommandCompletions::Modules(CommandInterpreter &interpreter,
-                            const char *partial_file_name,
-                            int match_start_point,
-                            int max_return_elements,
-                            SearchFilter *searcher,
-                            bool &word_complete,
-                            StringList &matches)
-{
-    word_complete = true;
-    ModuleCompleter completer (interpreter,
-                               partial_file_name, 
-                               match_start_point, 
-                               max_return_elements, 
-                               matches);
-    
-    if (searcher == nullptr)
-    {
-        lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
-        SearchFilterForUnconstrainedSearches null_searcher (target_sp);
-        completer.DoCompletion (&null_searcher);
-    }
-    else
-    {
-        completer.DoCompletion (searcher);
-    }
-    return matches.GetSize();
+  return matches.GetSize();
 }
 
-int
-CommandCompletions::Symbols(CommandInterpreter &interpreter,
-                            const char *partial_file_name,
-                            int match_start_point,
-                            int max_return_elements,
-                            SearchFilter *searcher,
-                            bool &word_complete,
-                            StringList &matches)
-{
-    word_complete = true;
-    SymbolCompleter completer (interpreter,
-                               partial_file_name, 
-                               match_start_point, 
-                               max_return_elements, 
-                               matches);
-
-    if (searcher == nullptr)
-    {
-        lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
-        SearchFilterForUnconstrainedSearches null_searcher (target_sp);
-        completer.DoCompletion (&null_searcher);
-    }
-    else
-    {
-        completer.DoCompletion (searcher);
-    }
-    return matches.GetSize();
+int CommandCompletions::DiskFiles(CommandInterpreter &interpreter,
+                                  const char *partial_file_name,
+                                  int match_start_point,
+                                  int max_return_elements,
+                                  SearchFilter *searcher, bool &word_complete,
+                                  StringList &matches) {
+  int ret_val =
+      DiskFilesOrDirectories(partial_file_name, false, word_complete, matches);
+  word_complete = !word_complete;
+  return ret_val;
+}
+
+int CommandCompletions::DiskDirectories(
+    CommandInterpreter &interpreter, const char *partial_file_name,
+    int match_start_point, int max_return_elements, SearchFilter *searcher,
+    bool &word_complete, StringList &matches) {
+  int ret_val =
+      DiskFilesOrDirectories(partial_file_name, true, word_complete, matches);
+  word_complete = false;
+  return ret_val;
 }
 
-int
-CommandCompletions::SettingsNames (CommandInterpreter &interpreter,
-                                   const char *partial_setting_name,
-                                   int match_start_point,
-                                   int max_return_elements,
-                                   SearchFilter *searcher,
-                                   bool &word_complete,
-                                   StringList &matches)
-{
-    // Cache the full setting name list
-    static StringList g_property_names;
-    if (g_property_names.GetSize() == 0)
-    {
-        // Generate the full setting name list on demand
-        lldb::OptionValuePropertiesSP properties_sp (interpreter.GetDebugger().GetValueProperties());
-        if (properties_sp)
-        {
-            StreamString strm;
-            properties_sp->DumpValue(nullptr, strm, OptionValue::eDumpOptionName);
-            const std::string &str = strm.GetString();
-            g_property_names.SplitIntoLines(str.c_str(), str.size());
-        }
-    }
-    
-    size_t exact_matches_idx = SIZE_MAX;
-    const size_t num_matches = g_property_names.AutoComplete (partial_setting_name, matches, exact_matches_idx);
-    word_complete = exact_matches_idx != SIZE_MAX;
-    return num_matches;
+int CommandCompletions::Modules(CommandInterpreter &interpreter,
+                                const char *partial_file_name,
+                                int match_start_point, int max_return_elements,
+                                SearchFilter *searcher, bool &word_complete,
+                                StringList &matches) {
+  word_complete = true;
+  ModuleCompleter completer(interpreter, partial_file_name, match_start_point,
+                            max_return_elements, matches);
+
+  if (searcher == nullptr) {
+    lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
+    SearchFilterForUnconstrainedSearches null_searcher(target_sp);
+    completer.DoCompletion(&null_searcher);
+  } else {
+    completer.DoCompletion(searcher);
+  }
+  return matches.GetSize();
 }
 
-int
-CommandCompletions::PlatformPluginNames (CommandInterpreter &interpreter,
-                                         const char *partial_name,
-                                         int match_start_point,
-                                         int max_return_elements,
-                                         SearchFilter *searcher,
-                                         bool &word_complete,
-                                         lldb_private::StringList &matches)
-{
-    const uint32_t num_matches = PluginManager::AutoCompletePlatformName(partial_name, matches);
-    word_complete = num_matches == 1;
-    return num_matches;
-}
-
-int
-CommandCompletions::ArchitectureNames (CommandInterpreter &interpreter,
-                                       const char *partial_name,
-                                       int match_start_point,
-                                       int max_return_elements,
-                                       SearchFilter *searcher,
-                                       bool &word_complete,
-                                       lldb_private::StringList &matches)
-{
-    const uint32_t num_matches = ArchSpec::AutoComplete (partial_name, matches);
-    word_complete = num_matches == 1;
-    return num_matches;
-}
-
-int
-CommandCompletions::VariablePath (CommandInterpreter &interpreter,
-                                  const char *partial_name,
-                                  int match_start_point,
-                                  int max_return_elements,
-                                  SearchFilter *searcher,
-                                  bool &word_complete,
-                                  lldb_private::StringList &matches)
-{
-    return Variable::AutoComplete (interpreter.GetExecutionContext(), partial_name, matches, word_complete);
+int CommandCompletions::Symbols(CommandInterpreter &interpreter,
+                                const char *partial_file_name,
+                                int match_start_point, int max_return_elements,
+                                SearchFilter *searcher, bool &word_complete,
+                                StringList &matches) {
+  word_complete = true;
+  SymbolCompleter completer(interpreter, partial_file_name, match_start_point,
+                            max_return_elements, matches);
+
+  if (searcher == nullptr) {
+    lldb::TargetSP target_sp = interpreter.GetDebugger().GetSelectedTarget();
+    SearchFilterForUnconstrainedSearches null_searcher(target_sp);
+    completer.DoCompletion(&null_searcher);
+  } else {
+    completer.DoCompletion(searcher);
+  }
+  return matches.GetSize();
+}
+
+int CommandCompletions::SettingsNames(
+    CommandInterpreter &interpreter, const char *partial_setting_name,
+    int match_start_point, int max_return_elements, SearchFilter *searcher,
+    bool &word_complete, StringList &matches) {
+  // Cache the full setting name list
+  static StringList g_property_names;
+  if (g_property_names.GetSize() == 0) {
+    // Generate the full setting name list on demand
+    lldb::OptionValuePropertiesSP properties_sp(
+        interpreter.GetDebugger().GetValueProperties());
+    if (properties_sp) {
+      StreamString strm;
+      properties_sp->DumpValue(nullptr, strm, OptionValue::eDumpOptionName);
+      const std::string &str = strm.GetString();
+      g_property_names.SplitIntoLines(str.c_str(), str.size());
+    }
+  }
+
+  size_t exact_matches_idx = SIZE_MAX;
+  const size_t num_matches = g_property_names.AutoComplete(
+      partial_setting_name, matches, exact_matches_idx);
+  word_complete = exact_matches_idx != SIZE_MAX;
+  return num_matches;
+}
+
+int CommandCompletions::PlatformPluginNames(
+    CommandInterpreter &interpreter, const char *partial_name,
+    int match_start_point, int max_return_elements, SearchFilter *searcher,
+    bool &word_complete, lldb_private::StringList &matches) {
+  const uint32_t num_matches =
+      PluginManager::AutoCompletePlatformName(partial_name, matches);
+  word_complete = num_matches == 1;
+  return num_matches;
+}
+
+int CommandCompletions::ArchitectureNames(
+    CommandInterpreter &interpreter, const char *partial_name,
+    int match_start_point, int max_return_elements, SearchFilter *searcher,
+    bool &word_complete, lldb_private::StringList &matches) {
+  const uint32_t num_matches = ArchSpec::AutoComplete(partial_name, matches);
+  word_complete = num_matches == 1;
+  return num_matches;
+}
+
+int CommandCompletions::VariablePath(
+    CommandInterpreter &interpreter, const char *partial_name,
+    int match_start_point, int max_return_elements, SearchFilter *searcher,
+    bool &word_complete, lldb_private::StringList &matches) {
+  return Variable::AutoComplete(interpreter.GetExecutionContext(), partial_name,
+                                matches, word_complete);
 }
 
 CommandCompletions::Completer::Completer(CommandInterpreter &interpreter,
                                          const char *completion_str,
                                          int match_start_point,
                                          int max_return_elements,
-                                         StringList &matches) :
-    m_interpreter (interpreter),
-    m_completion_str (completion_str),
-    m_match_start_point (match_start_point),
-    m_max_return_elements (max_return_elements),
-    m_matches (matches)
-{
-}
+                                         StringList &matches)
+    : m_interpreter(interpreter), m_completion_str(completion_str),
+      m_match_start_point(match_start_point),
+      m_max_return_elements(max_return_elements), m_matches(matches) {}
 
 CommandCompletions::Completer::~Completer() = default;
 
@@ -485,237 +406,195 @@ CommandCompletions::Completer::~Complete
 // SourceFileCompleter
 //----------------------------------------------------------------------
 
-CommandCompletions::SourceFileCompleter::SourceFileCompleter(CommandInterpreter &interpreter,
-                                                             bool include_support_files,
-                                                             const char *completion_str,
-                                                             int match_start_point,
-                                                             int max_return_elements,
-                                                             StringList &matches) :
-    CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches),
-    m_include_support_files (include_support_files),
-    m_matching_files()
-{
-    FileSpec partial_spec (m_completion_str.c_str(), false);
-    m_file_name = partial_spec.GetFilename().GetCString();
-    m_dir_name = partial_spec.GetDirectory().GetCString();
-}
-
-Searcher::Depth
-CommandCompletions::SourceFileCompleter::GetDepth()
-{
-    return eDepthCompUnit;
+CommandCompletions::SourceFileCompleter::SourceFileCompleter(
+    CommandInterpreter &interpreter, bool include_support_files,
+    const char *completion_str, int match_start_point, int max_return_elements,
+    StringList &matches)
+    : CommandCompletions::Completer(interpreter, completion_str,
+                                    match_start_point, max_return_elements,
+                                    matches),
+      m_include_support_files(include_support_files), m_matching_files() {
+  FileSpec partial_spec(m_completion_str.c_str(), false);
+  m_file_name = partial_spec.GetFilename().GetCString();
+  m_dir_name = partial_spec.GetDirectory().GetCString();
+}
+
+Searcher::Depth CommandCompletions::SourceFileCompleter::GetDepth() {
+  return eDepthCompUnit;
 }
 
 Searcher::CallbackReturn
 CommandCompletions::SourceFileCompleter::SearchCallback(SearchFilter &filter,
                                                         SymbolContext &context,
                                                         Address *addr,
-                                                        bool complete)
-{
-    if (context.comp_unit != nullptr)
-    {
-        if (m_include_support_files)
-        {
-            FileSpecList supporting_files = context.comp_unit->GetSupportFiles();
-            for (size_t sfiles = 0; sfiles < supporting_files.GetSize(); sfiles++)
-            {
-                const FileSpec &sfile_spec = supporting_files.GetFileSpecAtIndex(sfiles);
-                const char *sfile_file_name = sfile_spec.GetFilename().GetCString();
-                const char *sfile_dir_name = sfile_spec.GetFilename().GetCString();
-                bool match = false;
-                if (m_file_name && sfile_file_name
-                    && strstr (sfile_file_name, m_file_name) == sfile_file_name)
-                    match = true;
-                if (match && m_dir_name && sfile_dir_name
-                    && strstr (sfile_dir_name, m_dir_name) != sfile_dir_name)
-                    match = false;
-
-                if (match)
-                {
-                    m_matching_files.AppendIfUnique(sfile_spec);
-                }
-            }
-        }
-        else
-        {
-            const char *cur_file_name = context.comp_unit->GetFilename().GetCString();
-            const char *cur_dir_name = context.comp_unit->GetDirectory().GetCString();
-
-            bool match = false;
-            if (m_file_name && cur_file_name
-                && strstr (cur_file_name, m_file_name) == cur_file_name)
-                match = true;
-
-            if (match && m_dir_name && cur_dir_name
-                && strstr (cur_dir_name, m_dir_name) != cur_dir_name)
-                match = false;
-
-            if (match)
-            {
-                m_matching_files.AppendIfUnique(context.comp_unit);
-            }
-        }
+                                                        bool complete) {
+  if (context.comp_unit != nullptr) {
+    if (m_include_support_files) {
+      FileSpecList supporting_files = context.comp_unit->GetSupportFiles();
+      for (size_t sfiles = 0; sfiles < supporting_files.GetSize(); sfiles++) {
+        const FileSpec &sfile_spec =
+            supporting_files.GetFileSpecAtIndex(sfiles);
+        const char *sfile_file_name = sfile_spec.GetFilename().GetCString();
+        const char *sfile_dir_name = sfile_spec.GetFilename().GetCString();
+        bool match = false;
+        if (m_file_name && sfile_file_name &&
+            strstr(sfile_file_name, m_file_name) == sfile_file_name)
+          match = true;
+        if (match && m_dir_name && sfile_dir_name &&
+            strstr(sfile_dir_name, m_dir_name) != sfile_dir_name)
+          match = false;
+
+        if (match) {
+          m_matching_files.AppendIfUnique(sfile_spec);
+        }
+      }
+    } else {
+      const char *cur_file_name = context.comp_unit->GetFilename().GetCString();
+      const char *cur_dir_name = context.comp_unit->GetDirectory().GetCString();
+
+      bool match = false;
+      if (m_file_name && cur_file_name &&
+          strstr(cur_file_name, m_file_name) == cur_file_name)
+        match = true;
+
+      if (match && m_dir_name && cur_dir_name &&
+          strstr(cur_dir_name, m_dir_name) != cur_dir_name)
+        match = false;
+
+      if (match) {
+        m_matching_files.AppendIfUnique(context.comp_unit);
+      }
     }
-    return Searcher::eCallbackReturnContinue;
+  }
+  return Searcher::eCallbackReturnContinue;
 }
 
 size_t
-CommandCompletions::SourceFileCompleter::DoCompletion (SearchFilter *filter)
-{
-    filter->Search (*this);
-    // Now convert the filelist to completions:
-    for (size_t i = 0; i < m_matching_files.GetSize(); i++)
-    {
-        m_matches.AppendString (m_matching_files.GetFileSpecAtIndex(i).GetFilename().GetCString());
-    }
-    return m_matches.GetSize();
+CommandCompletions::SourceFileCompleter::DoCompletion(SearchFilter *filter) {
+  filter->Search(*this);
+  // Now convert the filelist to completions:
+  for (size_t i = 0; i < m_matching_files.GetSize(); i++) {
+    m_matches.AppendString(
+        m_matching_files.GetFileSpecAtIndex(i).GetFilename().GetCString());
+  }
+  return m_matches.GetSize();
 }
 
 //----------------------------------------------------------------------
 // SymbolCompleter
 //----------------------------------------------------------------------
 
-static bool
-regex_chars (const char comp)
-{
-    return (comp == '[' || comp == ']' ||
-            comp == '(' || comp == ')' ||
-            comp == '{' || comp == '}' ||
-            comp == '+' ||
-            comp == '.' ||
-            comp == '*' ||
-            comp == '|' ||
-            comp == '^' ||
-            comp == '$' ||
-            comp == '\\' ||
-            comp == '?');
-}
-
-CommandCompletions::SymbolCompleter::SymbolCompleter(CommandInterpreter &interpreter,
-                                                     const char *completion_str,
-                                                     int match_start_point,
-                                                     int max_return_elements,
-                                                     StringList &matches) :
-    CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches)
-{
-    std::string regex_str;
-    if (completion_str && completion_str[0])
-    {
-        regex_str.append("^");
-        regex_str.append(completion_str);
-    }
-    else
-    {
-        // Match anything since the completion string is empty
-        regex_str.append(".");
-    }
-    std::string::iterator pos = find_if(regex_str.begin() + 1, regex_str.end(), regex_chars);
-    while (pos < regex_str.end())
-    {
-        pos = regex_str.insert(pos, '\\');
-        pos = find_if(pos + 2, regex_str.end(), regex_chars);
-    }
-    m_regex.Compile(regex_str.c_str());
-}
-
-Searcher::Depth
-CommandCompletions::SymbolCompleter::GetDepth()
-{
-    return eDepthModule;
-}
-
-Searcher::CallbackReturn
-CommandCompletions::SymbolCompleter::SearchCallback(SearchFilter &filter,
-                                                    SymbolContext &context,
-                                                    Address *addr,
-                                                    bool complete)
-{
-    if (context.module_sp)
-    {
-        SymbolContextList sc_list;        
-        const bool include_symbols = true;
-        const bool include_inlines = true;
-        const bool append = true;
-        context.module_sp->FindFunctions (m_regex, include_symbols, include_inlines, append, sc_list);
-
-        SymbolContext sc;
-        // Now add the functions & symbols to the list - only add if unique:
-        for (uint32_t i = 0; i < sc_list.GetSize(); i++)
-        {
-            if (sc_list.GetContextAtIndex(i, sc))
-            {
-                ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
-                if (!func_name.IsEmpty())
-                    m_match_set.insert (func_name);
-            }
-        }
-    }
-    return Searcher::eCallbackReturnContinue;
-}
-
-size_t
-CommandCompletions::SymbolCompleter::DoCompletion (SearchFilter *filter)
-{
-    filter->Search (*this);
-    collection::iterator pos = m_match_set.begin(), end = m_match_set.end();
-    for (pos = m_match_set.begin(); pos != end; pos++)
-        m_matches.AppendString((*pos).GetCString());
+static bool regex_chars(const char comp) {
+  return (comp == '[' || comp == ']' || comp == '(' || comp == ')' ||
+          comp == '{' || comp == '}' || comp == '+' || comp == '.' ||
+          comp == '*' || comp == '|' || comp == '^' || comp == '$' ||
+          comp == '\\' || comp == '?');
+}
+
+CommandCompletions::SymbolCompleter::SymbolCompleter(
+    CommandInterpreter &interpreter, const char *completion_str,
+    int match_start_point, int max_return_elements, StringList &matches)
+    : CommandCompletions::Completer(interpreter, completion_str,
+                                    match_start_point, max_return_elements,
+                                    matches) {
+  std::string regex_str;
+  if (completion_str && completion_str[0]) {
+    regex_str.append("^");
+    regex_str.append(completion_str);
+  } else {
+    // Match anything since the completion string is empty
+    regex_str.append(".");
+  }
+  std::string::iterator pos =
+      find_if(regex_str.begin() + 1, regex_str.end(), regex_chars);
+  while (pos < regex_str.end()) {
+    pos = regex_str.insert(pos, '\\');
+    pos = find_if(pos + 2, regex_str.end(), regex_chars);
+  }
+  m_regex.Compile(regex_str.c_str());
+}
+
+Searcher::Depth CommandCompletions::SymbolCompleter::GetDepth() {
+  return eDepthModule;
+}
+
+Searcher::CallbackReturn CommandCompletions::SymbolCompleter::SearchCallback(
+    SearchFilter &filter, SymbolContext &context, Address *addr,
+    bool complete) {
+  if (context.module_sp) {
+    SymbolContextList sc_list;
+    const bool include_symbols = true;
+    const bool include_inlines = true;
+    const bool append = true;
+    context.module_sp->FindFunctions(m_regex, include_symbols, include_inlines,
+                                     append, sc_list);
+
+    SymbolContext sc;
+    // Now add the functions & symbols to the list - only add if unique:
+    for (uint32_t i = 0; i < sc_list.GetSize(); i++) {
+      if (sc_list.GetContextAtIndex(i, sc)) {
+        ConstString func_name = sc.GetFunctionName(Mangled::ePreferDemangled);
+        if (!func_name.IsEmpty())
+          m_match_set.insert(func_name);
+      }
+    }
+  }
+  return Searcher::eCallbackReturnContinue;
+}
+
+size_t CommandCompletions::SymbolCompleter::DoCompletion(SearchFilter *filter) {
+  filter->Search(*this);
+  collection::iterator pos = m_match_set.begin(), end = m_match_set.end();
+  for (pos = m_match_set.begin(); pos != end; pos++)
+    m_matches.AppendString((*pos).GetCString());
 
-    return m_matches.GetSize();
+  return m_matches.GetSize();
 }
 
 //----------------------------------------------------------------------
 // ModuleCompleter
 //----------------------------------------------------------------------
-CommandCompletions::ModuleCompleter::ModuleCompleter(CommandInterpreter &interpreter,
-                                                     const char *completion_str,
-                                                     int match_start_point,
-                                                     int max_return_elements,
-                                                     StringList &matches) :
-    CommandCompletions::Completer (interpreter, completion_str, match_start_point, max_return_elements, matches)
-{
-    FileSpec partial_spec (m_completion_str.c_str(), false);
-    m_file_name = partial_spec.GetFilename().GetCString();
-    m_dir_name = partial_spec.GetDirectory().GetCString();
-}
-
-Searcher::Depth
-CommandCompletions::ModuleCompleter::GetDepth()
-{
-    return eDepthModule;
-}
-
-Searcher::CallbackReturn
-CommandCompletions::ModuleCompleter::SearchCallback(SearchFilter &filter,
-                                                    SymbolContext &context,
-                                                    Address *addr,
-                                                    bool complete)
-{
-    if (context.module_sp)
-    {
-        const char *cur_file_name = context.module_sp->GetFileSpec().GetFilename().GetCString();
-        const char *cur_dir_name = context.module_sp->GetFileSpec().GetDirectory().GetCString();
-
-        bool match = false;
-        if (m_file_name && cur_file_name
-            && strstr (cur_file_name, m_file_name) == cur_file_name)
-            match = true;
-
-        if (match && m_dir_name && cur_dir_name
-            && strstr (cur_dir_name, m_dir_name) != cur_dir_name)
-            match = false;
-
-        if (match)
-        {
-            m_matches.AppendString (cur_file_name);
-        }
-    }
-    return Searcher::eCallbackReturnContinue;
-}
-
-size_t
-CommandCompletions::ModuleCompleter::DoCompletion (SearchFilter *filter)
-{
-    filter->Search (*this);
-    return m_matches.GetSize();
+CommandCompletions::ModuleCompleter::ModuleCompleter(
+    CommandInterpreter &interpreter, const char *completion_str,
+    int match_start_point, int max_return_elements, StringList &matches)
+    : CommandCompletions::Completer(interpreter, completion_str,
+                                    match_start_point, max_return_elements,
+                                    matches) {
+  FileSpec partial_spec(m_completion_str.c_str(), false);
+  m_file_name = partial_spec.GetFilename().GetCString();
+  m_dir_name = partial_spec.GetDirectory().GetCString();
+}
+
+Searcher::Depth CommandCompletions::ModuleCompleter::GetDepth() {
+  return eDepthModule;
+}
+
+Searcher::CallbackReturn CommandCompletions::ModuleCompleter::SearchCallback(
+    SearchFilter &filter, SymbolContext &context, Address *addr,
+    bool complete) {
+  if (context.module_sp) {
+    const char *cur_file_name =
+        context.module_sp->GetFileSpec().GetFilename().GetCString();
+    const char *cur_dir_name =
+        context.module_sp->GetFileSpec().GetDirectory().GetCString();
+
+    bool match = false;
+    if (m_file_name && cur_file_name &&
+        strstr(cur_file_name, m_file_name) == cur_file_name)
+      match = true;
+
+    if (match && m_dir_name && cur_dir_name &&
+        strstr(cur_dir_name, m_dir_name) != cur_dir_name)
+      match = false;
+
+    if (match) {
+      m_matches.AppendString(cur_file_name);
+    }
+  }
+  return Searcher::eCallbackReturnContinue;
+}
+
+size_t CommandCompletions::ModuleCompleter::DoCompletion(SearchFilter *filter) {
+  filter->Search(*this);
+  return m_matches.GetSize();
 }

Modified: lldb/trunk/source/Commands/CommandObjectApropos.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.cpp Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CommandObjectApropos.cpp ---------------------------------*- C++ -*-===//
+//===-- CommandObjectApropos.cpp ---------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -13,10 +14,10 @@
 // Project includes
 #include "CommandObjectApropos.h"
 #include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/Options.h"
-#include "lldb/Interpreter/Property.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/Property.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -26,93 +27,87 @@ using namespace lldb_private;
 //-------------------------------------------------------------------------
 
 CommandObjectApropos::CommandObjectApropos(CommandInterpreter &interpreter)
-    : CommandObjectParsed(interpreter, "apropos", "List debugger commands related to a word or subject.", nullptr)
-{
-    CommandArgumentEntry arg;
-    CommandArgumentData search_word_arg;
-
-    // Define the first (and only) variant of this arg.
-    search_word_arg.arg_type = eArgTypeSearchWord;
-    search_word_arg.arg_repetition = eArgRepeatPlain;
-
-    // There is only one variant this argument could be; put it into the argument entry.
-    arg.push_back (search_word_arg);
+    : CommandObjectParsed(
+          interpreter, "apropos",
+          "List debugger commands related to a word or subject.", nullptr) {
+  CommandArgumentEntry arg;
+  CommandArgumentData search_word_arg;
+
+  // Define the first (and only) variant of this arg.
+  search_word_arg.arg_type = eArgTypeSearchWord;
+  search_word_arg.arg_repetition = eArgRepeatPlain;
+
+  // There is only one variant this argument could be; put it into the argument
+  // entry.
+  arg.push_back(search_word_arg);
 
-    // Push the data for the first argument into the m_arguments vector.
-    m_arguments.push_back (arg);
+  // Push the data for the first argument into the m_arguments vector.
+  m_arguments.push_back(arg);
 }
 
 CommandObjectApropos::~CommandObjectApropos() = default;
 
-bool
-CommandObjectApropos::DoExecute (Args& args, CommandReturnObject &result)
-{
-    const size_t argc = args.GetArgumentCount ();
-
-    if (argc == 1)
-    {
-        const char *search_word = args.GetArgumentAtIndex(0);
-        if ((search_word != nullptr)
-            && (strlen (search_word) > 0))
-        {
-            // The bulk of the work must be done inside the Command Interpreter, since the command dictionary
-            // is private.
-            StringList commands_found;
-            StringList commands_help;
-            
-            m_interpreter.FindCommandsForApropos (search_word, commands_found, commands_help, true, true, true);
-            
-            if (commands_found.GetSize() == 0)
-            {
-                result.AppendMessageWithFormat ("No commands found pertaining to '%s'. Try 'help' to see a complete list of debugger commands.\n", search_word);
-            }
-            else
-            {
-                if (commands_found.GetSize() > 0)
-                {
-                    result.AppendMessageWithFormat ("The following commands may relate to '%s':\n", search_word);
-                    size_t max_len = 0;
-
-                    for (size_t i = 0; i < commands_found.GetSize(); ++i)
-                    {
-                        size_t len = strlen (commands_found.GetStringAtIndex (i));
-                        if (len > max_len)
-                            max_len = len;
-                    }
-
-                    for (size_t i = 0; i < commands_found.GetSize(); ++i)
-                        m_interpreter.OutputFormattedHelpText (result.GetOutputStream(), 
-                                                               commands_found.GetStringAtIndex(i),
-                                                               "--",
-                                                               commands_help.GetStringAtIndex(i),
-                                                               max_len);
-                }
-            }
-            
-            std::vector<const Property *> properties;
-            const size_t num_properties = m_interpreter.GetDebugger().Apropos(search_word, properties);
-            if (num_properties)
-            {
-                const bool dump_qualified_name = true;
-                result.AppendMessageWithFormat ("\nThe following settings variables may relate to '%s': \n\n", search_word);
-                for (size_t i=0; i<num_properties; ++i)
-                    properties[i]->DumpDescription (m_interpreter, result.GetOutputStream(), 0, dump_qualified_name);
-
-            }
-            
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            result.AppendError ("'' is not a valid search word.\n");
-            result.SetStatus (eReturnStatusFailed);
+bool CommandObjectApropos::DoExecute(Args &args, CommandReturnObject &result) {
+  const size_t argc = args.GetArgumentCount();
+
+  if (argc == 1) {
+    const char *search_word = args.GetArgumentAtIndex(0);
+    if ((search_word != nullptr) && (strlen(search_word) > 0)) {
+      // The bulk of the work must be done inside the Command Interpreter, since
+      // the command dictionary
+      // is private.
+      StringList commands_found;
+      StringList commands_help;
+
+      m_interpreter.FindCommandsForApropos(search_word, commands_found,
+                                           commands_help, true, true, true);
+
+      if (commands_found.GetSize() == 0) {
+        result.AppendMessageWithFormat("No commands found pertaining to '%s'. "
+                                       "Try 'help' to see a complete list of "
+                                       "debugger commands.\n",
+                                       search_word);
+      } else {
+        if (commands_found.GetSize() > 0) {
+          result.AppendMessageWithFormat(
+              "The following commands may relate to '%s':\n", search_word);
+          size_t max_len = 0;
+
+          for (size_t i = 0; i < commands_found.GetSize(); ++i) {
+            size_t len = strlen(commands_found.GetStringAtIndex(i));
+            if (len > max_len)
+              max_len = len;
+          }
+
+          for (size_t i = 0; i < commands_found.GetSize(); ++i)
+            m_interpreter.OutputFormattedHelpText(
+                result.GetOutputStream(), commands_found.GetStringAtIndex(i),
+                "--", commands_help.GetStringAtIndex(i), max_len);
         }
+      }
+
+      std::vector<const Property *> properties;
+      const size_t num_properties =
+          m_interpreter.GetDebugger().Apropos(search_word, properties);
+      if (num_properties) {
+        const bool dump_qualified_name = true;
+        result.AppendMessageWithFormat(
+            "\nThe following settings variables may relate to '%s': \n\n",
+            search_word);
+        for (size_t i = 0; i < num_properties; ++i)
+          properties[i]->DumpDescription(
+              m_interpreter, result.GetOutputStream(), 0, dump_qualified_name);
+      }
+
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      result.AppendError("'' is not a valid search word.\n");
+      result.SetStatus(eReturnStatusFailed);
     }
-    else
-    {
-        result.AppendError ("'apropos' must be called with exactly one argument.\n");
-        result.SetStatus (eReturnStatusFailed);
-    }
+  } else {
+    result.AppendError("'apropos' must be called with exactly one argument.\n");
+    result.SetStatus(eReturnStatusFailed);
+  }
 
-    return result.Succeeded();
+  return result.Succeeded();
 }

Modified: lldb/trunk/source/Commands/CommandObjectApropos.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectApropos.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectApropos.h (original)
+++ lldb/trunk/source/Commands/CommandObjectApropos.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CommandObjectApropos.h -----------------------------------*- C++ -*-===//
+//===-- CommandObjectApropos.h -----------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -22,18 +23,14 @@ namespace lldb_private {
 // CommandObjectApropos
 //-------------------------------------------------------------------------
 
-class CommandObjectApropos : public CommandObjectParsed
-{
+class CommandObjectApropos : public CommandObjectParsed {
 public:
+  CommandObjectApropos(CommandInterpreter &interpreter);
 
-    CommandObjectApropos (CommandInterpreter &interpreter);
-
-    ~CommandObjectApropos() override;
+  ~CommandObjectApropos() override;
 
 protected:
-    bool
-    DoExecute(Args& command,
-	      CommandReturnObject &result) override;
+  bool DoExecute(Args &command, CommandReturnObject &result) override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectArgs.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.cpp Tue Sep  6 15:57:50 2016
@@ -12,12 +12,12 @@
 // Other libraries and framework includes
 // Project includes
 #include "CommandObjectArgs.h"
-#include "lldb/Interpreter/Args.h"
+#include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/Value.h"
-#include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
 #include "lldb/Host/Host.h"
+#include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Symbol/ClangASTContext.h"
@@ -25,242 +25,213 @@
 #include "lldb/Symbol/Variable.h"
 #include "lldb/Target/ABI.h"
 #include "lldb/Target/Process.h"
+#include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
-#include "lldb/Target/StackFrame.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-// This command is a toy.  I'm just using it to have a way to construct the arguments to
+// This command is a toy.  I'm just using it to have a way to construct the
+// arguments to
 // calling functions.
 //
 
-CommandObjectArgs::CommandOptions::CommandOptions (CommandInterpreter &interpreter) :
-    Options()
-{
-    // Keep only one place to reset the values to their defaults
-    OptionParsingStarting(nullptr);
+CommandObjectArgs::CommandOptions::CommandOptions(
+    CommandInterpreter &interpreter)
+    : Options() {
+  // Keep only one place to reset the values to their defaults
+  OptionParsingStarting(nullptr);
 }
 
 CommandObjectArgs::CommandOptions::~CommandOptions() = default;
 
-Error
-CommandObjectArgs::CommandOptions::SetOptionValue(uint32_t option_idx,
-                                                  const char *option_arg,
-                                            ExecutionContext *execution_context)
-{
-    Error error;
-    
-    const int short_option = m_getopt_table[option_idx].val;
-    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-    
-    return error;
-}
+Error CommandObjectArgs::CommandOptions::SetOptionValue(
+    uint32_t option_idx, const char *option_arg,
+    ExecutionContext *execution_context) {
+  Error error;
 
-void
-CommandObjectArgs::CommandOptions::OptionParsingStarting(
-                                            ExecutionContext *execution_context)
-{
-}
+  const int short_option = m_getopt_table[option_idx].val;
+  error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                 short_option);
 
-const OptionDefinition*
-CommandObjectArgs::CommandOptions::GetDefinitions ()
-{
-    return g_option_table;
+  return error;
 }
 
-CommandObjectArgs::CommandObjectArgs (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "args",
-                         "When stopped at the start of a function, reads function arguments of type (u?)int(8|16|32|64)_t, (void|char)*",
-                         "args"),
-    m_options (interpreter)
-{
+void CommandObjectArgs::CommandOptions::OptionParsingStarting(
+    ExecutionContext *execution_context) {}
+
+const OptionDefinition *CommandObjectArgs::CommandOptions::GetDefinitions() {
+  return g_option_table;
 }
 
+CommandObjectArgs::CommandObjectArgs(CommandInterpreter &interpreter)
+    : CommandObjectParsed(interpreter, "args",
+                          "When stopped at the start of a function, reads "
+                          "function arguments of type (u?)int(8|16|32|64)_t, "
+                          "(void|char)*",
+                          "args"),
+      m_options(interpreter) {}
+
 CommandObjectArgs::~CommandObjectArgs() = default;
 
-Options *
-CommandObjectArgs::GetOptions ()
-{
-    return &m_options;
-}
+Options *CommandObjectArgs::GetOptions() { return &m_options; }
 
-bool
-CommandObjectArgs::DoExecute (Args& args, CommandReturnObject &result)
-{
-    ConstString target_triple;
-
-    Process *process = m_exe_ctx.GetProcessPtr();
-    if (!process)
-    {
-        result.AppendError ("Args found no process.");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    const ABI *abi = process->GetABI().get();
-    if (!abi)
-    {
-        result.AppendError ("The current process has no ABI.");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    const size_t num_args = args.GetArgumentCount ();
-    size_t arg_index;
-    
-    if (!num_args)
-    {
-        result.AppendError ("args requires at least one argument");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    Thread *thread = m_exe_ctx.GetThreadPtr();
-    
-    if (!thread)
-    {
-        result.AppendError ("args found no thread.");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-        
-    lldb::StackFrameSP thread_cur_frame = thread->GetSelectedFrame ();
-    if (!thread_cur_frame)
-    {
-        result.AppendError ("The current thread has no current frame.");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    ModuleSP thread_module_sp (thread_cur_frame->GetFrameCodeAddress ().GetModule());
-    if (!thread_module_sp)
-    {
-        result.AppendError ("The PC has no associated module.");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
+bool CommandObjectArgs::DoExecute(Args &args, CommandReturnObject &result) {
+  ConstString target_triple;
 
-    TypeSystem *type_system = thread_module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
-    if (type_system == nullptr)
-    {
-        result.AppendError ("Unable to create C type system.");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    ValueList value_list;
-    
-    for (arg_index = 0; arg_index < num_args; ++arg_index)
-    {
-        const char *arg_type_cstr = args.GetArgumentAtIndex(arg_index);
-        Value value;
-        value.SetValueType(Value::eValueTypeScalar);
-        CompilerType compiler_type;
-        
-        char *int_pos;
-        if ((int_pos = strstr (const_cast<char*>(arg_type_cstr), "int")))
-        {
-            Encoding encoding = eEncodingSint;
-            
-            int width = 0;
-            
-            if (int_pos > arg_type_cstr + 1)
-            {
-                result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            if (int_pos == arg_type_cstr + 1 && arg_type_cstr[0] != 'u')
-            {
-                result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            if (arg_type_cstr[0] == 'u')
-            {
-                encoding = eEncodingUint;
-            }
-            
-            char *width_pos = int_pos + 3;
-            
-            if (!strcmp (width_pos, "8_t"))
-                width = 8;
-            else if (!strcmp (width_pos, "16_t"))
-                width = 16;
-            else if (!strcmp (width_pos, "32_t"))
-                width = 32;
-            else if (!strcmp (width_pos, "64_t"))
-                width = 64;
-            else
-            {
-                result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            compiler_type = type_system->GetBuiltinTypeForEncodingAndBitSize(encoding, width);
-            
-            if (!compiler_type.IsValid())
-            {
-                result.AppendErrorWithFormat ("Couldn't get Clang type for format %s (%s integer, width %d).\n",
-                                             arg_type_cstr,
-                                             (encoding == eEncodingSint ? "signed" : "unsigned"),
-                                             width);
-                
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-        }
-        else if (strchr (arg_type_cstr, '*'))
-        {
-            if (!strcmp (arg_type_cstr, "void*"))
-                compiler_type = type_system->GetBasicTypeFromAST(eBasicTypeVoid).GetPointerType();
-            else if (!strcmp (arg_type_cstr, "char*"))
-                compiler_type = type_system->GetBasicTypeFromAST(eBasicTypeChar).GetPointerType();
-            else
-            {
-                result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-        }
-        else 
-        {
-            result.AppendErrorWithFormat ("Invalid format: %s.\n", arg_type_cstr);
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-                     
-        value.SetCompilerType (compiler_type);
-        value_list.PushValue(value);
-    }
-    
-    if (!abi->GetArgumentValues (*thread, value_list))
-    {
-        result.AppendError ("Couldn't get argument values");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    result.GetOutputStream ().Printf("Arguments : \n");
+  Process *process = m_exe_ctx.GetProcessPtr();
+  if (!process) {
+    result.AppendError("Args found no process.");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  const ABI *abi = process->GetABI().get();
+  if (!abi) {
+    result.AppendError("The current process has no ABI.");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  const size_t num_args = args.GetArgumentCount();
+  size_t arg_index;
+
+  if (!num_args) {
+    result.AppendError("args requires at least one argument");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  Thread *thread = m_exe_ctx.GetThreadPtr();
+
+  if (!thread) {
+    result.AppendError("args found no thread.");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  lldb::StackFrameSP thread_cur_frame = thread->GetSelectedFrame();
+  if (!thread_cur_frame) {
+    result.AppendError("The current thread has no current frame.");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  ModuleSP thread_module_sp(
+      thread_cur_frame->GetFrameCodeAddress().GetModule());
+  if (!thread_module_sp) {
+    result.AppendError("The PC has no associated module.");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  TypeSystem *type_system =
+      thread_module_sp->GetTypeSystemForLanguage(eLanguageTypeC);
+  if (type_system == nullptr) {
+    result.AppendError("Unable to create C type system.");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  ValueList value_list;
+
+  for (arg_index = 0; arg_index < num_args; ++arg_index) {
+    const char *arg_type_cstr = args.GetArgumentAtIndex(arg_index);
+    Value value;
+    value.SetValueType(Value::eValueTypeScalar);
+    CompilerType compiler_type;
+
+    char *int_pos;
+    if ((int_pos = strstr(const_cast<char *>(arg_type_cstr), "int"))) {
+      Encoding encoding = eEncodingSint;
+
+      int width = 0;
+
+      if (int_pos > arg_type_cstr + 1) {
+        result.AppendErrorWithFormat("Invalid format: %s.\n", arg_type_cstr);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      if (int_pos == arg_type_cstr + 1 && arg_type_cstr[0] != 'u') {
+        result.AppendErrorWithFormat("Invalid format: %s.\n", arg_type_cstr);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      if (arg_type_cstr[0] == 'u') {
+        encoding = eEncodingUint;
+      }
+
+      char *width_pos = int_pos + 3;
+
+      if (!strcmp(width_pos, "8_t"))
+        width = 8;
+      else if (!strcmp(width_pos, "16_t"))
+        width = 16;
+      else if (!strcmp(width_pos, "32_t"))
+        width = 32;
+      else if (!strcmp(width_pos, "64_t"))
+        width = 64;
+      else {
+        result.AppendErrorWithFormat("Invalid format: %s.\n", arg_type_cstr);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      compiler_type =
+          type_system->GetBuiltinTypeForEncodingAndBitSize(encoding, width);
+
+      if (!compiler_type.IsValid()) {
+        result.AppendErrorWithFormat(
+            "Couldn't get Clang type for format %s (%s integer, width %d).\n",
+            arg_type_cstr, (encoding == eEncodingSint ? "signed" : "unsigned"),
+            width);
+
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else if (strchr(arg_type_cstr, '*')) {
+      if (!strcmp(arg_type_cstr, "void*"))
+        compiler_type =
+            type_system->GetBasicTypeFromAST(eBasicTypeVoid).GetPointerType();
+      else if (!strcmp(arg_type_cstr, "char*"))
+        compiler_type =
+            type_system->GetBasicTypeFromAST(eBasicTypeChar).GetPointerType();
+      else {
+        result.AppendErrorWithFormat("Invalid format: %s.\n", arg_type_cstr);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else {
+      result.AppendErrorWithFormat("Invalid format: %s.\n", arg_type_cstr);
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    value.SetCompilerType(compiler_type);
+    value_list.PushValue(value);
+  }
+
+  if (!abi->GetArgumentValues(*thread, value_list)) {
+    result.AppendError("Couldn't get argument values");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  result.GetOutputStream().Printf("Arguments : \n");
+
+  for (arg_index = 0; arg_index < num_args; ++arg_index) {
+    result.GetOutputStream().Printf("%" PRIu64 " (%s): ", (uint64_t)arg_index,
+                                    args.GetArgumentAtIndex(arg_index));
+    value_list.GetValueAtIndex(arg_index)->Dump(&result.GetOutputStream());
+    result.GetOutputStream().Printf("\n");
+  }
 
-    for (arg_index = 0; arg_index < num_args; ++arg_index)
-    {
-        result.GetOutputStream ().Printf ("%" PRIu64 " (%s): ", (uint64_t)arg_index, args.GetArgumentAtIndex (arg_index));
-        value_list.GetValueAtIndex (arg_index)->Dump (&result.GetOutputStream ());
-        result.GetOutputStream ().Printf("\n");
-    }
-    
-    return result.Succeeded();
+  return result.Succeeded();
 }
 
-OptionDefinition
-CommandObjectArgs::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectArgs::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1, false, "debug", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Enable verbose debug logging of the expression parsing and evaluation."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };

Modified: lldb/trunk/source/Commands/CommandObjectArgs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectArgs.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectArgs.h (original)
+++ lldb/trunk/source/Commands/CommandObjectArgs.h Tue Sep  6 15:57:50 2016
@@ -18,50 +18,39 @@
 #include "lldb/Interpreter/Options.h"
 
 namespace lldb_private {
-    
-    class CommandObjectArgs : public CommandObjectParsed
-    {
-    public:
-        
-        class CommandOptions : public Options
-        {
-        public:
-            
-            CommandOptions (CommandInterpreter &interpreter);
-            
-            ~CommandOptions() override;
-            
-            Error
-            SetOptionValue(uint32_t option_idx, const char *option_arg,
-                           ExecutionContext *execution_context) override;
-            
-            void
-            OptionParsingStarting(ExecutionContext *execution_context) override;
-            
-            const OptionDefinition*
-            GetDefinitions() override;
-            
-            // Options table: Required for subclasses of Options.
-            
-            static OptionDefinition g_option_table[];
-        };
-        
-        CommandObjectArgs (CommandInterpreter &interpreter);
-        
-        ~CommandObjectArgs() override;
-        
-        Options *
-        GetOptions() override;
-        
-    protected:
-        
-        CommandOptions m_options;
-
-        bool
-        DoExecute(Args& command,
-		  CommandReturnObject &result) override;
-    };
-    
+
+class CommandObjectArgs : public CommandObjectParsed {
+public:
+  class CommandOptions : public Options {
+  public:
+    CommandOptions(CommandInterpreter &interpreter);
+
+    ~CommandOptions() override;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override;
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+    const OptionDefinition *GetDefinitions() override;
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+  };
+
+  CommandObjectArgs(CommandInterpreter &interpreter);
+
+  ~CommandObjectArgs() override;
+
+  Options *GetOptions() override;
+
+protected:
+  CommandOptions m_options;
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override;
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_CommandObjectArgs_h_

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.cpp Tue Sep  6 15:57:50 2016
@@ -18,749 +18,692 @@
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointIDList.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Host/StringConvert.h"
-#include "lldb/Interpreter/Options.h"
-#include "lldb/Interpreter/OptionValueBoolean.h"
-#include "lldb/Interpreter/OptionValueString.h"
-#include "lldb/Interpreter/OptionValueUInt64.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/StreamString.h"
+#include "lldb/Host/StringConvert.h"
+#include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/OptionValueBoolean.h"
+#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Target/Language.h"
-#include "lldb/Target/Target.h"
-#include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
 #include "lldb/Target/ThreadSpec.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
-static void
-AddBreakpointDescription (Stream *s, Breakpoint *bp, lldb::DescriptionLevel level)
-{
-    s->IndentMore();
-    bp->GetDescription (s, level, true);
-    s->IndentLess();
-    s->EOL();
+static void AddBreakpointDescription(Stream *s, Breakpoint *bp,
+                                     lldb::DescriptionLevel level) {
+  s->IndentMore();
+  bp->GetDescription(s, level, true);
+  s->IndentLess();
+  s->EOL();
 }
 
 //-------------------------------------------------------------------------
 // CommandObjectBreakpointSet
 //-------------------------------------------------------------------------
 
-class CommandObjectBreakpointSet : public CommandObjectParsed
-{
+class CommandObjectBreakpointSet : public CommandObjectParsed {
 public:
-    typedef enum BreakpointSetType
-    {
-        eSetTypeInvalid,
-        eSetTypeFileAndLine,
-        eSetTypeAddress,
-        eSetTypeFunctionName,
-        eSetTypeFunctionRegexp,
-        eSetTypeSourceRegexp,
-        eSetTypeException
-    } BreakpointSetType;
-
-    CommandObjectBreakpointSet (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "breakpoint set", 
-                             "Sets a breakpoint or set of breakpoints in the executable.", 
-                             "breakpoint set <cmd-options>"),
-        m_options ()
-    {
-    }
-
-    ~CommandObjectBreakpointSet() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions () :
-            Options (),
-            m_condition (),
-            m_filenames (),
-            m_line_num (0),
-            m_column (0),
-            m_func_names (),
-            m_func_name_type_mask (eFunctionNameTypeNone),
-            m_func_regexp (),
-            m_source_text_regexp(),
-            m_modules (),
-            m_load_addr(),
-            m_ignore_count (0),
-            m_thread_id(LLDB_INVALID_THREAD_ID),
-            m_thread_index (UINT32_MAX),
-            m_thread_name(),
-            m_queue_name(),
-            m_catch_bp (false),
-            m_throw_bp (true),
-            m_hardware (false),
-            m_exception_language (eLanguageTypeUnknown),
-            m_language (lldb::eLanguageTypeUnknown),
-            m_skip_prologue (eLazyBoolCalculate),
-            m_one_shot (false),
-            m_all_files (false),
-            m_move_to_nearest_code (eLazyBoolCalculate)
-        {
-        }
-
-        ~CommandOptions() override = default;
-
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-                case 'a':
-                    {
-                        m_load_addr =
-                            Args::StringToAddress(execution_context, option_arg,
-                                                  LLDB_INVALID_ADDRESS, &error);
-                    }
-                    break;
-
-                case 'A':
-                    m_all_files = true;
-                    break;
-
-                case 'b':
-                    m_func_names.push_back (option_arg);
-                    m_func_name_type_mask |= eFunctionNameTypeBase;
-                    break;
-
-                case 'C':
-                {
-                    bool success;
-                    m_column = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid column number: %s", option_arg);
-                    break;
-                }
-
-                case 'c':
-                    m_condition.assign(option_arg);
-                    break;
-
-                case 'D':
-                    m_use_dummy = true;
-                    break;
-
-                case 'E':
-                {
-                    LanguageType language = Language::GetLanguageTypeFromString (option_arg);
-
-                    switch (language)
-                    {
-                        case eLanguageTypeC89:
-                        case eLanguageTypeC:
-                        case eLanguageTypeC99:
-                        case eLanguageTypeC11:
-                            m_exception_language = eLanguageTypeC;
-                            break;
-                        case eLanguageTypeC_plus_plus:
-                        case eLanguageTypeC_plus_plus_03:
-                        case eLanguageTypeC_plus_plus_11:
-                        case eLanguageTypeC_plus_plus_14:
-                            m_exception_language = eLanguageTypeC_plus_plus;
-                            break;
-                        case eLanguageTypeObjC:
-                            m_exception_language = eLanguageTypeObjC;
-                            break;
-                        case eLanguageTypeObjC_plus_plus:
-                            error.SetErrorStringWithFormat ("Set exception breakpoints separately for c++ and objective-c");
-                            break;
-                        case eLanguageTypeUnknown:
-                            error.SetErrorStringWithFormat ("Unknown language type: '%s' for exception breakpoint", option_arg);
-                            break;
-                        default:
-                            error.SetErrorStringWithFormat ("Unsupported language type: '%s' for exception breakpoint", option_arg);
-                    }
-                }
-                break;
-
-                case 'f':
-                    m_filenames.AppendIfUnique (FileSpec(option_arg, false));
-                    break;
-
-                case 'F':
-                    m_func_names.push_back (option_arg);
-                    m_func_name_type_mask |= eFunctionNameTypeFull;
-                    break;
-
-                case 'h':
-                    {
-                        bool success;
-                        m_catch_bp = Args::StringToBoolean (option_arg, true, &success);
-                        if (!success)
-                            error.SetErrorStringWithFormat ("Invalid boolean value for on-catch option: '%s'", option_arg);
-                    }
-                    break;
-
-                case 'H':
-                    m_hardware = true;
-                    break;
-
-                case 'i':
-                    m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
-                    if (m_ignore_count == UINT32_MAX)
-                       error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
-                    break;
-
-                case 'K':
-                {
-                    bool success;
-                    bool value;
-                    value = Args::StringToBoolean (option_arg, true, &success);
-                    if (value)
-                        m_skip_prologue = eLazyBoolYes;
-                    else
-                        m_skip_prologue = eLazyBoolNo;
-                        
-                    if (!success)
-                        error.SetErrorStringWithFormat ("Invalid boolean value for skip prologue option: '%s'", option_arg);
-                }
-                break;
-
-                case 'l':
-                {
-                    bool success;
-                    m_line_num = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat ("invalid line number: %s.", option_arg);
-                    break;
-                }
-
-                case 'L':
-                    m_language = Language::GetLanguageTypeFromString (option_arg);
-                    if (m_language == eLanguageTypeUnknown)
-                        error.SetErrorStringWithFormat ("Unknown language type: '%s' for breakpoint", option_arg);
-                    break;
-
-                case 'm':
-                {
-                    bool success;
-                    bool value;
-                    value = Args::StringToBoolean (option_arg, true, &success);
-                    if (value)
-                        m_move_to_nearest_code = eLazyBoolYes;
-                    else
-                        m_move_to_nearest_code = eLazyBoolNo;
-                        
-                    if (!success)
-                        error.SetErrorStringWithFormat ("Invalid boolean value for move-to-nearest-code option: '%s'", option_arg);
-                    break;
-                }
-
-                case 'M':
-                    m_func_names.push_back (option_arg);
-                    m_func_name_type_mask |= eFunctionNameTypeMethod;
-                    break;
-
-                case 'n':
-                    m_func_names.push_back (option_arg);
-                    m_func_name_type_mask |= eFunctionNameTypeAuto;
-                    break;
-
-                case 'N':
-                    if (BreakpointID::StringIsBreakpointName(option_arg, error))
-                        m_breakpoint_names.push_back (option_arg);
-                    break;
-
-                case 'R':
-                    {
-                        lldb::addr_t tmp_offset_addr;
-                        tmp_offset_addr =
-                            Args::StringToAddress(execution_context, option_arg,
-                                                  0, &error);
-                        if (error.Success())
-                            m_offset_addr = tmp_offset_addr;
-                    }
-                    break;
-
-                case 'o':
-                    m_one_shot = true;
-                    break;
-
-                case 'O':
-                    m_exception_extra_args.AppendArgument ("-O");
-                    m_exception_extra_args.AppendArgument (option_arg);
-                    break;
-
-                case 'p':
-                    m_source_text_regexp.assign (option_arg);
-                    break;
-                    
-                case 'q':
-                    m_queue_name.assign (option_arg);
-                    break;
-
-                case 'r':
-                    m_func_regexp.assign (option_arg);
-                    break;
-
-                case 's':
-                    m_modules.AppendIfUnique (FileSpec (option_arg, false));
-                    break;
-                    
-                case 'S':
-                    m_func_names.push_back (option_arg);
-                    m_func_name_type_mask |= eFunctionNameTypeSelector;
-                    break;
-
-                case 't' :
-                    m_thread_id = StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
-                    if (m_thread_id == LLDB_INVALID_THREAD_ID)
-                       error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg);
-                    break;
-
-                case 'T':
-                    m_thread_name.assign (option_arg);
-                    break;
-
-                case 'w':
-                {
-                    bool success;
-                    m_throw_bp = Args::StringToBoolean (option_arg, true, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat ("Invalid boolean value for on-throw option: '%s'", option_arg);
-                }
-                break;
-
-                case 'x':
-                    m_thread_index = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
-                    if (m_thread_id == UINT32_MAX)
-                       error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
-                    break;
-
-                case 'X':
-                    m_source_regex_func_names.insert(option_arg);
-                    break;
-                    
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-
-            return error;
-        }
-
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_condition.clear();
-            m_filenames.Clear();
-            m_line_num = 0;
-            m_column = 0;
-            m_func_names.clear();
-            m_func_name_type_mask = eFunctionNameTypeNone;
-            m_func_regexp.clear();
-            m_source_text_regexp.clear();
-            m_modules.Clear();
-            m_load_addr = LLDB_INVALID_ADDRESS;
-            m_offset_addr = 0;
-            m_ignore_count = 0;
-            m_thread_id = LLDB_INVALID_THREAD_ID;
-            m_thread_index = UINT32_MAX;
-            m_thread_name.clear();
-            m_queue_name.clear();
-            m_catch_bp = false;
-            m_throw_bp = true;
-            m_hardware = false;
-            m_exception_language = eLanguageTypeUnknown;
-            m_language = lldb::eLanguageTypeUnknown;
-            m_skip_prologue = eLazyBoolCalculate;
-            m_one_shot = false;
-            m_use_dummy = false;
-            m_breakpoint_names.clear();
-            m_all_files = false;
-            m_exception_extra_args.Clear();
-            m_move_to_nearest_code = eLazyBoolCalculate;
-            m_source_regex_func_names.clear();
-        }
-    
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
+  typedef enum BreakpointSetType {
+    eSetTypeInvalid,
+    eSetTypeFileAndLine,
+    eSetTypeAddress,
+    eSetTypeFunctionName,
+    eSetTypeFunctionRegexp,
+    eSetTypeSourceRegexp,
+    eSetTypeException
+  } BreakpointSetType;
+
+  CommandObjectBreakpointSet(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "breakpoint set",
+            "Sets a breakpoint or set of breakpoints in the executable.",
+            "breakpoint set <cmd-options>"),
+        m_options() {}
+
+  ~CommandObjectBreakpointSet() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_condition(), m_filenames(), m_line_num(0), m_column(0),
+          m_func_names(), m_func_name_type_mask(eFunctionNameTypeNone),
+          m_func_regexp(), m_source_text_regexp(), m_modules(), m_load_addr(),
+          m_ignore_count(0), m_thread_id(LLDB_INVALID_THREAD_ID),
+          m_thread_index(UINT32_MAX), m_thread_name(), m_queue_name(),
+          m_catch_bp(false), m_throw_bp(true), m_hardware(false),
+          m_exception_language(eLanguageTypeUnknown),
+          m_language(lldb::eLanguageTypeUnknown),
+          m_skip_prologue(eLazyBoolCalculate), m_one_shot(false),
+          m_all_files(false), m_move_to_nearest_code(eLazyBoolCalculate) {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'a': {
+        m_load_addr = Args::StringToAddress(execution_context, option_arg,
+                                            LLDB_INVALID_ADDRESS, &error);
+      } break;
+
+      case 'A':
+        m_all_files = true;
+        break;
+
+      case 'b':
+        m_func_names.push_back(option_arg);
+        m_func_name_type_mask |= eFunctionNameTypeBase;
+        break;
+
+      case 'C': {
+        bool success;
+        m_column = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid column number: %s",
+                                         option_arg);
+        break;
+      }
+
+      case 'c':
+        m_condition.assign(option_arg);
+        break;
+
+      case 'D':
+        m_use_dummy = true;
+        break;
+
+      case 'E': {
+        LanguageType language = Language::GetLanguageTypeFromString(option_arg);
+
+        switch (language) {
+        case eLanguageTypeC89:
+        case eLanguageTypeC:
+        case eLanguageTypeC99:
+        case eLanguageTypeC11:
+          m_exception_language = eLanguageTypeC;
+          break;
+        case eLanguageTypeC_plus_plus:
+        case eLanguageTypeC_plus_plus_03:
+        case eLanguageTypeC_plus_plus_11:
+        case eLanguageTypeC_plus_plus_14:
+          m_exception_language = eLanguageTypeC_plus_plus;
+          break;
+        case eLanguageTypeObjC:
+          m_exception_language = eLanguageTypeObjC;
+          break;
+        case eLanguageTypeObjC_plus_plus:
+          error.SetErrorStringWithFormat(
+              "Set exception breakpoints separately for c++ and objective-c");
+          break;
+        case eLanguageTypeUnknown:
+          error.SetErrorStringWithFormat(
+              "Unknown language type: '%s' for exception breakpoint",
+              option_arg);
+          break;
+        default:
+          error.SetErrorStringWithFormat(
+              "Unsupported language type: '%s' for exception breakpoint",
+              option_arg);
+        }
+      } break;
+
+      case 'f':
+        m_filenames.AppendIfUnique(FileSpec(option_arg, false));
+        break;
+
+      case 'F':
+        m_func_names.push_back(option_arg);
+        m_func_name_type_mask |= eFunctionNameTypeFull;
+        break;
+
+      case 'h': {
+        bool success;
+        m_catch_bp = Args::StringToBoolean(option_arg, true, &success);
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "Invalid boolean value for on-catch option: '%s'", option_arg);
+      } break;
+
+      case 'H':
+        m_hardware = true;
+        break;
+
+      case 'i':
+        m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
+        if (m_ignore_count == UINT32_MAX)
+          error.SetErrorStringWithFormat("invalid ignore count '%s'",
+                                         option_arg);
+        break;
+
+      case 'K': {
+        bool success;
+        bool value;
+        value = Args::StringToBoolean(option_arg, true, &success);
+        if (value)
+          m_skip_prologue = eLazyBoolYes;
+        else
+          m_skip_prologue = eLazyBoolNo;
 
-        // Instance variables to hold the values for command options.
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "Invalid boolean value for skip prologue option: '%s'",
+              option_arg);
+      } break;
+
+      case 'l': {
+        bool success;
+        m_line_num = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid line number: %s.",
+                                         option_arg);
+        break;
+      }
+
+      case 'L':
+        m_language = Language::GetLanguageTypeFromString(option_arg);
+        if (m_language == eLanguageTypeUnknown)
+          error.SetErrorStringWithFormat(
+              "Unknown language type: '%s' for breakpoint", option_arg);
+        break;
+
+      case 'm': {
+        bool success;
+        bool value;
+        value = Args::StringToBoolean(option_arg, true, &success);
+        if (value)
+          m_move_to_nearest_code = eLazyBoolYes;
+        else
+          m_move_to_nearest_code = eLazyBoolNo;
 
-        std::string m_condition;
-        FileSpecList m_filenames;
-        uint32_t m_line_num;
-        uint32_t m_column;
-        std::vector<std::string> m_func_names;
-        std::vector<std::string> m_breakpoint_names;
-        uint32_t m_func_name_type_mask;
-        std::string m_func_regexp;
-        std::string m_source_text_regexp;
-        FileSpecList m_modules;
-        lldb::addr_t m_load_addr;
-        lldb::addr_t m_offset_addr;
-        uint32_t m_ignore_count;
-        lldb::tid_t m_thread_id;
-        uint32_t m_thread_index;
-        std::string m_thread_name;
-        std::string m_queue_name;
-        bool m_catch_bp;
-        bool m_throw_bp;
-        bool m_hardware; // Request to use hardware breakpoints
-        lldb::LanguageType m_exception_language;
-        lldb::LanguageType m_language;
-        LazyBool m_skip_prologue;
-        bool m_one_shot;
-        bool m_use_dummy;
-        bool m_all_files;
-        Args m_exception_extra_args;
-        LazyBool m_move_to_nearest_code;
-        std::unordered_set<std::string> m_source_regex_func_names;
-    };
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "Invalid boolean value for move-to-nearest-code option: '%s'",
+              option_arg);
+        break;
+      }
+
+      case 'M':
+        m_func_names.push_back(option_arg);
+        m_func_name_type_mask |= eFunctionNameTypeMethod;
+        break;
+
+      case 'n':
+        m_func_names.push_back(option_arg);
+        m_func_name_type_mask |= eFunctionNameTypeAuto;
+        break;
+
+      case 'N':
+        if (BreakpointID::StringIsBreakpointName(option_arg, error))
+          m_breakpoint_names.push_back(option_arg);
+        break;
+
+      case 'R': {
+        lldb::addr_t tmp_offset_addr;
+        tmp_offset_addr =
+            Args::StringToAddress(execution_context, option_arg, 0, &error);
+        if (error.Success())
+          m_offset_addr = tmp_offset_addr;
+      } break;
+
+      case 'o':
+        m_one_shot = true;
+        break;
+
+      case 'O':
+        m_exception_extra_args.AppendArgument("-O");
+        m_exception_extra_args.AppendArgument(option_arg);
+        break;
+
+      case 'p':
+        m_source_text_regexp.assign(option_arg);
+        break;
+
+      case 'q':
+        m_queue_name.assign(option_arg);
+        break;
+
+      case 'r':
+        m_func_regexp.assign(option_arg);
+        break;
+
+      case 's':
+        m_modules.AppendIfUnique(FileSpec(option_arg, false));
+        break;
+
+      case 'S':
+        m_func_names.push_back(option_arg);
+        m_func_name_type_mask |= eFunctionNameTypeSelector;
+        break;
+
+      case 't':
+        m_thread_id =
+            StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
+        if (m_thread_id == LLDB_INVALID_THREAD_ID)
+          error.SetErrorStringWithFormat("invalid thread id string '%s'",
+                                         option_arg);
+        break;
+
+      case 'T':
+        m_thread_name.assign(option_arg);
+        break;
+
+      case 'w': {
+        bool success;
+        m_throw_bp = Args::StringToBoolean(option_arg, true, &success);
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "Invalid boolean value for on-throw option: '%s'", option_arg);
+      } break;
+
+      case 'x':
+        m_thread_index = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
+        if (m_thread_id == UINT32_MAX)
+          error.SetErrorStringWithFormat("invalid thread index string '%s'",
+                                         option_arg);
+        break;
+
+      case 'X':
+        m_source_regex_func_names.insert(option_arg);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_condition.clear();
+      m_filenames.Clear();
+      m_line_num = 0;
+      m_column = 0;
+      m_func_names.clear();
+      m_func_name_type_mask = eFunctionNameTypeNone;
+      m_func_regexp.clear();
+      m_source_text_regexp.clear();
+      m_modules.Clear();
+      m_load_addr = LLDB_INVALID_ADDRESS;
+      m_offset_addr = 0;
+      m_ignore_count = 0;
+      m_thread_id = LLDB_INVALID_THREAD_ID;
+      m_thread_index = UINT32_MAX;
+      m_thread_name.clear();
+      m_queue_name.clear();
+      m_catch_bp = false;
+      m_throw_bp = true;
+      m_hardware = false;
+      m_exception_language = eLanguageTypeUnknown;
+      m_language = lldb::eLanguageTypeUnknown;
+      m_skip_prologue = eLazyBoolCalculate;
+      m_one_shot = false;
+      m_use_dummy = false;
+      m_breakpoint_names.clear();
+      m_all_files = false;
+      m_exception_extra_args.Clear();
+      m_move_to_nearest_code = eLazyBoolCalculate;
+      m_source_regex_func_names.clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    std::string m_condition;
+    FileSpecList m_filenames;
+    uint32_t m_line_num;
+    uint32_t m_column;
+    std::vector<std::string> m_func_names;
+    std::vector<std::string> m_breakpoint_names;
+    uint32_t m_func_name_type_mask;
+    std::string m_func_regexp;
+    std::string m_source_text_regexp;
+    FileSpecList m_modules;
+    lldb::addr_t m_load_addr;
+    lldb::addr_t m_offset_addr;
+    uint32_t m_ignore_count;
+    lldb::tid_t m_thread_id;
+    uint32_t m_thread_index;
+    std::string m_thread_name;
+    std::string m_queue_name;
+    bool m_catch_bp;
+    bool m_throw_bp;
+    bool m_hardware; // Request to use hardware breakpoints
+    lldb::LanguageType m_exception_language;
+    lldb::LanguageType m_language;
+    LazyBool m_skip_prologue;
+    bool m_one_shot;
+    bool m_use_dummy;
+    bool m_all_files;
+    Args m_exception_extra_args;
+    LazyBool m_move_to_nearest_code;
+    std::unordered_set<std::string> m_source_regex_func_names;
+  };
 
 protected:
-    bool
-    DoExecute (Args& command,
-              CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target.  Must set target before setting breakpoints (see 'target create' command).");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        // The following are the various types of breakpoints that could be set:
-        //   1).  -f -l -p  [-s -g]   (setting breakpoint by source location)
-        //   2).  -a  [-s -g]         (setting breakpoint by address)
-        //   3).  -n  [-s -g]         (setting breakpoint by function name)
-        //   4).  -r  [-s -g]         (setting breakpoint by function name regular expression)
-        //   5).  -p -f               (setting a breakpoint by comparing a reg-exp to source text)
-        //   6).  -E [-w -h]          (setting a breakpoint for exceptions for a given language.)
-
-        BreakpointSetType break_type = eSetTypeInvalid;
-
-        if (m_options.m_line_num != 0)
-            break_type = eSetTypeFileAndLine;
-        else if (m_options.m_load_addr != LLDB_INVALID_ADDRESS)
-            break_type = eSetTypeAddress;
-        else if (!m_options.m_func_names.empty())
-            break_type = eSetTypeFunctionName;
-        else if  (!m_options.m_func_regexp.empty())
-            break_type = eSetTypeFunctionRegexp;
-        else if (!m_options.m_source_text_regexp.empty())
-            break_type = eSetTypeSourceRegexp;
-        else if (m_options.m_exception_language != eLanguageTypeUnknown)
-            break_type = eSetTypeException;
-
-        Breakpoint *bp = nullptr;
-        FileSpec module_spec;
-        const bool internal = false;
-        
-        // If the user didn't specify skip-prologue, having an offset should turn that off.
-        if (m_options.m_offset_addr != 0 && m_options.m_skip_prologue == eLazyBoolCalculate)
-            m_options.m_skip_prologue = eLazyBoolNo;
-
-        switch (break_type)
-        {
-            case eSetTypeFileAndLine: // Breakpoint by source position
-                {
-                    FileSpec file;
-                    const size_t num_files = m_options.m_filenames.GetSize();
-                    if (num_files == 0)
-                    {
-                        if (!GetDefaultFile (target, file, result))
-                        {
-                            result.AppendError("No file supplied and no default file available.");
-                            result.SetStatus (eReturnStatusFailed);
-                            return false;
-                        }
-                    }
-                    else if (num_files > 1)
-                    {
-                        result.AppendError("Only one file at a time is allowed for file and line breakpoints.");
-                        result.SetStatus (eReturnStatusFailed);
-                        return false;
-                    }
-                    else
-                        file = m_options.m_filenames.GetFileSpecAtIndex(0);
-                    
-                    // Only check for inline functions if 
-                    LazyBool check_inlines = eLazyBoolCalculate;
-                    
-                    bp = target->CreateBreakpoint (&(m_options.m_modules),
-                                                   file,
-                                                   m_options.m_line_num,
-                                                   m_options.m_offset_addr,
-                                                   check_inlines,
-                                                   m_options.m_skip_prologue,
-                                                   internal,
-                                                   m_options.m_hardware,
-                                                   m_options.m_move_to_nearest_code).get();
-                }
-                break;
-
-            case eSetTypeAddress: // Breakpoint by address
-                {
-                    // If a shared library has been specified, make an lldb_private::Address with the library, and
-                    // use that.  That way the address breakpoint will track the load location of the library.
-                    size_t num_modules_specified = m_options.m_modules.GetSize();
-                    if (num_modules_specified == 1)
-                    {
-                        const FileSpec *file_spec = m_options.m_modules.GetFileSpecPointerAtIndex(0);
-                        bp = target->CreateAddressInModuleBreakpoint (m_options.m_load_addr,
-                                                                      internal,
-                                                                      file_spec,
-                                                                      m_options.m_hardware).get();
-                    }
-                    else if (num_modules_specified == 0)
-                    {
-                        bp = target->CreateBreakpoint (m_options.m_load_addr,
-                                                       internal,
-                                                       m_options.m_hardware).get();
-                    }
-                    else
-                    {
-                        result.AppendError("Only one shared library can be specified for address breakpoints.");
-                        result.SetStatus(eReturnStatusFailed);
-                        return false;
-                    }
-                break;
-                }
-            case eSetTypeFunctionName: // Breakpoint by function name
-                {
-                    uint32_t name_type_mask = m_options.m_func_name_type_mask;
-                    
-                    if (name_type_mask == 0)
-                        name_type_mask = eFunctionNameTypeAuto;
-                    
-                    bp = target->CreateBreakpoint (&(m_options.m_modules),
-                                                   &(m_options.m_filenames),
-                                                   m_options.m_func_names,
-                                                   name_type_mask,
-                                                   m_options.m_language,
-                                                   m_options.m_offset_addr,
-                                                   m_options.m_skip_prologue,
-                                                   internal,
-                                                   m_options.m_hardware).get();
-                }
-                break;
-
-            case eSetTypeFunctionRegexp: // Breakpoint by regular expression function name
-                {
-                    RegularExpression regexp(m_options.m_func_regexp.c_str());
-                    if (!regexp.IsValid())
-                    {
-                        char err_str[1024];
-                        regexp.GetErrorAsCString(err_str, sizeof(err_str));
-                        result.AppendErrorWithFormat("Function name regular expression could not be compiled: \"%s\"",
-                                                     err_str);
-                        result.SetStatus (eReturnStatusFailed);
-                        return false;
-                    }
-                    
-                    bp = target->CreateFuncRegexBreakpoint (&(m_options.m_modules),
-                                                            &(m_options.m_filenames),
-                                                            regexp,
-                                                            m_options.m_language,
-                                                            m_options.m_skip_prologue,
-                                                            internal,
-                                                            m_options.m_hardware).get();
-                }
-                break;
-            case eSetTypeSourceRegexp: // Breakpoint by regexp on source text.
-                {
-                    const size_t num_files = m_options.m_filenames.GetSize();
-                    
-                    if (num_files == 0 && !m_options.m_all_files)
-                    {
-                        FileSpec file;
-                        if (!GetDefaultFile (target, file, result))
-                        {
-                            result.AppendError ("No files provided and could not find default file.");
-                            result.SetStatus (eReturnStatusFailed);
-                            return false;
-                        }
-                        else
-                        {
-                            m_options.m_filenames.Append (file);
-                        }
-                    }
-                    
-                    RegularExpression regexp(m_options.m_source_text_regexp.c_str());
-                    if (!regexp.IsValid())
-                    {
-                        char err_str[1024];
-                        regexp.GetErrorAsCString(err_str, sizeof(err_str));
-                        result.AppendErrorWithFormat("Source text regular expression could not be compiled: \"%s\"",
-                                                     err_str);
-                        result.SetStatus (eReturnStatusFailed);
-                        return false;
-                    }
-                    bp = target->CreateSourceRegexBreakpoint (&(m_options.m_modules),
-                                                              &(m_options.m_filenames),
-                                                              m_options.m_source_regex_func_names,
-                                                              regexp,
-                                                              internal,
-                                                              m_options.m_hardware,
-                                                              m_options.m_move_to_nearest_code).get();
-                }
-                break;
-            case eSetTypeException:
-                {
-                    Error precond_error;
-                    bp = target->CreateExceptionBreakpoint (m_options.m_exception_language,
-                                                            m_options.m_catch_bp,
-                                                            m_options.m_throw_bp,
-                                                            internal,
-                                                            &m_options.m_exception_extra_args,
-                                                            &precond_error).get();
-                    if (precond_error.Fail())
-                    {
-                        result.AppendErrorWithFormat("Error setting extra exception arguments: %s",
-                                                     precond_error.AsCString());
-                        target->RemoveBreakpointByID(bp->GetID());
-                        result.SetStatus(eReturnStatusFailed);
-                        return false;
-                    }
-                }
-                break;
-            default:
-                break;
-        }
-
-        // Now set the various options that were passed in:
-        if (bp)
-        {
-            if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
-                bp->SetThreadID (m_options.m_thread_id);
-                
-            if (m_options.m_thread_index != UINT32_MAX)
-                bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
-            
-            if (!m_options.m_thread_name.empty())
-                bp->GetOptions()->GetThreadSpec()->SetName(m_options.m_thread_name.c_str());
-            
-            if (!m_options.m_queue_name.empty())
-                bp->GetOptions()->GetThreadSpec()->SetQueueName(m_options.m_queue_name.c_str());
-                
-            if (m_options.m_ignore_count != 0)
-                bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
-
-            if (!m_options.m_condition.empty())
-                bp->GetOptions()->SetCondition(m_options.m_condition.c_str());
-
-            if (!m_options.m_breakpoint_names.empty())
-            {
-                Error error;  // We don't need to check the error here, since the option parser checked it...
-                for (auto name : m_options.m_breakpoint_names)
-                    bp->AddName(name.c_str(), error);
-            }
-            
-            bp->SetOneShot (m_options.m_one_shot);
-        }
-        
-        if (bp)
-        {
-            Stream &output_stream = result.GetOutputStream();
-            const bool show_locations = false;
-            bp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial, show_locations);
-            if (target == m_interpreter.GetDebugger().GetDummyTarget())
-                    output_stream.Printf ("Breakpoint set in dummy target, will get copied into future targets.\n");
-            else
-            {
-                // Don't print out this warning for exception breakpoints.  They can get set before the target
-                // is set, but we won't know how to actually set the breakpoint till we run.
-                if (bp->GetNumLocations() == 0 && break_type != eSetTypeException)
-                {
-                    output_stream.Printf ("WARNING:  Unable to resolve breakpoint to any actual locations.\n");
-                }
-            }
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else if (!bp)
-        {
-            result.AppendError ("Breakpoint creation failed: No breakpoint created.");
-            result.SetStatus (eReturnStatusFailed);
-        }
-
-        return result.Succeeded();
+    if (target == nullptr) {
+      result.AppendError("Invalid target.  Must set target before setting "
+                         "breakpoints (see 'target create' command).");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // The following are the various types of breakpoints that could be set:
+    //   1).  -f -l -p  [-s -g]   (setting breakpoint by source location)
+    //   2).  -a  [-s -g]         (setting breakpoint by address)
+    //   3).  -n  [-s -g]         (setting breakpoint by function name)
+    //   4).  -r  [-s -g]         (setting breakpoint by function name regular
+    //   expression)
+    //   5).  -p -f               (setting a breakpoint by comparing a reg-exp
+    //   to source text)
+    //   6).  -E [-w -h]          (setting a breakpoint for exceptions for a
+    //   given language.)
+
+    BreakpointSetType break_type = eSetTypeInvalid;
+
+    if (m_options.m_line_num != 0)
+      break_type = eSetTypeFileAndLine;
+    else if (m_options.m_load_addr != LLDB_INVALID_ADDRESS)
+      break_type = eSetTypeAddress;
+    else if (!m_options.m_func_names.empty())
+      break_type = eSetTypeFunctionName;
+    else if (!m_options.m_func_regexp.empty())
+      break_type = eSetTypeFunctionRegexp;
+    else if (!m_options.m_source_text_regexp.empty())
+      break_type = eSetTypeSourceRegexp;
+    else if (m_options.m_exception_language != eLanguageTypeUnknown)
+      break_type = eSetTypeException;
+
+    Breakpoint *bp = nullptr;
+    FileSpec module_spec;
+    const bool internal = false;
+
+    // If the user didn't specify skip-prologue, having an offset should turn
+    // that off.
+    if (m_options.m_offset_addr != 0 &&
+        m_options.m_skip_prologue == eLazyBoolCalculate)
+      m_options.m_skip_prologue = eLazyBoolNo;
+
+    switch (break_type) {
+    case eSetTypeFileAndLine: // Breakpoint by source position
+    {
+      FileSpec file;
+      const size_t num_files = m_options.m_filenames.GetSize();
+      if (num_files == 0) {
+        if (!GetDefaultFile(target, file, result)) {
+          result.AppendError("No file supplied and no default file available.");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      } else if (num_files > 1) {
+        result.AppendError("Only one file at a time is allowed for file and "
+                           "line breakpoints.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      } else
+        file = m_options.m_filenames.GetFileSpecAtIndex(0);
+
+      // Only check for inline functions if
+      LazyBool check_inlines = eLazyBoolCalculate;
+
+      bp = target
+               ->CreateBreakpoint(&(m_options.m_modules), file,
+                                  m_options.m_line_num, m_options.m_offset_addr,
+                                  check_inlines, m_options.m_skip_prologue,
+                                  internal, m_options.m_hardware,
+                                  m_options.m_move_to_nearest_code)
+               .get();
+    } break;
+
+    case eSetTypeAddress: // Breakpoint by address
+    {
+      // If a shared library has been specified, make an lldb_private::Address
+      // with the library, and
+      // use that.  That way the address breakpoint will track the load location
+      // of the library.
+      size_t num_modules_specified = m_options.m_modules.GetSize();
+      if (num_modules_specified == 1) {
+        const FileSpec *file_spec =
+            m_options.m_modules.GetFileSpecPointerAtIndex(0);
+        bp = target
+                 ->CreateAddressInModuleBreakpoint(m_options.m_load_addr,
+                                                   internal, file_spec,
+                                                   m_options.m_hardware)
+                 .get();
+      } else if (num_modules_specified == 0) {
+        bp = target
+                 ->CreateBreakpoint(m_options.m_load_addr, internal,
+                                    m_options.m_hardware)
+                 .get();
+      } else {
+        result.AppendError("Only one shared library can be specified for "
+                           "address breakpoints.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      break;
+    }
+    case eSetTypeFunctionName: // Breakpoint by function name
+    {
+      uint32_t name_type_mask = m_options.m_func_name_type_mask;
+
+      if (name_type_mask == 0)
+        name_type_mask = eFunctionNameTypeAuto;
+
+      bp = target
+               ->CreateBreakpoint(
+                   &(m_options.m_modules), &(m_options.m_filenames),
+                   m_options.m_func_names, name_type_mask, m_options.m_language,
+                   m_options.m_offset_addr, m_options.m_skip_prologue, internal,
+                   m_options.m_hardware)
+               .get();
+    } break;
+
+    case eSetTypeFunctionRegexp: // Breakpoint by regular expression function
+                                 // name
+    {
+      RegularExpression regexp(m_options.m_func_regexp.c_str());
+      if (!regexp.IsValid()) {
+        char err_str[1024];
+        regexp.GetErrorAsCString(err_str, sizeof(err_str));
+        result.AppendErrorWithFormat(
+            "Function name regular expression could not be compiled: \"%s\"",
+            err_str);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      bp = target
+               ->CreateFuncRegexBreakpoint(
+                   &(m_options.m_modules), &(m_options.m_filenames), regexp,
+                   m_options.m_language, m_options.m_skip_prologue, internal,
+                   m_options.m_hardware)
+               .get();
+    } break;
+    case eSetTypeSourceRegexp: // Breakpoint by regexp on source text.
+    {
+      const size_t num_files = m_options.m_filenames.GetSize();
+
+      if (num_files == 0 && !m_options.m_all_files) {
+        FileSpec file;
+        if (!GetDefaultFile(target, file, result)) {
+          result.AppendError(
+              "No files provided and could not find default file.");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else {
+          m_options.m_filenames.Append(file);
+        }
+      }
+
+      RegularExpression regexp(m_options.m_source_text_regexp.c_str());
+      if (!regexp.IsValid()) {
+        char err_str[1024];
+        regexp.GetErrorAsCString(err_str, sizeof(err_str));
+        result.AppendErrorWithFormat(
+            "Source text regular expression could not be compiled: \"%s\"",
+            err_str);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      bp = target
+               ->CreateSourceRegexBreakpoint(
+                   &(m_options.m_modules), &(m_options.m_filenames),
+                   m_options.m_source_regex_func_names, regexp, internal,
+                   m_options.m_hardware, m_options.m_move_to_nearest_code)
+               .get();
+    } break;
+    case eSetTypeException: {
+      Error precond_error;
+      bp = target
+               ->CreateExceptionBreakpoint(
+                   m_options.m_exception_language, m_options.m_catch_bp,
+                   m_options.m_throw_bp, internal,
+                   &m_options.m_exception_extra_args, &precond_error)
+               .get();
+      if (precond_error.Fail()) {
+        result.AppendErrorWithFormat(
+            "Error setting extra exception arguments: %s",
+            precond_error.AsCString());
+        target->RemoveBreakpointByID(bp->GetID());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } break;
+    default:
+      break;
+    }
+
+    // Now set the various options that were passed in:
+    if (bp) {
+      if (m_options.m_thread_id != LLDB_INVALID_THREAD_ID)
+        bp->SetThreadID(m_options.m_thread_id);
+
+      if (m_options.m_thread_index != UINT32_MAX)
+        bp->GetOptions()->GetThreadSpec()->SetIndex(m_options.m_thread_index);
+
+      if (!m_options.m_thread_name.empty())
+        bp->GetOptions()->GetThreadSpec()->SetName(
+            m_options.m_thread_name.c_str());
+
+      if (!m_options.m_queue_name.empty())
+        bp->GetOptions()->GetThreadSpec()->SetQueueName(
+            m_options.m_queue_name.c_str());
+
+      if (m_options.m_ignore_count != 0)
+        bp->GetOptions()->SetIgnoreCount(m_options.m_ignore_count);
+
+      if (!m_options.m_condition.empty())
+        bp->GetOptions()->SetCondition(m_options.m_condition.c_str());
+
+      if (!m_options.m_breakpoint_names.empty()) {
+        Error error; // We don't need to check the error here, since the option
+                     // parser checked it...
+        for (auto name : m_options.m_breakpoint_names)
+          bp->AddName(name.c_str(), error);
+      }
+
+      bp->SetOneShot(m_options.m_one_shot);
+    }
+
+    if (bp) {
+      Stream &output_stream = result.GetOutputStream();
+      const bool show_locations = false;
+      bp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial,
+                         show_locations);
+      if (target == m_interpreter.GetDebugger().GetDummyTarget())
+        output_stream.Printf("Breakpoint set in dummy target, will get copied "
+                             "into future targets.\n");
+      else {
+        // Don't print out this warning for exception breakpoints.  They can get
+        // set before the target
+        // is set, but we won't know how to actually set the breakpoint till we
+        // run.
+        if (bp->GetNumLocations() == 0 && break_type != eSetTypeException) {
+          output_stream.Printf("WARNING:  Unable to resolve breakpoint to any "
+                               "actual locations.\n");
+        }
+      }
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else if (!bp) {
+      result.AppendError("Breakpoint creation failed: No breakpoint created.");
+      result.SetStatus(eReturnStatusFailed);
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    bool
-    GetDefaultFile (Target *target, FileSpec &file, CommandReturnObject &result)
-    {
-        uint32_t default_line;
-        // First use the Source Manager's default file. 
-        // Then use the current stack frame's file.
-        if (!target->GetSourceManager().GetDefaultFileAndLine(file, default_line))
-        {
-            StackFrame *cur_frame = m_exe_ctx.GetFramePtr();
-            if (cur_frame == nullptr)
-            {
-                result.AppendError ("No selected frame to use to find the default file.");
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            else if (!cur_frame->HasDebugInformation())
-            {
-                result.AppendError ("Cannot use the selected frame to find the default file, it has no debug info.");
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            else
-            {
-                const SymbolContext &sc = cur_frame->GetSymbolContext (eSymbolContextLineEntry);
-                if (sc.line_entry.file)
-                {
-                    file = sc.line_entry.file;
-                }
-                else
-                {
-                    result.AppendError ("Can't find the file for the selected frame to use as the default file.");
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
+  bool GetDefaultFile(Target *target, FileSpec &file,
+                      CommandReturnObject &result) {
+    uint32_t default_line;
+    // First use the Source Manager's default file.
+    // Then use the current stack frame's file.
+    if (!target->GetSourceManager().GetDefaultFileAndLine(file, default_line)) {
+      StackFrame *cur_frame = m_exe_ctx.GetFramePtr();
+      if (cur_frame == nullptr) {
+        result.AppendError(
+            "No selected frame to use to find the default file.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      } else if (!cur_frame->HasDebugInformation()) {
+        result.AppendError("Cannot use the selected frame to find the default "
+                           "file, it has no debug info.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      } else {
+        const SymbolContext &sc =
+            cur_frame->GetSymbolContext(eSymbolContextLineEntry);
+        if (sc.line_entry.file) {
+          file = sc.line_entry.file;
+        } else {
+          result.AppendError("Can't find the file for the selected frame to "
+                             "use as the default file.");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
-        return true;
+      }
     }
-    
-    CommandOptions m_options;
+    return true;
+  }
+
+  CommandOptions m_options;
 };
 
 // If an additional option set beyond LLDB_OPTION_SET_10 is added, make sure to
 // update the numbers passed to LLDB_OPT_SET_FROM_TO(...) appropriately.
-#define LLDB_OPT_FILE ( LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2 )
-#define LLDB_OPT_NOT_10 ( LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10 )
-#define LLDB_OPT_SKIP_PROLOGUE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )
-#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3,8) )
-#define LLDB_OPT_MOVE_TO_NEAREST_CODE ( LLDB_OPT_SET_1 | LLDB_OPT_SET_9 )
-#define LLDB_OPT_EXPR_LANGUAGE ( LLDB_OPT_SET_FROM_TO(3, 8) )
+#define LLDB_OPT_FILE (LLDB_OPT_SET_FROM_TO(1, 9) & ~LLDB_OPT_SET_2)
+#define LLDB_OPT_NOT_10 (LLDB_OPT_SET_FROM_TO(1, 10) & ~LLDB_OPT_SET_10)
+#define LLDB_OPT_SKIP_PROLOGUE (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
+#define LLDB_OPT_OFFSET_APPLIES (LLDB_OPT_SET_1 | LLDB_OPT_SET_FROM_TO(3, 8))
+#define LLDB_OPT_MOVE_TO_NEAREST_CODE (LLDB_OPT_SET_1 | LLDB_OPT_SET_9)
+#define LLDB_OPT_EXPR_LANGUAGE (LLDB_OPT_SET_FROM_TO(3, 8))
 
-OptionDefinition
-CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectBreakpointSet::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_NOT_10,               false, "shlib",                  's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion,     eArgTypeShlibName,           "Set the breakpoint only in this shared library.  Can repeat this option "
                                                                                                                                                                                                    "multiple times to specify multiple shared libraries."},
   {LLDB_OPT_SET_ALL,              false, "ignore-count",           'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                         eArgTypeCount,               "Set the number of times this breakpoint is skipped before stopping." },
@@ -838,7 +781,7 @@ CommandObjectBreakpointSet::CommandOptio
   {LLDB_OPT_MOVE_TO_NEAREST_CODE, false, "move-to-nearest-code", 'm', OptionParser::eRequiredArgument,   nullptr, nullptr, 0,                                         eArgTypeBoolean,             "Move breakpoints to nearest code. If not set the target.move-to-nearest-code "
                                                                                                                                                                                                    "setting is used."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -846,300 +789,264 @@ CommandObjectBreakpointSet::CommandOptio
 //-------------------------------------------------------------------------
 #pragma mark Modify
 
-class CommandObjectBreakpointModify : public CommandObjectParsed
-{
+class CommandObjectBreakpointModify : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointModify (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "breakpoint modify", 
-                            "Modify the options on a breakpoint or set of breakpoints in the executable.  "
-                            "If no breakpoint is specified, acts on the last created breakpoint.  "
-                            "With the exception of -e, -d and -i, passing an empty argument clears the modification.", 
+  CommandObjectBreakpointModify(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "breakpoint modify",
+                            "Modify the options on a breakpoint or set of "
+                            "breakpoints in the executable.  "
+                            "If no breakpoint is specified, acts on the last "
+                            "created breakpoint.  "
+                            "With the exception of -e, -d and -i, passing an "
+                            "empty argument clears the modification.",
                             nullptr),
-        m_options ()
-    {
-        CommandArgumentEntry arg;
-        CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);
-        // Add the entry for the first argument for this command to the object's arguments vector.
-        m_arguments.push_back (arg);   
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID,
+                                      eArgTypeBreakpointIDRange);
+    // Add the entry for the first argument for this command to the object's
+    // arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectBreakpointModify() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_ignore_count(0), m_thread_id(LLDB_INVALID_THREAD_ID),
+          m_thread_id_passed(false), m_thread_index(UINT32_MAX),
+          m_thread_index_passed(false), m_thread_name(), m_queue_name(),
+          m_condition(), m_one_shot(false), m_enable_passed(false),
+          m_enable_value(false), m_name_passed(false), m_queue_passed(false),
+          m_condition_passed(false), m_one_shot_passed(false),
+          m_use_dummy(false) {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'c':
+        if (option_arg != nullptr)
+          m_condition.assign(option_arg);
+        else
+          m_condition.clear();
+        m_condition_passed = true;
+        break;
+      case 'd':
+        m_enable_passed = true;
+        m_enable_value = false;
+        break;
+      case 'D':
+        m_use_dummy = true;
+        break;
+      case 'e':
+        m_enable_passed = true;
+        m_enable_value = true;
+        break;
+      case 'i':
+        m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
+        if (m_ignore_count == UINT32_MAX)
+          error.SetErrorStringWithFormat("invalid ignore count '%s'",
+                                         option_arg);
+        break;
+      case 'o': {
+        bool value, success;
+        value = Args::StringToBoolean(option_arg, false, &success);
+        if (success) {
+          m_one_shot_passed = true;
+          m_one_shot = value;
+        } else
+          error.SetErrorStringWithFormat(
+              "invalid boolean value '%s' passed for -o option", option_arg);
+      } break;
+      case 't':
+        if (option_arg[0] == '\0') {
+          m_thread_id = LLDB_INVALID_THREAD_ID;
+          m_thread_id_passed = true;
+        } else {
+          m_thread_id =
+              StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
+          if (m_thread_id == LLDB_INVALID_THREAD_ID)
+            error.SetErrorStringWithFormat("invalid thread id string '%s'",
+                                           option_arg);
+          else
+            m_thread_id_passed = true;
+        }
+        break;
+      case 'T':
+        if (option_arg != nullptr)
+          m_thread_name.assign(option_arg);
+        else
+          m_thread_name.clear();
+        m_name_passed = true;
+        break;
+      case 'q':
+        if (option_arg != nullptr)
+          m_queue_name.assign(option_arg);
+        else
+          m_queue_name.clear();
+        m_queue_passed = true;
+        break;
+      case 'x':
+        if (option_arg[0] == '\n') {
+          m_thread_index = UINT32_MAX;
+          m_thread_index_passed = true;
+        } else {
+          m_thread_index = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
+          if (m_thread_id == UINT32_MAX)
+            error.SetErrorStringWithFormat("invalid thread index string '%s'",
+                                           option_arg);
+          else
+            m_thread_index_passed = true;
+        }
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_ignore_count = 0;
+      m_thread_id = LLDB_INVALID_THREAD_ID;
+      m_thread_id_passed = false;
+      m_thread_index = UINT32_MAX;
+      m_thread_index_passed = false;
+      m_thread_name.clear();
+      m_queue_name.clear();
+      m_condition.clear();
+      m_one_shot = false;
+      m_enable_passed = false;
+      m_queue_passed = false;
+      m_name_passed = false;
+      m_condition_passed = false;
+      m_one_shot_passed = false;
+      m_use_dummy = false;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    uint32_t m_ignore_count;
+    lldb::tid_t m_thread_id;
+    bool m_thread_id_passed;
+    uint32_t m_thread_index;
+    bool m_thread_index_passed;
+    std::string m_thread_name;
+    std::string m_queue_name;
+    std::string m_condition;
+    bool m_one_shot;
+    bool m_enable_passed;
+    bool m_enable_value;
+    bool m_name_passed;
+    bool m_queue_passed;
+    bool m_condition_passed;
+    bool m_one_shot_passed;
+    bool m_use_dummy;
+  };
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
+    if (target == nullptr) {
+      result.AppendError("Invalid target.  No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
 
-    ~CommandObjectBreakpointModify() override = default;
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+    BreakpointIDList valid_bp_ids;
 
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions () :
-            Options (),
-            m_ignore_count (0),
-            m_thread_id(LLDB_INVALID_THREAD_ID),
-            m_thread_id_passed(false),
-            m_thread_index (UINT32_MAX),
-            m_thread_index_passed(false),
-            m_thread_name(),
-            m_queue_name(),
-            m_condition (),
-            m_one_shot (false),
-            m_enable_passed (false),
-            m_enable_value (false),
-            m_name_passed (false),
-            m_queue_passed (false),
-            m_condition_passed (false),
-            m_one_shot_passed (false),
-            m_use_dummy (false)
-        {
-        }
+    CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+        command, target, result, &valid_bp_ids);
 
-        ~CommandOptions() override = default;
+    if (result.Succeeded()) {
+      const size_t count = valid_bp_ids.GetSize();
+      for (size_t i = 0; i < count; ++i) {
+        BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-                case 'c':
-                    if (option_arg != nullptr)
-                        m_condition.assign (option_arg);
-                    else
-                        m_condition.clear();
-                    m_condition_passed = true;
-                    break;
-                case 'd':
-                    m_enable_passed = true;
-                    m_enable_value = false;
-                    break;
-                case 'D':
-                    m_use_dummy = true;
-                    break;
-                case 'e':
-                    m_enable_passed = true;
-                    m_enable_value = true;
-                    break;
-                case 'i':
-                    m_ignore_count = StringConvert::ToUInt32(option_arg, UINT32_MAX, 0);
-                    if (m_ignore_count == UINT32_MAX)
-                       error.SetErrorStringWithFormat ("invalid ignore count '%s'", option_arg);
-                    break;
-                case 'o':
-                {
-                    bool value, success;
-                    value = Args::StringToBoolean(option_arg, false, &success);
-                    if (success)
-                    {
-                        m_one_shot_passed = true;
-                        m_one_shot = value;
-                    }
-                    else
-                        error.SetErrorStringWithFormat("invalid boolean value '%s' passed for -o option", option_arg);
-                }
-                break;
-                case 't' :
-                    if (option_arg[0] == '\0')
-                    {
-                        m_thread_id = LLDB_INVALID_THREAD_ID;
-                        m_thread_id_passed = true;
-                    }
-                    else
-                    {
-                        m_thread_id = StringConvert::ToUInt64(option_arg, LLDB_INVALID_THREAD_ID, 0);
-                        if (m_thread_id == LLDB_INVALID_THREAD_ID)
-                           error.SetErrorStringWithFormat ("invalid thread id string '%s'", option_arg);
-                        else
-                            m_thread_id_passed = true;
-                    }
-                    break;
-                case 'T':
-                    if (option_arg != nullptr)
-                        m_thread_name.assign (option_arg);
-                    else
-                        m_thread_name.clear();
-                    m_name_passed = true;
-                    break;
-                case 'q':
-                    if (option_arg != nullptr)
-                        m_queue_name.assign (option_arg);
-                    else
-                        m_queue_name.clear();
-                    m_queue_passed = true;
-                    break;
-                case 'x':
-                    if (option_arg[0] == '\n')
-                    {
-                        m_thread_index = UINT32_MAX;
-                        m_thread_index_passed = true;
-                    }
-                    else
-                    {
-                        m_thread_index = StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0);
-                        if (m_thread_id == UINT32_MAX)
-                           error.SetErrorStringWithFormat ("invalid thread index string '%s'", option_arg);
-                        else
-                            m_thread_index_passed = true;
-                    }
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
+        if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+          Breakpoint *bp =
+              target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+          if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
+            BreakpointLocation *location =
+                bp->FindLocationByID(cur_bp_id.GetLocationID()).get();
+            if (location) {
+              if (m_options.m_thread_id_passed)
+                location->SetThreadID(m_options.m_thread_id);
 
-            return error;
-        }
+              if (m_options.m_thread_index_passed)
+                location->SetThreadIndex(m_options.m_thread_index);
 
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_ignore_count = 0;
-            m_thread_id = LLDB_INVALID_THREAD_ID;
-            m_thread_id_passed = false;
-            m_thread_index = UINT32_MAX;
-            m_thread_index_passed = false;
-            m_thread_name.clear();
-            m_queue_name.clear();
-            m_condition.clear();
-            m_one_shot = false;
-            m_enable_passed = false;
-            m_queue_passed = false;
-            m_name_passed = false;
-            m_condition_passed = false;
-            m_one_shot_passed = false;
-            m_use_dummy = false;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        // Options table: Required for subclasses of Options.
+              if (m_options.m_name_passed)
+                location->SetThreadName(m_options.m_thread_name.c_str());
 
-        static OptionDefinition g_option_table[];
+              if (m_options.m_queue_passed)
+                location->SetQueueName(m_options.m_queue_name.c_str());
 
-        // Instance variables to hold the values for command options.
+              if (m_options.m_ignore_count != 0)
+                location->SetIgnoreCount(m_options.m_ignore_count);
 
-        uint32_t m_ignore_count;
-        lldb::tid_t m_thread_id;
-        bool m_thread_id_passed;
-        uint32_t m_thread_index;
-        bool m_thread_index_passed;
-        std::string m_thread_name;
-        std::string m_queue_name;
-        std::string m_condition;
-        bool m_one_shot;
-        bool m_enable_passed;
-        bool m_enable_value;
-        bool m_name_passed;
-        bool m_queue_passed;
-        bool m_condition_passed;
-        bool m_one_shot_passed;
-        bool m_use_dummy;
-    };
+              if (m_options.m_enable_passed)
+                location->SetEnabled(m_options.m_enable_value);
 
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target.  No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+              if (m_options.m_condition_passed)
+                location->SetCondition(m_options.m_condition.c_str());
+            }
+          } else {
+            if (m_options.m_thread_id_passed)
+              bp->SetThreadID(m_options.m_thread_id);
 
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
+            if (m_options.m_thread_index_passed)
+              bp->SetThreadIndex(m_options.m_thread_index);
 
-        BreakpointIDList valid_bp_ids;
+            if (m_options.m_name_passed)
+              bp->SetThreadName(m_options.m_thread_name.c_str());
 
-        CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
+            if (m_options.m_queue_passed)
+              bp->SetQueueName(m_options.m_queue_name.c_str());
 
-        if (result.Succeeded())
-        {
-            const size_t count = valid_bp_ids.GetSize(); 
-            for (size_t i = 0; i < count; ++i)
-            {
-                BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-
-                if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                {
-                    Breakpoint *bp = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                    if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
-                    {
-                        BreakpointLocation *location = bp->FindLocationByID (cur_bp_id.GetLocationID()).get();
-                        if (location)
-                        {
-                            if (m_options.m_thread_id_passed)
-                                location->SetThreadID (m_options.m_thread_id);
-                                
-                            if (m_options.m_thread_index_passed)
-                                location->SetThreadIndex(m_options.m_thread_index);
-                            
-                            if (m_options.m_name_passed)
-                                location->SetThreadName(m_options.m_thread_name.c_str());
-                            
-                            if (m_options.m_queue_passed)
-                                location->SetQueueName(m_options.m_queue_name.c_str());
-                                
-                            if (m_options.m_ignore_count != 0)
-                                location->SetIgnoreCount(m_options.m_ignore_count);
-                                
-                            if (m_options.m_enable_passed)
-                                location->SetEnabled (m_options.m_enable_value);
-                                
-                            if (m_options.m_condition_passed)
-                                location->SetCondition (m_options.m_condition.c_str());
-                        }
-                    }
-                    else
-                    {
-                        if (m_options.m_thread_id_passed)
-                            bp->SetThreadID (m_options.m_thread_id);
-                            
-                        if (m_options.m_thread_index_passed)
-                            bp->SetThreadIndex(m_options.m_thread_index);
-                        
-                        if (m_options.m_name_passed)
-                            bp->SetThreadName(m_options.m_thread_name.c_str());
-                        
-                        if (m_options.m_queue_passed)
-                            bp->SetQueueName(m_options.m_queue_name.c_str());
-                            
-                        if (m_options.m_ignore_count != 0)
-                            bp->SetIgnoreCount(m_options.m_ignore_count);
-                            
-                        if (m_options.m_enable_passed)
-                            bp->SetEnabled (m_options.m_enable_value);
-                            
-                        if (m_options.m_condition_passed)
-                            bp->SetCondition (m_options.m_condition.c_str());
-                    }
-                }
-            }
+            if (m_options.m_ignore_count != 0)
+              bp->SetIgnoreCount(m_options.m_ignore_count);
+
+            if (m_options.m_enable_passed)
+              bp->SetEnabled(m_options.m_enable_value);
+
+            if (m_options.m_condition_passed)
+              bp->SetCondition(m_options.m_condition.c_str());
+          }
         }
-        
-        return result.Succeeded();
+      }
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 #pragma mark Modify::CommandOptions
 OptionDefinition
-CommandObjectBreakpointModify::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectBreakpointModify::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "ignore-count", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount,       "Set the number of times this breakpoint is skipped before stopping."},
   {LLDB_OPT_SET_ALL, false, "one-shot",     'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean,     "The breakpoint is deleted the first time it stop causes a stop."},
   {LLDB_OPT_SET_ALL, false, "thread-index", 'x', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeThreadIndex, "The breakpoint stops only for the thread whose index matches this argument."},
@@ -1151,7 +1058,7 @@ CommandObjectBreakpointModify::CommandOp
   {LLDB_OPT_SET_2,   false, "disable",      'd', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,        "Disable the breakpoint."},
   {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument,  nullptr, nullptr, 0, eArgTypeNone,        "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -1159,97 +1066,89 @@ CommandObjectBreakpointModify::CommandOp
 //-------------------------------------------------------------------------
 #pragma mark Enable
 
-class CommandObjectBreakpointEnable : public CommandObjectParsed
-{
+class CommandObjectBreakpointEnable : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointEnable (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "enable",
-                            "Enable the specified disabled breakpoint(s). If no breakpoints are specified, enable all of them.",
-                            nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);
-        // Add the entry for the first argument for this command to the object's arguments vector.
-        m_arguments.push_back (arg);   
-    }
+  CommandObjectBreakpointEnable(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "enable",
+                            "Enable the specified disabled breakpoint(s). If "
+                            "no breakpoints are specified, enable all of them.",
+                            nullptr) {
+    CommandArgumentEntry arg;
+    CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID,
+                                      eArgTypeBreakpointIDRange);
+    // Add the entry for the first argument for this command to the object's
+    // arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectBreakpointEnable() override = default;
+  ~CommandObjectBreakpointEnable() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget();
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target.  No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
-
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-
-        size_t num_breakpoints = breakpoints.GetSize();
-
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("No breakpoints exist to be enabled.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (command.GetArgumentCount() == 0)
-        {
-            // No breakpoint selected; enable all currently set breakpoints.
-            target->EnableAllBreakpoints ();
-            result.AppendMessageWithFormat ("All breakpoints enabled. (%" PRIu64 " breakpoints)\n", (uint64_t)num_breakpoints);
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            // Particular breakpoint selected; enable that breakpoint.
-            BreakpointIDList valid_bp_ids;
-            CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
-
-            if (result.Succeeded())
-            {
-                int enable_count = 0;
-                int loc_count = 0;
-                const size_t count = valid_bp_ids.GetSize();
-                for (size_t i = 0; i < count; ++i)
-                {
-                    BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-
-                    if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                    {
-                        Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                        if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
-                        {
-                            BreakpointLocation *location = breakpoint->FindLocationByID (cur_bp_id.GetLocationID()).get();
-                            if (location)
-                            {
-                                location->SetEnabled (true);
-                                ++loc_count;
-                            }
-                        }
-                        else
-                        {
-                            breakpoint->SetEnabled (true);
-                            ++enable_count;
-                        }
-                    }
-                }
-                result.AppendMessageWithFormat ("%d breakpoints enabled.\n", enable_count + loc_count);
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-        }
-
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget();
+    if (target == nullptr) {
+      result.AppendError("Invalid target.  No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendError("No breakpoints exist to be enabled.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      // No breakpoint selected; enable all currently set breakpoints.
+      target->EnableAllBreakpoints();
+      result.AppendMessageWithFormat("All breakpoints enabled. (%" PRIu64
+                                     " breakpoints)\n",
+                                     (uint64_t)num_breakpoints);
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      // Particular breakpoint selected; enable that breakpoint.
+      BreakpointIDList valid_bp_ids;
+      CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+          command, target, result, &valid_bp_ids);
+
+      if (result.Succeeded()) {
+        int enable_count = 0;
+        int loc_count = 0;
+        const size_t count = valid_bp_ids.GetSize();
+        for (size_t i = 0; i < count; ++i) {
+          BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+
+          if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+            Breakpoint *breakpoint =
+                target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+            if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
+              BreakpointLocation *location =
+                  breakpoint->FindLocationByID(cur_bp_id.GetLocationID()).get();
+              if (location) {
+                location->SetEnabled(true);
+                ++loc_count;
+              }
+            } else {
+              breakpoint->SetEnabled(true);
+              ++enable_count;
+            }
+          }
+        }
+        result.AppendMessageWithFormat("%d breakpoints enabled.\n",
+                                       enable_count + loc_count);
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      }
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1257,23 +1156,24 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark Disable
 
-class CommandObjectBreakpointDisable : public CommandObjectParsed
-{
+class CommandObjectBreakpointDisable : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointDisable(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "breakpoint disable", "Disable the specified breakpoint(s) without deleting "
-                                                                 "them.  If none are specified, disable all "
-                                                                 "breakpoints.",
-                              nullptr)
-    {
-        SetHelpLong("Disable the specified breakpoint(s) without deleting them.  \
+  CommandObjectBreakpointDisable(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "breakpoint disable",
+            "Disable the specified breakpoint(s) without deleting "
+            "them.  If none are specified, disable all "
+            "breakpoints.",
+            nullptr) {
+    SetHelpLong(
+        "Disable the specified breakpoint(s) without deleting them.  \
 If none are specified, disable all breakpoints."
-                    R"(
+        R"(
 
 )"
-                    "Note: disabling a breakpoint will cause none of its locations to be hit \
+        "Note: disabling a breakpoint will cause none of its locations to be hit \
 regardless of whether individual locations are enabled or disabled.  After the sequence:"
-                    R"(
+        R"(
 
     (lldb) break disable 1
     (lldb) break enable 1.1
@@ -1284,91 +1184,85 @@ execution will NOT stop at location 1.1.
     (lldb) break enable 1.1
 
 )"
-                    "The first command disables all locations for breakpoint 1, \
+        "The first command disables all locations for breakpoint 1, \
 the second re-enables the first location.");
 
-        CommandArgumentEntry arg;
-        CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);
-        // Add the entry for the first argument for this command to the object's arguments vector.
-        m_arguments.push_back (arg);
-    }
+    CommandArgumentEntry arg;
+    CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID,
+                                      eArgTypeBreakpointIDRange);
+    // Add the entry for the first argument for this command to the object's
+    // arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectBreakpointDisable() override = default;
+  ~CommandObjectBreakpointDisable() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget();
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target.  No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
-
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-        size_t num_breakpoints = breakpoints.GetSize();
-
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("No breakpoints exist to be disabled.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (command.GetArgumentCount() == 0)
-        {
-            // No breakpoint selected; disable all currently set breakpoints.
-            target->DisableAllBreakpoints ();
-            result.AppendMessageWithFormat ("All breakpoints disabled. (%" PRIu64 " breakpoints)\n", (uint64_t)num_breakpoints);
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            // Particular breakpoint selected; disable that breakpoint.
-            BreakpointIDList valid_bp_ids;
-
-            CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
-
-            if (result.Succeeded())
-            {
-                int disable_count = 0;
-                int loc_count = 0;
-                const size_t count = valid_bp_ids.GetSize();
-                for (size_t i = 0; i < count; ++i)
-                {
-                    BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-
-                    if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                    {
-                        Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                        if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
-                        {
-                            BreakpointLocation *location = breakpoint->FindLocationByID (cur_bp_id.GetLocationID()).get();
-                            if (location)
-                            {
-                                location->SetEnabled (false);
-                                ++loc_count;
-                            }
-                        }
-                        else
-                        {
-                            breakpoint->SetEnabled (false);
-                            ++disable_count;
-                        }
-                    }
-                }
-                result.AppendMessageWithFormat ("%d breakpoints disabled.\n", disable_count + loc_count);
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-        }
-
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget();
+    if (target == nullptr) {
+      result.AppendError("Invalid target.  No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendError("No breakpoints exist to be disabled.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      // No breakpoint selected; disable all currently set breakpoints.
+      target->DisableAllBreakpoints();
+      result.AppendMessageWithFormat("All breakpoints disabled. (%" PRIu64
+                                     " breakpoints)\n",
+                                     (uint64_t)num_breakpoints);
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      // Particular breakpoint selected; disable that breakpoint.
+      BreakpointIDList valid_bp_ids;
+
+      CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+          command, target, result, &valid_bp_ids);
+
+      if (result.Succeeded()) {
+        int disable_count = 0;
+        int loc_count = 0;
+        const size_t count = valid_bp_ids.GetSize();
+        for (size_t i = 0; i < count; ++i) {
+          BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+
+          if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+            Breakpoint *breakpoint =
+                target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+            if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
+              BreakpointLocation *location =
+                  breakpoint->FindLocationByID(cur_bp_id.GetLocationID()).get();
+              if (location) {
+                location->SetEnabled(false);
+                ++loc_count;
+              }
+            } else {
+              breakpoint->SetEnabled(false);
+              ++disable_count;
+            }
+          }
+        }
+        result.AppendMessageWithFormat("%d breakpoints disabled.\n",
+                                       disable_count + loc_count);
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      }
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1376,182 +1270,156 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark List
 
-class CommandObjectBreakpointList : public CommandObjectParsed
-{
+class CommandObjectBreakpointList : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointList (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter, 
-                            "breakpoint list",
-                            "List some or all breakpoints at configurable levels of detail.",
-                            nullptr),
-        m_options ()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData bp_id_arg;
-
-        // Define the first (and only) variant of this arg.
-        bp_id_arg.arg_type = eArgTypeBreakpointID;
-        bp_id_arg.arg_repetition = eArgRepeatOptional;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (bp_id_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectBreakpointList() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions () :
-            Options (),
-            m_level (lldb::eDescriptionLevelBrief),
-            m_use_dummy(false)
-        {
-        }
-
-        ~CommandOptions() override = default;
-
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-                case 'b':
-                    m_level = lldb::eDescriptionLevelBrief;
-                    break;
-                case 'D':
-                    m_use_dummy = true;
-                    break;
-                case 'f':
-                    m_level = lldb::eDescriptionLevelFull;
-                    break;
-                case 'v':
-                    m_level = lldb::eDescriptionLevelVerbose;
-                    break;
-                case 'i':
-                    m_internal = true;
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-
-            return error;
-        }
-
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_level = lldb::eDescriptionLevelFull;
-            m_internal = false;
-            m_use_dummy = false;
-        }
-
-        const OptionDefinition *
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-
-        lldb::DescriptionLevel m_level;
-
-        bool m_internal;
-        bool m_use_dummy;
-    };
+  CommandObjectBreakpointList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "breakpoint list",
+            "List some or all breakpoints at configurable levels of detail.",
+            nullptr),
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData bp_id_arg;
+
+    // Define the first (and only) variant of this arg.
+    bp_id_arg.arg_type = eArgTypeBreakpointID;
+    bp_id_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(bp_id_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectBreakpointList() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_level(lldb::eDescriptionLevelBrief), m_use_dummy(false) {
+    }
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'b':
+        m_level = lldb::eDescriptionLevelBrief;
+        break;
+      case 'D':
+        m_use_dummy = true;
+        break;
+      case 'f':
+        m_level = lldb::eDescriptionLevelFull;
+        break;
+      case 'v':
+        m_level = lldb::eDescriptionLevelVerbose;
+        break;
+      case 'i':
+        m_internal = true;
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_level = lldb::eDescriptionLevelFull;
+      m_internal = false;
+      m_use_dummy = false;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    lldb::DescriptionLevel m_level;
+
+    bool m_internal;
+    bool m_use_dummy;
+  };
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
-
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target. No current target or breakpoints.");
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            return true;
-        }
-
-        const BreakpointList &breakpoints = target->GetBreakpointList(m_options.m_internal);
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList(m_options.m_internal).GetListMutex(lock);
-
-        size_t num_breakpoints = breakpoints.GetSize();
-
-        if (num_breakpoints == 0)
-        {
-            result.AppendMessage ("No breakpoints currently set.");
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            return true;
-        }
-
-        Stream &output_stream = result.GetOutputStream();
-
-        if (command.GetArgumentCount() == 0)
-        {
-            // No breakpoint selected; show info about all currently set breakpoints.
-            result.AppendMessage ("Current breakpoints:");
-            for (size_t i = 0; i < num_breakpoints; ++i)
-            {
-                Breakpoint *breakpoint = breakpoints.GetBreakpointAtIndex (i).get();
-                AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level);
-            }
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            // Particular breakpoints selected; show info about that breakpoint.
-            BreakpointIDList valid_bp_ids;
-            CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
-
-            if (result.Succeeded())
-            {
-                for (size_t i = 0; i < valid_bp_ids.GetSize(); ++i)
-                {
-                    BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-                    Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                    AddBreakpointDescription (&output_stream, breakpoint, m_options.m_level);
-                }
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-            else
-            {
-                result.AppendError("Invalid breakpoint ID.");
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        return result.Succeeded();
+    if (target == nullptr) {
+      result.AppendError("Invalid target. No current target or breakpoints.");
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      return true;
+    }
+
+    const BreakpointList &breakpoints =
+        target->GetBreakpointList(m_options.m_internal);
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList(m_options.m_internal).GetListMutex(lock);
+
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendMessage("No breakpoints currently set.");
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      return true;
+    }
+
+    Stream &output_stream = result.GetOutputStream();
+
+    if (command.GetArgumentCount() == 0) {
+      // No breakpoint selected; show info about all currently set breakpoints.
+      result.AppendMessage("Current breakpoints:");
+      for (size_t i = 0; i < num_breakpoints; ++i) {
+        Breakpoint *breakpoint = breakpoints.GetBreakpointAtIndex(i).get();
+        AddBreakpointDescription(&output_stream, breakpoint, m_options.m_level);
+      }
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      // Particular breakpoints selected; show info about that breakpoint.
+      BreakpointIDList valid_bp_ids;
+      CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+          command, target, result, &valid_bp_ids);
+
+      if (result.Succeeded()) {
+        for (size_t i = 0; i < valid_bp_ids.GetSize(); ++i) {
+          BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+          Breakpoint *breakpoint =
+              target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+          AddBreakpointDescription(&output_stream, breakpoint,
+                                   m_options.m_level);
+        }
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        result.AppendError("Invalid breakpoint ID.");
+        result.SetStatus(eReturnStatusFailed);
+      }
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 #pragma mark List::CommandOptions
-OptionDefinition
-CommandObjectBreakpointList::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectBreakpointList::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
     {LLDB_OPT_SET_ALL, false, "internal",          'i', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Show debugger internal breakpoints" },
     {LLDB_OPT_SET_1,   false, "brief",             'b', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Give a brief description of the breakpoint (no location info)."},
     // FIXME: We need to add an "internal" command, and then add this sort of thing to it.
@@ -1560,7 +1428,7 @@ CommandObjectBreakpointList::CommandOpti
     {LLDB_OPT_SET_3,   false, "verbose",           'v', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Explain everything we know about the breakpoint (for debugging debugger bugs)."},
     {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "List Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
     {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -1568,196 +1436,162 @@ CommandObjectBreakpointList::CommandOpti
 //-------------------------------------------------------------------------
 #pragma mark Clear
 
-class CommandObjectBreakpointClear : public CommandObjectParsed
-{
+class CommandObjectBreakpointClear : public CommandObjectParsed {
 public:
-    typedef enum BreakpointClearType
-    {
-        eClearTypeInvalid,
-        eClearTypeFileAndLine
-    } BreakpointClearType;
-
-    CommandObjectBreakpointClear(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "breakpoint clear",
-                              "Delete or disable breakpoints matching the specified source file and line.",
-                              "breakpoint clear <cmd-options>"),
-          m_options()
-    {
-    }
+  typedef enum BreakpointClearType {
+    eClearTypeInvalid,
+    eClearTypeFileAndLine
+  } BreakpointClearType;
 
-    ~CommandObjectBreakpointClear() override = default;
+  CommandObjectBreakpointClear(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "breakpoint clear",
+                            "Delete or disable breakpoints matching the "
+                            "specified source file and line.",
+                            "breakpoint clear <cmd-options>"),
+        m_options() {}
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  ~CommandObjectBreakpointClear() override = default;
 
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions () :
-            Options (),
-            m_filename (),
-            m_line_num (0)
-        {
-        }
+  Options *GetOptions() override { return &m_options; }
 
-        ~CommandOptions() override = default;
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), m_filename(), m_line_num(0) {}
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-                case 'f':
-                    m_filename.assign (option_arg);
-                    break;
-
-                case 'l':
-                    m_line_num = StringConvert::ToUInt32 (option_arg, 0);
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
+    ~CommandOptions() override = default;
 
-            return error;
-        }
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
 
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_filename.clear();
-            m_line_num = 0;
-        }
+      switch (short_option) {
+      case 'f':
+        m_filename.assign(option_arg);
+        break;
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
+      case 'l':
+        m_line_num = StringConvert::ToUInt32(option_arg, 0);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_filename.clear();
+      m_line_num = 0;
+    }
 
-        // Options table: Required for subclasses of Options.
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        static OptionDefinition g_option_table[];
+    // Options table: Required for subclasses of Options.
 
-        // Instance variables to hold the values for command options.
+    static OptionDefinition g_option_table[];
 
-        std::string m_filename;
-        uint32_t m_line_num;
+    // Instance variables to hold the values for command options.
 
-    };
+    std::string m_filename;
+    uint32_t m_line_num;
+  };
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget();
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target. No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget();
+    if (target == nullptr) {
+      result.AppendError("Invalid target. No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
 
-        // The following are the various types of breakpoints that could be cleared:
-        //   1). -f -l (clearing breakpoint by source location)
+    // The following are the various types of breakpoints that could be cleared:
+    //   1). -f -l (clearing breakpoint by source location)
 
-        BreakpointClearType break_type = eClearTypeInvalid;
+    BreakpointClearType break_type = eClearTypeInvalid;
 
-        if (m_options.m_line_num != 0)
-            break_type = eClearTypeFileAndLine;
+    if (m_options.m_line_num != 0)
+      break_type = eClearTypeFileAndLine;
 
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
-
-        BreakpointList &breakpoints = target->GetBreakpointList();
-        size_t num_breakpoints = breakpoints.GetSize();
-
-        // Early return if there's no breakpoint at all.
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("Breakpoint clear: No breakpoint cleared.");
-            result.SetStatus (eReturnStatusFailed);
-            return result.Succeeded();
-        }
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
+
+    BreakpointList &breakpoints = target->GetBreakpointList();
+    size_t num_breakpoints = breakpoints.GetSize();
 
-        // Find matching breakpoints and delete them.
+    // Early return if there's no breakpoint at all.
+    if (num_breakpoints == 0) {
+      result.AppendError("Breakpoint clear: No breakpoint cleared.");
+      result.SetStatus(eReturnStatusFailed);
+      return result.Succeeded();
+    }
 
-        // First create a copy of all the IDs.
-        std::vector<break_id_t> BreakIDs;
-        for (size_t i = 0; i < num_breakpoints; ++i)
-            BreakIDs.push_back(breakpoints.GetBreakpointAtIndex(i)->GetID());
-
-        int num_cleared = 0;
-        StreamString ss;
-        switch (break_type)
-        {
-            case eClearTypeFileAndLine: // Breakpoint by source position
-                {
-                    const ConstString filename(m_options.m_filename.c_str());
-                    BreakpointLocationCollection loc_coll;
-
-                    for (size_t i = 0; i < num_breakpoints; ++i)
-                    {
-                        Breakpoint *bp = breakpoints.FindBreakpointByID(BreakIDs[i]).get();
-                        
-                        if (bp->GetMatchingFileLine(filename, m_options.m_line_num, loc_coll))
-                        {
-                            // If the collection size is 0, it's a full match and we can just remove the breakpoint.
-                            if (loc_coll.GetSize() == 0)
-                            {
-                                bp->GetDescription(&ss, lldb::eDescriptionLevelBrief);
-                                ss.EOL();
-                                target->RemoveBreakpointByID (bp->GetID());
-                                ++num_cleared;
-                            }
-                        }
-                    }
-                }
-                break;
+    // Find matching breakpoints and delete them.
 
-            default:
-                break;
-        }
+    // First create a copy of all the IDs.
+    std::vector<break_id_t> BreakIDs;
+    for (size_t i = 0; i < num_breakpoints; ++i)
+      BreakIDs.push_back(breakpoints.GetBreakpointAtIndex(i)->GetID());
 
-        if (num_cleared > 0)
-        {
-            Stream &output_stream = result.GetOutputStream();
-            output_stream.Printf ("%d breakpoints cleared:\n", num_cleared);
-            output_stream << ss.GetData();
-            output_stream.EOL();
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            result.AppendError ("Breakpoint clear: No breakpoint cleared.");
-            result.SetStatus (eReturnStatusFailed);
+    int num_cleared = 0;
+    StreamString ss;
+    switch (break_type) {
+    case eClearTypeFileAndLine: // Breakpoint by source position
+    {
+      const ConstString filename(m_options.m_filename.c_str());
+      BreakpointLocationCollection loc_coll;
+
+      for (size_t i = 0; i < num_breakpoints; ++i) {
+        Breakpoint *bp = breakpoints.FindBreakpointByID(BreakIDs[i]).get();
+
+        if (bp->GetMatchingFileLine(filename, m_options.m_line_num, loc_coll)) {
+          // If the collection size is 0, it's a full match and we can just
+          // remove the breakpoint.
+          if (loc_coll.GetSize() == 0) {
+            bp->GetDescription(&ss, lldb::eDescriptionLevelBrief);
+            ss.EOL();
+            target->RemoveBreakpointByID(bp->GetID());
+            ++num_cleared;
+          }
         }
+      }
+    } break;
 
-        return result.Succeeded();
+    default:
+      break;
     }
 
+    if (num_cleared > 0) {
+      Stream &output_stream = result.GetOutputStream();
+      output_stream.Printf("%d breakpoints cleared:\n", num_cleared);
+      output_stream << ss.GetData();
+      output_stream.EOL();
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      result.AppendError("Breakpoint clear: No breakpoint cleared.");
+      result.SetStatus(eReturnStatusFailed);
+    }
+
+    return result.Succeeded();
+  }
+
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 #pragma mark Clear::CommandOptions
 
 OptionDefinition
-CommandObjectBreakpointClear::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectBreakpointClear::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "file", 'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename, "Specify the breakpoint by source location in this particular file."},
   {LLDB_OPT_SET_1, true,  "line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                         eArgTypeLineNum,  "Specify the breakpoint by source location at this particular line."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -1765,184 +1599,158 @@ CommandObjectBreakpointClear::CommandOpt
 //-------------------------------------------------------------------------
 #pragma mark Delete
 
-class CommandObjectBreakpointDelete : public CommandObjectParsed
-{
+class CommandObjectBreakpointDelete : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointDelete (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "breakpoint delete",
-                            "Delete the specified breakpoint(s).  If no breakpoints are specified, delete them all.",
+  CommandObjectBreakpointDelete(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "breakpoint delete",
+                            "Delete the specified breakpoint(s).  If no "
+                            "breakpoints are specified, delete them all.",
                             nullptr),
-        m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID, eArgTypeBreakpointIDRange);
-        // Add the entry for the first argument for this command to the object's arguments vector.
-        m_arguments.push_back (arg);   
-    }
-
-    ~CommandObjectBreakpointDelete() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandObject::AddIDsArgumentData(arg, eArgTypeBreakpointID,
+                                      eArgTypeBreakpointIDRange);
+    // Add the entry for the first argument for this command to the object's
+    // arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions () :
-            Options (),
-            m_use_dummy (false),
-            m_force (false)
-        {
-        }
+  ~CommandObjectBreakpointDelete() override = default;
 
-        ~CommandOptions() override = default;
+  Options *GetOptions() override { return &m_options; }
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-                case 'f':
-                    m_force = true;
-                    break;
-
-                case 'D':
-                    m_use_dummy = true;
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), m_use_dummy(false), m_force(false) {}
 
-            return error;
-        }
+    ~CommandOptions() override = default;
 
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_use_dummy = false;
-            m_force = false;
-        }
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
+      switch (short_option) {
+      case 'f':
+        m_force = true;
+        break;
 
-        // Options table: Required for subclasses of Options.
+      case 'D':
+        m_use_dummy = true;
+        break;
 
-        static OptionDefinition g_option_table[];
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
 
-        // Instance variables to hold the values for command options.
-        bool m_use_dummy;
-        bool m_force;
-    };
+      return error;
+    }
 
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_use_dummy = false;
+      m_force = false;
+    }
 
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target. No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
+    // Options table: Required for subclasses of Options.
 
-        const BreakpointList &breakpoints = target->GetBreakpointList();
+    static OptionDefinition g_option_table[];
 
-        size_t num_breakpoints = breakpoints.GetSize();
+    // Instance variables to hold the values for command options.
+    bool m_use_dummy;
+    bool m_force;
+  };
 
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("No breakpoints exist to be deleted.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        if (command.GetArgumentCount() == 0)
-        {
-            if (!m_options.m_force && !m_interpreter.Confirm ("About to delete all breakpoints, do you want to do that?", true))
-            {
-                result.AppendMessage("Operation cancelled...");
-            }
-            else
-            {
-                target->RemoveAllBreakpoints ();
-                result.AppendMessageWithFormat ("All breakpoints removed. (%" PRIu64 " breakpoint%s)\n", (uint64_t)num_breakpoints, num_breakpoints > 1 ? "s" : "");
-            }
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            // Particular breakpoint selected; disable that breakpoint.
-            BreakpointIDList valid_bp_ids;
-            CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
-
-            if (result.Succeeded())
-            {
-                int delete_count = 0;
-                int disable_count = 0;
-                const size_t count = valid_bp_ids.GetSize();
-                for (size_t i = 0; i < count; ++i)
-                {
-                    BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-
-                    if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                    {
-                        if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
-                        {
-                            Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                            BreakpointLocation *location = breakpoint->FindLocationByID (cur_bp_id.GetLocationID()).get();
-                            // It makes no sense to try to delete individual locations, so we disable them instead.
-                            if (location)
-                            {
-                                location->SetEnabled (false);
-                                ++disable_count;
-                            }
-                        }
-                        else
-                        {
-                            target->RemoveBreakpointByID (cur_bp_id.GetBreakpointID());
-                            ++delete_count;
-                        }
-                    }
-                }
-                result.AppendMessageWithFormat ("%d breakpoints deleted; %d breakpoint locations disabled.\n",
-                                               delete_count, disable_count);
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-        }
-        return result.Succeeded();
+    if (target == nullptr) {
+      result.AppendError("Invalid target. No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendError("No breakpoints exist to be deleted.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      if (!m_options.m_force &&
+          !m_interpreter.Confirm(
+              "About to delete all breakpoints, do you want to do that?",
+              true)) {
+        result.AppendMessage("Operation cancelled...");
+      } else {
+        target->RemoveAllBreakpoints();
+        result.AppendMessageWithFormat(
+            "All breakpoints removed. (%" PRIu64 " breakpoint%s)\n",
+            (uint64_t)num_breakpoints, num_breakpoints > 1 ? "s" : "");
+      }
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      // Particular breakpoint selected; disable that breakpoint.
+      BreakpointIDList valid_bp_ids;
+      CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+          command, target, result, &valid_bp_ids);
+
+      if (result.Succeeded()) {
+        int delete_count = 0;
+        int disable_count = 0;
+        const size_t count = valid_bp_ids.GetSize();
+        for (size_t i = 0; i < count; ++i) {
+          BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+
+          if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+            if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
+              Breakpoint *breakpoint =
+                  target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+              BreakpointLocation *location =
+                  breakpoint->FindLocationByID(cur_bp_id.GetLocationID()).get();
+              // It makes no sense to try to delete individual locations, so we
+              // disable them instead.
+              if (location) {
+                location->SetEnabled(false);
+                ++disable_count;
+              }
+            } else {
+              target->RemoveBreakpointByID(cur_bp_id.GetBreakpointID());
+              ++delete_count;
+            }
+          }
+        }
+        result.AppendMessageWithFormat(
+            "%d breakpoints deleted; %d breakpoint locations disabled.\n",
+            delete_count, disable_count);
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      }
     }
+    return result.Succeeded();
+  }
 
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectBreakpointDelete::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectBreakpointDelete::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "force",             'f', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete all breakpoints without querying for confirmation."},
   {LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -1950,374 +1758,327 @@ CommandObjectBreakpointDelete::CommandOp
 //-------------------------------------------------------------------------
 
 static OptionDefinition g_breakpoint_name_options[] = {
-  // clang-format off
+    // clang-format off
   {LLDB_OPT_SET_1,   false, "name",              'N', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointName, "Specifies a breakpoint name to use."},
   {LLDB_OPT_SET_2,   false, "breakpoint-id",     'B', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBreakpointID,   "Specify a breakpoint ID to use."},
   {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,           "Operate on Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
-  // clang-format on
+    // clang-format on
 };
-class BreakpointNameOptionGroup : public OptionGroup
-{
+class BreakpointNameOptionGroup : public OptionGroup {
 public:
-    BreakpointNameOptionGroup() :
-        OptionGroup(),
-        m_breakpoint(LLDB_INVALID_BREAK_ID),
-        m_use_dummy (false)
-    {
-    }
-
-    ~BreakpointNameOptionGroup() override = default;
-
-    uint32_t
-    GetNumDefinitions () override
-    {
-      return sizeof (g_breakpoint_name_options) / sizeof (OptionDefinition);
-    }
-
-    const OptionDefinition*
-    GetDefinitions () override
-    {
-        return g_breakpoint_name_options;
-    }
-
-    Error
-    SetOptionValue (uint32_t option_idx,
-                    const char *option_value,
-                    ExecutionContext *execution_context) override
-    {
-        Error error;
-        const int short_option = g_breakpoint_name_options[option_idx].short_option;
-      
-        switch (short_option)
-        {
-        case 'N':
-            if (BreakpointID::StringIsBreakpointName(option_value, error) && error.Success())
-                m_name.SetValueFromString(option_value);
-            break;
-          
-        case 'B':
-            if (m_breakpoint.SetValueFromString(option_value).Fail())
-                error.SetErrorStringWithFormat ("unrecognized value \"%s\" for breakpoint", option_value);
-            break;
-        case 'D':
-            if (m_use_dummy.SetValueFromString(option_value).Fail())
-                error.SetErrorStringWithFormat ("unrecognized value \"%s\" for use-dummy", option_value);
-            break;
-
-        default:
-              error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-              break;
-        }
-        return error;
-    }
-
-    void
-    OptionParsingStarting (ExecutionContext *execution_context) override
-    {
-        m_name.Clear();
-        m_breakpoint.Clear();
-        m_use_dummy.Clear();
-        m_use_dummy.SetDefaultValue(false);
-    }
-
-    OptionValueString m_name;
-    OptionValueUInt64 m_breakpoint;
-    OptionValueBoolean m_use_dummy;
+  BreakpointNameOptionGroup()
+      : OptionGroup(), m_breakpoint(LLDB_INVALID_BREAK_ID), m_use_dummy(false) {
+  }
+
+  ~BreakpointNameOptionGroup() override = default;
+
+  uint32_t GetNumDefinitions() override {
+    return sizeof(g_breakpoint_name_options) / sizeof(OptionDefinition);
+  }
+
+  const OptionDefinition *GetDefinitions() override {
+    return g_breakpoint_name_options;
+  }
+
+  Error SetOptionValue(uint32_t option_idx, const char *option_value,
+                       ExecutionContext *execution_context) override {
+    Error error;
+    const int short_option = g_breakpoint_name_options[option_idx].short_option;
+
+    switch (short_option) {
+    case 'N':
+      if (BreakpointID::StringIsBreakpointName(option_value, error) &&
+          error.Success())
+        m_name.SetValueFromString(option_value);
+      break;
+
+    case 'B':
+      if (m_breakpoint.SetValueFromString(option_value).Fail())
+        error.SetErrorStringWithFormat(
+            "unrecognized value \"%s\" for breakpoint", option_value);
+      break;
+    case 'D':
+      if (m_use_dummy.SetValueFromString(option_value).Fail())
+        error.SetErrorStringWithFormat(
+            "unrecognized value \"%s\" for use-dummy", option_value);
+      break;
+
+    default:
+      error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                     short_option);
+      break;
+    }
+    return error;
+  }
+
+  void OptionParsingStarting(ExecutionContext *execution_context) override {
+    m_name.Clear();
+    m_breakpoint.Clear();
+    m_use_dummy.Clear();
+    m_use_dummy.SetDefaultValue(false);
+  }
+
+  OptionValueString m_name;
+  OptionValueUInt64 m_breakpoint;
+  OptionValueBoolean m_use_dummy;
 };
 
-class CommandObjectBreakpointNameAdd : public CommandObjectParsed
-{
+class CommandObjectBreakpointNameAdd : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointNameAdd (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "add",
-                             "Add a name to the breakpoints provided.",
-                             "breakpoint name add <command-options> <breakpoint-id-list>"),
-        m_name_options(),
-        m_option_group()
-        {
-            // Create the first variant for the first (and only) argument for this command.
-            CommandArgumentEntry arg1;
-            CommandArgumentData id_arg;
-            id_arg.arg_type = eArgTypeBreakpointID;
-            id_arg.arg_repetition = eArgRepeatOptional;
-            arg1.push_back(id_arg);
-            m_arguments.push_back (arg1);
+  CommandObjectBreakpointNameAdd(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "add", "Add a name to the breakpoints provided.",
+            "breakpoint name add <command-options> <breakpoint-id-list>"),
+        m_name_options(), m_option_group() {
+    // Create the first variant for the first (and only) argument for this
+    // command.
+    CommandArgumentEntry arg1;
+    CommandArgumentData id_arg;
+    id_arg.arg_type = eArgTypeBreakpointID;
+    id_arg.arg_repetition = eArgRepeatOptional;
+    arg1.push_back(id_arg);
+    m_arguments.push_back(arg1);
+
+    m_option_group.Append(&m_name_options, LLDB_OPT_SET_1, LLDB_OPT_SET_ALL);
+    m_option_group.Finalize();
+  }
 
-            m_option_group.Append (&m_name_options, LLDB_OPT_SET_1, LLDB_OPT_SET_ALL);
-            m_option_group.Finalize();
-        }
+  ~CommandObjectBreakpointNameAdd() override = default;
 
-    ~CommandObjectBreakpointNameAdd() override = default;
-
-    Options *
-    GetOptions() override
-    {
-        return &m_option_group;
-    }
+  Options *GetOptions() override { return &m_option_group; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        if (!m_name_options.m_name.OptionWasSet())
-        {
-            result.SetError("No name option provided.");
-            return false;
-        }
-
-        Target *target = GetSelectedOrDummyTarget(m_name_options.m_use_dummy.GetCurrentValue());
-
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target. No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
-
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-
-        size_t num_breakpoints = breakpoints.GetSize();
-        if (num_breakpoints == 0)
-        {
-            result.SetError("No breakpoints, cannot add names.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        // Particular breakpoint selected; disable that breakpoint.
-        BreakpointIDList valid_bp_ids;
-        CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (command, target, result, &valid_bp_ids);
-
-        if (result.Succeeded())
-        {
-            if (valid_bp_ids.GetSize() == 0)
-            {
-                result.SetError("No breakpoints specified, cannot add names.");
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            size_t num_valid_ids = valid_bp_ids.GetSize();
-            for (size_t index = 0; index < num_valid_ids; index++)
-            {
-                lldb::break_id_t bp_id = valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID();
-                BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id);
-                Error error;  // We don't need to check the error here, since the option parser checked it...
-                bp_sp->AddName(m_name_options.m_name.GetCurrentValue(), error);
-            }
-        }
-
-        return true;
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (!m_name_options.m_name.OptionWasSet()) {
+      result.SetError("No name option provided.");
+      return false;
+    }
+
+    Target *target =
+        GetSelectedOrDummyTarget(m_name_options.m_use_dummy.GetCurrentValue());
+
+    if (target == nullptr) {
+      result.AppendError("Invalid target. No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+
+    size_t num_breakpoints = breakpoints.GetSize();
+    if (num_breakpoints == 0) {
+      result.SetError("No breakpoints, cannot add names.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Particular breakpoint selected; disable that breakpoint.
+    BreakpointIDList valid_bp_ids;
+    CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
+        command, target, result, &valid_bp_ids);
+
+    if (result.Succeeded()) {
+      if (valid_bp_ids.GetSize() == 0) {
+        result.SetError("No breakpoints specified, cannot add names.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      size_t num_valid_ids = valid_bp_ids.GetSize();
+      for (size_t index = 0; index < num_valid_ids; index++) {
+        lldb::break_id_t bp_id =
+            valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID();
+        BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id);
+        Error error; // We don't need to check the error here, since the option
+                     // parser checked it...
+        bp_sp->AddName(m_name_options.m_name.GetCurrentValue(), error);
+      }
     }
 
+    return true;
+  }
+
 private:
-    BreakpointNameOptionGroup m_name_options;
-    OptionGroupOptions m_option_group;
+  BreakpointNameOptionGroup m_name_options;
+  OptionGroupOptions m_option_group;
 };
 
-class CommandObjectBreakpointNameDelete : public CommandObjectParsed
-{
+class CommandObjectBreakpointNameDelete : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointNameDelete (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "delete",
-                             "Delete a name from the breakpoints provided.",
-                             "breakpoint name delete <command-options> <breakpoint-id-list>"),
-        m_name_options(),
-        m_option_group()
-    {
-        // Create the first variant for the first (and only) argument for this command.
-        CommandArgumentEntry arg1;
-        CommandArgumentData id_arg;
-        id_arg.arg_type = eArgTypeBreakpointID;
-        id_arg.arg_repetition = eArgRepeatOptional;
-        arg1.push_back(id_arg);
-        m_arguments.push_back (arg1);
-
-        m_option_group.Append (&m_name_options, LLDB_OPT_SET_1, LLDB_OPT_SET_ALL);
-        m_option_group.Finalize();
-    }
+  CommandObjectBreakpointNameDelete(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "delete",
+            "Delete a name from the breakpoints provided.",
+            "breakpoint name delete <command-options> <breakpoint-id-list>"),
+        m_name_options(), m_option_group() {
+    // Create the first variant for the first (and only) argument for this
+    // command.
+    CommandArgumentEntry arg1;
+    CommandArgumentData id_arg;
+    id_arg.arg_type = eArgTypeBreakpointID;
+    id_arg.arg_repetition = eArgRepeatOptional;
+    arg1.push_back(id_arg);
+    m_arguments.push_back(arg1);
+
+    m_option_group.Append(&m_name_options, LLDB_OPT_SET_1, LLDB_OPT_SET_ALL);
+    m_option_group.Finalize();
+  }
 
-    ~CommandObjectBreakpointNameDelete() override = default;
+  ~CommandObjectBreakpointNameDelete() override = default;
 
-    Options *
-    GetOptions() override
-    {
-        return &m_option_group;
-    }
+  Options *GetOptions() override { return &m_option_group; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        if (!m_name_options.m_name.OptionWasSet())
-        {
-            result.SetError("No name option provided.");
-            return false;
-        }
-
-        Target *target = GetSelectedOrDummyTarget(m_name_options.m_use_dummy.GetCurrentValue());
-
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target. No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        std::unique_lock<std::recursive_mutex> lock;
-        target->GetBreakpointList().GetListMutex(lock);
-
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-
-        size_t num_breakpoints = breakpoints.GetSize();
-        if (num_breakpoints == 0)
-        {
-            result.SetError("No breakpoints, cannot delete names.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        // Particular breakpoint selected; disable that breakpoint.
-        BreakpointIDList valid_bp_ids;
-        CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (command, target, result, &valid_bp_ids);
-
-        if (result.Succeeded())
-        {
-            if (valid_bp_ids.GetSize() == 0)
-            {
-                result.SetError("No breakpoints specified, cannot delete names.");
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            size_t num_valid_ids = valid_bp_ids.GetSize();
-            for (size_t index = 0; index < num_valid_ids; index++)
-            {
-                lldb::break_id_t bp_id = valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID();
-                BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id);
-                bp_sp->RemoveName(m_name_options.m_name.GetCurrentValue());
-            }
-        }
-
-        return true;
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (!m_name_options.m_name.OptionWasSet()) {
+      result.SetError("No name option provided.");
+      return false;
+    }
+
+    Target *target =
+        GetSelectedOrDummyTarget(m_name_options.m_use_dummy.GetCurrentValue());
+
+    if (target == nullptr) {
+      result.AppendError("Invalid target. No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    std::unique_lock<std::recursive_mutex> lock;
+    target->GetBreakpointList().GetListMutex(lock);
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+
+    size_t num_breakpoints = breakpoints.GetSize();
+    if (num_breakpoints == 0) {
+      result.SetError("No breakpoints, cannot delete names.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Particular breakpoint selected; disable that breakpoint.
+    BreakpointIDList valid_bp_ids;
+    CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs(
+        command, target, result, &valid_bp_ids);
+
+    if (result.Succeeded()) {
+      if (valid_bp_ids.GetSize() == 0) {
+        result.SetError("No breakpoints specified, cannot delete names.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      size_t num_valid_ids = valid_bp_ids.GetSize();
+      for (size_t index = 0; index < num_valid_ids; index++) {
+        lldb::break_id_t bp_id =
+            valid_bp_ids.GetBreakpointIDAtIndex(index).GetBreakpointID();
+        BreakpointSP bp_sp = breakpoints.FindBreakpointByID(bp_id);
+        bp_sp->RemoveName(m_name_options.m_name.GetCurrentValue());
+      }
     }
 
+    return true;
+  }
+
 private:
-    BreakpointNameOptionGroup m_name_options;
-    OptionGroupOptions m_option_group;
+  BreakpointNameOptionGroup m_name_options;
+  OptionGroupOptions m_option_group;
 };
 
-class CommandObjectBreakpointNameList : public CommandObjectParsed
-{
+class CommandObjectBreakpointNameList : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointNameList (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "list",
-                             "List either the names for a breakpoint or the breakpoints for a given name.",
-                             "breakpoint name list <command-options>"),
-        m_name_options(),
-        m_option_group()
-    {
-        m_option_group.Append (&m_name_options);
-        m_option_group.Finalize();
-    }
+  CommandObjectBreakpointNameList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "list",
+                            "List either the names for a breakpoint or the "
+                            "breakpoints for a given name.",
+                            "breakpoint name list <command-options>"),
+        m_name_options(), m_option_group() {
+    m_option_group.Append(&m_name_options);
+    m_option_group.Finalize();
+  }
 
-    ~CommandObjectBreakpointNameList() override = default;
+  ~CommandObjectBreakpointNameList() override = default;
 
-    Options *
-    GetOptions() override
-    {
-        return &m_option_group;
-    }
+  Options *GetOptions() override { return &m_option_group; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_name_options.m_use_dummy.GetCurrentValue());
-
-        if (target == nullptr)
-        {
-            result.AppendError ("Invalid target. No existing target or breakpoints.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (m_name_options.m_name.OptionWasSet())
-        {
-            const char *name = m_name_options.m_name.GetCurrentValue();
-            std::unique_lock<std::recursive_mutex> lock;
-            target->GetBreakpointList().GetListMutex(lock);
-
-            BreakpointList &breakpoints = target->GetBreakpointList();
-            for (BreakpointSP bp_sp : breakpoints.Breakpoints())
-            {
-                if (bp_sp->MatchesName(name))
-                {
-                    StreamString s;
-                    bp_sp->GetDescription(&s, eDescriptionLevelBrief);
-                    s.EOL();
-                    result.AppendMessage(s.GetData());
-                }
-            }
-
-        }
-        else if (m_name_options.m_breakpoint.OptionWasSet())
-        {
-            BreakpointSP bp_sp = target->GetBreakpointList().FindBreakpointByID(m_name_options.m_breakpoint.GetCurrentValue());
-            if (bp_sp)
-            {
-                std::vector<std::string> names;
-                bp_sp->GetNames (names);
-                result.AppendMessage ("Names:");
-                for (auto name : names)
-                    result.AppendMessageWithFormat ("    %s\n", name.c_str());
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("Could not find breakpoint %" PRId64 ".\n",
-                                           m_name_options.m_breakpoint.GetCurrentValue());
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-        }
-        else
-        {
-            result.SetError ("Must specify -N or -B option to list.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        return true;
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target =
+        GetSelectedOrDummyTarget(m_name_options.m_use_dummy.GetCurrentValue());
+
+    if (target == nullptr) {
+      result.AppendError("Invalid target. No existing target or breakpoints.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (m_name_options.m_name.OptionWasSet()) {
+      const char *name = m_name_options.m_name.GetCurrentValue();
+      std::unique_lock<std::recursive_mutex> lock;
+      target->GetBreakpointList().GetListMutex(lock);
+
+      BreakpointList &breakpoints = target->GetBreakpointList();
+      for (BreakpointSP bp_sp : breakpoints.Breakpoints()) {
+        if (bp_sp->MatchesName(name)) {
+          StreamString s;
+          bp_sp->GetDescription(&s, eDescriptionLevelBrief);
+          s.EOL();
+          result.AppendMessage(s.GetData());
+        }
+      }
+
+    } else if (m_name_options.m_breakpoint.OptionWasSet()) {
+      BreakpointSP bp_sp = target->GetBreakpointList().FindBreakpointByID(
+          m_name_options.m_breakpoint.GetCurrentValue());
+      if (bp_sp) {
+        std::vector<std::string> names;
+        bp_sp->GetNames(names);
+        result.AppendMessage("Names:");
+        for (auto name : names)
+          result.AppendMessageWithFormat("    %s\n", name.c_str());
+      } else {
+        result.AppendErrorWithFormat(
+            "Could not find breakpoint %" PRId64 ".\n",
+            m_name_options.m_breakpoint.GetCurrentValue());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else {
+      result.SetError("Must specify -N or -B option to list.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+    return true;
+  }
 
 private:
-    BreakpointNameOptionGroup m_name_options;
-    OptionGroupOptions m_option_group;
+  BreakpointNameOptionGroup m_name_options;
+  OptionGroupOptions m_option_group;
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectMultiwordBreakpoint
 //-------------------------------------------------------------------------
-class CommandObjectBreakpointName : public CommandObjectMultiword
-{
+class CommandObjectBreakpointName : public CommandObjectMultiword {
 public:
-    CommandObjectBreakpointName(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "name", "Commands to manage name tags for breakpoints",
-                                 "breakpoint name <subcommand> [<command-options>]")
-    {
-        CommandObjectSP add_command_object (new CommandObjectBreakpointNameAdd (interpreter));
-        CommandObjectSP delete_command_object (new CommandObjectBreakpointNameDelete (interpreter));
-        CommandObjectSP list_command_object (new CommandObjectBreakpointNameList (interpreter));
-
-        LoadSubCommand ("add", add_command_object);
-        LoadSubCommand ("delete", delete_command_object);
-        LoadSubCommand ("list", list_command_object);
-    }
+  CommandObjectBreakpointName(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "name", "Commands to manage name tags for breakpoints",
+            "breakpoint name <subcommand> [<command-options>]") {
+    CommandObjectSP add_command_object(
+        new CommandObjectBreakpointNameAdd(interpreter));
+    CommandObjectSP delete_command_object(
+        new CommandObjectBreakpointNameDelete(interpreter));
+    CommandObjectSP list_command_object(
+        new CommandObjectBreakpointNameList(interpreter));
+
+    LoadSubCommand("add", add_command_object);
+    LoadSubCommand("delete", delete_command_object);
+    LoadSubCommand("list", list_command_object);
+  }
 
-    ~CommandObjectBreakpointName() override = default;
+  ~CommandObjectBreakpointName() override = default;
 };
 
 //-------------------------------------------------------------------------
@@ -2325,120 +2086,134 @@ public:
 //-------------------------------------------------------------------------
 #pragma mark MultiwordBreakpoint
 
-CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "breakpoint",
-                             "Commands for operating on breakpoints (see 'help b' for shorthand.)",
-                             "breakpoint <subcommand> [<command-options>]")
-{
-    CommandObjectSP list_command_object (new CommandObjectBreakpointList (interpreter));
-    CommandObjectSP enable_command_object (new CommandObjectBreakpointEnable (interpreter));
-    CommandObjectSP disable_command_object (new CommandObjectBreakpointDisable (interpreter));
-    CommandObjectSP clear_command_object (new CommandObjectBreakpointClear (interpreter));
-    CommandObjectSP delete_command_object (new CommandObjectBreakpointDelete (interpreter));
-    CommandObjectSP set_command_object (new CommandObjectBreakpointSet (interpreter));
-    CommandObjectSP command_command_object (new CommandObjectBreakpointCommand (interpreter));
-    CommandObjectSP modify_command_object (new CommandObjectBreakpointModify(interpreter));
-    CommandObjectSP name_command_object (new CommandObjectBreakpointName(interpreter));
-
-    list_command_object->SetCommandName ("breakpoint list");
-    enable_command_object->SetCommandName("breakpoint enable");
-    disable_command_object->SetCommandName("breakpoint disable");
-    clear_command_object->SetCommandName("breakpoint clear");
-    delete_command_object->SetCommandName("breakpoint delete");
-    set_command_object->SetCommandName("breakpoint set");
-    command_command_object->SetCommandName ("breakpoint command");
-    modify_command_object->SetCommandName ("breakpoint modify");
-    name_command_object->SetCommandName ("breakpoint name");
-
-    LoadSubCommand ("list",       list_command_object);
-    LoadSubCommand ("enable",     enable_command_object);
-    LoadSubCommand ("disable",    disable_command_object);
-    LoadSubCommand ("clear",      clear_command_object);
-    LoadSubCommand ("delete",     delete_command_object);
-    LoadSubCommand ("set",        set_command_object);
-    LoadSubCommand ("command",    command_command_object);
-    LoadSubCommand ("modify",     modify_command_object);
-    LoadSubCommand ("name",       name_command_object);
+CommandObjectMultiwordBreakpoint::CommandObjectMultiwordBreakpoint(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(
+          interpreter, "breakpoint",
+          "Commands for operating on breakpoints (see 'help b' for shorthand.)",
+          "breakpoint <subcommand> [<command-options>]") {
+  CommandObjectSP list_command_object(
+      new CommandObjectBreakpointList(interpreter));
+  CommandObjectSP enable_command_object(
+      new CommandObjectBreakpointEnable(interpreter));
+  CommandObjectSP disable_command_object(
+      new CommandObjectBreakpointDisable(interpreter));
+  CommandObjectSP clear_command_object(
+      new CommandObjectBreakpointClear(interpreter));
+  CommandObjectSP delete_command_object(
+      new CommandObjectBreakpointDelete(interpreter));
+  CommandObjectSP set_command_object(
+      new CommandObjectBreakpointSet(interpreter));
+  CommandObjectSP command_command_object(
+      new CommandObjectBreakpointCommand(interpreter));
+  CommandObjectSP modify_command_object(
+      new CommandObjectBreakpointModify(interpreter));
+  CommandObjectSP name_command_object(
+      new CommandObjectBreakpointName(interpreter));
+
+  list_command_object->SetCommandName("breakpoint list");
+  enable_command_object->SetCommandName("breakpoint enable");
+  disable_command_object->SetCommandName("breakpoint disable");
+  clear_command_object->SetCommandName("breakpoint clear");
+  delete_command_object->SetCommandName("breakpoint delete");
+  set_command_object->SetCommandName("breakpoint set");
+  command_command_object->SetCommandName("breakpoint command");
+  modify_command_object->SetCommandName("breakpoint modify");
+  name_command_object->SetCommandName("breakpoint name");
+
+  LoadSubCommand("list", list_command_object);
+  LoadSubCommand("enable", enable_command_object);
+  LoadSubCommand("disable", disable_command_object);
+  LoadSubCommand("clear", clear_command_object);
+  LoadSubCommand("delete", delete_command_object);
+  LoadSubCommand("set", set_command_object);
+  LoadSubCommand("command", command_command_object);
+  LoadSubCommand("modify", modify_command_object);
+  LoadSubCommand("name", name_command_object);
 }
 
 CommandObjectMultiwordBreakpoint::~CommandObjectMultiwordBreakpoint() = default;
 
-void
-CommandObjectMultiwordBreakpoint::VerifyIDs (Args &args,
-                                             Target *target,
-                                             bool allow_locations,
-                                             CommandReturnObject &result,
-                                             BreakpointIDList *valid_ids)
-{
-    // args can be strings representing 1). integers (for breakpoint ids)
-    //                                  2). the full breakpoint & location canonical representation
-    //                                  3). the word "to" or a hyphen, representing a range (in which case there
-    //                                      had *better* be an entry both before & after of one of the first two types.
-    //                                  4). A breakpoint name
-    // If args is empty, we will use the last created breakpoint (if there is one.)
-
-    Args temp_args;
-
-    if (args.GetArgumentCount() == 0)
-    {
-        if (target->GetLastCreatedBreakpoint())
-        {
-            valid_ids->AddBreakpointID (BreakpointID(target->GetLastCreatedBreakpoint()->GetID(), LLDB_INVALID_BREAK_ID));
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        } 
-        else
-        {   
-            result.AppendError("No breakpoint specified and no last created breakpoint.");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return;
-    }
-    
-    // Create a new Args variable to use; copy any non-breakpoint-id-ranges stuff directly from the old ARGS to
-    // the new TEMP_ARGS.  Do not copy breakpoint id range strings over; instead generate a list of strings for
-    // all the breakpoint ids in the range, and shove all of those breakpoint id strings into TEMP_ARGS.
-
-    BreakpointIDList::FindAndReplaceIDRanges (args, target, allow_locations, result, temp_args);
-
-    // NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual BreakpointIDList:
-
-    valid_ids->InsertStringArray (temp_args.GetConstArgumentVector(), temp_args.GetArgumentCount(), result);
-
-    // At this point,  all of the breakpoint ids that the user passed in have been converted to breakpoint IDs
-    // and put into valid_ids.
-
-    if (result.Succeeded())
-    {
-        // Now that we've converted everything from args into a list of breakpoint ids, go through our tentative list
-        // of breakpoint id's and verify that they correspond to valid/currently set breakpoints.
-
-        const size_t count = valid_ids->GetSize();
-        for (size_t i = 0; i < count; ++i)
-        {
-            BreakpointID cur_bp_id = valid_ids->GetBreakpointIDAtIndex (i);
-            Breakpoint *breakpoint = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-            if (breakpoint != nullptr)
-            {
-                const size_t num_locations = breakpoint->GetNumLocations();
-                if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations)
-                {
-                    StreamString id_str;
-                    BreakpointID::GetCanonicalReference (&id_str, 
-                                                         cur_bp_id.GetBreakpointID(),
-                                                         cur_bp_id.GetLocationID());
-                    i = valid_ids->GetSize() + 1;
-                    result.AppendErrorWithFormat ("'%s' is not a currently valid breakpoint/location id.\n",
-                                                 id_str.GetData());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            else
-            {
-                i = valid_ids->GetSize() + 1;
-                result.AppendErrorWithFormat("'%d' is not a currently valid breakpoint ID.\n",
-                                             cur_bp_id.GetBreakpointID());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
+void CommandObjectMultiwordBreakpoint::VerifyIDs(Args &args, Target *target,
+                                                 bool allow_locations,
+                                                 CommandReturnObject &result,
+                                                 BreakpointIDList *valid_ids) {
+  // args can be strings representing 1). integers (for breakpoint ids)
+  //                                  2). the full breakpoint & location
+  //                                  canonical representation
+  //                                  3). the word "to" or a hyphen,
+  //                                  representing a range (in which case there
+  //                                      had *better* be an entry both before &
+  //                                      after of one of the first two types.
+  //                                  4). A breakpoint name
+  // If args is empty, we will use the last created breakpoint (if there is
+  // one.)
+
+  Args temp_args;
+
+  if (args.GetArgumentCount() == 0) {
+    if (target->GetLastCreatedBreakpoint()) {
+      valid_ids->AddBreakpointID(BreakpointID(
+          target->GetLastCreatedBreakpoint()->GetID(), LLDB_INVALID_BREAK_ID));
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      result.AppendError(
+          "No breakpoint specified and no last created breakpoint.");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return;
+  }
+
+  // Create a new Args variable to use; copy any non-breakpoint-id-ranges stuff
+  // directly from the old ARGS to
+  // the new TEMP_ARGS.  Do not copy breakpoint id range strings over; instead
+  // generate a list of strings for
+  // all the breakpoint ids in the range, and shove all of those breakpoint id
+  // strings into TEMP_ARGS.
+
+  BreakpointIDList::FindAndReplaceIDRanges(args, target, allow_locations,
+                                           result, temp_args);
+
+  // NOW, convert the list of breakpoint id strings in TEMP_ARGS into an actual
+  // BreakpointIDList:
+
+  valid_ids->InsertStringArray(temp_args.GetConstArgumentVector(),
+                               temp_args.GetArgumentCount(), result);
+
+  // At this point,  all of the breakpoint ids that the user passed in have been
+  // converted to breakpoint IDs
+  // and put into valid_ids.
+
+  if (result.Succeeded()) {
+    // Now that we've converted everything from args into a list of breakpoint
+    // ids, go through our tentative list
+    // of breakpoint id's and verify that they correspond to valid/currently set
+    // breakpoints.
+
+    const size_t count = valid_ids->GetSize();
+    for (size_t i = 0; i < count; ++i) {
+      BreakpointID cur_bp_id = valid_ids->GetBreakpointIDAtIndex(i);
+      Breakpoint *breakpoint =
+          target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+      if (breakpoint != nullptr) {
+        const size_t num_locations = breakpoint->GetNumLocations();
+        if (static_cast<size_t>(cur_bp_id.GetLocationID()) > num_locations) {
+          StreamString id_str;
+          BreakpointID::GetCanonicalReference(
+              &id_str, cur_bp_id.GetBreakpointID(), cur_bp_id.GetLocationID());
+          i = valid_ids->GetSize() + 1;
+          result.AppendErrorWithFormat(
+              "'%s' is not a currently valid breakpoint/location id.\n",
+              id_str.GetData());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        i = valid_ids->GetSize() + 1;
+        result.AppendErrorWithFormat(
+            "'%d' is not a currently valid breakpoint ID.\n",
+            cur_bp_id.GetBreakpointID());
+        result.SetStatus(eReturnStatusFailed);
+      }
     }
+  }
 }

Modified: lldb/trunk/source/Commands/CommandObjectBreakpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpoint.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpoint.h Tue Sep  6 15:57:50 2016
@@ -19,9 +19,9 @@
 // Other libraries and framework includes
 // Project includes
 #include "lldb/Core/Address.h"
+#include "lldb/Core/STLUtils.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/Options.h"
-#include "lldb/Core/STLUtils.h"
 
 namespace lldb_private {
 
@@ -29,28 +29,28 @@ namespace lldb_private {
 // CommandObjectMultiwordBreakpoint
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword
-{
+class CommandObjectMultiwordBreakpoint : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordBreakpoint (CommandInterpreter &interpreter);
+  CommandObjectMultiwordBreakpoint(CommandInterpreter &interpreter);
 
-    ~CommandObjectMultiwordBreakpoint() override;
+  ~CommandObjectMultiwordBreakpoint() override;
 
-    static void
-    VerifyBreakpointOrLocationIDs (Args &args, Target *target, CommandReturnObject &result, BreakpointIDList *valid_ids)
-    {
-        VerifyIDs (args, target, true, result, valid_ids);
-    }
-
-    static void
-    VerifyBreakpointIDs (Args &args, Target *target, CommandReturnObject &result, BreakpointIDList *valid_ids)
-    {
-        VerifyIDs (args, target, false, result, valid_ids);
-    }
+  static void VerifyBreakpointOrLocationIDs(Args &args, Target *target,
+                                            CommandReturnObject &result,
+                                            BreakpointIDList *valid_ids) {
+    VerifyIDs(args, target, true, result, valid_ids);
+  }
+
+  static void VerifyBreakpointIDs(Args &args, Target *target,
+                                  CommandReturnObject &result,
+                                  BreakpointIDList *valid_ids) {
+    VerifyIDs(args, target, false, result, valid_ids);
+  }
 
 private:
-    static void
-    VerifyIDs (Args &args, Target *target, bool allow_locations, CommandReturnObject &result, BreakpointIDList *valid_ids);
+  static void VerifyIDs(Args &args, Target *target, bool allow_locations,
+                        CommandReturnObject &result,
+                        BreakpointIDList *valid_ids);
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.cpp Tue Sep  6 15:57:50 2016
@@ -13,16 +13,16 @@
 // Project includes
 #include "CommandObjectBreakpointCommand.h"
 #include "CommandObjectBreakpoint.h"
+#include "lldb/Breakpoint/Breakpoint.h"
+#include "lldb/Breakpoint/BreakpointIDList.h"
+#include "lldb/Breakpoint/BreakpointLocation.h"
+#include "lldb/Breakpoint/StoppointCallbackContext.h"
 #include "lldb/Core/IOHandler.h"
+#include "lldb/Core/State.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Target/Target.h"
 #include "lldb/Target/Thread.h"
-#include "lldb/Breakpoint/BreakpointIDList.h"
-#include "lldb/Breakpoint/Breakpoint.h"
-#include "lldb/Breakpoint/BreakpointLocation.h"
-#include "lldb/Breakpoint/StoppointCallbackContext.h"
-#include "lldb/Core/State.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -31,44 +31,52 @@ using namespace lldb_private;
 // CommandObjectBreakpointCommandAdd
 //-------------------------------------------------------------------------
 
-class CommandObjectBreakpointCommandAdd :
-    public CommandObjectParsed,
-    public IOHandlerDelegateMultiline
-{
+class CommandObjectBreakpointCommandAdd : public CommandObjectParsed,
+                                          public IOHandlerDelegateMultiline {
 public:
-    CommandObjectBreakpointCommandAdd(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "add",
-                              "Add LLDB commands to a breakpoint, to be executed whenever the breakpoint is hit."
-                              "  If no breakpoint is specified, adds the commands to the last created breakpoint.",
-                              nullptr),
-          IOHandlerDelegateMultiline("DONE", IOHandlerDelegate::Completion::LLDBCommand),
-          m_options()
-    {
-        SetHelpLong (
-R"(
+  CommandObjectBreakpointCommandAdd(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "add",
+                            "Add LLDB commands to a breakpoint, to be executed "
+                            "whenever the breakpoint is hit."
+                            "  If no breakpoint is specified, adds the "
+                            "commands to the last created breakpoint.",
+                            nullptr),
+        IOHandlerDelegateMultiline("DONE",
+                                   IOHandlerDelegate::Completion::LLDBCommand),
+        m_options() {
+    SetHelpLong(
+        R"(
 General information about entering breakpoint commands
 ------------------------------------------------------
 
-)" "This command will prompt for commands to be executed when the specified \
+)"
+        "This command will prompt for commands to be executed when the specified \
 breakpoint is hit.  Each command is typed on its own line following the '> ' \
-prompt until 'DONE' is entered." R"(
+prompt until 'DONE' is entered."
+        R"(
 
-)" "Syntactic errors may not be detected when initially entered, and many \
+)"
+        "Syntactic errors may not be detected when initially entered, and many \
 malformed commands can silently fail when executed.  If your breakpoint commands \
-do not appear to be executing, double-check the command syntax." R"(
+do not appear to be executing, double-check the command syntax."
+        R"(
 
-)" "Note: You may enter any debugger command exactly as you would at the debugger \
+)"
+        "Note: You may enter any debugger command exactly as you would at the debugger \
 prompt.  There is no limit to the number of commands supplied, but do NOT enter \
-more than one command per line." R"(
+more than one command per line."
+        R"(
 
 Special information about PYTHON breakpoint commands
 ----------------------------------------------------
 
-)" "You may enter either one or more lines of Python, including function \
+)"
+        "You may enter either one or more lines of Python, including function \
 definitions or calls to functions that will have been imported by the time \
 the code executes.  Single line breakpoint commands will be interpreted 'as is' \
 when the breakpoint is hit.  Multiple lines of Python will be wrapped in a \
-generated function, and a call to the function will be attached to the breakpoint." R"(
+generated function, and a call to the function will be attached to the breakpoint."
+        R"(
 
 This auto-generated function is passed in three arguments:
 
@@ -78,8 +86,10 @@ This auto-generated function is passed i
 
     dict:   the python session dictionary hit.
 
-)" "When specifying a python function with the --python-function option, you need \
-to supply the function name prepended by the module name:" R"(
+)"
+        "When specifying a python function with the --python-function option, you need \
+to supply the function name prepended by the module name:"
+        R"(
 
     --python-function myutils.breakpoint_callback
 
@@ -88,16 +98,20 @@ The function itself must have the follow
 def breakpoint_callback(frame, bp_loc, dict):
   # Your code goes here
 
-)" "The arguments are the same as the arguments passed to generated functions as \
+)"
+        "The arguments are the same as the arguments passed to generated functions as \
 described above.  Note that the global variable 'lldb.frame' will NOT be updated when \
 this function is called, so be sure to use the 'frame' argument. The 'frame' argument \
 can get you to the thread via frame.GetThread(), the thread can get you to the \
 process via thread.GetProcess(), and the process can get you back to the target \
-via process.GetTarget()." R"(
+via process.GetTarget()."
+        R"(
 
-)" "Important Note: As Python code gets collected into functions, access to global \
+)"
+        "Important Note: As Python code gets collected into functions, access to global \
 variables requires explicit scoping using the 'global' keyword.  Be sure to use correct \
-Python syntax, including indentation, when entering Python breakpoint commands." R"(
+Python syntax, including indentation, when entering Python breakpoint commands."
+        R"(
 
 Example Python one-line breakpoint command:
 
@@ -142,729 +156,658 @@ Enter your Python command(s). Type 'DONE
 > breakpoint_output (1)
 > DONE
 
-)" "In this case, since there is a reference to a global variable, \
+)"
+        "In this case, since there is a reference to a global variable, \
 'bp_count', you will also need to make sure 'bp_count' exists and is \
-initialized:" R"(
+initialized:"
+        R"(
 
 (lldb) script
 >>> bp_count = 0
 >>> quit()
 
-)" "Your Python code, however organized, can optionally return a value.  \
+)"
+        "Your Python code, however organized, can optionally return a value.  \
 If the returned value is False, that tells LLDB not to stop at the breakpoint \
 to which the code is associated. Returning anything other than False, or even \
 returning None, or even omitting a return statement entirely, will cause \
-LLDB to stop." R"(
-
-)" "Final Note: A warning that no breakpoint command was generated when there \
-are no syntax errors may indicate that a function was declared but never called."
-        );
-
-        CommandArgumentEntry arg;
-        CommandArgumentData bp_id_arg;
-
-        // Define the first (and only) variant of this arg.
-        bp_id_arg.arg_type = eArgTypeBreakpointID;
-        bp_id_arg.arg_repetition = eArgRepeatOptional;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (bp_id_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectBreakpointCommandAdd() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-
-    void
-    IOHandlerActivated (IOHandler &io_handler) override
-    {
-        StreamFileSP output_sp(io_handler.GetOutputStreamFile());
-        if (output_sp)
-        {
-            output_sp->PutCString(g_reader_instructions);
-            output_sp->Flush();
-        }
-    }
-
-    void
-    IOHandlerInputComplete (IOHandler &io_handler, std::string &line) override
-    {
-        io_handler.SetIsDone(true);
-        
-        std::vector<BreakpointOptions *> *bp_options_vec = (std::vector<BreakpointOptions *> *)io_handler.GetUserData();
-        for (BreakpointOptions *bp_options : *bp_options_vec)
-        {
-            if (!bp_options)
-                continue;
-                    
-            std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
-            if (data_ap)
-            {
-                data_ap->user_source.SplitIntoLines (line.c_str(), line.size());
-                BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
-                bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
-            }
-        }
-    }
-    
-    void
-    CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
-                                             CommandReturnObject &result)
-    {
-        m_interpreter.GetLLDBCommandsFromIOHandler ("> ",           // Prompt
-                                                    *this,          // IOHandlerDelegate
-                                                    true,           // Run IOHandler in async mode
-                                                    &bp_options_vec);    // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions
-    }
-    
-    /// Set a one-liner as the callback for the breakpoint.
-    void 
-    SetBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
-                                  const char *oneliner)
-    {
-        for (auto bp_options : bp_options_vec)
-        {
-            std::unique_ptr<BreakpointOptions::CommandData> data_ap(new BreakpointOptions::CommandData());
-
-            // It's necessary to set both user_source and script_source to the oneliner.
-            // The former is used to generate callback description (as in breakpoint command list)
-            // while the latter is used for Python to interpret during the actual callback.
-            data_ap->user_source.AppendString (oneliner);
-            data_ap->script_source.assign (oneliner);
-            data_ap->stop_on_error = m_options.m_stop_on_error;
-
-            BatonSP baton_sp (new BreakpointOptions::CommandBaton (data_ap.release()));
-            bp_options->SetCallback (BreakpointOptionsCallbackFunction, baton_sp);
-        }
-    }
-    
-    static bool
-    BreakpointOptionsCallbackFunction (void *baton,
-                                       StoppointCallbackContext *context, 
-                                       lldb::user_id_t break_id,
-                                       lldb::user_id_t break_loc_id)
-    {
-        bool ret_value = true;
-        if (baton == nullptr)
-            return true;
-
-        BreakpointOptions::CommandData *data = (BreakpointOptions::CommandData *) baton;
-        StringList &commands = data->user_source;
-        
-        if (commands.GetSize() > 0)
-        {
-            ExecutionContext exe_ctx (context->exe_ctx_ref);
-            Target *target = exe_ctx.GetTargetPtr();
-            if (target)
-            {
-                CommandReturnObject result;
-                Debugger &debugger = target->GetDebugger();
-                // Rig up the results secondary output stream to the debugger's, so the output will come out synchronously
-                // if the debugger is set up that way.
-                    
-                StreamSP output_stream (debugger.GetAsyncOutputStream());
-                StreamSP error_stream (debugger.GetAsyncErrorStream());
-                result.SetImmediateOutputStream (output_stream);
-                result.SetImmediateErrorStream (error_stream);
-        
-                CommandInterpreterRunOptions options;
-                options.SetStopOnContinue(true);
-                options.SetStopOnError (data->stop_on_error);
-                options.SetEchoCommands (true);
-                options.SetPrintResults (true);
-                options.SetAddToHistory (false);
-
-                debugger.GetCommandInterpreter().HandleCommands (commands,
-                                                                 &exe_ctx,
-                                                                 options,
-                                                                 result);
-                result.GetImmediateOutputStream()->Flush();
-                result.GetImmediateErrorStream()->Flush();
-           }
-        }
-        return ret_value;
-    }    
-
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions () :
-            Options (),
-            m_use_commands (false),
-            m_use_script_language (false),
-            m_script_language (eScriptLanguageNone),
-            m_use_one_liner (false),
-            m_one_liner(),
-            m_function_name()
-        {
-        }
-
-        ~CommandOptions() override = default;
-
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-            case 'o':
-                m_use_one_liner = true;
-                m_one_liner = option_arg;
-                break;
-
-            case 's':
-                m_script_language = (lldb::ScriptLanguage) Args::StringToOptionEnum (option_arg, 
-                                                                                     g_option_table[option_idx].enum_values, 
-                                                                                     eScriptLanguageNone,
-                                                                                     error);
-
-                if (m_script_language == eScriptLanguagePython || m_script_language == eScriptLanguageDefault)
-                {
-                    m_use_script_language = true;
-                }
-                else
-                {
-                    m_use_script_language = false;
-                }          
-                break;
-
-            case 'e':
-                {
-                    bool success = false;
-                    m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid value for stop-on-error: \"%s\"", option_arg);
-                }
-                break;
-                    
-            case 'F':
-                m_use_one_liner = false;
-                m_use_script_language = true;
-                m_function_name.assign(option_arg);
-                break;
-
-            case 'D':
-                m_use_dummy = true;
-                break;
-
-            default:
-                break;
-            }
-            return error;
-        }
-
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_use_commands = true;
-            m_use_script_language = false;
-            m_script_language = eScriptLanguageNone;
-
-            m_use_one_liner = false;
-            m_stop_on_error = true;
-            m_one_liner.clear();
-            m_function_name.clear();
-            m_use_dummy = false;
-        }
-
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
+LLDB to stop."
+        R"(
 
-        // Instance variables to hold the values for command options.
-
-        bool m_use_commands;
-        bool m_use_script_language;
-        lldb::ScriptLanguage m_script_language;
-
-        // Instance variables to hold the values for one_liner options.
-        bool m_use_one_liner;
-        std::string m_one_liner;
-        bool m_stop_on_error;
-        std::string m_function_name;
-        bool m_use_dummy;
-    };
+)"
+        "Final Note: A warning that no breakpoint command was generated when there \
+are no syntax errors may indicate that a function was declared but never called.");
+
+    CommandArgumentEntry arg;
+    CommandArgumentData bp_id_arg;
+
+    // Define the first (and only) variant of this arg.
+    bp_id_arg.arg_type = eArgTypeBreakpointID;
+    bp_id_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(bp_id_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectBreakpointCommandAdd() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  void IOHandlerActivated(IOHandler &io_handler) override {
+    StreamFileSP output_sp(io_handler.GetOutputStreamFile());
+    if (output_sp) {
+      output_sp->PutCString(g_reader_instructions);
+      output_sp->Flush();
+    }
+  }
+
+  void IOHandlerInputComplete(IOHandler &io_handler,
+                              std::string &line) override {
+    io_handler.SetIsDone(true);
+
+    std::vector<BreakpointOptions *> *bp_options_vec =
+        (std::vector<BreakpointOptions *> *)io_handler.GetUserData();
+    for (BreakpointOptions *bp_options : *bp_options_vec) {
+      if (!bp_options)
+        continue;
+
+      std::unique_ptr<BreakpointOptions::CommandData> data_ap(
+          new BreakpointOptions::CommandData());
+      if (data_ap) {
+        data_ap->user_source.SplitIntoLines(line.c_str(), line.size());
+        BatonSP baton_sp(
+            new BreakpointOptions::CommandBaton(data_ap.release()));
+        bp_options->SetCallback(BreakpointOptionsCallbackFunction, baton_sp);
+      }
+    }
+  }
+
+  void CollectDataForBreakpointCommandCallback(
+      std::vector<BreakpointOptions *> &bp_options_vec,
+      CommandReturnObject &result) {
+    m_interpreter.GetLLDBCommandsFromIOHandler(
+        "> ",             // Prompt
+        *this,            // IOHandlerDelegate
+        true,             // Run IOHandler in async mode
+        &bp_options_vec); // Baton for the "io_handler" that will be passed back
+                          // into our IOHandlerDelegate functions
+  }
+
+  /// Set a one-liner as the callback for the breakpoint.
+  void
+  SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec,
+                               const char *oneliner) {
+    for (auto bp_options : bp_options_vec) {
+      std::unique_ptr<BreakpointOptions::CommandData> data_ap(
+          new BreakpointOptions::CommandData());
+
+      // It's necessary to set both user_source and script_source to the
+      // oneliner.
+      // The former is used to generate callback description (as in breakpoint
+      // command list)
+      // while the latter is used for Python to interpret during the actual
+      // callback.
+      data_ap->user_source.AppendString(oneliner);
+      data_ap->script_source.assign(oneliner);
+      data_ap->stop_on_error = m_options.m_stop_on_error;
+
+      BatonSP baton_sp(new BreakpointOptions::CommandBaton(data_ap.release()));
+      bp_options->SetCallback(BreakpointOptionsCallbackFunction, baton_sp);
+    }
+  }
+
+  static bool BreakpointOptionsCallbackFunction(
+      void *baton, StoppointCallbackContext *context, lldb::user_id_t break_id,
+      lldb::user_id_t break_loc_id) {
+    bool ret_value = true;
+    if (baton == nullptr)
+      return true;
+
+    BreakpointOptions::CommandData *data =
+        (BreakpointOptions::CommandData *)baton;
+    StringList &commands = data->user_source;
+
+    if (commands.GetSize() > 0) {
+      ExecutionContext exe_ctx(context->exe_ctx_ref);
+      Target *target = exe_ctx.GetTargetPtr();
+      if (target) {
+        CommandReturnObject result;
+        Debugger &debugger = target->GetDebugger();
+        // Rig up the results secondary output stream to the debugger's, so the
+        // output will come out synchronously
+        // if the debugger is set up that way.
+
+        StreamSP output_stream(debugger.GetAsyncOutputStream());
+        StreamSP error_stream(debugger.GetAsyncErrorStream());
+        result.SetImmediateOutputStream(output_stream);
+        result.SetImmediateErrorStream(error_stream);
+
+        CommandInterpreterRunOptions options;
+        options.SetStopOnContinue(true);
+        options.SetStopOnError(data->stop_on_error);
+        options.SetEchoCommands(true);
+        options.SetPrintResults(true);
+        options.SetAddToHistory(false);
+
+        debugger.GetCommandInterpreter().HandleCommands(commands, &exe_ctx,
+                                                        options, result);
+        result.GetImmediateOutputStream()->Flush();
+        result.GetImmediateErrorStream()->Flush();
+      }
+    }
+    return ret_value;
+  }
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_use_commands(false), m_use_script_language(false),
+          m_script_language(eScriptLanguageNone), m_use_one_liner(false),
+          m_one_liner(), m_function_name() {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'o':
+        m_use_one_liner = true;
+        m_one_liner = option_arg;
+        break;
+
+      case 's':
+        m_script_language = (lldb::ScriptLanguage)Args::StringToOptionEnum(
+            option_arg, g_option_table[option_idx].enum_values,
+            eScriptLanguageNone, error);
+
+        if (m_script_language == eScriptLanguagePython ||
+            m_script_language == eScriptLanguageDefault) {
+          m_use_script_language = true;
+        } else {
+          m_use_script_language = false;
+        }
+        break;
+
+      case 'e': {
+        bool success = false;
+        m_stop_on_error = Args::StringToBoolean(option_arg, false, &success);
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "invalid value for stop-on-error: \"%s\"", option_arg);
+      } break;
+
+      case 'F':
+        m_use_one_liner = false;
+        m_use_script_language = true;
+        m_function_name.assign(option_arg);
+        break;
+
+      case 'D':
+        m_use_dummy = true;
+        break;
+
+      default:
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_use_commands = true;
+      m_use_script_language = false;
+      m_script_language = eScriptLanguageNone;
+
+      m_use_one_liner = false;
+      m_stop_on_error = true;
+      m_one_liner.clear();
+      m_function_name.clear();
+      m_use_dummy = false;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    bool m_use_commands;
+    bool m_use_script_language;
+    lldb::ScriptLanguage m_script_language;
+
+    // Instance variables to hold the values for one_liner options.
+    bool m_use_one_liner;
+    std::string m_one_liner;
+    bool m_stop_on_error;
+    std::string m_function_name;
+    bool m_use_dummy;
+  };
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
-
-        if (target == nullptr)
-        {
-            result.AppendError ("There is not a current executable; there are no breakpoints to which to add commands");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-        size_t num_breakpoints = breakpoints.GetSize();
-
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("No breakpoints exist to have commands added");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (!m_options.m_use_script_language && !m_options.m_function_name.empty())
-        {
-            result.AppendError ("need to enable scripting to have a function run as a breakpoint command");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        BreakpointIDList valid_bp_ids;
-        CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
-
-        m_bp_options_vec.clear();
-        
-        if (result.Succeeded())
-        {
-            const size_t count = valid_bp_ids.GetSize();
-            
-            for (size_t i = 0; i < count; ++i)
-            {
-                BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-                if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                {
-                    Breakpoint *bp = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                    BreakpointOptions *bp_options = nullptr;
-                    if (cur_bp_id.GetLocationID() == LLDB_INVALID_BREAK_ID)
-                    {
-                        // This breakpoint does not have an associated location.
-                        bp_options = bp->GetOptions();
-                    }
-                    else                    
-                    {
-                        BreakpointLocationSP bp_loc_sp(bp->FindLocationByID (cur_bp_id.GetLocationID()));
-                        // This breakpoint does have an associated location.
-                        // Get its breakpoint options.
-                        if (bp_loc_sp)
-                            bp_options = bp_loc_sp->GetLocationOptions();
-                    }
-                    if (bp_options)
-                        m_bp_options_vec.push_back (bp_options);
-                }
-            }
-
-            // If we are using script language, get the script interpreter
-            // in order to set or collect command callback.  Otherwise, call
-            // the methods associated with this object.
-            if (m_options.m_use_script_language)
-            {
-                ScriptInterpreter *script_interp = m_interpreter.GetScriptInterpreter();
-                // Special handling for one-liner specified inline.
-                if (m_options.m_use_one_liner)
-                {
-                    script_interp->SetBreakpointCommandCallback (m_bp_options_vec,
-                                                                 m_options.m_one_liner.c_str());
-                }
-                else if (!m_options.m_function_name.empty())
-                {
-                    script_interp->SetBreakpointCommandCallbackFunction (m_bp_options_vec,
-                                                                         m_options.m_function_name.c_str());
-                }
-                else
-                {
-                    script_interp->CollectDataForBreakpointCommandCallback (m_bp_options_vec,
-                                                                            result);
-                }
-            }
-            else
-            {
-                // Special handling for one-liner specified inline.
-                if (m_options.m_use_one_liner)
-                    SetBreakpointCommandCallback (m_bp_options_vec,
-                                                  m_options.m_one_liner.c_str());
-                else
-                    CollectDataForBreakpointCommandCallback (m_bp_options_vec,
-                                                             result);
-            }
-        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        return result.Succeeded();
+    if (target == nullptr) {
+      result.AppendError("There is not a current executable; there are no "
+                         "breakpoints to which to add commands");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendError("No breakpoints exist to have commands added");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (!m_options.m_use_script_language &&
+        !m_options.m_function_name.empty()) {
+      result.AppendError("need to enable scripting to have a function run as a "
+                         "breakpoint command");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    BreakpointIDList valid_bp_ids;
+    CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+        command, target, result, &valid_bp_ids);
+
+    m_bp_options_vec.clear();
+
+    if (result.Succeeded()) {
+      const size_t count = valid_bp_ids.GetSize();
+
+      for (size_t i = 0; i < count; ++i) {
+        BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+        if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+          Breakpoint *bp =
+              target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+          BreakpointOptions *bp_options = nullptr;
+          if (cur_bp_id.GetLocationID() == LLDB_INVALID_BREAK_ID) {
+            // This breakpoint does not have an associated location.
+            bp_options = bp->GetOptions();
+          } else {
+            BreakpointLocationSP bp_loc_sp(
+                bp->FindLocationByID(cur_bp_id.GetLocationID()));
+            // This breakpoint does have an associated location.
+            // Get its breakpoint options.
+            if (bp_loc_sp)
+              bp_options = bp_loc_sp->GetLocationOptions();
+          }
+          if (bp_options)
+            m_bp_options_vec.push_back(bp_options);
+        }
+      }
+
+      // If we are using script language, get the script interpreter
+      // in order to set or collect command callback.  Otherwise, call
+      // the methods associated with this object.
+      if (m_options.m_use_script_language) {
+        ScriptInterpreter *script_interp = m_interpreter.GetScriptInterpreter();
+        // Special handling for one-liner specified inline.
+        if (m_options.m_use_one_liner) {
+          script_interp->SetBreakpointCommandCallback(
+              m_bp_options_vec, m_options.m_one_liner.c_str());
+        } else if (!m_options.m_function_name.empty()) {
+          script_interp->SetBreakpointCommandCallbackFunction(
+              m_bp_options_vec, m_options.m_function_name.c_str());
+        } else {
+          script_interp->CollectDataForBreakpointCommandCallback(
+              m_bp_options_vec, result);
+        }
+      } else {
+        // Special handling for one-liner specified inline.
+        if (m_options.m_use_one_liner)
+          SetBreakpointCommandCallback(m_bp_options_vec,
+                                       m_options.m_one_liner.c_str());
+        else
+          CollectDataForBreakpointCommandCallback(m_bp_options_vec, result);
+      }
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    CommandOptions m_options;
-    std::vector<BreakpointOptions *> m_bp_options_vec;  // This stores the breakpoint options that we are currently
-                                                        // collecting commands for.  In the CollectData... calls we need
-                                                        // to hand this off to the IOHandler, which may run asynchronously.
-                                                        // So we have to have some way to keep it alive, and not leak it.
-                                                        // Making it an ivar of the command object, which never goes away
-                                                        // achieves this.  Note that if we were able to run
-                                                        // the same command concurrently in one interpreter we'd have to
-                                                        // make this "per invocation".  But there are many more reasons
-                                                        // why it is not in general safe to do that in lldb at present,
-                                                        // so it isn't worthwhile to come up with a more complex mechanism
-                                                        // to address this particular weakness right now.
-    static const char *g_reader_instructions;
+  CommandOptions m_options;
+  std::vector<BreakpointOptions *> m_bp_options_vec; // This stores the
+                                                     // breakpoint options that
+                                                     // we are currently
+  // collecting commands for.  In the CollectData... calls we need
+  // to hand this off to the IOHandler, which may run asynchronously.
+  // So we have to have some way to keep it alive, and not leak it.
+  // Making it an ivar of the command object, which never goes away
+  // achieves this.  Note that if we were able to run
+  // the same command concurrently in one interpreter we'd have to
+  // make this "per invocation".  But there are many more reasons
+  // why it is not in general safe to do that in lldb at present,
+  // so it isn't worthwhile to come up with a more complex mechanism
+  // to address this particular weakness right now.
+  static const char *g_reader_instructions;
 };
 
-const char *
-CommandObjectBreakpointCommandAdd::g_reader_instructions = "Enter your debugger command(s).  Type 'DONE' to end.\n";
-
-// FIXME: "script-type" needs to have its contents determined dynamically, so somebody can add a new scripting
-// language to lldb and have it pickable here without having to change this enumeration by hand and rebuild lldb proper.
+const char *CommandObjectBreakpointCommandAdd::g_reader_instructions =
+    "Enter your debugger command(s).  Type 'DONE' to end.\n";
 
-static OptionEnumValueElement
-g_script_option_enumeration[4] =
-{
-    { eScriptLanguageNone,    "command",         "Commands are in the lldb command interpreter language"},
-    { eScriptLanguagePython,  "python",          "Commands are in the Python language."},
-    { eSortOrderByName,       "default-script",  "Commands are in the default scripting language."},
-    { 0,                      nullptr,           nullptr }
-};
+// FIXME: "script-type" needs to have its contents determined dynamically, so
+// somebody can add a new scripting
+// language to lldb and have it pickable here without having to change this
+// enumeration by hand and rebuild lldb proper.
+
+static OptionEnumValueElement g_script_option_enumeration[4] = {
+    {eScriptLanguageNone, "command",
+     "Commands are in the lldb command interpreter language"},
+    {eScriptLanguagePython, "python", "Commands are in the Python language."},
+    {eSortOrderByName, "default-script",
+     "Commands are in the default scripting language."},
+    {0, nullptr, nullptr}};
 
 OptionDefinition
-CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectBreakpointCommandAdd::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1,   false, "one-liner",         'o', OptionParser::eRequiredArgument, nullptr, nullptr,                     0, eArgTypeOneLiner,       "Specify a one-line breakpoint command inline. Be sure to surround it with quotes." },
   {LLDB_OPT_SET_ALL, false, "stop-on-error",     'e', OptionParser::eRequiredArgument, nullptr, nullptr,                     0, eArgTypeBoolean,        "Specify whether breakpoint command execution should terminate on error." },
   {LLDB_OPT_SET_ALL, false, "script-type",       's', OptionParser::eRequiredArgument, nullptr, g_script_option_enumeration, 0, eArgTypeNone,           "Specify the language for the commands - if none is specified, the lldb command interpreter will be used."},
   {LLDB_OPT_SET_2,   false, "python-function",   'F', OptionParser::eRequiredArgument, nullptr, nullptr,                     0, eArgTypePythonFunction, "Give the name of a Python function to run as command for this breakpoint. Be sure to give a module name if appropriate."},
   {LLDB_OPT_SET_ALL, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument,       nullptr, nullptr,                     0, eArgTypeNone,           "Sets Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectBreakpointCommandDelete
 //-------------------------------------------------------------------------
 
-class CommandObjectBreakpointCommandDelete : public CommandObjectParsed
-{
+class CommandObjectBreakpointCommandDelete : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointCommandDelete (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "delete",
+  CommandObjectBreakpointCommandDelete(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "delete",
                             "Delete the set of commands from a breakpoint.",
                             nullptr),
-        m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData bp_id_arg;
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData bp_id_arg;
 
-        // Define the first (and only) variant of this arg.
-        bp_id_arg.arg_type = eArgTypeBreakpointID;
-        bp_id_arg.arg_repetition = eArgRepeatPlain;
+    // Define the first (and only) variant of this arg.
+    bp_id_arg.arg_type = eArgTypeBreakpointID;
+    bp_id_arg.arg_repetition = eArgRepeatPlain;
 
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (bp_id_arg);
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(bp_id_arg);
 
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectBreakpointCommandDelete() override = default;
+  ~CommandObjectBreakpointCommandDelete() override = default;
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            m_use_dummy(false)
-        {
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), m_use_dummy(false) {}
 
-        ~CommandOptions() override = default;
+    ~CommandOptions() override = default;
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-                case 'D':
-                    m_use_dummy = true;
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
 
-            return error;
-        }
+      switch (short_option) {
+      case 'D':
+        m_use_dummy = true;
+        break;
 
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_use_dummy = false;
-        }
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
+      return error;
+    }
 
-        static OptionDefinition g_option_table[];
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_use_dummy = false;
+    }
 
-        // Instance variables to hold the values for command options.
-        bool m_use_dummy;
-    };
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
-
-        if (target == nullptr)
-        {
-            result.AppendError ("There is not a current executable; there are no breakpoints from which to delete commands");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    // Options table: Required for subclasses of Options.
 
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-        size_t num_breakpoints = breakpoints.GetSize();
+    static OptionDefinition g_option_table[];
 
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("No breakpoints exist to have commands deleted");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    // Instance variables to hold the values for command options.
+    bool m_use_dummy;
+  };
 
-        if (command.GetArgumentCount() == 0)
-        {
-            result.AppendError ("No breakpoint specified from which to delete the commands");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        BreakpointIDList valid_bp_ids;
-        CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = GetSelectedOrDummyTarget(m_options.m_use_dummy);
 
-        if (result.Succeeded())
-        {
-            const size_t count = valid_bp_ids.GetSize();
-            for (size_t i = 0; i < count; ++i)
-            {
-                BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-                if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                {
-                    Breakpoint *bp = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                    if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
-                    {
-                        BreakpointLocationSP bp_loc_sp (bp->FindLocationByID (cur_bp_id.GetLocationID()));
-                        if (bp_loc_sp)
-                            bp_loc_sp->ClearCallback();
-                        else
-                        {
-                            result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n", 
-                                                         cur_bp_id.GetBreakpointID(),
-                                                         cur_bp_id.GetLocationID());
-                            result.SetStatus (eReturnStatusFailed);
-                            return false;
-                        }
-                    }
-                    else
-                    {
-                        bp->ClearCallback();
-                    }
-                }
+    if (target == nullptr) {
+      result.AppendError("There is not a current executable; there are no "
+                         "breakpoints from which to delete commands");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendError("No breakpoints exist to have commands deleted");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      result.AppendError(
+          "No breakpoint specified from which to delete the commands");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    BreakpointIDList valid_bp_ids;
+    CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+        command, target, result, &valid_bp_ids);
+
+    if (result.Succeeded()) {
+      const size_t count = valid_bp_ids.GetSize();
+      for (size_t i = 0; i < count; ++i) {
+        BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+        if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+          Breakpoint *bp =
+              target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+          if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
+            BreakpointLocationSP bp_loc_sp(
+                bp->FindLocationByID(cur_bp_id.GetLocationID()));
+            if (bp_loc_sp)
+              bp_loc_sp->ClearCallback();
+            else {
+              result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",
+                                           cur_bp_id.GetBreakpointID(),
+                                           cur_bp_id.GetLocationID());
+              result.SetStatus(eReturnStatusFailed);
+              return false;
             }
+          } else {
+            bp->ClearCallback();
+          }
         }
-        return result.Succeeded();
+      }
     }
+    return result.Succeeded();
+  }
 
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectBreakpointCommandDelete::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectBreakpointCommandDelete::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "dummy-breakpoints", 'D', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Delete commands from Dummy breakpoints - i.e. breakpoints set before a file is provided, which prime new targets."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectBreakpointCommandList
 //-------------------------------------------------------------------------
 
-class CommandObjectBreakpointCommandList : public CommandObjectParsed
-{
+class CommandObjectBreakpointCommandList : public CommandObjectParsed {
 public:
-    CommandObjectBreakpointCommandList (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "list",
-                            "List the script or set of commands to be executed when the breakpoint is hit.",
-                            nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData bp_id_arg;
-
-        // Define the first (and only) variant of this arg.
-        bp_id_arg.arg_type = eArgTypeBreakpointID;
-        bp_id_arg.arg_repetition = eArgRepeatPlain;
+  CommandObjectBreakpointCommandList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "list", "List the script or set of "
+                                                 "commands to be executed when "
+                                                 "the breakpoint is hit.",
+                            nullptr) {
+    CommandArgumentEntry arg;
+    CommandArgumentData bp_id_arg;
+
+    // Define the first (and only) variant of this arg.
+    bp_id_arg.arg_type = eArgTypeBreakpointID;
+    bp_id_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(bp_id_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (bp_id_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectBreakpointCommandList() override = default;
+  ~CommandObjectBreakpointCommandList() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command,
-             CommandReturnObject &result) override
-    {
-        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-
-        if (target == nullptr)
-        {
-            result.AppendError ("There is not a current executable; there are no breakpoints for which to list commands");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        const BreakpointList &breakpoints = target->GetBreakpointList();
-        size_t num_breakpoints = breakpoints.GetSize();
-
-        if (num_breakpoints == 0)
-        {
-            result.AppendError ("No breakpoints exist for which to list commands");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
 
-        if (command.GetArgumentCount() == 0)
-        {
-            result.AppendError ("No breakpoint specified for which to list the commands");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        BreakpointIDList valid_bp_ids;
-        CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs (command, target, result, &valid_bp_ids);
+    if (target == nullptr) {
+      result.AppendError("There is not a current executable; there are no "
+                         "breakpoints for which to list commands");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const BreakpointList &breakpoints = target->GetBreakpointList();
+    size_t num_breakpoints = breakpoints.GetSize();
+
+    if (num_breakpoints == 0) {
+      result.AppendError("No breakpoints exist for which to list commands");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      result.AppendError(
+          "No breakpoint specified for which to list the commands");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    BreakpointIDList valid_bp_ids;
+    CommandObjectMultiwordBreakpoint::VerifyBreakpointOrLocationIDs(
+        command, target, result, &valid_bp_ids);
+
+    if (result.Succeeded()) {
+      const size_t count = valid_bp_ids.GetSize();
+      for (size_t i = 0; i < count; ++i) {
+        BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex(i);
+        if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID) {
+          Breakpoint *bp =
+              target->GetBreakpointByID(cur_bp_id.GetBreakpointID()).get();
+
+          if (bp) {
+            const BreakpointOptions *bp_options = nullptr;
+            if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID) {
+              BreakpointLocationSP bp_loc_sp(
+                  bp->FindLocationByID(cur_bp_id.GetLocationID()));
+              if (bp_loc_sp)
+                bp_options = bp_loc_sp->GetOptionsNoCreate();
+              else {
+                result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",
+                                             cur_bp_id.GetBreakpointID(),
+                                             cur_bp_id.GetLocationID());
+                result.SetStatus(eReturnStatusFailed);
+                return false;
+              }
+            } else {
+              bp_options = bp->GetOptions();
+            }
 
-        if (result.Succeeded())
-        {
-            const size_t count = valid_bp_ids.GetSize();
-            for (size_t i = 0; i < count; ++i)
-            {
-                BreakpointID cur_bp_id = valid_bp_ids.GetBreakpointIDAtIndex (i);
-                if (cur_bp_id.GetBreakpointID() != LLDB_INVALID_BREAK_ID)
-                {
-                    Breakpoint *bp = target->GetBreakpointByID (cur_bp_id.GetBreakpointID()).get();
-                    
-                    if (bp)
-                    {
-                        const BreakpointOptions *bp_options = nullptr;
-                        if (cur_bp_id.GetLocationID() != LLDB_INVALID_BREAK_ID)
-                        {
-                            BreakpointLocationSP bp_loc_sp(bp->FindLocationByID (cur_bp_id.GetLocationID()));
-                            if (bp_loc_sp)
-                                bp_options = bp_loc_sp->GetOptionsNoCreate();
-                            else
-                            {
-                                result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n", 
-                                                             cur_bp_id.GetBreakpointID(),
-                                                             cur_bp_id.GetLocationID());
-                                result.SetStatus (eReturnStatusFailed);
-                                return false;
-                            }
-                        }
-                        else
-                        {
-                            bp_options = bp->GetOptions();
-                        }
-
-                        if (bp_options)
-                        {
-                            StreamString id_str;
-                            BreakpointID::GetCanonicalReference (&id_str, 
-                                                                 cur_bp_id.GetBreakpointID(), 
-                                                                 cur_bp_id.GetLocationID());
-                            const Baton *baton = bp_options->GetBaton();
-                            if (baton)
-                            {
-                                result.GetOutputStream().Printf ("Breakpoint %s:\n", id_str.GetData());
-                                result.GetOutputStream().IndentMore ();
-                                baton->GetDescription(&result.GetOutputStream(), eDescriptionLevelFull);
-                                result.GetOutputStream().IndentLess ();
-                            }
-                            else
-                            {
-                                result.AppendMessageWithFormat ("Breakpoint %s does not have an associated command.\n", 
-                                                                id_str.GetData());
-                            }
-                        }
-                        result.SetStatus (eReturnStatusSuccessFinishResult);
-                    }
-                    else
-                    {
-                        result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n", cur_bp_id.GetBreakpointID());
-                        result.SetStatus (eReturnStatusFailed);
-                    }
-                }
+            if (bp_options) {
+              StreamString id_str;
+              BreakpointID::GetCanonicalReference(&id_str,
+                                                  cur_bp_id.GetBreakpointID(),
+                                                  cur_bp_id.GetLocationID());
+              const Baton *baton = bp_options->GetBaton();
+              if (baton) {
+                result.GetOutputStream().Printf("Breakpoint %s:\n",
+                                                id_str.GetData());
+                result.GetOutputStream().IndentMore();
+                baton->GetDescription(&result.GetOutputStream(),
+                                      eDescriptionLevelFull);
+                result.GetOutputStream().IndentLess();
+              } else {
+                result.AppendMessageWithFormat(
+                    "Breakpoint %s does not have an associated command.\n",
+                    id_str.GetData());
+              }
             }
+            result.SetStatus(eReturnStatusSuccessFinishResult);
+          } else {
+            result.AppendErrorWithFormat("Invalid breakpoint ID: %u.\n",
+                                         cur_bp_id.GetBreakpointID());
+            result.SetStatus(eReturnStatusFailed);
+          }
         }
-
-        return result.Succeeded();
+      }
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectBreakpointCommand
 //-------------------------------------------------------------------------
 
-CommandObjectBreakpointCommand::CommandObjectBreakpointCommand(CommandInterpreter &interpreter)
+CommandObjectBreakpointCommand::CommandObjectBreakpointCommand(
+    CommandInterpreter &interpreter)
     : CommandObjectMultiword(
-          interpreter, "command",
-          "Commands for adding, removing and listing LLDB commands executed when a breakpoint is hit.",
-          "command <sub-command> [<sub-command-options>] <breakpoint-id>")
-{
-    CommandObjectSP add_command_object (new CommandObjectBreakpointCommandAdd (interpreter));
-    CommandObjectSP delete_command_object (new CommandObjectBreakpointCommandDelete (interpreter));
-    CommandObjectSP list_command_object (new CommandObjectBreakpointCommandList (interpreter));
-
-    add_command_object->SetCommandName ("breakpoint command add");
-    delete_command_object->SetCommandName ("breakpoint command delete");
-    list_command_object->SetCommandName ("breakpoint command list");
-
-    LoadSubCommand ("add",    add_command_object);
-    LoadSubCommand ("delete", delete_command_object);
-    LoadSubCommand ("list",   list_command_object);
+          interpreter, "command", "Commands for adding, removing and listing "
+                                  "LLDB commands executed when a breakpoint is "
+                                  "hit.",
+          "command <sub-command> [<sub-command-options>] <breakpoint-id>") {
+  CommandObjectSP add_command_object(
+      new CommandObjectBreakpointCommandAdd(interpreter));
+  CommandObjectSP delete_command_object(
+      new CommandObjectBreakpointCommandDelete(interpreter));
+  CommandObjectSP list_command_object(
+      new CommandObjectBreakpointCommandList(interpreter));
+
+  add_command_object->SetCommandName("breakpoint command add");
+  delete_command_object->SetCommandName("breakpoint command delete");
+  list_command_object->SetCommandName("breakpoint command list");
+
+  LoadSubCommand("add", add_command_object);
+  LoadSubCommand("delete", delete_command_object);
+  LoadSubCommand("list", list_command_object);
 }
 
 CommandObjectBreakpointCommand::~CommandObjectBreakpointCommand() = default;

Modified: lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBreakpointCommand.h Tue Sep  6 15:57:50 2016
@@ -16,11 +16,11 @@
 // Other libraries and framework includes
 // Project includes
 
-#include "lldb/lldb-types.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/CommandObject.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
+#include "lldb/lldb-types.h"
 
 namespace lldb_private {
 
@@ -28,12 +28,11 @@ namespace lldb_private {
 // CommandObjectMultiwordBreakpoint
 //-------------------------------------------------------------------------
 
-class CommandObjectBreakpointCommand : public CommandObjectMultiword
-{
+class CommandObjectBreakpointCommand : public CommandObjectMultiword {
 public:
-    CommandObjectBreakpointCommand (CommandInterpreter &interpreter);
+  CommandObjectBreakpointCommand(CommandInterpreter &interpreter);
 
-    ~CommandObjectBreakpointCommand() override;
+  ~CommandObjectBreakpointCommand() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectBugreport.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBugreport.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectBugreport.cpp Tue Sep  6 15:57:50 2016
@@ -28,100 +28,87 @@ using namespace lldb_private;
 // "bugreport unwind"
 //-------------------------------------------------------------------------
 
-class CommandObjectBugreportUnwind : public CommandObjectParsed
-{
+class CommandObjectBugreportUnwind : public CommandObjectParsed {
 public:
-    CommandObjectBugreportUnwind(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "bugreport unwind",
-                            "Create a bugreport for a bug in the stack unwinding code.",
-                            nullptr),
-        m_option_group(),
-        m_outfile_options()
-    {
-        m_option_group.Append (&m_outfile_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
-        m_option_group.Finalize();
-    }
+  CommandObjectBugreportUnwind(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "bugreport unwind",
+            "Create a bugreport for a bug in the stack unwinding code.",
+            nullptr),
+        m_option_group(), m_outfile_options() {
+    m_option_group.Append(&m_outfile_options, LLDB_OPT_SET_ALL,
+                          LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
+    m_option_group.Finalize();
+  }
 
-    ~CommandObjectBugreportUnwind() override
-    {
-    }
+  ~CommandObjectBugreportUnwind() override {}
 
-    Options *
-    GetOptions() override
-    {
-        return &m_option_group;
-    }
+  Options *GetOptions() override { return &m_option_group; }
 
 protected:
-    bool
-    DoExecute(Args& command, CommandReturnObject &result) override
-    {
-        StringList commands;
-        commands.AppendString("thread backtrace");
-
-        Thread *thread = m_exe_ctx.GetThreadPtr();
-        if (thread)
-        {
-            char command_buffer[256];
-
-            uint32_t frame_count = thread->GetStackFrameCount();
-            for (uint32_t i = 0; i < frame_count; ++i)
-            {
-                StackFrameSP frame = thread->GetStackFrameAtIndex(i);
-                lldb::addr_t pc = frame->GetStackID().GetPC();
-
-                snprintf(command_buffer, sizeof(command_buffer), "disassemble --bytes --address 0x%" PRIx64, pc);
-                commands.AppendString(command_buffer);
-
-                snprintf(command_buffer, sizeof(command_buffer), "image show-unwind --address 0x%" PRIx64, pc);
-                commands.AppendString(command_buffer);
-            }
-        }
-
-        const FileSpec &outfile_spec = m_outfile_options.GetFile().GetCurrentValue();
-        if (outfile_spec)
-        {
-            char path[PATH_MAX];
-            outfile_spec.GetPath (path, sizeof(path));
-
-            uint32_t open_options = File::eOpenOptionWrite |
-                                    File::eOpenOptionCanCreate |
-                                    File::eOpenOptionAppend |
-                                    File::eOpenOptionCloseOnExec;
-
-            const bool append = m_outfile_options.GetAppend().GetCurrentValue();
-            if (!append)
-                open_options |= File::eOpenOptionTruncate;
-            
-            StreamFileSP outfile_stream = std::make_shared<StreamFile>();
-            Error error = outfile_stream->GetFile().Open(path, open_options);
-            if (error.Fail())
-            {
-                result.AppendErrorWithFormat("Failed to open file '%s' for %s: %s\n",
-                                             path,
-                                             append ? "append" : "write",
-                                             error.AsCString());
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-
-            result.SetImmediateOutputStream(outfile_stream);
-        }
-
-        CommandInterpreterRunOptions options;
-        options.SetStopOnError(false);
-        options.SetEchoCommands(true);
-        options.SetPrintResults(true);
-        options.SetAddToHistory(false);
-        m_interpreter.HandleCommands(commands, &m_exe_ctx, options, result);
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    StringList commands;
+    commands.AppendString("thread backtrace");
+
+    Thread *thread = m_exe_ctx.GetThreadPtr();
+    if (thread) {
+      char command_buffer[256];
+
+      uint32_t frame_count = thread->GetStackFrameCount();
+      for (uint32_t i = 0; i < frame_count; ++i) {
+        StackFrameSP frame = thread->GetStackFrameAtIndex(i);
+        lldb::addr_t pc = frame->GetStackID().GetPC();
+
+        snprintf(command_buffer, sizeof(command_buffer),
+                 "disassemble --bytes --address 0x%" PRIx64, pc);
+        commands.AppendString(command_buffer);
+
+        snprintf(command_buffer, sizeof(command_buffer),
+                 "image show-unwind --address 0x%" PRIx64, pc);
+        commands.AppendString(command_buffer);
+      }
+    }
 
-        return result.Succeeded();
+    const FileSpec &outfile_spec =
+        m_outfile_options.GetFile().GetCurrentValue();
+    if (outfile_spec) {
+      char path[PATH_MAX];
+      outfile_spec.GetPath(path, sizeof(path));
+
+      uint32_t open_options =
+          File::eOpenOptionWrite | File::eOpenOptionCanCreate |
+          File::eOpenOptionAppend | File::eOpenOptionCloseOnExec;
+
+      const bool append = m_outfile_options.GetAppend().GetCurrentValue();
+      if (!append)
+        open_options |= File::eOpenOptionTruncate;
+
+      StreamFileSP outfile_stream = std::make_shared<StreamFile>();
+      Error error = outfile_stream->GetFile().Open(path, open_options);
+      if (error.Fail()) {
+        result.AppendErrorWithFormat("Failed to open file '%s' for %s: %s\n",
+                                     path, append ? "append" : "write",
+                                     error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      result.SetImmediateOutputStream(outfile_stream);
     }
 
+    CommandInterpreterRunOptions options;
+    options.SetStopOnError(false);
+    options.SetEchoCommands(true);
+    options.SetPrintResults(true);
+    options.SetAddToHistory(false);
+    m_interpreter.HandleCommands(commands, &m_exe_ctx, options, result);
+
+    return result.Succeeded();
+  }
+
 private:
-    OptionGroupOptions m_option_group;
-    OptionGroupOutputFile m_outfile_options;
+  OptionGroupOptions m_option_group;
+  OptionGroupOutputFile m_outfile_options;
 };
 
 #pragma mark CommandObjectMultiwordBugreport
@@ -130,14 +117,15 @@ private:
 // CommandObjectMultiwordBugreport
 //-------------------------------------------------------------------------
 
-CommandObjectMultiwordBugreport::CommandObjectMultiwordBugreport(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "bugreport", "Commands for creating domain-specific bug reports.",
-                             "bugreport <subcommand> [<subcommand-options>]")
-{
+CommandObjectMultiwordBugreport::CommandObjectMultiwordBugreport(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(
+          interpreter, "bugreport",
+          "Commands for creating domain-specific bug reports.",
+          "bugreport <subcommand> [<subcommand-options>]") {
 
-    LoadSubCommand("unwind", CommandObjectSP(new CommandObjectBugreportUnwind(interpreter)));
+  LoadSubCommand(
+      "unwind", CommandObjectSP(new CommandObjectBugreportUnwind(interpreter)));
 }
 
-CommandObjectMultiwordBugreport::~CommandObjectMultiwordBugreport ()
-{
-}
+CommandObjectMultiwordBugreport::~CommandObjectMultiwordBugreport() {}

Modified: lldb/trunk/source/Commands/CommandObjectBugreport.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectBugreport.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectBugreport.h (original)
+++ lldb/trunk/source/Commands/CommandObjectBugreport.h Tue Sep  6 15:57:50 2016
@@ -22,12 +22,11 @@ namespace lldb_private {
 // CommandObjectMultiwordBugreport
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordBugreport : public CommandObjectMultiword
-{
+class CommandObjectMultiwordBugreport : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordBugreport(CommandInterpreter &interpreter);
+  CommandObjectMultiwordBugreport(CommandInterpreter &interpreter);
 
-    ~CommandObjectMultiwordBugreport() override;
+  ~CommandObjectMultiwordBugreport() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectCommands.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.cpp Tue Sep  6 15:57:50 2016
@@ -36,495 +36,400 @@ using namespace lldb_private;
 // CommandObjectCommandsSource
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsHistory : public CommandObjectParsed
-{
+class CommandObjectCommandsHistory : public CommandObjectParsed {
 public:
-    CommandObjectCommandsHistory(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "command history",
+  CommandObjectCommandsHistory(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "command history",
                             "Dump the history of commands in this session.",
                             nullptr),
-        m_options()
-    {
-    }
+        m_options() {}
 
-    ~CommandObjectCommandsHistory() override = default;
+  ~CommandObjectCommandsHistory() override = default;
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
 protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            m_start_idx(0),
-            m_stop_idx(0),
-            m_count(0),
-            m_clear(false)
-        {
-        }
-
-        ~CommandOptions() override = default;
-
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            
-            switch (short_option)
-            {
-                case 'c':
-                    error = m_count.SetValueFromString(option_arg,eVarSetOperationAssign);
-                    break;
-                case 's':
-                    if (option_arg && strcmp("end", option_arg) == 0)
-                    {
-                        m_start_idx.SetCurrentValue(UINT64_MAX);
-                        m_start_idx.SetOptionWasSet();
-                    }
-                    else
-                        error = m_start_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
-                    break;
-                case 'e':
-                    error = m_stop_idx.SetValueFromString(option_arg,eVarSetOperationAssign);
-                    break;
-                case 'C':
-                    m_clear.SetCurrentValue(true);
-                    m_clear.SetOptionWasSet();
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_start_idx.Clear();
-            m_stop_idx.Clear();
-            m_count.Clear();
-            m_clear.Clear();
-        }
-
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-
-        OptionValueUInt64 m_start_idx;
-        OptionValueUInt64 m_stop_idx;
-        OptionValueUInt64 m_count;
-        OptionValueBoolean m_clear;
-    };
-    
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        if (m_options.m_clear.GetCurrentValue() && m_options.m_clear.OptionWasSet())
-        {
-            m_interpreter.GetCommandHistory().Clear();
-            result.SetStatus(lldb::eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            if (m_options.m_start_idx.OptionWasSet() && m_options.m_stop_idx.OptionWasSet() && m_options.m_count.OptionWasSet())
-            {
-                result.AppendError("--count, --start-index and --end-index cannot be all specified in the same invocation");
-                result.SetStatus(lldb::eReturnStatusFailed);
-            }
-            else
-            {
-                std::pair<bool,uint64_t> start_idx(m_options.m_start_idx.OptionWasSet(),m_options.m_start_idx.GetCurrentValue());
-                std::pair<bool,uint64_t> stop_idx(m_options.m_stop_idx.OptionWasSet(),m_options.m_stop_idx.GetCurrentValue());
-                std::pair<bool,uint64_t> count(m_options.m_count.OptionWasSet(),m_options.m_count.GetCurrentValue());
-                
-                const CommandHistory& history(m_interpreter.GetCommandHistory());
-                                              
-                if (start_idx.first && start_idx.second == UINT64_MAX)
-                {
-                    if (count.first)
-                    {
-                        start_idx.second = history.GetSize() - count.second;
-                        stop_idx.second = history.GetSize() - 1;
-                    }
-                    else if (stop_idx.first)
-                    {
-                        start_idx.second = stop_idx.second;
-                        stop_idx.second = history.GetSize() - 1;
-                    }
-                    else
-                    {
-                        start_idx.second = 0;
-                        stop_idx.second = history.GetSize() - 1;
-                    }
-                }
-                else
-                {
-                    if (!start_idx.first && !stop_idx.first && !count.first)
-                    {
-                        start_idx.second = 0;
-                        stop_idx.second = history.GetSize() - 1;
-                    }
-                    else if (start_idx.first)
-                    {
-                        if (count.first)
-                        {
-                            stop_idx.second = start_idx.second + count.second - 1;
-                        }
-                        else if (!stop_idx.first)
-                        {
-                            stop_idx.second = history.GetSize() - 1;
-                        }
-                    }
-                    else if (stop_idx.first)
-                    {
-                        if (count.first)
-                        {
-                            if (stop_idx.second >= count.second)
-                                start_idx.second = stop_idx.second - count.second + 1;
-                            else
-                                start_idx.second = 0;
-                        }
-                    }
-                    else /* if (count.first) */
-                    {
-                        start_idx.second = 0;
-                        stop_idx.second = count.second - 1;
-                    }
-                }
-                history.Dump(result.GetOutputStream(), start_idx.second, stop_idx.second);
-            }
-        }
-        return result.Succeeded();
-
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_start_idx(0), m_stop_idx(0), m_count(0), m_clear(false) {
+    }
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'c':
+        error = m_count.SetValueFromString(option_arg, eVarSetOperationAssign);
+        break;
+      case 's':
+        if (option_arg && strcmp("end", option_arg) == 0) {
+          m_start_idx.SetCurrentValue(UINT64_MAX);
+          m_start_idx.SetOptionWasSet();
+        } else
+          error = m_start_idx.SetValueFromString(option_arg,
+                                                 eVarSetOperationAssign);
+        break;
+      case 'e':
+        error =
+            m_stop_idx.SetValueFromString(option_arg, eVarSetOperationAssign);
+        break;
+      case 'C':
+        m_clear.SetCurrentValue(true);
+        m_clear.SetOptionWasSet();
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_start_idx.Clear();
+      m_stop_idx.Clear();
+      m_count.Clear();
+      m_clear.Clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    OptionValueUInt64 m_start_idx;
+    OptionValueUInt64 m_stop_idx;
+    OptionValueUInt64 m_count;
+    OptionValueBoolean m_clear;
+  };
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (m_options.m_clear.GetCurrentValue() &&
+        m_options.m_clear.OptionWasSet()) {
+      m_interpreter.GetCommandHistory().Clear();
+      result.SetStatus(lldb::eReturnStatusSuccessFinishNoResult);
+    } else {
+      if (m_options.m_start_idx.OptionWasSet() &&
+          m_options.m_stop_idx.OptionWasSet() &&
+          m_options.m_count.OptionWasSet()) {
+        result.AppendError("--count, --start-index and --end-index cannot be "
+                           "all specified in the same invocation");
+        result.SetStatus(lldb::eReturnStatusFailed);
+      } else {
+        std::pair<bool, uint64_t> start_idx(
+            m_options.m_start_idx.OptionWasSet(),
+            m_options.m_start_idx.GetCurrentValue());
+        std::pair<bool, uint64_t> stop_idx(
+            m_options.m_stop_idx.OptionWasSet(),
+            m_options.m_stop_idx.GetCurrentValue());
+        std::pair<bool, uint64_t> count(m_options.m_count.OptionWasSet(),
+                                        m_options.m_count.GetCurrentValue());
+
+        const CommandHistory &history(m_interpreter.GetCommandHistory());
+
+        if (start_idx.first && start_idx.second == UINT64_MAX) {
+          if (count.first) {
+            start_idx.second = history.GetSize() - count.second;
+            stop_idx.second = history.GetSize() - 1;
+          } else if (stop_idx.first) {
+            start_idx.second = stop_idx.second;
+            stop_idx.second = history.GetSize() - 1;
+          } else {
+            start_idx.second = 0;
+            stop_idx.second = history.GetSize() - 1;
+          }
+        } else {
+          if (!start_idx.first && !stop_idx.first && !count.first) {
+            start_idx.second = 0;
+            stop_idx.second = history.GetSize() - 1;
+          } else if (start_idx.first) {
+            if (count.first) {
+              stop_idx.second = start_idx.second + count.second - 1;
+            } else if (!stop_idx.first) {
+              stop_idx.second = history.GetSize() - 1;
+            }
+          } else if (stop_idx.first) {
+            if (count.first) {
+              if (stop_idx.second >= count.second)
+                start_idx.second = stop_idx.second - count.second + 1;
+              else
+                start_idx.second = 0;
+            }
+          } else /* if (count.first) */
+          {
+            start_idx.second = 0;
+            stop_idx.second = count.second - 1;
+          }
+        }
+        history.Dump(result.GetOutputStream(), start_idx.second,
+                     stop_idx.second);
+      }
     }
+    return result.Succeeded();
+  }
 
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectCommandsHistory::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectCommandsHistory::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "count",       'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "How many history commands to print."},
   {LLDB_OPT_SET_1, false, "start-index", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to start printing history commands (or end to mean tail mode)."},
   {LLDB_OPT_SET_1, false, "end-index",   'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Index at which to stop printing history commands."},
   {LLDB_OPT_SET_2, false, "clear",       'C', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeBoolean,         "Clears the current command history."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectCommandsSource
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsSource : public CommandObjectParsed
-{
+class CommandObjectCommandsSource : public CommandObjectParsed {
 public:
-    CommandObjectCommandsSource(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "command source", "Read and execute LLDB commands from the file <filename>.",
-                              nullptr),
-          m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData file_arg;
-        
-        // Define the first (and only) variant of this arg.
-        file_arg.arg_type = eArgTypeFilename;
-        file_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (file_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  CommandObjectCommandsSource(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "command source",
+            "Read and execute LLDB commands from the file <filename>.",
+            nullptr),
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData file_arg;
+
+    // Define the first (and only) variant of this arg.
+    file_arg.arg_type = eArgTypeFilename;
+    file_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(file_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectCommandsSource() override = default;
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override {
+    return "";
+  }
+
+  int HandleArgumentCompletion(Args &input, int &cursor_index,
+                               int &cursor_char_position,
+                               OptionElementVector &opt_element_vector,
+                               int match_start_point, int max_return_elements,
+                               bool &word_complete,
+                               StringList &matches) override {
+    std::string completion_str(input.GetArgumentAtIndex(cursor_index));
+    completion_str.erase(cursor_char_position);
+
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
+        completion_str.c_str(), match_start_point, max_return_elements, nullptr,
+        word_complete, matches);
+    return matches.GetSize();
+  }
 
-    ~CommandObjectCommandsSource() override = default;
+  Options *GetOptions() override { return &m_options; }
 
-    const char*
-    GetRepeatCommand (Args &current_command_args, uint32_t index) override
-    {
-        return "";
-    }
-    
-    int
-    HandleArgumentCompletion (Args &input,
-                              int &cursor_index,
-                              int &cursor_char_position,
-                              OptionElementVector &opt_element_vector,
-                              int match_start_point,
-                              int max_return_elements,
-                              bool &word_complete,
-                              StringList &matches) override
-    {
-        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
-        completion_str.erase (cursor_char_position);
+protected:
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_stop_on_error(true), m_silent_run(false),
+          m_stop_on_continue(true) {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'e':
+        error = m_stop_on_error.SetValueFromString(option_arg);
+        break;
+
+      case 'c':
+        error = m_stop_on_continue.SetValueFromString(option_arg);
+        break;
+
+      case 's':
+        error = m_silent_run.SetValueFromString(option_arg);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_stop_on_error.Clear();
+      m_silent_run.Clear();
+      m_stop_on_continue.Clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    OptionValueBoolean m_stop_on_error;
+    OptionValueBoolean m_silent_run;
+    OptionValueBoolean m_stop_on_continue;
+  };
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    const size_t argc = command.GetArgumentCount();
+    if (argc == 1) {
+      const char *filename = command.GetArgumentAtIndex(0);
+
+      FileSpec cmd_file(filename, true);
+      ExecutionContext *exe_ctx = nullptr; // Just use the default context.
+
+      // If any options were set, then use them
+      if (m_options.m_stop_on_error.OptionWasSet() ||
+          m_options.m_silent_run.OptionWasSet() ||
+          m_options.m_stop_on_continue.OptionWasSet()) {
+        // Use user set settings
+        CommandInterpreterRunOptions options;
+        options.SetStopOnContinue(
+            m_options.m_stop_on_continue.GetCurrentValue());
+        options.SetStopOnError(m_options.m_stop_on_error.GetCurrentValue());
+        options.SetEchoCommands(!m_options.m_silent_run.GetCurrentValue());
+        options.SetPrintResults(!m_options.m_silent_run.GetCurrentValue());
+
+        m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options,
+                                             result);
+      } else {
+        // No options were set, inherit any settings from nested "command
+        // source" commands,
+        // or set to sane default settings...
+        CommandInterpreterRunOptions options;
+        m_interpreter.HandleCommandsFromFile(cmd_file, exe_ctx, options,
+                                             result);
+      }
+    } else {
+      result.AppendErrorWithFormat(
+          "'%s' takes exactly one executable filename argument.\n",
+          GetCommandName());
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
 
-        CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                            CommandCompletions::eDiskFileCompletion,
-                                                            completion_str.c_str(),
-                                                            match_start_point,
-                                                            max_return_elements,
-                                                            nullptr,
-                                                            word_complete,
-                                                            matches);
-        return matches.GetSize();
-    }
+  CommandOptions m_options;
+};
 
-    Options *
-    GetOptions () override
+OptionDefinition CommandObjectCommandsSource::CommandOptions::g_option_table[] =
     {
-        return &m_options;
-    }
+        // clang-format off
+  {LLDB_OPT_SET_ALL, false, "stop-on-error",    'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on error."},
+  {LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on continue."},
+  {LLDB_OPT_SET_ALL, false, "silent-run",       's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true don't echo commands while executing."},
+  {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
+        // clang-format on
+};
+
+#pragma mark CommandObjectCommandsAlias
+//-------------------------------------------------------------------------
+// CommandObjectCommandsAlias
+//-------------------------------------------------------------------------
 
+static const char *g_python_command_instructions =
+    "Enter your Python command(s). Type 'DONE' to end.\n"
+    "You must define a Python function with this signature:\n"
+    "def my_command_impl(debugger, args, result, internal_dict):\n";
+
+class CommandObjectCommandsAlias : public CommandObjectRaw {
 protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            m_stop_on_error (true),
-            m_silent_run (false),
-            m_stop_on_continue (true)
-        {
-        }
+  class CommandOptions : public OptionGroup {
+  public:
+    CommandOptions() : OptionGroup(), m_help(), m_long_help() {}
 
-        ~CommandOptions() override = default;
+    ~CommandOptions() override = default;
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            
-            switch (short_option)
-            {
-                case 'e':
-                    error = m_stop_on_error.SetValueFromString(option_arg);
-                    break;
-
-                case 'c':
-                    error = m_stop_on_continue.SetValueFromString(option_arg);
-                    break;
-
-                case 's':
-                    error = m_silent_run.SetValueFromString(option_arg);
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
+    uint32_t GetNumDefinitions() override { return 3; }
 
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_stop_on_error.Clear();
-            m_silent_run.Clear();
-            m_stop_on_continue.Clear();
-        }
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
+    Error SetOptionValue(uint32_t option_idx, const char *option_value,
+                         ExecutionContext *execution_context) override {
+      Error error;
 
-        // Options table: Required for subclasses of Options.
+      const int short_option = g_option_table[option_idx].short_option;
 
-        static OptionDefinition g_option_table[];
+      switch (short_option) {
+      case 'h':
+        m_help.SetCurrentValue(option_value);
+        m_help.SetOptionWasSet();
+        break;
 
-        // Instance variables to hold the values for command options.
+      case 'H':
+        m_long_help.SetCurrentValue(option_value);
+        m_long_help.SetOptionWasSet();
+        break;
 
-        OptionValueBoolean m_stop_on_error;
-        OptionValueBoolean m_silent_run;
-        OptionValueBoolean m_stop_on_continue;
-    };
-    
-    bool
-    DoExecute(Args& command, CommandReturnObject &result) override
-    {
-        const size_t argc = command.GetArgumentCount();
-        if (argc == 1)
-        {
-            const char *filename = command.GetArgumentAtIndex(0);
-
-            FileSpec cmd_file (filename, true);
-            ExecutionContext *exe_ctx = nullptr;  // Just use the default context.
-            
-            // If any options were set, then use them
-            if (m_options.m_stop_on_error.OptionWasSet()    ||
-                m_options.m_silent_run.OptionWasSet()       ||
-                m_options.m_stop_on_continue.OptionWasSet())
-            {
-                // Use user set settings
-                CommandInterpreterRunOptions options;
-                options.SetStopOnContinue(m_options.m_stop_on_continue.GetCurrentValue());
-                options.SetStopOnError (m_options.m_stop_on_error.GetCurrentValue());
-                options.SetEchoCommands (!m_options.m_silent_run.GetCurrentValue());
-                options.SetPrintResults (!m_options.m_silent_run.GetCurrentValue());
-
-                m_interpreter.HandleCommandsFromFile (cmd_file,
-                                                      exe_ctx,
-                                                      options,
-                                                      result);
-            }
-            else
-            {
-                // No options were set, inherit any settings from nested "command source" commands,
-                // or set to sane default settings...
-                CommandInterpreterRunOptions options;
-                m_interpreter.HandleCommandsFromFile (cmd_file,
-                                                      exe_ctx,
-                                                      options,
-                                                      result);
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat("'%s' takes exactly one executable filename argument.\n", GetCommandName());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
     }
 
-    CommandOptions m_options;    
-};
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_help.Clear();
+      m_long_help.Clear();
+    }
 
-OptionDefinition
-CommandObjectCommandsSource::CommandOptions::g_option_table[] =
-{
-  // clang-format off
-  {LLDB_OPT_SET_ALL, false, "stop-on-error",    'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on error."},
-  {LLDB_OPT_SET_ALL, false, "stop-on-continue", 'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true, stop executing commands on continue."},
-  {LLDB_OPT_SET_ALL, false, "silent-run",       's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "If true don't echo commands while executing."},
-  {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
-};
+    // Options table: Required for subclasses of Options.
 
-#pragma mark CommandObjectCommandsAlias
-//-------------------------------------------------------------------------
-// CommandObjectCommandsAlias
-//-------------------------------------------------------------------------
+    static OptionDefinition g_option_table[];
+    OptionValueString m_help;
+    OptionValueString m_long_help;
+  };
 
-static const char *g_python_command_instructions =   "Enter your Python command(s). Type 'DONE' to end.\n"
-                                                     "You must define a Python function with this signature:\n"
-                                                     "def my_command_impl(debugger, args, result, internal_dict):\n";
+  OptionGroupOptions m_option_group;
+  CommandOptions m_command_options;
 
-class CommandObjectCommandsAlias : public CommandObjectRaw
-{
-protected:
-    class CommandOptions : public OptionGroup
-    {
-    public:
-        CommandOptions () :
-        OptionGroup(),
-        m_help(),
-        m_long_help()
-        {}
-        
-        ~CommandOptions() override = default;
-        
-        uint32_t
-        GetNumDefinitions () override
-        {
-            return 3;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        Error
-        SetOptionValue (uint32_t option_idx,
-                        const char *option_value,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            
-            const int short_option = g_option_table[option_idx].short_option;
-            
-            switch (short_option)
-            {
-                case 'h':
-                    m_help.SetCurrentValue(option_value);
-                    m_help.SetOptionWasSet();
-                    break;
-                    
-                case 'H':
-                    m_long_help.SetCurrentValue(option_value);
-                    m_long_help.SetOptionWasSet();
-                    break;
-                    
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting (ExecutionContext *execution_context) override
-        {
-            m_help.Clear();
-            m_long_help.Clear();
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static OptionDefinition g_option_table[];
-        OptionValueString m_help;
-        OptionValueString m_long_help;
-    };
-
-    OptionGroupOptions m_option_group;
-    CommandOptions m_command_options;
-    
 public:
-    Options *
-    GetOptions () override
-    {
-        return &m_option_group;
-    }
+  Options *GetOptions() override { return &m_option_group; }
 
-    CommandObjectCommandsAlias(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "command alias", "Define a custom command in terms of an existing command.",
-                           nullptr),
-          m_option_group(),
-          m_command_options()
-    {
-        m_option_group.Append(&m_command_options);
-        m_option_group.Finalize();
+  CommandObjectCommandsAlias(CommandInterpreter &interpreter)
+      : CommandObjectRaw(
+            interpreter, "command alias",
+            "Define a custom command in terms of an existing command.",
+            nullptr),
+        m_option_group(), m_command_options() {
+    m_option_group.Append(&m_command_options);
+    m_option_group.Finalize();
 
-        SetHelpLong(
-"'alias' allows the user to create a short-cut or abbreviation for long \
+    SetHelpLong(
+        "'alias' allows the user to create a short-cut or abbreviation for long \
 commands, multi-word commands, and commands that take particular options.  \
-Below are some simple examples of how one might use the 'alias' command:" R"(
+Below are some simple examples of how one might use the 'alias' command:"
+        R"(
 
 (lldb) command alias sc script
 
@@ -532,22 +437,27 @@ Below are some simple examples of how on
 
 (lldb) command alias bp breakpoint
 
-)" "    Creates the abbreviation 'bp' for the 'breakpoint' command.  Since \
+)"
+        "    Creates the abbreviation 'bp' for the 'breakpoint' command.  Since \
 breakpoint commands are two-word commands, the user would still need to \
-enter the second word after 'bp', e.g. 'bp enable' or 'bp delete'." R"(
+enter the second word after 'bp', e.g. 'bp enable' or 'bp delete'."
+        R"(
 
 (lldb) command alias bpl breakpoint list
 
     Creates the abbreviation 'bpl' for the two-word command 'breakpoint list'.
 
-)" "An alias can include some options for the command, with the values either \
+)"
+        "An alias can include some options for the command, with the values either \
 filled in at the time the alias is created, or specified as positional \
 arguments, to be filled in when the alias is invoked.  The following example \
-shows how to create aliases with options:" R"(
+shows how to create aliases with options:"
+        R"(
 
 (lldb) command alias bfl breakpoint set -f %1 -l %2
 
-)" "    Creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \
+)"
+        "    Creates the abbreviation 'bfl' (for break-file-line), with the -f and -l \
 options already part of the alias.  So if the user wants to set a breakpoint \
 by file and line without explicitly having to use the -f and -l options, the \
 user can now use 'bfl' instead.  The '%1' and '%2' are positional placeholders \
@@ -557,18 +467,23 @@ occupies when the alias is used.  All th
 will be replaced with the first argument, all the occurrences of '%2' in the \
 alias will be replaced with the second argument, and so on.  This also allows \
 actual arguments to be used multiple times within an alias (see 'process \
-launch' example below)." R"(
+launch' example below)."
+        R"(
 
-)" "Note: the positional arguments must substitute as whole words in the resultant \
+)"
+        "Note: the positional arguments must substitute as whole words in the resultant \
 command, so you can't at present do something like this to append the file extension \
-\".cpp\":" R"(
+\".cpp\":"
+        R"(
 
 (lldb) command alias bcppfl breakpoint set -f %1.cpp -l %2
 
-)" "For more complex aliasing, use the \"command regex\" command instead.  In the \
+)"
+        "For more complex aliasing, use the \"command regex\" command instead.  In the \
 'bfl' case above, the actual file value will be filled in with the first argument \
 following 'bfl' and the actual line number value will be filled in with the second \
-argument.  The user would use this alias as follows:" R"(
+argument.  The user would use this alias as follows:"
+        R"(
 
 (lldb) command alias bfl breakpoint set -f %1 -l %2
 (lldb) bfl my-file.c 137
@@ -582,343 +497,326 @@ Another example:
 
     Interpreted as 'process launch -s -o /dev/tty0 -e /dev/tty0'
 
-)" "If the user always wanted to pass the same value to a particular option, the \
+)"
+        "If the user always wanted to pass the same value to a particular option, the \
 alias could be defined with that value directly in the alias as a constant, \
-rather than using a positional placeholder:" R"(
+rather than using a positional placeholder:"
+        R"(
 
 (lldb) command alias bl3 breakpoint set -f %1 -l 3
 
-    Always sets a breakpoint on line 3 of whatever file is indicated.)"
-        );
+    Always sets a breakpoint on line 3 of whatever file is indicated.)");
 
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentEntry arg3;
-        CommandArgumentData alias_arg;
-        CommandArgumentData cmd_arg;
-        CommandArgumentData options_arg;
-        
-        // Define the first (and only) variant of this arg.
-        alias_arg.arg_type = eArgTypeAliasName;
-        alias_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (alias_arg);
-        
-        // Define the first (and only) variant of this arg.
-        cmd_arg.arg_type = eArgTypeCommandName;
-        cmd_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (cmd_arg);
-        
-        // Define the first (and only) variant of this arg.
-        options_arg.arg_type = eArgTypeAliasOptions;
-        options_arg.arg_repetition = eArgRepeatOptional;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg3.push_back (options_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-        m_arguments.push_back (arg3);
-    }
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentEntry arg3;
+    CommandArgumentData alias_arg;
+    CommandArgumentData cmd_arg;
+    CommandArgumentData options_arg;
+
+    // Define the first (and only) variant of this arg.
+    alias_arg.arg_type = eArgTypeAliasName;
+    alias_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(alias_arg);
+
+    // Define the first (and only) variant of this arg.
+    cmd_arg.arg_type = eArgTypeCommandName;
+    cmd_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(cmd_arg);
+
+    // Define the first (and only) variant of this arg.
+    options_arg.arg_type = eArgTypeAliasOptions;
+    options_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg3.push_back(options_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+    m_arguments.push_back(arg3);
+  }
 
-    ~CommandObjectCommandsAlias() override = default;
+  ~CommandObjectCommandsAlias() override = default;
 
 protected:
-    bool
-    DoExecute (const char *raw_command_line, CommandReturnObject &result) override
-    {
-        if (!raw_command_line || !raw_command_line[0])
-        {
-            result.AppendError ("'command alias' requires at least two arguments");
-            return false;
-        }
-
-        ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
-        m_option_group.NotifyOptionParsingStarting(&exe_ctx);
-        
-        const char * remainder = nullptr;
-        
-        if (raw_command_line[0] == '-')
-        {
-            // We have some options and these options MUST end with --.
-            const char *end_options = nullptr;
-            const char *s = raw_command_line;
-            while (s && s[0])
-            {
-                end_options = ::strstr (s, "--");
-                if (end_options)
-                {
-                    end_options += 2; // Get past the "--"
-                    if (::isspace (end_options[0]))
-                    {
-                        remainder = end_options;
-                        while (::isspace (*remainder))
-                            ++remainder;
-                        break;
-                    }
-                }
-                s = end_options;
-            }
-            
-            if (end_options)
-            {
-                Args args (llvm::StringRef(raw_command_line, end_options - raw_command_line));
-                if (!ParseOptions (args, result))
-                    return false;
-                
-                Error error (m_option_group.NotifyOptionParsingFinished(&exe_ctx));
-                if (error.Fail())
-                {
-                    result.AppendError (error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
-        }
-        if (nullptr == remainder)
-            remainder = raw_command_line;
-        
-        std::string raw_command_string (remainder);
-        Args args (raw_command_string.c_str());
-        
-        size_t argc = args.GetArgumentCount();
-        
-        if (argc < 2)
-        {
-            result.AppendError ("'command alias' requires at least two arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        // Get the alias command.
-        
-        const std::string alias_command = args.GetArgumentAtIndex (0);
-        if (alias_command.size() > 1 &&
-            alias_command[0] == '-')
-        {
-            result.AppendError("aliases starting with a dash are not supported");
-            if (alias_command == "--help" || alias_command == "--long-help")
-            {
-                result.AppendWarning("if trying to pass options to 'command alias' add a -- at the end of the options");
-            }
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        // Strip the new alias name off 'raw_command_string'  (leave it on args, which gets passed to 'Execute', which
-        // does the stripping itself.
-        size_t pos = raw_command_string.find (alias_command);
-        if (pos == 0)
-        {
-            raw_command_string = raw_command_string.substr (alias_command.size());
-            pos = raw_command_string.find_first_not_of (' ');
-            if ((pos != std::string::npos) && (pos > 0))
-                raw_command_string = raw_command_string.substr (pos);
-        }
-        else
-        {
-            result.AppendError ("Error parsing command string.  No alias created.");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        
-        // Verify that the command is alias-able.
-        if (m_interpreter.CommandExists (alias_command.c_str()))
-        {
-            result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be redefined.\n",
-                                          alias_command.c_str());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        // Get CommandObject that is being aliased. The command name is read from the front of raw_command_string.
-        // raw_command_string is returned with the name of the command object stripped off the front.
-        std::string original_raw_command_string(raw_command_string);
-        CommandObject *cmd_obj = m_interpreter.GetCommandObjectForCommand (raw_command_string);
-        
-        if (!cmd_obj)
-        {
-            result.AppendErrorWithFormat ("invalid command given to 'command alias'. '%s' does not begin with a valid command."
-                                          "  No alias created.", original_raw_command_string.c_str());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        else if (!cmd_obj->WantsRawCommandString ())
-        {
-            // Note that args was initialized with the original command, and has not been updated to this point.
-            // Therefore can we pass it to the version of Execute that does not need/expect raw input in the alias.
-            return HandleAliasingNormalCommand (args, result);
-        }
-        else
-        {
-            return HandleAliasingRawCommand (alias_command, raw_command_string, *cmd_obj, result);
-        }
-        return result.Succeeded();
-    }
-
-    bool
-    HandleAliasingRawCommand (const std::string &alias_command, std::string &raw_command_string, CommandObject &cmd_obj, CommandReturnObject &result)
-    {
-            // Verify & handle any options/arguments passed to the alias command
-            
-            OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector);
-        
-            if (CommandObjectSP cmd_obj_sp = m_interpreter.GetCommandSPExact (cmd_obj.GetCommandName(), false))
-            {
-                if (m_interpreter.AliasExists (alias_command.c_str())
-                    || m_interpreter.UserCommandExists (alias_command.c_str()))
-                {
-                    result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n",
-                                                    alias_command.c_str());
-                }
-                if (CommandAlias *alias = m_interpreter.AddAlias (alias_command.c_str(), cmd_obj_sp, raw_command_string.c_str()))
-                {
-                    if (m_command_options.m_help.OptionWasSet())
-                        alias->SetHelp(m_command_options.m_help.GetCurrentValue());
-                    if (m_command_options.m_long_help.OptionWasSet())
-                        alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                }
-                else
-                {
-                    result.AppendError ("Unable to create requested alias.\n");
-                    result.SetStatus (eReturnStatusFailed);
-                }
-
-            }
-            else
-            {
-                result.AppendError ("Unable to create requested alias.\n");
-                result.SetStatus (eReturnStatusFailed);
-            }
-
-            return result.Succeeded ();
+  bool DoExecute(const char *raw_command_line,
+                 CommandReturnObject &result) override {
+    if (!raw_command_line || !raw_command_line[0]) {
+      result.AppendError("'command alias' requires at least two arguments");
+      return false;
+    }
+
+    ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
+    m_option_group.NotifyOptionParsingStarting(&exe_ctx);
+
+    const char *remainder = nullptr;
+
+    if (raw_command_line[0] == '-') {
+      // We have some options and these options MUST end with --.
+      const char *end_options = nullptr;
+      const char *s = raw_command_line;
+      while (s && s[0]) {
+        end_options = ::strstr(s, "--");
+        if (end_options) {
+          end_options += 2; // Get past the "--"
+          if (::isspace(end_options[0])) {
+            remainder = end_options;
+            while (::isspace(*remainder))
+              ++remainder;
+            break;
+          }
+        }
+        s = end_options;
+      }
+
+      if (end_options) {
+        Args args(
+            llvm::StringRef(raw_command_line, end_options - raw_command_line));
+        if (!ParseOptions(args, result))
+          return false;
+
+        Error error(m_option_group.NotifyOptionParsingFinished(&exe_ctx));
+        if (error.Fail()) {
+          result.AppendError(error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      }
+    }
+    if (nullptr == remainder)
+      remainder = raw_command_line;
+
+    std::string raw_command_string(remainder);
+    Args args(raw_command_string.c_str());
+
+    size_t argc = args.GetArgumentCount();
+
+    if (argc < 2) {
+      result.AppendError("'command alias' requires at least two arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Get the alias command.
+
+    const std::string alias_command = args.GetArgumentAtIndex(0);
+    if (alias_command.size() > 1 && alias_command[0] == '-') {
+      result.AppendError("aliases starting with a dash are not supported");
+      if (alias_command == "--help" || alias_command == "--long-help") {
+        result.AppendWarning("if trying to pass options to 'command alias' add "
+                             "a -- at the end of the options");
+      }
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Strip the new alias name off 'raw_command_string'  (leave it on args,
+    // which gets passed to 'Execute', which
+    // does the stripping itself.
+    size_t pos = raw_command_string.find(alias_command);
+    if (pos == 0) {
+      raw_command_string = raw_command_string.substr(alias_command.size());
+      pos = raw_command_string.find_first_not_of(' ');
+      if ((pos != std::string::npos) && (pos > 0))
+        raw_command_string = raw_command_string.substr(pos);
+    } else {
+      result.AppendError("Error parsing command string.  No alias created.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Verify that the command is alias-able.
+    if (m_interpreter.CommandExists(alias_command.c_str())) {
+      result.AppendErrorWithFormat(
+          "'%s' is a permanent debugger command and cannot be redefined.\n",
+          alias_command.c_str());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Get CommandObject that is being aliased. The command name is read from
+    // the front of raw_command_string.
+    // raw_command_string is returned with the name of the command object
+    // stripped off the front.
+    std::string original_raw_command_string(raw_command_string);
+    CommandObject *cmd_obj =
+        m_interpreter.GetCommandObjectForCommand(raw_command_string);
+
+    if (!cmd_obj) {
+      result.AppendErrorWithFormat("invalid command given to 'command alias'. "
+                                   "'%s' does not begin with a valid command."
+                                   "  No alias created.",
+                                   original_raw_command_string.c_str());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    } else if (!cmd_obj->WantsRawCommandString()) {
+      // Note that args was initialized with the original command, and has not
+      // been updated to this point.
+      // Therefore can we pass it to the version of Execute that does not
+      // need/expect raw input in the alias.
+      return HandleAliasingNormalCommand(args, result);
+    } else {
+      return HandleAliasingRawCommand(alias_command, raw_command_string,
+                                      *cmd_obj, result);
+    }
+    return result.Succeeded();
+  }
+
+  bool HandleAliasingRawCommand(const std::string &alias_command,
+                                std::string &raw_command_string,
+                                CommandObject &cmd_obj,
+                                CommandReturnObject &result) {
+    // Verify & handle any options/arguments passed to the alias command
+
+    OptionArgVectorSP option_arg_vector_sp =
+        OptionArgVectorSP(new OptionArgVector);
+
+    if (CommandObjectSP cmd_obj_sp =
+            m_interpreter.GetCommandSPExact(cmd_obj.GetCommandName(), false)) {
+      if (m_interpreter.AliasExists(alias_command.c_str()) ||
+          m_interpreter.UserCommandExists(alias_command.c_str())) {
+        result.AppendWarningWithFormat(
+            "Overwriting existing definition for '%s'.\n",
+            alias_command.c_str());
+      }
+      if (CommandAlias *alias = m_interpreter.AddAlias(
+              alias_command.c_str(), cmd_obj_sp, raw_command_string.c_str())) {
+        if (m_command_options.m_help.OptionWasSet())
+          alias->SetHelp(m_command_options.m_help.GetCurrentValue());
+        if (m_command_options.m_long_help.OptionWasSet())
+          alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        result.AppendError("Unable to create requested alias.\n");
+        result.SetStatus(eReturnStatusFailed);
+      }
+
+    } else {
+      result.AppendError("Unable to create requested alias.\n");
+      result.SetStatus(eReturnStatusFailed);
+    }
+
+    return result.Succeeded();
+  }
+
+  bool HandleAliasingNormalCommand(Args &args, CommandReturnObject &result) {
+    size_t argc = args.GetArgumentCount();
+
+    if (argc < 2) {
+      result.AppendError("'command alias' requires at least two arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const std::string alias_command = args.GetArgumentAtIndex(0);
+    const std::string actual_command = args.GetArgumentAtIndex(1);
+
+    args.Shift(); // Shift the alias command word off the argument vector.
+    args.Shift(); // Shift the old command word off the argument vector.
+
+    // Verify that the command is alias'able, and get the appropriate command
+    // object.
+
+    if (m_interpreter.CommandExists(alias_command.c_str())) {
+      result.AppendErrorWithFormat(
+          "'%s' is a permanent debugger command and cannot be redefined.\n",
+          alias_command.c_str());
+      result.SetStatus(eReturnStatusFailed);
+    } else {
+      CommandObjectSP command_obj_sp(
+          m_interpreter.GetCommandSPExact(actual_command.c_str(), true));
+      CommandObjectSP subcommand_obj_sp;
+      bool use_subcommand = false;
+      if (command_obj_sp) {
+        CommandObject *cmd_obj = command_obj_sp.get();
+        CommandObject *sub_cmd_obj = nullptr;
+        OptionArgVectorSP option_arg_vector_sp =
+            OptionArgVectorSP(new OptionArgVector);
+
+        while (cmd_obj->IsMultiwordObject() && args.GetArgumentCount() > 0) {
+          if (argc >= 3) {
+            const std::string sub_command = args.GetArgumentAtIndex(0);
+            assert(sub_command.length() != 0);
+            subcommand_obj_sp = cmd_obj->GetSubcommandSP(sub_command.c_str());
+            if (subcommand_obj_sp) {
+              sub_cmd_obj = subcommand_obj_sp.get();
+              use_subcommand = true;
+              args.Shift(); // Shift the sub_command word off the argument
+                            // vector.
+              cmd_obj = sub_cmd_obj;
+            } else {
+              result.AppendErrorWithFormat(
+                  "'%s' is not a valid sub-command of '%s'.  "
+                  "Unable to create alias.\n",
+                  sub_command.c_str(), actual_command.c_str());
+              result.SetStatus(eReturnStatusFailed);
+              return false;
+            }
+          }
+        }
+
+        // Verify & handle any options/arguments passed to the alias command
+
+        std::string args_string;
+
+        if (args.GetArgumentCount() > 0) {
+          CommandObjectSP tmp_sp =
+              m_interpreter.GetCommandSPExact(cmd_obj->GetCommandName(), false);
+          if (use_subcommand)
+            tmp_sp = m_interpreter.GetCommandSPExact(
+                sub_cmd_obj->GetCommandName(), false);
+
+          args.GetCommandString(args_string);
+        }
+
+        if (m_interpreter.AliasExists(alias_command.c_str()) ||
+            m_interpreter.UserCommandExists(alias_command.c_str())) {
+          result.AppendWarningWithFormat(
+              "Overwriting existing definition for '%s'.\n",
+              alias_command.c_str());
+        }
+
+        if (CommandAlias *alias = m_interpreter.AddAlias(
+                alias_command.c_str(),
+                use_subcommand ? subcommand_obj_sp : command_obj_sp,
+                args_string.c_str())) {
+          if (m_command_options.m_help.OptionWasSet())
+            alias->SetHelp(m_command_options.m_help.GetCurrentValue());
+          if (m_command_options.m_long_help.OptionWasSet())
+            alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else {
+          result.AppendError("Unable to create requested alias.\n");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      } else {
+        result.AppendErrorWithFormat("'%s' is not an existing command.\n",
+                                     actual_command.c_str());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
     }
-    
-    bool
-    HandleAliasingNormalCommand (Args& args, CommandReturnObject &result)
-    {
-        size_t argc = args.GetArgumentCount();
-
-        if (argc < 2)
-        {
-            result.AppendError ("'command alias' requires at least two arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
 
-        const std::string alias_command = args.GetArgumentAtIndex(0);
-        const std::string actual_command = args.GetArgumentAtIndex(1);
-
-        args.Shift();  // Shift the alias command word off the argument vector.
-        args.Shift();  // Shift the old command word off the argument vector.
-
-        // Verify that the command is alias'able, and get the appropriate command object.
-
-        if (m_interpreter.CommandExists (alias_command.c_str()))
-        {
-            result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be redefined.\n",
-                                         alias_command.c_str());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        else
-        {
-             CommandObjectSP command_obj_sp(m_interpreter.GetCommandSPExact (actual_command.c_str(), true));
-             CommandObjectSP subcommand_obj_sp;
-             bool use_subcommand = false;
-             if (command_obj_sp)
-             {
-                 CommandObject *cmd_obj = command_obj_sp.get();
-                 CommandObject *sub_cmd_obj = nullptr;
-                 OptionArgVectorSP option_arg_vector_sp = OptionArgVectorSP (new OptionArgVector);
-
-                 while (cmd_obj->IsMultiwordObject() && args.GetArgumentCount() > 0)
-                 {
-                     if (argc >= 3)
-                     {
-                         const std::string sub_command = args.GetArgumentAtIndex(0);
-                         assert (sub_command.length() != 0);
-                         subcommand_obj_sp = cmd_obj->GetSubcommandSP (sub_command.c_str());
-                         if (subcommand_obj_sp)
-                         {
-                             sub_cmd_obj = subcommand_obj_sp.get();
-                             use_subcommand = true;
-                             args.Shift();  // Shift the sub_command word off the argument vector.
-                             cmd_obj = sub_cmd_obj;
-                         }
-                         else
-                         {
-                             result.AppendErrorWithFormat("'%s' is not a valid sub-command of '%s'.  "
-                                                          "Unable to create alias.\n",
-                                                          sub_command.c_str(), actual_command.c_str());
-                             result.SetStatus (eReturnStatusFailed);
-                             return false;
-                         }
-                     }
-                 }
-
-                 // Verify & handle any options/arguments passed to the alias command
-
-                 std::string args_string;
-                 
-                 if (args.GetArgumentCount () > 0)
-                 {
-                    CommandObjectSP tmp_sp = m_interpreter.GetCommandSPExact (cmd_obj->GetCommandName(), false);
-                    if (use_subcommand)
-                        tmp_sp = m_interpreter.GetCommandSPExact (sub_cmd_obj->GetCommandName(), false);
-                        
-                    args.GetCommandString (args_string);
-                 }
-                 
-                 if (m_interpreter.AliasExists (alias_command.c_str())
-                     || m_interpreter.UserCommandExists (alias_command.c_str()))
-                 {
-                     result.AppendWarningWithFormat ("Overwriting existing definition for '%s'.\n",
-                                                     alias_command.c_str());
-                 }
-                 
-                 if (CommandAlias *alias = m_interpreter.AddAlias(alias_command.c_str(),
-                                                                  use_subcommand ? subcommand_obj_sp : command_obj_sp,
-                                                                  args_string.c_str()))
-                 {
-                     if (m_command_options.m_help.OptionWasSet())
-                         alias->SetHelp(m_command_options.m_help.GetCurrentValue());
-                     if (m_command_options.m_long_help.OptionWasSet())
-                         alias->SetHelpLong(m_command_options.m_long_help.GetCurrentValue());
-                     result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                 }
-                 else
-                 {
-                     result.AppendError ("Unable to create requested alias.\n");
-                     result.SetStatus (eReturnStatusFailed);
-                     return false;
-                 }
-             }
-             else
-             {
-                 result.AppendErrorWithFormat ("'%s' is not an existing command.\n", actual_command.c_str());
-                 result.SetStatus (eReturnStatusFailed);
-                 return false;
-             }
-        }
-
-        return result.Succeeded();
-    }
+    return result.Succeeded();
+  }
 };
 
-OptionDefinition
-CommandObjectCommandsAlias::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectCommandsAlias::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "help",      'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Help text for this command"},
   {LLDB_OPT_SET_ALL, false, "long-help", 'H', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeHelpText, "Long help text for this command"},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 #pragma mark CommandObjectCommandsUnalias
@@ -926,87 +824,78 @@ CommandObjectCommandsAlias::CommandOptio
 // CommandObjectCommandsUnalias
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsUnalias : public CommandObjectParsed
-{
+class CommandObjectCommandsUnalias : public CommandObjectParsed {
 public:
-    CommandObjectCommandsUnalias(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "command unalias",
-                              "Delete one or more custom commands defined by 'command alias'.", nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData alias_arg;
-        
-        // Define the first (and only) variant of this arg.
-        alias_arg.arg_type = eArgTypeAliasName;
-        alias_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (alias_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  CommandObjectCommandsUnalias(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "command unalias",
+            "Delete one or more custom commands defined by 'command alias'.",
+            nullptr) {
+    CommandArgumentEntry arg;
+    CommandArgumentData alias_arg;
+
+    // Define the first (and only) variant of this arg.
+    alias_arg.arg_type = eArgTypeAliasName;
+    alias_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(alias_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectCommandsUnalias() override = default;
+  ~CommandObjectCommandsUnalias() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        CommandObject::CommandMap::iterator pos;
-        CommandObject *cmd_obj;
-
-        if (args.GetArgumentCount() != 0)
-        {
-            const char *command_name = args.GetArgumentAtIndex(0);
-            cmd_obj = m_interpreter.GetCommandObject(command_name);
-            if (cmd_obj)
-            {
-                if (m_interpreter.CommandExists (command_name))
-                {
-                    if (cmd_obj->IsRemovable())
-                    {
-                        result.AppendErrorWithFormat ("'%s' is not an alias, it is a debugger command which can be removed using the 'command delete' command.\n",
-                                                      command_name);
-                    }
-                    else
-                    {
-                        result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n",
-                                                      command_name);
-                    }
-                    result.SetStatus (eReturnStatusFailed);
-                }
-                else
-                {
-                    if (!m_interpreter.RemoveAlias(command_name))
-                    {
-                        if (m_interpreter.AliasExists (command_name))
-                            result.AppendErrorWithFormat ("Error occurred while attempting to unalias '%s'.\n", 
-                                                          command_name);
-                        else
-                            result.AppendErrorWithFormat ("'%s' is not an existing alias.\n", command_name);
-                        result.SetStatus (eReturnStatusFailed);
-                    }
-                    else
-                        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                }
-            }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    CommandObject::CommandMap::iterator pos;
+    CommandObject *cmd_obj;
+
+    if (args.GetArgumentCount() != 0) {
+      const char *command_name = args.GetArgumentAtIndex(0);
+      cmd_obj = m_interpreter.GetCommandObject(command_name);
+      if (cmd_obj) {
+        if (m_interpreter.CommandExists(command_name)) {
+          if (cmd_obj->IsRemovable()) {
+            result.AppendErrorWithFormat(
+                "'%s' is not an alias, it is a debugger command which can be "
+                "removed using the 'command delete' command.\n",
+                command_name);
+          } else {
+            result.AppendErrorWithFormat(
+                "'%s' is a permanent debugger command and cannot be removed.\n",
+                command_name);
+          }
+          result.SetStatus(eReturnStatusFailed);
+        } else {
+          if (!m_interpreter.RemoveAlias(command_name)) {
+            if (m_interpreter.AliasExists(command_name))
+              result.AppendErrorWithFormat(
+                  "Error occurred while attempting to unalias '%s'.\n",
+                  command_name);
             else
-            {
-                result.AppendErrorWithFormat ("'%s' is not a known command.\nTry 'help' to see a "
-                                              "current list of commands.\n",
-                                             command_name);
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("must call 'unalias' with a valid alias");
-            result.SetStatus (eReturnStatusFailed);
+              result.AppendErrorWithFormat("'%s' is not an existing alias.\n",
+                                           command_name);
+            result.SetStatus(eReturnStatusFailed);
+          } else
+            result.SetStatus(eReturnStatusSuccessFinishNoResult);
         }
-
-        return result.Succeeded();
+      } else {
+        result.AppendErrorWithFormat(
+            "'%s' is not a known command.\nTry 'help' to see a "
+            "current list of commands.\n",
+            command_name);
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("must call 'unalias' with a valid alias");
+      result.SetStatus(eReturnStatusFailed);
     }
+
+    return result.Succeeded();
+  }
 };
 
 #pragma mark CommandObjectCommandsDelete
@@ -1014,76 +903,64 @@ protected:
 // CommandObjectCommandsDelete
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsDelete : public CommandObjectParsed
-{
+class CommandObjectCommandsDelete : public CommandObjectParsed {
 public:
-    CommandObjectCommandsDelete(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "command delete",
-                              "Delete one or more custom commands defined by 'command regex'.", nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData alias_arg;
+  CommandObjectCommandsDelete(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "command delete",
+            "Delete one or more custom commands defined by 'command regex'.",
+            nullptr) {
+    CommandArgumentEntry arg;
+    CommandArgumentData alias_arg;
+
+    // Define the first (and only) variant of this arg.
+    alias_arg.arg_type = eArgTypeCommandName;
+    alias_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(alias_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-        // Define the first (and only) variant of this arg.
-        alias_arg.arg_type = eArgTypeCommandName;
-        alias_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (alias_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectCommandsDelete() override = default;
+  ~CommandObjectCommandsDelete() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        CommandObject::CommandMap::iterator pos;
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    CommandObject::CommandMap::iterator pos;
 
-        if (args.GetArgumentCount() != 0)
-        {
-            const char *command_name = args.GetArgumentAtIndex(0);
-            if (m_interpreter.CommandExists (command_name))
-            {
-                if (m_interpreter.RemoveCommand (command_name))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("'%s' is a permanent debugger command and cannot be removed.\n",
-                                                  command_name);
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            else
-            {
-                StreamString error_msg_stream;
-                const bool generate_apropos = true;
-                const bool generate_type_lookup = false;
-                CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
-                                                                        command_name,
-                                                                        nullptr,
-                                                                        nullptr,
-                                                                        generate_apropos,
-                                                                        generate_type_lookup);
-                result.AppendErrorWithFormat ("%s", error_msg_stream.GetData());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat(
-                "must call '%s' with one or more valid user defined regular expression command names",
-                GetCommandName());
-            result.SetStatus (eReturnStatusFailed);
-        }
-
-        return result.Succeeded();
+    if (args.GetArgumentCount() != 0) {
+      const char *command_name = args.GetArgumentAtIndex(0);
+      if (m_interpreter.CommandExists(command_name)) {
+        if (m_interpreter.RemoveCommand(command_name)) {
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else {
+          result.AppendErrorWithFormat(
+              "'%s' is a permanent debugger command and cannot be removed.\n",
+              command_name);
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        StreamString error_msg_stream;
+        const bool generate_apropos = true;
+        const bool generate_type_lookup = false;
+        CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(
+            &error_msg_stream, command_name, nullptr, nullptr, generate_apropos,
+            generate_type_lookup);
+        result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendErrorWithFormat("must call '%s' with one or more valid user "
+                                   "defined regular expression command names",
+                                   GetCommandName());
+      result.SetStatus(eReturnStatusFailed);
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1091,1181 +968,967 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectCommandsAddRegex
 
-class CommandObjectCommandsAddRegex :
-    public CommandObjectParsed,
-    public IOHandlerDelegateMultiline
-{
+class CommandObjectCommandsAddRegex : public CommandObjectParsed,
+                                      public IOHandlerDelegateMultiline {
 public:
-    CommandObjectCommandsAddRegex(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "command regex",
-                              "Define a custom command in terms of existing commands by matching regular expressions.",
-                              "command regex <cmd-name> [s/<regex>/<subst>/ ...]"),
-          IOHandlerDelegateMultiline("", IOHandlerDelegate::Completion::LLDBCommand),
-          m_options()
-    {
-        SetHelpLong(R"(
-)" "This command allows the user to create powerful regular expression commands \
+  CommandObjectCommandsAddRegex(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "command regex", "Define a custom command in terms of "
+                                          "existing commands by matching "
+                                          "regular expressions.",
+            "command regex <cmd-name> [s/<regex>/<subst>/ ...]"),
+        IOHandlerDelegateMultiline("",
+                                   IOHandlerDelegate::Completion::LLDBCommand),
+        m_options() {
+    SetHelpLong(
+        R"(
+)"
+        "This command allows the user to create powerful regular expression commands \
 with substitutions. The regular expressions and substitutions are specified \
-using the regular expression substitution format of:" R"(
+using the regular expression substitution format of:"
+        R"(
 
     s/<regex>/<subst>/
 
-)" "<regex> is a regular expression that can use parenthesis to capture regular \
+)"
+        "<regex> is a regular expression that can use parenthesis to capture regular \
 expression input and substitute the captured matches in the output using %1 \
-for the first match, %2 for the second, and so on." R"(
+for the first match, %2 for the second, and so on."
+        R"(
 
-)" "The regular expressions can all be specified on the command line if more than \
+)"
+        "The regular expressions can all be specified on the command line if more than \
 one argument is provided. If just the command name is provided on the command \
 line, then the regular expressions and substitutions can be entered on separate \
-lines, followed by an empty line to terminate the command definition." R"(
+lines, followed by an empty line to terminate the command definition."
+        R"(
 
 EXAMPLES
 
-)" "The following example will define a regular expression command named 'f' that \
+)"
+        "The following example will define a regular expression command named 'f' that \
 will call 'finish' if there are no arguments, or 'frame select <frame-idx>' if \
-a number follows 'f':" R"(
+a number follows 'f':"
+        R"(
 
-    (lldb) command regex f s/^$/finish/ 's/([0-9]+)/frame select %1/')"
-        );
-    }
+    (lldb) command regex f s/^$/finish/ 's/([0-9]+)/frame select %1/')");
+  }
 
-    ~CommandObjectCommandsAddRegex() override = default;
+  ~CommandObjectCommandsAddRegex() override = default;
 
 protected:
-    void
-    IOHandlerActivated (IOHandler &io_handler) override
-    {
-        StreamFileSP output_sp(io_handler.GetOutputStreamFile());
-        if (output_sp)
-        {
-            output_sp->PutCString("Enter one of more sed substitution commands in the form: 's/<regex>/<subst>/'.\nTerminate the substitution list with an empty line.\n");
-            output_sp->Flush();
-        }
+  void IOHandlerActivated(IOHandler &io_handler) override {
+    StreamFileSP output_sp(io_handler.GetOutputStreamFile());
+    if (output_sp) {
+      output_sp->PutCString("Enter one of more sed substitution commands in "
+                            "the form: 's/<regex>/<subst>/'.\nTerminate the "
+                            "substitution list with an empty line.\n");
+      output_sp->Flush();
+    }
+  }
+
+  void IOHandlerInputComplete(IOHandler &io_handler,
+                              std::string &data) override {
+    io_handler.SetIsDone(true);
+    if (m_regex_cmd_ap) {
+      StringList lines;
+      if (lines.SplitIntoLines(data)) {
+        const size_t num_lines = lines.GetSize();
+        bool check_only = false;
+        for (size_t i = 0; i < num_lines; ++i) {
+          llvm::StringRef bytes_strref(lines[i]);
+          Error error = AppendRegexSubstitution(bytes_strref, check_only);
+          if (error.Fail()) {
+            if (!m_interpreter.GetDebugger()
+                     .GetCommandInterpreter()
+                     .GetBatchCommandMode()) {
+              StreamSP out_stream =
+                  m_interpreter.GetDebugger().GetAsyncOutputStream();
+              out_stream->Printf("error: %s\n", error.AsCString());
+            }
+          }
+        }
+      }
+      if (m_regex_cmd_ap->HasRegexEntries()) {
+        CommandObjectSP cmd_sp(m_regex_cmd_ap.release());
+        m_interpreter.AddCommand(cmd_sp->GetCommandName(), cmd_sp, true);
+      }
+    }
+  }
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    const size_t argc = command.GetArgumentCount();
+    if (argc == 0) {
+      result.AppendError("usage: 'command regex <command-name> "
+                         "[s/<regex1>/<subst1>/ s/<regex2>/<subst2>/ ...]'\n");
+      result.SetStatus(eReturnStatusFailed);
+    } else {
+      Error error;
+      const char *name = command.GetArgumentAtIndex(0);
+      m_regex_cmd_ap.reset(new CommandObjectRegexCommand(
+          m_interpreter, name, m_options.GetHelp(), m_options.GetSyntax(), 10,
+          0, true));
+
+      if (argc == 1) {
+        Debugger &debugger = m_interpreter.GetDebugger();
+        bool color_prompt = debugger.GetUseColor();
+        const bool multiple_lines = true; // Get multiple lines
+        IOHandlerSP io_handler_sp(new IOHandlerEditline(
+            debugger, IOHandler::Type::Other,
+            "lldb-regex", // Name of input reader for history
+            "> ",         // Prompt
+            nullptr,      // Continuation prompt
+            multiple_lines, color_prompt,
+            0, // Don't show line numbers
+            *this));
+
+        if (io_handler_sp) {
+          debugger.PushIOHandler(io_handler_sp);
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        }
+      } else {
+        for (size_t arg_idx = 1; arg_idx < argc; ++arg_idx) {
+          llvm::StringRef arg_strref(command.GetArgumentAtIndex(arg_idx));
+          bool check_only = false;
+          error = AppendRegexSubstitution(arg_strref, check_only);
+          if (error.Fail())
+            break;
+        }
+
+        if (error.Success()) {
+          AddRegexCommandToInterpreter();
+        }
+      }
+      if (error.Fail()) {
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    }
+
+    return result.Succeeded();
+  }
+
+  Error AppendRegexSubstitution(const llvm::StringRef &regex_sed,
+                                bool check_only) {
+    Error error;
+
+    if (!m_regex_cmd_ap) {
+      error.SetErrorStringWithFormat(
+          "invalid regular expression command object for: '%.*s'",
+          (int)regex_sed.size(), regex_sed.data());
+      return error;
+    }
+
+    size_t regex_sed_size = regex_sed.size();
+
+    if (regex_sed_size <= 1) {
+      error.SetErrorStringWithFormat(
+          "regular expression substitution string is too short: '%.*s'",
+          (int)regex_sed.size(), regex_sed.data());
+      return error;
+    }
+
+    if (regex_sed[0] != 's') {
+      error.SetErrorStringWithFormat("regular expression substitution string "
+                                     "doesn't start with 's': '%.*s'",
+                                     (int)regex_sed.size(), regex_sed.data());
+      return error;
+    }
+    const size_t first_separator_char_pos = 1;
+    // use the char that follows 's' as the regex separator character
+    // so we can have "s/<regex>/<subst>/" or "s|<regex>|<subst>|"
+    const char separator_char = regex_sed[first_separator_char_pos];
+    const size_t second_separator_char_pos =
+        regex_sed.find(separator_char, first_separator_char_pos + 1);
+
+    if (second_separator_char_pos == std::string::npos) {
+      error.SetErrorStringWithFormat(
+          "missing second '%c' separator char after '%.*s' in '%.*s'",
+          separator_char,
+          (int)(regex_sed.size() - first_separator_char_pos - 1),
+          regex_sed.data() + (first_separator_char_pos + 1),
+          (int)regex_sed.size(), regex_sed.data());
+      return error;
+    }
+
+    const size_t third_separator_char_pos =
+        regex_sed.find(separator_char, second_separator_char_pos + 1);
+
+    if (third_separator_char_pos == std::string::npos) {
+      error.SetErrorStringWithFormat(
+          "missing third '%c' separator char after '%.*s' in '%.*s'",
+          separator_char,
+          (int)(regex_sed.size() - second_separator_char_pos - 1),
+          regex_sed.data() + (second_separator_char_pos + 1),
+          (int)regex_sed.size(), regex_sed.data());
+      return error;
+    }
+
+    if (third_separator_char_pos != regex_sed_size - 1) {
+      // Make sure that everything that follows the last regex
+      // separator char
+      if (regex_sed.find_first_not_of("\t\n\v\f\r ",
+                                      third_separator_char_pos + 1) !=
+          std::string::npos) {
+        error.SetErrorStringWithFormat(
+            "extra data found after the '%.*s' regular expression substitution "
+            "string: '%.*s'",
+            (int)third_separator_char_pos + 1, regex_sed.data(),
+            (int)(regex_sed.size() - third_separator_char_pos - 1),
+            regex_sed.data() + (third_separator_char_pos + 1));
+        return error;
+      }
+    } else if (first_separator_char_pos + 1 == second_separator_char_pos) {
+      error.SetErrorStringWithFormat(
+          "<regex> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
+          separator_char, separator_char, separator_char, (int)regex_sed.size(),
+          regex_sed.data());
+      return error;
+    } else if (second_separator_char_pos + 1 == third_separator_char_pos) {
+      error.SetErrorStringWithFormat(
+          "<subst> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",
+          separator_char, separator_char, separator_char, (int)regex_sed.size(),
+          regex_sed.data());
+      return error;
+    }
+
+    if (!check_only) {
+      std::string regex(regex_sed.substr(first_separator_char_pos + 1,
+                                         second_separator_char_pos -
+                                             first_separator_char_pos - 1));
+      std::string subst(regex_sed.substr(second_separator_char_pos + 1,
+                                         third_separator_char_pos -
+                                             second_separator_char_pos - 1));
+      m_regex_cmd_ap->AddRegexCommand(regex.c_str(), subst.c_str());
+    }
+    return error;
+  }
+
+  void AddRegexCommandToInterpreter() {
+    if (m_regex_cmd_ap) {
+      if (m_regex_cmd_ap->HasRegexEntries()) {
+        CommandObjectSP cmd_sp(m_regex_cmd_ap.release());
+        m_interpreter.AddCommand(cmd_sp->GetCommandName(), cmd_sp, true);
+      }
     }
+  }
 
-    void
-    IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override
-    {
-        io_handler.SetIsDone(true);
-        if (m_regex_cmd_ap)
-        {
-            StringList lines;
-            if (lines.SplitIntoLines (data))
-            {
-                const size_t num_lines = lines.GetSize();
-                bool check_only = false;
-                for (size_t i=0; i<num_lines; ++i)
-                {
-                    llvm::StringRef bytes_strref (lines[i]);
-                    Error error = AppendRegexSubstitution (bytes_strref, check_only);
-                    if (error.Fail())
-                    {
-                        if (!m_interpreter.GetDebugger().GetCommandInterpreter().GetBatchCommandMode())
-                        {
-                            StreamSP out_stream = m_interpreter.GetDebugger().GetAsyncOutputStream();
-                            out_stream->Printf("error: %s\n", error.AsCString());
-                        }
-                    }
-                }
-            }
-            if (m_regex_cmd_ap->HasRegexEntries())
-            {
-                CommandObjectSP cmd_sp (m_regex_cmd_ap.release());
-                m_interpreter.AddCommand(cmd_sp->GetCommandName(), cmd_sp, true);
-            }
-        }
-    }
+private:
+  std::unique_ptr<CommandObjectRegexCommand> m_regex_cmd_ap;
 
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        const size_t argc = command.GetArgumentCount();
-        if (argc == 0)
-        {
-            result.AppendError ("usage: 'command regex <command-name> [s/<regex1>/<subst1>/ s/<regex2>/<subst2>/ ...]'\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        else
-        {   
-            Error error;
-            const char *name = command.GetArgumentAtIndex(0);
-            m_regex_cmd_ap.reset (new CommandObjectRegexCommand (m_interpreter, 
-                                                                 name, 
-                                                                 m_options.GetHelp (),
-                                                                 m_options.GetSyntax (),
-                                                                 10,
-                                                                 0,
-                                                                 true));
-
-            if (argc == 1)
-            {
-                Debugger &debugger = m_interpreter.GetDebugger();
-                bool color_prompt = debugger.GetUseColor();
-                const bool multiple_lines = true; // Get multiple lines
-                IOHandlerSP io_handler_sp(new IOHandlerEditline(debugger,
-                                                                IOHandler::Type::Other,
-                                                                "lldb-regex", // Name of input reader for history
-                                                                "> ",         // Prompt
-                                                                nullptr,      // Continuation prompt
-                                                                multiple_lines,
-                                                                color_prompt,
-                                                                0,            // Don't show line numbers
-                                                                *this));
-                
-                if (io_handler_sp)
-                {
-                    debugger.PushIOHandler(io_handler_sp);
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                }
-            }
-            else
-            {
-                for (size_t arg_idx = 1; arg_idx < argc; ++arg_idx)
-                {
-                    llvm::StringRef arg_strref (command.GetArgumentAtIndex(arg_idx));
-                    bool check_only = false;
-                    error = AppendRegexSubstitution (arg_strref, check_only);
-                    if (error.Fail())
-                        break;
-                }
-                
-                if (error.Success())
-                {
-                    AddRegexCommandToInterpreter();
-                }
-            }
-            if (error.Fail())
-            {
-                result.AppendError (error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
 
-        return result.Succeeded();
+      switch (short_option) {
+      case 'h':
+        m_help.assign(option_arg);
+        break;
+      case 's':
+        m_syntax.assign(option_arg);
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
     }
-    
-    Error
-    AppendRegexSubstitution (const llvm::StringRef &regex_sed, bool check_only)
-    {
-        Error error;
-        
-        if (!m_regex_cmd_ap)
-        {
-            error.SetErrorStringWithFormat("invalid regular expression command object for: '%.*s'", 
-                                           (int)regex_sed.size(), 
-                                           regex_sed.data());
-            return error;
-        }
-    
-        size_t regex_sed_size = regex_sed.size();
-        
-        if (regex_sed_size <= 1)
-        {
-            error.SetErrorStringWithFormat("regular expression substitution string is too short: '%.*s'", 
-                                           (int)regex_sed.size(), 
-                                           regex_sed.data());
-            return error;
-        }
 
-        if (regex_sed[0] != 's')
-        {
-            error.SetErrorStringWithFormat("regular expression substitution string doesn't start with 's': '%.*s'", 
-                                           (int)regex_sed.size(), 
-                                           regex_sed.data());
-            return error;
-        }
-        const size_t first_separator_char_pos = 1;
-        // use the char that follows 's' as the regex separator character
-        // so we can have "s/<regex>/<subst>/" or "s|<regex>|<subst>|"
-        const char separator_char = regex_sed[first_separator_char_pos];
-        const size_t second_separator_char_pos = regex_sed.find (separator_char, first_separator_char_pos + 1);
-        
-        if (second_separator_char_pos == std::string::npos)
-        {
-            error.SetErrorStringWithFormat("missing second '%c' separator char after '%.*s' in '%.*s'",
-                                           separator_char, 
-                                           (int)(regex_sed.size() - first_separator_char_pos - 1),
-                                           regex_sed.data() + (first_separator_char_pos + 1),
-                                           (int)regex_sed.size(),
-                                           regex_sed.data());
-            return error;
-        }
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_help.clear();
+      m_syntax.clear();
+    }
 
-        const size_t third_separator_char_pos = regex_sed.find (separator_char, second_separator_char_pos + 1);
-        
-        if (third_separator_char_pos == std::string::npos)
-        {
-            error.SetErrorStringWithFormat("missing third '%c' separator char after '%.*s' in '%.*s'",
-                                           separator_char, 
-                                           (int)(regex_sed.size() - second_separator_char_pos - 1),
-                                           regex_sed.data() + (second_separator_char_pos + 1),
-                                           (int)regex_sed.size(),
-                                           regex_sed.data());
-            return error;            
-        }
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        if (third_separator_char_pos != regex_sed_size - 1)
-        {
-            // Make sure that everything that follows the last regex 
-            // separator char 
-            if (regex_sed.find_first_not_of("\t\n\v\f\r ", third_separator_char_pos + 1) != std::string::npos)
-            {
-                error.SetErrorStringWithFormat("extra data found after the '%.*s' regular expression substitution string: '%.*s'", 
-                                               (int)third_separator_char_pos + 1,
-                                               regex_sed.data(),
-                                               (int)(regex_sed.size() - third_separator_char_pos - 1),
-                                               regex_sed.data() + (third_separator_char_pos + 1));
-                return error;
-            }
-        }
-        else if (first_separator_char_pos + 1 == second_separator_char_pos)
-        {
-            error.SetErrorStringWithFormat("<regex> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",  
-                                           separator_char,
-                                           separator_char,
-                                           separator_char,
-                                           (int)regex_sed.size(), 
-                                           regex_sed.data());
-            return error;            
-        }
-        else if (second_separator_char_pos + 1 == third_separator_char_pos)
-        {
-            error.SetErrorStringWithFormat("<subst> can't be empty in 's%c<regex>%c<subst>%c' string: '%.*s'",   
-                                           separator_char,
-                                           separator_char,
-                                           separator_char,
-                                           (int)regex_sed.size(), 
-                                           regex_sed.data());
-            return error;            
-        }
+    // Options table: Required for subclasses of Options.
 
-        if (!check_only)
-        {
-            std::string regex(regex_sed.substr(first_separator_char_pos + 1, second_separator_char_pos - first_separator_char_pos - 1));
-            std::string subst(regex_sed.substr(second_separator_char_pos + 1, third_separator_char_pos - second_separator_char_pos - 1));
-            m_regex_cmd_ap->AddRegexCommand (regex.c_str(),
-                                             subst.c_str());
-        }
-        return error;
+    static OptionDefinition g_option_table[];
+
+    const char *GetHelp() {
+      return (m_help.empty() ? nullptr : m_help.c_str());
     }
-    
-    void
-    AddRegexCommandToInterpreter()
-    {
-        if (m_regex_cmd_ap)
-        {
-            if (m_regex_cmd_ap->HasRegexEntries())
-            {
-                CommandObjectSP cmd_sp (m_regex_cmd_ap.release());
-                m_interpreter.AddCommand(cmd_sp->GetCommandName(), cmd_sp, true);
-            }
-        }
+
+    const char *GetSyntax() {
+      return (m_syntax.empty() ? nullptr : m_syntax.c_str());
     }
 
-private:
-    std::unique_ptr<CommandObjectRegexCommand> m_regex_cmd_ap;
+  protected:
+    // Instance variables to hold the values for command options.
+
+    std::string m_help;
+    std::string m_syntax;
+  };
 
-     class CommandOptions : public Options
-     {
-     public:
-         CommandOptions() :
-            Options()
-         {
-         }
-
-         ~CommandOptions() override = default;
-
-         Error
-         SetOptionValue (uint32_t option_idx, const char *option_arg,
-                         ExecutionContext *execution_context) override
-         {
-             Error error;
-             const int short_option = m_getopt_table[option_idx].val;
-             
-             switch (short_option)
-             {
-                 case 'h':
-                     m_help.assign (option_arg);
-                     break;
-                 case 's':
-                     m_syntax.assign (option_arg);
-                     break;
-                 default:
-                     error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                     break;
-             }
-             
-             return error;
-         }
-         
-         void
-         OptionParsingStarting (ExecutionContext *execution_context) override
-         {
-             m_help.clear();
-             m_syntax.clear();
-         }
-         
-         const OptionDefinition*
-         GetDefinitions () override
-         {
-             return g_option_table;
-         }
-         
-         // Options table: Required for subclasses of Options.
-         
-         static OptionDefinition g_option_table[];
-         
-         const char *
-         GetHelp()
-         {
-             return (m_help.empty() ? nullptr : m_help.c_str());
-         }
-
-         const char *
-         GetSyntax ()
-         {
-             return (m_syntax.empty() ? nullptr : m_syntax.c_str());
-         }
-
-     protected:
-         // Instance variables to hold the values for command options.
-
-         std::string m_help;
-         std::string m_syntax;
-     };
-          
-     Options *
-     GetOptions () override
-     {
-         return &m_options;
-     }
-     
-     CommandOptions m_options;
+  Options *GetOptions() override { return &m_options; }
+
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectCommandsAddRegex::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectCommandsAddRegex::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "help"  , 'h', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "The help text to display for this command."},
   {LLDB_OPT_SET_1, false, "syntax", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNone, "A syntax string showing the typical usage syntax."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
-class CommandObjectPythonFunction : public CommandObjectRaw
-{
+class CommandObjectPythonFunction : public CommandObjectRaw {
 public:
-    CommandObjectPythonFunction (CommandInterpreter &interpreter,
-                                 std::string name,
-                                 std::string funct,
-                                 std::string help,
-                                 ScriptedCommandSynchronicity synch) :
-        CommandObjectRaw(interpreter,
-                         name.c_str(),
-                         nullptr,
-                         nullptr),
-        m_function_name(funct),
-        m_synchro(synch),
-        m_fetched_help_long(false)
-    {
-        if (!help.empty())
-            SetHelp(help.c_str());
-        else
-        {
-            StreamString stream;
-            stream.Printf("For more information run 'help %s'",name.c_str());
-            SetHelp(stream.GetData());
-        }
-    }
-
-    ~CommandObjectPythonFunction() override = default;
-
-    bool
-    IsRemovable () const override
-    {
-        return true;
+  CommandObjectPythonFunction(CommandInterpreter &interpreter, std::string name,
+                              std::string funct, std::string help,
+                              ScriptedCommandSynchronicity synch)
+      : CommandObjectRaw(interpreter, name.c_str(), nullptr, nullptr),
+        m_function_name(funct), m_synchro(synch), m_fetched_help_long(false) {
+    if (!help.empty())
+      SetHelp(help.c_str());
+    else {
+      StreamString stream;
+      stream.Printf("For more information run 'help %s'", name.c_str());
+      SetHelp(stream.GetData());
+    }
+  }
+
+  ~CommandObjectPythonFunction() override = default;
+
+  bool IsRemovable() const override { return true; }
+
+  const std::string &GetFunctionName() { return m_function_name; }
+
+  ScriptedCommandSynchronicity GetSynchronicity() { return m_synchro; }
+
+  const char *GetHelpLong() override {
+    if (!m_fetched_help_long) {
+      ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+      if (scripter) {
+        std::string docstring;
+        m_fetched_help_long = scripter->GetDocumentationForItem(
+            m_function_name.c_str(), docstring);
+        if (!docstring.empty())
+          SetHelpLong(docstring.c_str());
+      }
     }
+    return CommandObjectRaw::GetHelpLong();
+  }
 
-    const std::string&
-    GetFunctionName ()
-    {
-        return m_function_name;
-    }
-
-    ScriptedCommandSynchronicity
-    GetSynchronicity ()
-    {
-        return m_synchro;
-    }
-    
-    const char *
-    GetHelpLong () override
-    {
-        if (!m_fetched_help_long)
-        {
-            ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-            if (scripter)
-            {
-                std::string docstring;
-                m_fetched_help_long = scripter->GetDocumentationForItem(m_function_name.c_str(),docstring);
-                if (!docstring.empty())
-                    SetHelpLong(docstring.c_str());
-            }
-        }
-        return CommandObjectRaw::GetHelpLong();
-    }
-    
 protected:
-    bool
-    DoExecute (const char *raw_command_line, CommandReturnObject &result) override
-    {
-        ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-        
-        Error error;
-        
-        result.SetStatus(eReturnStatusInvalid);
-        
-        if (!scripter || !scripter->RunScriptBasedCommand(m_function_name.c_str(),
-                                                          raw_command_line,
-                                                          m_synchro,
-                                                          result,
-                                                          error,
-                                                          m_exe_ctx))
-        {
-            result.AppendError(error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-        }
+  bool DoExecute(const char *raw_command_line,
+                 CommandReturnObject &result) override {
+    ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+
+    Error error;
+
+    result.SetStatus(eReturnStatusInvalid);
+
+    if (!scripter ||
+        !scripter->RunScriptBasedCommand(m_function_name.c_str(),
+                                         raw_command_line, m_synchro, result,
+                                         error, m_exe_ctx)) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+    } else {
+      // Don't change the status if the command already set it...
+      if (result.GetStatus() == eReturnStatusInvalid) {
+        if (result.GetOutputData() == nullptr ||
+            result.GetOutputData()[0] == '\0')
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
         else
-        {
-            // Don't change the status if the command already set it...
-            if (result.GetStatus() == eReturnStatusInvalid)
-            {
-                if (result.GetOutputData() == nullptr || result.GetOutputData()[0] == '\0')
-                    result.SetStatus(eReturnStatusSuccessFinishNoResult);
-                else
-                    result.SetStatus(eReturnStatusSuccessFinishResult);
-            }
-        }
-        
-        return result.Succeeded();
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+      }
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    std::string m_function_name;
-    ScriptedCommandSynchronicity m_synchro;
-    bool m_fetched_help_long;
+  std::string m_function_name;
+  ScriptedCommandSynchronicity m_synchro;
+  bool m_fetched_help_long;
 };
 
-class CommandObjectScriptingObject : public CommandObjectRaw
-{
+class CommandObjectScriptingObject : public CommandObjectRaw {
 public:
-    CommandObjectScriptingObject (CommandInterpreter &interpreter,
-                                  std::string name,
-                                  StructuredData::GenericSP cmd_obj_sp,
-                                  ScriptedCommandSynchronicity synch) :
-        CommandObjectRaw(interpreter,
-                         name.c_str(),
-                         nullptr,
-                         nullptr),
-        m_cmd_obj_sp(cmd_obj_sp),
-        m_synchro(synch),
-        m_fetched_help_short(false),
-        m_fetched_help_long(false)
-    {
-        StreamString stream;
-        stream.Printf("For more information run 'help %s'",name.c_str());
-        SetHelp(stream.GetData());
-        if (ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter())
-            GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
+  CommandObjectScriptingObject(CommandInterpreter &interpreter,
+                               std::string name,
+                               StructuredData::GenericSP cmd_obj_sp,
+                               ScriptedCommandSynchronicity synch)
+      : CommandObjectRaw(interpreter, name.c_str(), nullptr, nullptr),
+        m_cmd_obj_sp(cmd_obj_sp), m_synchro(synch), m_fetched_help_short(false),
+        m_fetched_help_long(false) {
+    StreamString stream;
+    stream.Printf("For more information run 'help %s'", name.c_str());
+    SetHelp(stream.GetData());
+    if (ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter())
+      GetFlags().Set(scripter->GetFlagsForCommandObject(cmd_obj_sp));
+  }
+
+  ~CommandObjectScriptingObject() override = default;
+
+  bool IsRemovable() const override { return true; }
+
+  StructuredData::GenericSP GetImplementingObject() { return m_cmd_obj_sp; }
+
+  ScriptedCommandSynchronicity GetSynchronicity() { return m_synchro; }
+
+  const char *GetHelp() override {
+    if (!m_fetched_help_short) {
+      ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+      if (scripter) {
+        std::string docstring;
+        m_fetched_help_short =
+            scripter->GetShortHelpForCommandObject(m_cmd_obj_sp, docstring);
+        if (!docstring.empty())
+          SetHelp(docstring.c_str());
+      }
+    }
+    return CommandObjectRaw::GetHelp();
+  }
+
+  const char *GetHelpLong() override {
+    if (!m_fetched_help_long) {
+      ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+      if (scripter) {
+        std::string docstring;
+        m_fetched_help_long =
+            scripter->GetLongHelpForCommandObject(m_cmd_obj_sp, docstring);
+        if (!docstring.empty())
+          SetHelpLong(docstring.c_str());
+      }
     }
+    return CommandObjectRaw::GetHelpLong();
+  }
 
-    ~CommandObjectScriptingObject() override = default;
-
-    bool
-    IsRemovable () const override
-    {
-        return true;
-    }
-    
-    StructuredData::GenericSP
-    GetImplementingObject ()
-    {
-        return m_cmd_obj_sp;
-    }
-    
-    ScriptedCommandSynchronicity
-    GetSynchronicity ()
-    {
-        return m_synchro;
-    }
-
-    const char *
-    GetHelp () override
-    {
-        if (!m_fetched_help_short)
-        {
-            ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-            if (scripter)
-            {
-                std::string docstring;
-                m_fetched_help_short = scripter->GetShortHelpForCommandObject(m_cmd_obj_sp,docstring);
-                if (!docstring.empty())
-                    SetHelp(docstring.c_str());
-            }
-        }
-        return CommandObjectRaw::GetHelp();
-    }
-    
-    const char *
-    GetHelpLong () override
-    {
-        if (!m_fetched_help_long)
-        {
-            ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-            if (scripter)
-            {
-                std::string docstring;
-                m_fetched_help_long = scripter->GetLongHelpForCommandObject(m_cmd_obj_sp,docstring);
-                if (!docstring.empty())
-                    SetHelpLong(docstring.c_str());
-            }
-        }
-        return CommandObjectRaw::GetHelpLong();
-    }
-    
 protected:
-    bool
-    DoExecute (const char *raw_command_line, CommandReturnObject &result) override
-    {
-        ScriptInterpreter* scripter = m_interpreter.GetScriptInterpreter();
-        
-        Error error;
-        
-        result.SetStatus(eReturnStatusInvalid);
-        
-        if (!scripter || !scripter->RunScriptBasedCommand(m_cmd_obj_sp,
-                                                          raw_command_line,
-                                                          m_synchro,
-                                                          result,
-                                                          error,
-                                                          m_exe_ctx))
-        {
-            result.AppendError(error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-        }
+  bool DoExecute(const char *raw_command_line,
+                 CommandReturnObject &result) override {
+    ScriptInterpreter *scripter = m_interpreter.GetScriptInterpreter();
+
+    Error error;
+
+    result.SetStatus(eReturnStatusInvalid);
+
+    if (!scripter ||
+        !scripter->RunScriptBasedCommand(m_cmd_obj_sp, raw_command_line,
+                                         m_synchro, result, error, m_exe_ctx)) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+    } else {
+      // Don't change the status if the command already set it...
+      if (result.GetStatus() == eReturnStatusInvalid) {
+        if (result.GetOutputData() == nullptr ||
+            result.GetOutputData()[0] == '\0')
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
         else
-        {
-            // Don't change the status if the command already set it...
-            if (result.GetStatus() == eReturnStatusInvalid)
-            {
-                if (result.GetOutputData() == nullptr || result.GetOutputData()[0] == '\0')
-                    result.SetStatus(eReturnStatusSuccessFinishNoResult);
-                else
-                    result.SetStatus(eReturnStatusSuccessFinishResult);
-            }
-        }
-        
-        return result.Succeeded();
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+      }
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    StructuredData::GenericSP m_cmd_obj_sp;
-    ScriptedCommandSynchronicity m_synchro;
-    bool m_fetched_help_short: 1;
-    bool m_fetched_help_long: 1;
+  StructuredData::GenericSP m_cmd_obj_sp;
+  ScriptedCommandSynchronicity m_synchro;
+  bool m_fetched_help_short : 1;
+  bool m_fetched_help_long : 1;
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectCommandsScriptImport
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsScriptImport : public CommandObjectParsed
-{
+class CommandObjectCommandsScriptImport : public CommandObjectParsed {
 public:
-    CommandObjectCommandsScriptImport (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "command script import",
-                            "Import a scripting module in LLDB.",
-                            nullptr),
-        m_options()
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentData cmd_arg;
-        
-        // Define the first (and only) variant of this arg.
-        cmd_arg.arg_type = eArgTypeFilename;
-        cmd_arg.arg_repetition = eArgRepeatPlus;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (cmd_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-    }
-
-    ~CommandObjectCommandsScriptImport() override = default;
-
-    int
-    HandleArgumentCompletion (Args &input,
-                              int &cursor_index,
-                              int &cursor_char_position,
-                              OptionElementVector &opt_element_vector,
-                              int match_start_point,
-                              int max_return_elements,
-                              bool &word_complete,
-                              StringList &matches) override
-    {
-        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
-        completion_str.erase (cursor_char_position);
+  CommandObjectCommandsScriptImport(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "command script import",
+                            "Import a scripting module in LLDB.", nullptr),
+        m_options() {
+    CommandArgumentEntry arg1;
+    CommandArgumentData cmd_arg;
+
+    // Define the first (and only) variant of this arg.
+    cmd_arg.arg_type = eArgTypeFilename;
+    cmd_arg.arg_repetition = eArgRepeatPlus;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(cmd_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+  }
+
+  ~CommandObjectCommandsScriptImport() override = default;
+
+  int HandleArgumentCompletion(Args &input, int &cursor_index,
+                               int &cursor_char_position,
+                               OptionElementVector &opt_element_vector,
+                               int match_start_point, int max_return_elements,
+                               bool &word_complete,
+                               StringList &matches) override {
+    std::string completion_str(input.GetArgumentAtIndex(cursor_index));
+    completion_str.erase(cursor_char_position);
+
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
+        completion_str.c_str(), match_start_point, max_return_elements, nullptr,
+        word_complete, matches);
+    return matches.GetSize();
+  }
 
-        CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                            CommandCompletions::eDiskFileCompletion,
-                                                            completion_str.c_str(),
-                                                            match_start_point,
-                                                            max_return_elements,
-                                                            nullptr,
-                                                            word_complete,
-                                                            matches);
-        return matches.GetSize();
-    }
-    
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
 protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options()
-        {
-        }
-
-        ~CommandOptions() override = default;
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'r':
+        m_allow_reload = true;
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_allow_reload = true;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    bool m_allow_reload;
+  };
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (m_interpreter.GetDebugger().GetScriptLanguage() !=
+        lldb::eScriptLanguagePython) {
+      result.AppendError("only scripting language supported for module "
+                         "importing is currently Python");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    size_t argc = command.GetArgumentCount();
+    if (0 == argc) {
+      result.AppendError("command script import needs one or more arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    for (size_t i = 0; i < argc; i++) {
+      std::string path = command.GetArgumentAtIndex(i);
+      Error error;
+
+      const bool init_session = true;
+      // FIXME: this is necessary because CommandObject::CheckRequirements()
+      // assumes that
+      // commands won't ever be recursively invoked, but it's actually possible
+      // to craft
+      // a Python script that does other "command script imports" in
+      // __lldb_init_module
+      // the real fix is to have recursive commands possible with a
+      // CommandInvocation object
+      // separate from the CommandObject itself, so that recursive command
+      // invocations
+      // won't stomp on each other (wrt to execution contents, options, and
+      // more)
+      m_exe_ctx.Clear();
+      if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule(
+              path.c_str(), m_options.m_allow_reload, init_session, error)) {
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        result.AppendErrorWithFormat("module importing failed: %s",
+                                     error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    }
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            
-            switch (short_option)
-            {
-                case 'r':
-                    m_allow_reload = true;
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_allow_reload = true;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static OptionDefinition g_option_table[];
-        
-        // Instance variables to hold the values for command options.
-        
-        bool m_allow_reload;
-    };
+    return result.Succeeded();
+  }
 
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        if (m_interpreter.GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython)
-        {
-            result.AppendError ("only scripting language supported for module importing is currently Python");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        size_t argc = command.GetArgumentCount();
-        if (0 == argc)
-        {
-            result.AppendError("command script import needs one or more arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        for (size_t i = 0;
-             i < argc;
-             i++)
-        {
-            std::string path = command.GetArgumentAtIndex(i);
-            Error error;
-            
-            const bool init_session = true;
-            // FIXME: this is necessary because CommandObject::CheckRequirements() assumes that
-            // commands won't ever be recursively invoked, but it's actually possible to craft
-            // a Python script that does other "command script imports" in __lldb_init_module
-            // the real fix is to have recursive commands possible with a CommandInvocation object
-            // separate from the CommandObject itself, so that recursive command invocations
-            // won't stomp on each other (wrt to execution contents, options, and more)
-            m_exe_ctx.Clear();
-            if (m_interpreter.GetScriptInterpreter()->LoadScriptingModule(path.c_str(),
-                                                                          m_options.m_allow_reload,
-                                                                          init_session,
-                                                                          error))
-            {
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-            else
-            {
-                result.AppendErrorWithFormat("module importing failed: %s", error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        
-        return result.Succeeded();
-    }
-    
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectCommandsScriptImport::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectCommandsScriptImport::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "allow-reload", 'r', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Allow the script to be loaded even if it was already loaded before. This argument exists for backwards compatibility, but reloading is always allowed, whether you specify it or not."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectCommandsScriptAdd
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsScriptAdd :
-    public CommandObjectParsed,
-    public IOHandlerDelegateMultiline
-{
+class CommandObjectCommandsScriptAdd : public CommandObjectParsed,
+                                       public IOHandlerDelegateMultiline {
 public:
-    CommandObjectCommandsScriptAdd(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "command script add",
+  CommandObjectCommandsScriptAdd(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "command script add",
                             "Add a scripted function as an LLDB command.",
                             nullptr),
-        IOHandlerDelegateMultiline ("DONE"),
-        m_options()
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentData cmd_arg;
-        
-        // Define the first (and only) variant of this arg.
-        cmd_arg.arg_type = eArgTypeCommandName;
-        cmd_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (cmd_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-    }
+        IOHandlerDelegateMultiline("DONE"), m_options() {
+    CommandArgumentEntry arg1;
+    CommandArgumentData cmd_arg;
 
-    ~CommandObjectCommandsScriptAdd() override = default;
+    // Define the first (and only) variant of this arg.
+    cmd_arg.arg_type = eArgTypeCommandName;
+    cmd_arg.arg_repetition = eArgRepeatPlain;
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
-protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            m_class_name(),
-            m_funct_name(),
-            m_short_help(),
-            m_synchronicity(eScriptedCommandSynchronicitySynchronous)
-        {
-        }
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(cmd_arg);
 
-        ~CommandOptions() override = default;
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+  }
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            
-            switch (short_option)
-            {
-                case 'f':
-                    if (option_arg)
-                        m_funct_name.assign(option_arg);
-                    break;
-                case 'c':
-                    if (option_arg)
-                        m_class_name.assign(option_arg);
-                    break;
-                case 'h':
-                    if (option_arg)
-                        m_short_help.assign(option_arg);
-                    break;
-                case 's':
-                    m_synchronicity = (ScriptedCommandSynchronicity) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error);
-                    if (!error.Success())
-                        error.SetErrorStringWithFormat ("unrecognized value for synchronicity '%s'", option_arg);
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_class_name.clear();
-            m_funct_name.clear();
-            m_short_help.clear();
-            m_synchronicity = eScriptedCommandSynchronicitySynchronous;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static OptionDefinition g_option_table[];
-        
-        // Instance variables to hold the values for command options.
-        
-        std::string m_class_name;
-        std::string m_funct_name;
-        std::string m_short_help;
-        ScriptedCommandSynchronicity m_synchronicity;
-    };
+  ~CommandObjectCommandsScriptAdd() override = default;
 
-    void
-    IOHandlerActivated (IOHandler &io_handler) override
-    {
-        StreamFileSP output_sp(io_handler.GetOutputStreamFile());
-        if (output_sp)
-        {
-            output_sp->PutCString(g_python_command_instructions);
-            output_sp->Flush();
-        }
-    }
-    
+  Options *GetOptions() override { return &m_options; }
 
-    void
-    IOHandlerInputComplete (IOHandler &io_handler, std::string &data) override
-    {
-        StreamFileSP error_sp = io_handler.GetErrorStreamFile();
-        
-        ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
-        if (interpreter)
-        {
-        
-            StringList lines;
-            lines.SplitIntoLines(data);
-            if (lines.GetSize() > 0)
-            {
-                std::string funct_name_str;
-                if (interpreter->GenerateScriptAliasFunction (lines, funct_name_str))
-                {
-                    if (funct_name_str.empty())
-                    {
-                        error_sp->Printf ("error: unable to obtain a function name, didn't add python command.\n");
-                        error_sp->Flush();
-                    }
-                    else
-                    {
-                        // everything should be fine now, let's add this alias
-                        
-                        CommandObjectSP command_obj_sp(new CommandObjectPythonFunction (m_interpreter,
-                                                                                        m_cmd_name,
-                                                                                        funct_name_str.c_str(),
-                                                                                        m_short_help,
-                                                                                        m_synchronicity));
-                        
-                        if (!m_interpreter.AddUserCommand(m_cmd_name, command_obj_sp, true))
-                        {
-                            error_sp->Printf ("error: unable to add selected command, didn't add python command.\n");
-                            error_sp->Flush();
-                        }
-                    }
-                }
-                else
-                {
-                    error_sp->Printf ("error: unable to create function, didn't add python command.\n");
-                    error_sp->Flush();
-                }
-            }
-            else
-            {
-                error_sp->Printf ("error: empty function, didn't add python command.\n");
-                error_sp->Flush();
-            }
-        }
-        else
-        {
-            error_sp->Printf ("error: script interpreter missing, didn't add python command.\n");
-            error_sp->Flush();
-        }
+protected:
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), m_class_name(), m_funct_name(), m_short_help(),
+          m_synchronicity(eScriptedCommandSynchronicitySynchronous) {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'f':
+        if (option_arg)
+          m_funct_name.assign(option_arg);
+        break;
+      case 'c':
+        if (option_arg)
+          m_class_name.assign(option_arg);
+        break;
+      case 'h':
+        if (option_arg)
+          m_short_help.assign(option_arg);
+        break;
+      case 's':
+        m_synchronicity =
+            (ScriptedCommandSynchronicity)Args::StringToOptionEnum(
+                option_arg, g_option_table[option_idx].enum_values, 0, error);
+        if (!error.Success())
+          error.SetErrorStringWithFormat(
+              "unrecognized value for synchronicity '%s'", option_arg);
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_class_name.clear();
+      m_funct_name.clear();
+      m_short_help.clear();
+      m_synchronicity = eScriptedCommandSynchronicitySynchronous;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        io_handler.SetIsDone(true);
-    }
+    // Options table: Required for subclasses of Options.
 
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        if (m_interpreter.GetDebugger().GetScriptLanguage() != lldb::eScriptLanguagePython)
-        {
-            result.AppendError ("only scripting language supported for scripted commands is currently Python");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        size_t argc = command.GetArgumentCount();
-        
-        if (argc != 1)
-        {
-            result.AppendError ("'command script add' requires one argument");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        // Store the options in case we get multi-line input
-        m_cmd_name = command.GetArgumentAtIndex(0);
-        m_short_help.assign(m_options.m_short_help);
-        m_synchronicity = m_options.m_synchronicity;
-        
-        if (m_options.m_class_name.empty())
-        {
-            if (m_options.m_funct_name.empty())
-            {
-                m_interpreter.GetPythonCommandsFromIOHandler("     ",  // Prompt
-                                                             *this,    // IOHandlerDelegate
-                                                             true,     // Run IOHandler in async mode
-                                                             nullptr); // Baton for the "io_handler" that will be passed back into our IOHandlerDelegate functions
-            }
-            else
-            {
-                CommandObjectSP new_cmd(new CommandObjectPythonFunction(m_interpreter,
-                                                                        m_cmd_name,
-                                                                        m_options.m_funct_name,
-                                                                        m_options.m_short_help,
-                                                                        m_synchronicity));
-                if (m_interpreter.AddUserCommand(m_cmd_name, new_cmd, true))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                }
-                else
-                {
-                    result.AppendError("cannot add command");
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-        }
-        else
-        {
-            ScriptInterpreter *interpreter = GetCommandInterpreter().GetScriptInterpreter();
-            if (!interpreter)
-            {
-                result.AppendError("cannot find ScriptInterpreter");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            
-            auto cmd_obj_sp = interpreter->CreateScriptCommandObject(m_options.m_class_name.c_str());
-            if (!cmd_obj_sp)
-            {
-                result.AppendError("cannot create helper object");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            
-            CommandObjectSP new_cmd(new CommandObjectScriptingObject(m_interpreter,
-                                                                     m_cmd_name,
-                                                                     cmd_obj_sp,
-                                                                     m_synchronicity));
-            if (m_interpreter.AddUserCommand(m_cmd_name, new_cmd, true))
-            {
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-            else
-            {
-                result.AppendError("cannot add command");
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
+    static OptionDefinition g_option_table[];
 
-        return result.Succeeded();
-    }
-    
-    CommandOptions m_options;
-    std::string m_cmd_name;
+    // Instance variables to hold the values for command options.
+
+    std::string m_class_name;
+    std::string m_funct_name;
     std::string m_short_help;
     ScriptedCommandSynchronicity m_synchronicity;
-};
+  };
 
-static OptionEnumValueElement g_script_synchro_type[] =
-{
-    { eScriptedCommandSynchronicitySynchronous,      "synchronous",       "Run synchronous"},
-    { eScriptedCommandSynchronicityAsynchronous,     "asynchronous",      "Run asynchronous"},
-    { eScriptedCommandSynchronicityCurrentValue,     "current",           "Do not alter current setting"},
-    { 0, nullptr, nullptr }
-};
+  void IOHandlerActivated(IOHandler &io_handler) override {
+    StreamFileSP output_sp(io_handler.GetOutputStreamFile());
+    if (output_sp) {
+      output_sp->PutCString(g_python_command_instructions);
+      output_sp->Flush();
+    }
+  }
+
+  void IOHandlerInputComplete(IOHandler &io_handler,
+                              std::string &data) override {
+    StreamFileSP error_sp = io_handler.GetErrorStreamFile();
+
+    ScriptInterpreter *interpreter = m_interpreter.GetScriptInterpreter();
+    if (interpreter) {
+
+      StringList lines;
+      lines.SplitIntoLines(data);
+      if (lines.GetSize() > 0) {
+        std::string funct_name_str;
+        if (interpreter->GenerateScriptAliasFunction(lines, funct_name_str)) {
+          if (funct_name_str.empty()) {
+            error_sp->Printf("error: unable to obtain a function name, didn't "
+                             "add python command.\n");
+            error_sp->Flush();
+          } else {
+            // everything should be fine now, let's add this alias
+
+            CommandObjectSP command_obj_sp(new CommandObjectPythonFunction(
+                m_interpreter, m_cmd_name, funct_name_str.c_str(), m_short_help,
+                m_synchronicity));
+
+            if (!m_interpreter.AddUserCommand(m_cmd_name, command_obj_sp,
+                                              true)) {
+              error_sp->Printf("error: unable to add selected command, didn't "
+                               "add python command.\n");
+              error_sp->Flush();
+            }
+          }
+        } else {
+          error_sp->Printf(
+              "error: unable to create function, didn't add python command.\n");
+          error_sp->Flush();
+        }
+      } else {
+        error_sp->Printf("error: empty function, didn't add python command.\n");
+        error_sp->Flush();
+      }
+    } else {
+      error_sp->Printf(
+          "error: script interpreter missing, didn't add python command.\n");
+      error_sp->Flush();
+    }
+
+    io_handler.SetIsDone(true);
+  }
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (m_interpreter.GetDebugger().GetScriptLanguage() !=
+        lldb::eScriptLanguagePython) {
+      result.AppendError("only scripting language supported for scripted "
+                         "commands is currently Python");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    size_t argc = command.GetArgumentCount();
+
+    if (argc != 1) {
+      result.AppendError("'command script add' requires one argument");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Store the options in case we get multi-line input
+    m_cmd_name = command.GetArgumentAtIndex(0);
+    m_short_help.assign(m_options.m_short_help);
+    m_synchronicity = m_options.m_synchronicity;
+
+    if (m_options.m_class_name.empty()) {
+      if (m_options.m_funct_name.empty()) {
+        m_interpreter.GetPythonCommandsFromIOHandler(
+            "     ",  // Prompt
+            *this,    // IOHandlerDelegate
+            true,     // Run IOHandler in async mode
+            nullptr); // Baton for the "io_handler" that will be passed back
+                      // into our IOHandlerDelegate functions
+      } else {
+        CommandObjectSP new_cmd(new CommandObjectPythonFunction(
+            m_interpreter, m_cmd_name, m_options.m_funct_name,
+            m_options.m_short_help, m_synchronicity));
+        if (m_interpreter.AddUserCommand(m_cmd_name, new_cmd, true)) {
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else {
+          result.AppendError("cannot add command");
+          result.SetStatus(eReturnStatusFailed);
+        }
+      }
+    } else {
+      ScriptInterpreter *interpreter =
+          GetCommandInterpreter().GetScriptInterpreter();
+      if (!interpreter) {
+        result.AppendError("cannot find ScriptInterpreter");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      auto cmd_obj_sp = interpreter->CreateScriptCommandObject(
+          m_options.m_class_name.c_str());
+      if (!cmd_obj_sp) {
+        result.AppendError("cannot create helper object");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      CommandObjectSP new_cmd(new CommandObjectScriptingObject(
+          m_interpreter, m_cmd_name, cmd_obj_sp, m_synchronicity));
+      if (m_interpreter.AddUserCommand(m_cmd_name, new_cmd, true)) {
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        result.AppendError("cannot add command");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    }
+
+    return result.Succeeded();
+  }
+
+  CommandOptions m_options;
+  std::string m_cmd_name;
+  std::string m_short_help;
+  ScriptedCommandSynchronicity m_synchronicity;
+};
+
+static OptionEnumValueElement g_script_synchro_type[] = {
+    {eScriptedCommandSynchronicitySynchronous, "synchronous",
+     "Run synchronous"},
+    {eScriptedCommandSynchronicityAsynchronous, "asynchronous",
+     "Run asynchronous"},
+    {eScriptedCommandSynchronicityCurrentValue, "current",
+     "Do not alter current setting"},
+    {0, nullptr, nullptr}};
 
 OptionDefinition
-CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectCommandsScriptAdd::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1,   false, "function",      'f', OptionParser::eRequiredArgument, nullptr, nullptr,               0, eArgTypePythonFunction,               "Name of the Python function to bind to this command name."},
   {LLDB_OPT_SET_2,   false, "class",         'c', OptionParser::eRequiredArgument, nullptr, nullptr,               0, eArgTypePythonClass,                  "Name of the Python class to bind to this command name."},
   {LLDB_OPT_SET_1,   false, "help"  ,        'h', OptionParser::eRequiredArgument, nullptr, nullptr,               0, eArgTypeHelpText,                     "The help text to display for this command."},
   {LLDB_OPT_SET_ALL, false, "synchronicity", 's', OptionParser::eRequiredArgument, nullptr, g_script_synchro_type, 0, eArgTypeScriptedCommandSynchronicity, "Set the synchronicity of this command's executions with regard to LLDB event system."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectCommandsScriptList
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsScriptList : public CommandObjectParsed
-{
+class CommandObjectCommandsScriptList : public CommandObjectParsed {
 public:
-    CommandObjectCommandsScriptList(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "command script list",
-                            "List defined scripted commands.",
-                            nullptr)
-    {
-    }
+  CommandObjectCommandsScriptList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "command script list",
+                            "List defined scripted commands.", nullptr) {}
 
-    ~CommandObjectCommandsScriptList() override = default;
+  ~CommandObjectCommandsScriptList() override = default;
 
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        m_interpreter.GetHelp(result,
-                              CommandInterpreter::eCommandTypesUserDef);
-        
-        result.SetStatus (eReturnStatusSuccessFinishResult);
-        
-        return true;
-    }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    m_interpreter.GetHelp(result, CommandInterpreter::eCommandTypesUserDef);
+
+    result.SetStatus(eReturnStatusSuccessFinishResult);
+
+    return true;
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectCommandsScriptClear
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsScriptClear : public CommandObjectParsed
-{
+class CommandObjectCommandsScriptClear : public CommandObjectParsed {
 public:
-    CommandObjectCommandsScriptClear(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "command script clear",
-                            "Delete all scripted commands.",
-                            nullptr)
-    {
-    }
+  CommandObjectCommandsScriptClear(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "command script clear",
+                            "Delete all scripted commands.", nullptr) {}
 
-    ~CommandObjectCommandsScriptClear() override = default;
+  ~CommandObjectCommandsScriptClear() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        m_interpreter.RemoveAllUser();
-        
-        result.SetStatus (eReturnStatusSuccessFinishResult);
-        
-        return true;
-    }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    m_interpreter.RemoveAllUser();
+
+    result.SetStatus(eReturnStatusSuccessFinishResult);
+
+    return true;
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectCommandsScriptDelete
 //-------------------------------------------------------------------------
 
-class CommandObjectCommandsScriptDelete : public CommandObjectParsed
-{
+class CommandObjectCommandsScriptDelete : public CommandObjectParsed {
 public:
-    CommandObjectCommandsScriptDelete(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "command script delete",
-                            "Delete a scripted command.",
-                            nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentData cmd_arg;
-        
-        // Define the first (and only) variant of this arg.
-        cmd_arg.arg_type = eArgTypeCommandName;
-        cmd_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (cmd_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-    }
+  CommandObjectCommandsScriptDelete(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "command script delete",
+                            "Delete a scripted command.", nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentData cmd_arg;
+
+    // Define the first (and only) variant of this arg.
+    cmd_arg.arg_type = eArgTypeCommandName;
+    cmd_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(cmd_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+  }
 
-    ~CommandObjectCommandsScriptDelete() override = default;
+  ~CommandObjectCommandsScriptDelete() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        
-        size_t argc = command.GetArgumentCount();
-        
-        if (argc != 1)
-        {
-            result.AppendError ("'command script delete' requires one argument");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        const char* cmd_name = command.GetArgumentAtIndex(0);
-        
-        if (cmd_name && *cmd_name && m_interpreter.HasUserCommands() && m_interpreter.UserCommandExists(cmd_name))
-        {
-            m_interpreter.RemoveUser(cmd_name);
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendErrorWithFormat ("command %s not found", cmd_name);
-            result.SetStatus (eReturnStatusFailed);
-        }
-        
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+
+    size_t argc = command.GetArgumentCount();
+
+    if (argc != 1) {
+      result.AppendError("'command script delete' requires one argument");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *cmd_name = command.GetArgumentAtIndex(0);
+
+    if (cmd_name && *cmd_name && m_interpreter.HasUserCommands() &&
+        m_interpreter.UserCommandExists(cmd_name)) {
+      m_interpreter.RemoveUser(cmd_name);
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendErrorWithFormat("command %s not found", cmd_name);
+      result.SetStatus(eReturnStatusFailed);
     }
+
+    return result.Succeeded();
+  }
 };
 
 #pragma mark CommandObjectMultiwordCommandsScript
@@ -2274,22 +1937,30 @@ protected:
 // CommandObjectMultiwordCommandsScript
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordCommandsScript : public CommandObjectMultiword
-{
+class CommandObjectMultiwordCommandsScript : public CommandObjectMultiword {
 public:
-    CommandObjectMultiwordCommandsScript(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "command script",
-                                 "Commands for managing custom commands implemented by interpreter scripts.",
-                                 "command script <subcommand> [<subcommand-options>]")
-    {
-        LoadSubCommand ("add",    CommandObjectSP (new CommandObjectCommandsScriptAdd (interpreter)));
-        LoadSubCommand ("delete", CommandObjectSP (new CommandObjectCommandsScriptDelete (interpreter)));
-        LoadSubCommand ("clear",  CommandObjectSP (new CommandObjectCommandsScriptClear (interpreter)));
-        LoadSubCommand ("list",   CommandObjectSP (new CommandObjectCommandsScriptList (interpreter)));
-        LoadSubCommand ("import", CommandObjectSP (new CommandObjectCommandsScriptImport (interpreter)));
-    }
+  CommandObjectMultiwordCommandsScript(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "command script", "Commands for managing custom "
+                                           "commands implemented by "
+                                           "interpreter scripts.",
+            "command script <subcommand> [<subcommand-options>]") {
+    LoadSubCommand("add", CommandObjectSP(
+                              new CommandObjectCommandsScriptAdd(interpreter)));
+    LoadSubCommand(
+        "delete",
+        CommandObjectSP(new CommandObjectCommandsScriptDelete(interpreter)));
+    LoadSubCommand(
+        "clear",
+        CommandObjectSP(new CommandObjectCommandsScriptClear(interpreter)));
+    LoadSubCommand("list", CommandObjectSP(new CommandObjectCommandsScriptList(
+                               interpreter)));
+    LoadSubCommand(
+        "import",
+        CommandObjectSP(new CommandObjectCommandsScriptImport(interpreter)));
+  }
 
-    ~CommandObjectMultiwordCommandsScript() override = default;
+  ~CommandObjectMultiwordCommandsScript() override = default;
 };
 
 #pragma mark CommandObjectMultiwordCommands
@@ -2298,17 +1969,26 @@ public:
 // CommandObjectMultiwordCommands
 //-------------------------------------------------------------------------
 
-CommandObjectMultiwordCommands::CommandObjectMultiwordCommands(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "command", "Commands for managing custom LLDB commands.",
-                             "command <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand ("source",  CommandObjectSP (new CommandObjectCommandsSource (interpreter)));
-    LoadSubCommand ("alias",   CommandObjectSP (new CommandObjectCommandsAlias (interpreter)));
-    LoadSubCommand ("unalias", CommandObjectSP (new CommandObjectCommandsUnalias (interpreter)));
-    LoadSubCommand ("delete",  CommandObjectSP (new CommandObjectCommandsDelete (interpreter)));
-    LoadSubCommand ("regex",   CommandObjectSP (new CommandObjectCommandsAddRegex (interpreter)));
-    LoadSubCommand ("history", CommandObjectSP (new CommandObjectCommandsHistory (interpreter)));
-    LoadSubCommand ("script",  CommandObjectSP (new CommandObjectMultiwordCommandsScript (interpreter)));
+CommandObjectMultiwordCommands::CommandObjectMultiwordCommands(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(interpreter, "command",
+                             "Commands for managing custom LLDB commands.",
+                             "command <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("source",
+                 CommandObjectSP(new CommandObjectCommandsSource(interpreter)));
+  LoadSubCommand("alias",
+                 CommandObjectSP(new CommandObjectCommandsAlias(interpreter)));
+  LoadSubCommand("unalias", CommandObjectSP(
+                                new CommandObjectCommandsUnalias(interpreter)));
+  LoadSubCommand("delete",
+                 CommandObjectSP(new CommandObjectCommandsDelete(interpreter)));
+  LoadSubCommand(
+      "regex", CommandObjectSP(new CommandObjectCommandsAddRegex(interpreter)));
+  LoadSubCommand("history", CommandObjectSP(
+                                new CommandObjectCommandsHistory(interpreter)));
+  LoadSubCommand(
+      "script",
+      CommandObjectSP(new CommandObjectMultiwordCommandsScript(interpreter)));
 }
 
 CommandObjectMultiwordCommands::~CommandObjectMultiwordCommands() = default;

Modified: lldb/trunk/source/Commands/CommandObjectCommands.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectCommands.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectCommands.h (original)
+++ lldb/trunk/source/Commands/CommandObjectCommands.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CommandObjectCommands.h -----------------------------------*- C++ -*-===//
+//===-- CommandObjectCommands.h -----------------------------------*- C++
+//-*-===//
 //
 //                     The LLVM Compiler Infrastructure
 //
@@ -14,9 +15,9 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
+#include "lldb/Core/STLUtils.h"
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
-#include "lldb/Core/STLUtils.h"
 
 namespace lldb_private {
 
@@ -24,13 +25,11 @@ namespace lldb_private {
 // CommandObjectMultiwordCommands
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordCommands : public CommandObjectMultiword
-{
+class CommandObjectMultiwordCommands : public CommandObjectMultiword {
 public:
+  CommandObjectMultiwordCommands(CommandInterpreter &interpreter);
 
-    CommandObjectMultiwordCommands (CommandInterpreter &interpreter);
-
-    ~CommandObjectMultiwordCommands() override;
+  ~CommandObjectMultiwordCommands() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.cpp Tue Sep  6 15:57:50 2016
@@ -29,221 +29,191 @@
 #include "lldb/Target/Target.h"
 
 #define DEFAULT_DISASM_BYTE_SIZE 32
-#define DEFAULT_DISASM_NUM_INS  4
+#define DEFAULT_DISASM_NUM_INS 4
 
 using namespace lldb;
 using namespace lldb_private;
 
-CommandObjectDisassemble::CommandOptions::CommandOptions() :
-    Options(),
-    num_lines_context(0),
-    num_instructions (0),
-    func_name(),
-    current_function (false),
-    start_addr(),
-    end_addr (),
-    at_pc (false),
-    frame_line (false),
-    plugin_name (),
-    flavor_string(),
-    arch(),
-    some_location_specified (false),
-    symbol_containing_addr () 
-{
-    OptionParsingStarting(nullptr);
+CommandObjectDisassemble::CommandOptions::CommandOptions()
+    : Options(), num_lines_context(0), num_instructions(0), func_name(),
+      current_function(false), start_addr(), end_addr(), at_pc(false),
+      frame_line(false), plugin_name(), flavor_string(), arch(),
+      some_location_specified(false), symbol_containing_addr() {
+  OptionParsingStarting(nullptr);
 }
 
 CommandObjectDisassemble::CommandOptions::~CommandOptions() = default;
 
-Error
-CommandObjectDisassemble::CommandOptions::SetOptionValue(uint32_t option_idx,
-                                                         const char *option_arg,
-                                            ExecutionContext *execution_context)
-{
-    Error error;
-
-    const int short_option = m_getopt_table[option_idx].val;
-
-    bool success;
-    
-    switch (short_option)
-    {
-    case 'm':
-        show_mixed = true;
-        break;
-
-    case 'C':
-        num_lines_context = StringConvert::ToUInt32(option_arg, 0, 0, &success);
-        if (!success)
-            error.SetErrorStringWithFormat ("invalid num context lines string: \"%s\"", option_arg);
-        break;
-
-    case 'c':
-        num_instructions = StringConvert::ToUInt32(option_arg, 0, 0, &success);
-        if (!success)
-            error.SetErrorStringWithFormat ("invalid num of instructions string: \"%s\"", option_arg);
-        break;
-
-    case 'b':
-        show_bytes = true;
-        break;
-
-    case 's':
-        {
-            start_addr = Args::StringToAddress(execution_context, option_arg,
-                                               LLDB_INVALID_ADDRESS, &error);
-            if (start_addr != LLDB_INVALID_ADDRESS)
-                some_location_specified = true;
-        }
-        break;
-    case 'e':
-        {
-            end_addr = Args::StringToAddress(execution_context, option_arg,
-                                             LLDB_INVALID_ADDRESS, &error);
-            if (end_addr != LLDB_INVALID_ADDRESS)
-                some_location_specified = true;
-        }
-        break;
+Error CommandObjectDisassemble::CommandOptions::SetOptionValue(
+    uint32_t option_idx, const char *option_arg,
+    ExecutionContext *execution_context) {
+  Error error;
+
+  const int short_option = m_getopt_table[option_idx].val;
+
+  bool success;
+
+  switch (short_option) {
+  case 'm':
+    show_mixed = true;
+    break;
+
+  case 'C':
+    num_lines_context = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+    if (!success)
+      error.SetErrorStringWithFormat("invalid num context lines string: \"%s\"",
+                                     option_arg);
+    break;
+
+  case 'c':
+    num_instructions = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+    if (!success)
+      error.SetErrorStringWithFormat(
+          "invalid num of instructions string: \"%s\"", option_arg);
+    break;
+
+  case 'b':
+    show_bytes = true;
+    break;
+
+  case 's': {
+    start_addr = Args::StringToAddress(execution_context, option_arg,
+                                       LLDB_INVALID_ADDRESS, &error);
+    if (start_addr != LLDB_INVALID_ADDRESS)
+      some_location_specified = true;
+  } break;
+  case 'e': {
+    end_addr = Args::StringToAddress(execution_context, option_arg,
+                                     LLDB_INVALID_ADDRESS, &error);
+    if (end_addr != LLDB_INVALID_ADDRESS)
+      some_location_specified = true;
+  } break;
+
+  case 'n':
+    func_name.assign(option_arg);
+    some_location_specified = true;
+    break;
+
+  case 'p':
+    at_pc = true;
+    some_location_specified = true;
+    break;
+
+  case 'l':
+    frame_line = true;
+    // Disassemble the current source line kind of implies showing mixed
+    // source code context.
+    show_mixed = true;
+    some_location_specified = true;
+    break;
+
+  case 'P':
+    plugin_name.assign(option_arg);
+    break;
+
+  case 'F': {
+    TargetSP target_sp =
+        execution_context ? execution_context->GetTargetSP() : TargetSP();
+    if (target_sp && (target_sp->GetArchitecture().GetTriple().getArch() ==
+                          llvm::Triple::x86 ||
+                      target_sp->GetArchitecture().GetTriple().getArch() ==
+                          llvm::Triple::x86_64)) {
+      flavor_string.assign(option_arg);
+    } else
+      error.SetErrorStringWithFormat("Disassembler flavors are currently only "
+                                     "supported for x86 and x86_64 targets.");
+    break;
+  }
+
+  case 'r':
+    raw = true;
+    break;
+
+  case 'f':
+    current_function = true;
+    some_location_specified = true;
+    break;
+
+  case 'A':
+    if (execution_context) {
+      auto target_sp =
+          execution_context ? execution_context->GetTargetSP() : TargetSP();
+      auto platform_sp = target_sp ? target_sp->GetPlatform() : PlatformSP();
+      if (!arch.SetTriple(option_arg, platform_sp.get()))
+        arch.SetTriple(option_arg);
+    }
+    break;
 
-    case 'n':
-        func_name.assign (option_arg);
-        some_location_specified = true;
-        break;
-
-    case 'p':
-        at_pc = true;
-        some_location_specified = true;
-        break;
-
-    case 'l':
-        frame_line = true;
-        // Disassemble the current source line kind of implies showing mixed
-        // source code context. 
-        show_mixed = true;
-        some_location_specified = true;
-        break;
-
-    case 'P':
-        plugin_name.assign (option_arg);
-        break;
-
-    case 'F':
-        {
-            TargetSP target_sp = execution_context ?
-                execution_context->GetTargetSP() : TargetSP();
-            if (target_sp &&
-                (target_sp->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86
-                || target_sp->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86_64))
-            {
-                flavor_string.assign (option_arg);
-            }
-            else
-                error.SetErrorStringWithFormat("Disassembler flavors are currently only supported for x86 and x86_64 targets.");
-            break;
-        }
+  case 'a': {
+    symbol_containing_addr = Args::StringToAddress(
+        execution_context, option_arg, LLDB_INVALID_ADDRESS, &error);
+    if (symbol_containing_addr != LLDB_INVALID_ADDRESS) {
+      some_location_specified = true;
+    }
+  } break;
 
-    case 'r':
-        raw = true;
-        break;
-
-    case 'f':
-        current_function = true;
-        some_location_specified = true;
-        break;
-
-    case 'A':
-        if (execution_context)
-        {
-            auto target_sp = execution_context ?
-                execution_context->GetTargetSP() : TargetSP();
-            auto platform_sp =
-                target_sp ? target_sp->GetPlatform() : PlatformSP();
-            if (!arch.SetTriple (option_arg, platform_sp.get()))
-                arch.SetTriple (option_arg);
-        }
-        break;
+  default:
+    error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                   short_option);
+    break;
+  }
 
-    case 'a':
-        {
-            symbol_containing_addr =
-                Args::StringToAddress(execution_context,option_arg,
-                                      LLDB_INVALID_ADDRESS, &error);
-            if (symbol_containing_addr != LLDB_INVALID_ADDRESS)
-            {
-                some_location_specified = true;
-            }
-        }
-        break;
+  return error;
+}
 
-    default:
-        error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-        break;
-    }
+void CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
+    ExecutionContext *execution_context) {
+  show_mixed = false;
+  show_bytes = false;
+  num_lines_context = 0;
+  num_instructions = 0;
+  func_name.clear();
+  current_function = false;
+  at_pc = false;
+  frame_line = false;
+  start_addr = LLDB_INVALID_ADDRESS;
+  end_addr = LLDB_INVALID_ADDRESS;
+  symbol_containing_addr = LLDB_INVALID_ADDRESS;
+  raw = false;
+  plugin_name.clear();
+
+  Target *target =
+      execution_context ? execution_context->GetTargetPtr() : nullptr;
+
+  // This is a hack till we get the ability to specify features based on
+  // architecture.  For now GetDisassemblyFlavor
+  // is really only valid for x86 (and for the llvm assembler plugin, but I'm
+  // papering over that since that is the
+  // only disassembler plugin we have...
+  if (target) {
+    if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86 ||
+        target->GetArchitecture().GetTriple().getArch() ==
+            llvm::Triple::x86_64) {
+      flavor_string.assign(target->GetDisassemblyFlavor());
+    } else
+      flavor_string.assign("default");
 
-    return error;
-}
+  } else
+    flavor_string.assign("default");
 
-void
-CommandObjectDisassemble::CommandOptions::OptionParsingStarting(
-                                            ExecutionContext *execution_context)
-{
-    show_mixed = false;
-    show_bytes = false;
-    num_lines_context = 0;
-    num_instructions = 0;
-    func_name.clear();
-    current_function = false;
-    at_pc = false;
-    frame_line = false;
-    start_addr = LLDB_INVALID_ADDRESS;
-    end_addr = LLDB_INVALID_ADDRESS;
-    symbol_containing_addr = LLDB_INVALID_ADDRESS;
-    raw = false;
-    plugin_name.clear();
-    
-    Target *target =
-        execution_context ? execution_context->GetTargetPtr() : nullptr;
-    
-    // This is a hack till we get the ability to specify features based on architecture.  For now GetDisassemblyFlavor
-    // is really only valid for x86 (and for the llvm assembler plugin, but I'm papering over that since that is the
-    // only disassembler plugin we have...
-    if (target)
-    {
-        if (target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86
-            || target->GetArchitecture().GetTriple().getArch() == llvm::Triple::x86_64)
-        {
-            flavor_string.assign(target->GetDisassemblyFlavor());
-        }
-        else
-            flavor_string.assign ("default");
-        
-    }
-    else
-        flavor_string.assign("default");
-    
-    arch.Clear();
-    some_location_specified = false;
+  arch.Clear();
+  some_location_specified = false;
 }
 
-Error
-CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
-                                            ExecutionContext *execution_context)
-{
-    if (!some_location_specified)
-        current_function = true;
-    return Error();
+Error CommandObjectDisassemble::CommandOptions::OptionParsingFinished(
+    ExecutionContext *execution_context) {
+  if (!some_location_specified)
+    current_function = true;
+  return Error();
 }
 
-const OptionDefinition*
-CommandObjectDisassemble::CommandOptions::GetDefinitions ()
-{
-    return g_option_table;
+const OptionDefinition *
+CommandObjectDisassemble::CommandOptions::GetDefinitions() {
+  return g_option_table;
 }
 
-OptionDefinition
-CommandObjectDisassemble::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectDisassemble::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_ALL, false, "bytes",         'b', OptionParser::eNoArgument,       nullptr, nullptr, 0,                                     eArgTypeNone,                "Show opcode bytes when disassembling."},
   {LLDB_OPT_SET_ALL, false, "context",       'C', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                     eArgTypeNumLines,            "Number of context lines of source to show."},
   {LLDB_OPT_SET_ALL, false, "mixed",         'm', OptionParser::eNoArgument,       nullptr, nullptr, 0,                                     eArgTypeNone,                "Enable mixed source and assembly display."},
@@ -267,367 +237,330 @@ CommandObjectDisassemble::CommandOptions
                                                                                                                                                                          "table information, else disassemble around the pc."},
   {LLDB_OPT_SET_7,   false, "address",       'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                     eArgTypeAddressOrExpression, "Disassemble function containing this address."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr }
-  // clang-format on
+    // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectDisassemble
 //-------------------------------------------------------------------------
 
-CommandObjectDisassemble::CommandObjectDisassemble(CommandInterpreter &interpreter)
-    : CommandObjectParsed(interpreter, "disassemble", "Disassemble specified instructions in the current target.  "
-                                                      "Defaults to the current function for the current thread and "
-                                                      "stack frame.",
-                          "disassemble [<cmd-options>]"),
-      m_options()
-{
-}
+CommandObjectDisassemble::CommandObjectDisassemble(
+    CommandInterpreter &interpreter)
+    : CommandObjectParsed(
+          interpreter, "disassemble",
+          "Disassemble specified instructions in the current target.  "
+          "Defaults to the current function for the current thread and "
+          "stack frame.",
+          "disassemble [<cmd-options>]"),
+      m_options() {}
 
 CommandObjectDisassemble::~CommandObjectDisassemble() = default;
 
-bool
-CommandObjectDisassemble::DoExecute (Args& command, CommandReturnObject &result)
-{
-    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-    if (target == nullptr)
-    {
-        result.AppendError ("invalid target, create a debug target using the 'target create' command");
-        result.SetStatus (eReturnStatusFailed);
-        return false;
+bool CommandObjectDisassemble::DoExecute(Args &command,
+                                         CommandReturnObject &result) {
+  Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+  if (target == nullptr) {
+    result.AppendError("invalid target, create a debug target using the "
+                       "'target create' command");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+  if (!m_options.arch.IsValid())
+    m_options.arch = target->GetArchitecture();
+
+  if (!m_options.arch.IsValid()) {
+    result.AppendError(
+        "use the --arch option or set the target architecture to disassemble");
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  const char *plugin_name = m_options.GetPluginName();
+  const char *flavor_string = m_options.GetFlavorString();
+
+  DisassemblerSP disassembler =
+      Disassembler::FindPlugin(m_options.arch, flavor_string, plugin_name);
+
+  if (!disassembler) {
+    if (plugin_name) {
+      result.AppendErrorWithFormat(
+          "Unable to find Disassembler plug-in named '%s' that supports the "
+          "'%s' architecture.\n",
+          plugin_name, m_options.arch.GetArchitectureName());
+    } else
+      result.AppendErrorWithFormat(
+          "Unable to find Disassembler plug-in for the '%s' architecture.\n",
+          m_options.arch.GetArchitectureName());
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  } else if (flavor_string != nullptr &&
+             !disassembler->FlavorValidForArchSpec(m_options.arch,
+                                                   flavor_string))
+    result.AppendWarningWithFormat(
+        "invalid disassembler flavor \"%s\", using default.\n", flavor_string);
+
+  result.SetStatus(eReturnStatusSuccessFinishResult);
+
+  if (command.GetArgumentCount() != 0) {
+    result.AppendErrorWithFormat(
+        "\"disassemble\" arguments are specified as options.\n");
+    const int terminal_width =
+        GetCommandInterpreter().GetDebugger().GetTerminalWidth();
+    GetOptions()->GenerateOptionUsage(result.GetErrorStream(), this,
+                                      terminal_width);
+    result.SetStatus(eReturnStatusFailed);
+    return false;
+  }
+
+  if (m_options.show_mixed && m_options.num_lines_context == 0)
+    m_options.num_lines_context = 1;
+
+  // Always show the PC in the disassembly
+  uint32_t options = Disassembler::eOptionMarkPCAddress;
+
+  // Mark the source line for the current PC only if we are doing mixed source
+  // and assembly
+  if (m_options.show_mixed)
+    options |= Disassembler::eOptionMarkPCSourceLine;
+
+  if (m_options.show_bytes)
+    options |= Disassembler::eOptionShowBytes;
+
+  if (m_options.raw)
+    options |= Disassembler::eOptionRawOuput;
+
+  if (!m_options.func_name.empty()) {
+    ConstString name(m_options.func_name.c_str());
+
+    if (Disassembler::Disassemble(
+            m_interpreter.GetDebugger(), m_options.arch, plugin_name,
+            flavor_string, m_exe_ctx, name,
+            nullptr, // Module *
+            m_options.num_instructions,
+            m_options.show_mixed ? m_options.num_lines_context : 0, options,
+            result.GetOutputStream())) {
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendErrorWithFormat("Unable to find symbol with name '%s'.\n",
+                                   name.GetCString());
+      result.SetStatus(eReturnStatusFailed);
     }
-    if (!m_options.arch.IsValid())
-        m_options.arch = target->GetArchitecture();
-
-    if (!m_options.arch.IsValid())
-    {
-        result.AppendError ("use the --arch option or set the target architecture to disassemble");
-        result.SetStatus (eReturnStatusFailed);
+  } else {
+    std::vector<AddressRange> ranges;
+    AddressRange range;
+    StackFrame *frame = m_exe_ctx.GetFramePtr();
+    if (m_options.frame_line) {
+      if (frame == nullptr) {
+        result.AppendError("Cannot disassemble around the current line without "
+                           "a selected frame.\n");
+        result.SetStatus(eReturnStatusFailed);
         return false;
-    }
-
-    const char *plugin_name = m_options.GetPluginName ();
-    const char *flavor_string = m_options.GetFlavorString();
-
-    DisassemblerSP disassembler = Disassembler::FindPlugin(m_options.arch, flavor_string, plugin_name);
-
-    if (!disassembler)
-    {
-        if (plugin_name)
-        {
-            result.AppendErrorWithFormat ("Unable to find Disassembler plug-in named '%s' that supports the '%s' architecture.\n",
-                                          plugin_name,
-                                          m_options.arch.GetArchitectureName());
-        }
-        else
-            result.AppendErrorWithFormat ("Unable to find Disassembler plug-in for the '%s' architecture.\n", 
-                                          m_options.arch.GetArchitectureName());
-        result.SetStatus (eReturnStatusFailed);
+      }
+      LineEntry pc_line_entry(
+          frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
+      if (pc_line_entry.IsValid()) {
+        range = pc_line_entry.range;
+      } else {
+        m_options.at_pc =
+            true; // No line entry, so just disassemble around the current pc
+        m_options.show_mixed = false;
+      }
+    } else if (m_options.current_function) {
+      if (frame == nullptr) {
+        result.AppendError("Cannot disassemble around the current function "
+                           "without a selected frame.\n");
+        result.SetStatus(eReturnStatusFailed);
         return false;
+      }
+      Symbol *symbol = frame->GetSymbolContext(eSymbolContextSymbol).symbol;
+      if (symbol) {
+        range.GetBaseAddress() = symbol->GetAddress();
+        range.SetByteSize(symbol->GetByteSize());
+      }
     }
-    else if (flavor_string != nullptr && !disassembler->FlavorValidForArchSpec(m_options.arch, flavor_string))
-        result.AppendWarningWithFormat("invalid disassembler flavor \"%s\", using default.\n", flavor_string);
-
-    result.SetStatus (eReturnStatusSuccessFinishResult);
 
-    if (command.GetArgumentCount() != 0)
-    {
-        result.AppendErrorWithFormat ("\"disassemble\" arguments are specified as options.\n");
-        const int terminal_width =
-            GetCommandInterpreter().GetDebugger().GetTerminalWidth();
-        GetOptions()->GenerateOptionUsage(result.GetErrorStream(), this,
-                                          terminal_width);
-        result.SetStatus (eReturnStatusFailed);
-        return false;
-    }
-    
-    if (m_options.show_mixed && m_options.num_lines_context == 0)
-        m_options.num_lines_context = 1;
-
-    // Always show the PC in the disassembly
-    uint32_t options = Disassembler::eOptionMarkPCAddress;
-
-    // Mark the source line for the current PC only if we are doing mixed source and assembly
-    if (m_options.show_mixed)
-        options |= Disassembler::eOptionMarkPCSourceLine;
-
-    if (m_options.show_bytes)
-        options |= Disassembler::eOptionShowBytes;
-
-    if (m_options.raw)
-        options |= Disassembler::eOptionRawOuput;
-
-    if (!m_options.func_name.empty())
-    {
-        ConstString name(m_options.func_name.c_str());
-        
-        if (Disassembler::Disassemble(m_interpreter.GetDebugger(),
-                                      m_options.arch,
-                                      plugin_name,
-                                      flavor_string,
-                                      m_exe_ctx,
-                                      name,
-                                      nullptr,    // Module *
-                                      m_options.num_instructions,
-                                      m_options.show_mixed ? m_options.num_lines_context : 0,
-                                      options,
-                                      result.GetOutputStream()))
-        {
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendErrorWithFormat ("Unable to find symbol with name '%s'.\n", name.GetCString());
-            result.SetStatus (eReturnStatusFailed);
-        }
-    } 
-    else
-    {
-        std::vector<AddressRange> ranges;
-        AddressRange range;
-        StackFrame *frame = m_exe_ctx.GetFramePtr();
-        if (m_options.frame_line)
-        {
-            if (frame == nullptr)
-            {
-                result.AppendError ("Cannot disassemble around the current line without a selected frame.\n");
-                result.SetStatus (eReturnStatusFailed);
+    // Did the "m_options.frame_line" find a valid range already? If so
+    // skip the rest...
+    if (range.GetByteSize() == 0) {
+      if (m_options.at_pc) {
+        if (frame == nullptr) {
+          result.AppendError("Cannot disassemble around the current PC without "
+                             "a selected frame.\n");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+        range.GetBaseAddress() = frame->GetFrameCodeAddress();
+        if (m_options.num_instructions == 0) {
+          // Disassembling at the PC always disassembles some number of
+          // instructions (not the whole function).
+          m_options.num_instructions = DEFAULT_DISASM_NUM_INS;
+        }
+        ranges.push_back(range);
+      } else {
+        range.GetBaseAddress().SetOffset(m_options.start_addr);
+        if (range.GetBaseAddress().IsValid()) {
+          if (m_options.end_addr != LLDB_INVALID_ADDRESS) {
+            if (m_options.end_addr <= m_options.start_addr) {
+              result.AppendErrorWithFormat(
+                  "End address before start address.\n");
+              result.SetStatus(eReturnStatusFailed);
+              return false;
+            }
+            range.SetByteSize(m_options.end_addr - m_options.start_addr);
+          }
+          ranges.push_back(range);
+        } else {
+          if (m_options.symbol_containing_addr != LLDB_INVALID_ADDRESS &&
+              target) {
+            if (!target->GetSectionLoadList().IsEmpty()) {
+              bool failed = false;
+              Address symbol_containing_address;
+              if (target->GetSectionLoadList().ResolveLoadAddress(
+                      m_options.symbol_containing_addr,
+                      symbol_containing_address)) {
+                ModuleSP module_sp(symbol_containing_address.GetModule());
+                SymbolContext sc;
+                bool resolve_tail_call_address = true; // PC can be one past the
+                                                       // address range of the
+                                                       // function.
+                module_sp->ResolveSymbolContextForAddress(
+                    symbol_containing_address, eSymbolContextEverything, sc,
+                    resolve_tail_call_address);
+                if (sc.function || sc.symbol) {
+                  sc.GetAddressRange(eSymbolContextFunction |
+                                         eSymbolContextSymbol,
+                                     0, false, range);
+                } else {
+                  failed = true;
+                }
+              } else {
+                failed = true;
+              }
+              if (failed) {
+                result.AppendErrorWithFormat(
+                    "Could not find function bounds for address 0x%" PRIx64
+                    "\n",
+                    m_options.symbol_containing_addr);
+                result.SetStatus(eReturnStatusFailed);
                 return false;
-            }
-            LineEntry pc_line_entry (frame->GetSymbolContext(eSymbolContextLineEntry).line_entry);
-            if (pc_line_entry.IsValid())
-            {
-                range = pc_line_entry.range;
-            }
-            else
-            {
-                m_options.at_pc = true; // No line entry, so just disassemble around the current pc
-                m_options.show_mixed = false;
-            }
-        }
-        else if (m_options.current_function)
-        {
-            if (frame == nullptr)
-            {
-                result.AppendError ("Cannot disassemble around the current function without a selected frame.\n");
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            Symbol *symbol = frame->GetSymbolContext(eSymbolContextSymbol).symbol;
-            if (symbol)
-            {
-                range.GetBaseAddress() = symbol->GetAddress();
-                range.SetByteSize(symbol->GetByteSize());
-            }
-        }
-
-        // Did the "m_options.frame_line" find a valid range already? If so
-        // skip the rest...
-        if (range.GetByteSize() == 0)
-        {
-            if (m_options.at_pc)
-            {
-                if (frame == nullptr)
-                {
-                    result.AppendError ("Cannot disassemble around the current PC without a selected frame.\n");
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-                range.GetBaseAddress() = frame->GetFrameCodeAddress();
-                if (m_options.num_instructions == 0)
-                {
-                    // Disassembling at the PC always disassembles some number of instructions (not the whole function).
-                    m_options.num_instructions = DEFAULT_DISASM_NUM_INS;
-                }
-                ranges.push_back(range);
-            }
-            else
-            {
-                range.GetBaseAddress().SetOffset (m_options.start_addr);
-                if (range.GetBaseAddress().IsValid())
-                {
-                    if (m_options.end_addr != LLDB_INVALID_ADDRESS)
-                    {
-                        if (m_options.end_addr <= m_options.start_addr)
-                        {
-                            result.AppendErrorWithFormat ("End address before start address.\n");
-                            result.SetStatus (eReturnStatusFailed);
-                            return false;            
-                        }
-                        range.SetByteSize (m_options.end_addr - m_options.start_addr);
-                    }
+              }
+              ranges.push_back(range);
+            } else {
+              for (lldb::ModuleSP module_sp : target->GetImages().Modules()) {
+                lldb::addr_t file_addr = m_options.symbol_containing_addr;
+                Address file_address;
+                if (module_sp->ResolveFileAddress(file_addr, file_address)) {
+                  SymbolContext sc;
+                  bool resolve_tail_call_address = true; // PC can be one past
+                                                         // the address range of
+                                                         // the function.
+                  module_sp->ResolveSymbolContextForAddress(
+                      file_address, eSymbolContextEverything, sc,
+                      resolve_tail_call_address);
+                  if (sc.function || sc.symbol) {
+                    sc.GetAddressRange(eSymbolContextFunction |
+                                           eSymbolContextSymbol,
+                                       0, false, range);
                     ranges.push_back(range);
+                  }
                 }
-                else
-                {
-                    if (m_options.symbol_containing_addr != LLDB_INVALID_ADDRESS 
-                        && target)
-                    {
-                        if (!target->GetSectionLoadList().IsEmpty())
-                        {
-                            bool failed = false;
-                            Address symbol_containing_address;
-                            if (target->GetSectionLoadList().ResolveLoadAddress (m_options.symbol_containing_addr, symbol_containing_address))
-                            {
-                                ModuleSP module_sp (symbol_containing_address.GetModule());
-                                SymbolContext sc;
-                                bool resolve_tail_call_address = true; // PC can be one past the address range of the function.
-                                module_sp->ResolveSymbolContextForAddress (symbol_containing_address, eSymbolContextEverything, sc,
-                                                                           resolve_tail_call_address);
-                                if (sc.function || sc.symbol)
-                                {
-                                    sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range);
-                                }
-                                else
-                                {
-                                    failed = true;
-                                }
-                            }
-                            else
-                            {
-                                failed = true;
-                            }
-                            if (failed)
-                            {
-                                result.AppendErrorWithFormat ("Could not find function bounds for address 0x%" PRIx64 "\n", m_options.symbol_containing_addr);
-                                result.SetStatus (eReturnStatusFailed);
-                                return false;
-                            }
-                            ranges.push_back(range);
-                        }
-                        else
-                        {
-                            for (lldb::ModuleSP module_sp : target->GetImages().Modules())
-                            {
-                                lldb::addr_t file_addr = m_options.symbol_containing_addr;
-                                Address file_address;
-                                if (module_sp->ResolveFileAddress(file_addr, file_address))
-                                {
-                                    SymbolContext sc;
-                                    bool resolve_tail_call_address = true; // PC can be one past the address range of the function.
-                                    module_sp->ResolveSymbolContextForAddress (file_address, eSymbolContextEverything, sc, resolve_tail_call_address);
-                                    if (sc.function || sc.symbol)
-                                    {
-                                        sc.GetAddressRange (eSymbolContextFunction | eSymbolContextSymbol, 0, false, range);
-                                        ranges.push_back(range);
-                                    }
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        else
-            ranges.push_back(range);
-
-        if (m_options.num_instructions != 0)
-        {
-            if (ranges.empty())
-            {
-                // The default action is to disassemble the current frame function.
-                if (frame)
-                {
-                    SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
-                    if (sc.function)
-                        range.GetBaseAddress() = sc.function->GetAddressRange().GetBaseAddress();
-                    else if (sc.symbol && sc.symbol->ValueIsAddress())
-                        range.GetBaseAddress() = sc.symbol->GetAddress();
-                    else
-                        range.GetBaseAddress() = frame->GetFrameCodeAddress();
-                }
-                
-                if (!range.GetBaseAddress().IsValid())
-                {
-                    result.AppendError ("invalid frame");
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
-            
-            bool print_sc_header = ranges.size() > 1;
-            for (AddressRange cur_range : ranges)
-            {
-                if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
-                                               m_options.arch,
-                                               plugin_name,
-                                               flavor_string,
-                                               m_exe_ctx,
-                                               cur_range.GetBaseAddress(),
-                                               m_options.num_instructions,
-                                               m_options.show_mixed ? m_options.num_lines_context : 0,
-                                               options,
-                                               result.GetOutputStream()))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    if (m_options.start_addr != LLDB_INVALID_ADDRESS)
-                        result.AppendErrorWithFormat ("Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", m_options.start_addr);
-                    else if (m_options.symbol_containing_addr != LLDB_INVALID_ADDRESS)
-                        result.AppendErrorWithFormat ("Failed to disassemble memory in function at 0x%8.8" PRIx64 ".\n", m_options.symbol_containing_addr);
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            if (print_sc_header)
-                result.AppendMessage("\n");
-        }
-        else
-        {
-            if (ranges.empty())
-            {
-                // The default action is to disassemble the current frame function.
-                if (frame)
-                {
-                    SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol));
-                    if (sc.function)
-                        range = sc.function->GetAddressRange();
-                    else if (sc.symbol && sc.symbol->ValueIsAddress())
-                    {
-                        range.GetBaseAddress() = sc.symbol->GetAddress();
-                        range.SetByteSize (sc.symbol->GetByteSize());
-                    }
-                    else
-                        range.GetBaseAddress() = frame->GetFrameCodeAddress();
-                }
-                else
-                {
-                    result.AppendError ("invalid frame");
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-                ranges.push_back(range);
-            }
-            
-            bool print_sc_header = ranges.size() > 1;
-            for (AddressRange cur_range : ranges)
-            {
-                if (cur_range.GetByteSize() == 0)
-                    cur_range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE);
-
-                if (Disassembler::Disassemble (m_interpreter.GetDebugger(),
-                                               m_options.arch,
-                                               plugin_name,
-                                               flavor_string,
-                                               m_exe_ctx,
-                                               cur_range,
-                                               m_options.num_instructions,
-                                               m_options.show_mixed ? m_options.num_lines_context : 0,
-                                               options,
-                                               result.GetOutputStream()))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("Failed to disassemble memory at 0x%8.8" PRIx64 ".\n", m_options.start_addr);
-                    result.SetStatus (eReturnStatusFailed);            
-                }
-                if (print_sc_header)
-                    result.AppendMessage("\n");
+              }
             }
+          }
         }
+      }
+    } else
+      ranges.push_back(range);
+
+    if (m_options.num_instructions != 0) {
+      if (ranges.empty()) {
+        // The default action is to disassemble the current frame function.
+        if (frame) {
+          SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
+                                                   eSymbolContextSymbol));
+          if (sc.function)
+            range.GetBaseAddress() =
+                sc.function->GetAddressRange().GetBaseAddress();
+          else if (sc.symbol && sc.symbol->ValueIsAddress())
+            range.GetBaseAddress() = sc.symbol->GetAddress();
+          else
+            range.GetBaseAddress() = frame->GetFrameCodeAddress();
+        }
+
+        if (!range.GetBaseAddress().IsValid()) {
+          result.AppendError("invalid frame");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      }
+
+      bool print_sc_header = ranges.size() > 1;
+      for (AddressRange cur_range : ranges) {
+        if (Disassembler::Disassemble(
+                m_interpreter.GetDebugger(), m_options.arch, plugin_name,
+                flavor_string, m_exe_ctx, cur_range.GetBaseAddress(),
+                m_options.num_instructions,
+                m_options.show_mixed ? m_options.num_lines_context : 0, options,
+                result.GetOutputStream())) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          if (m_options.start_addr != LLDB_INVALID_ADDRESS)
+            result.AppendErrorWithFormat(
+                "Failed to disassemble memory at 0x%8.8" PRIx64 ".\n",
+                m_options.start_addr);
+          else if (m_options.symbol_containing_addr != LLDB_INVALID_ADDRESS)
+            result.AppendErrorWithFormat(
+                "Failed to disassemble memory in function at 0x%8.8" PRIx64
+                ".\n",
+                m_options.symbol_containing_addr);
+          result.SetStatus(eReturnStatusFailed);
+        }
+      }
+      if (print_sc_header)
+        result.AppendMessage("\n");
+    } else {
+      if (ranges.empty()) {
+        // The default action is to disassemble the current frame function.
+        if (frame) {
+          SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction |
+                                                   eSymbolContextSymbol));
+          if (sc.function)
+            range = sc.function->GetAddressRange();
+          else if (sc.symbol && sc.symbol->ValueIsAddress()) {
+            range.GetBaseAddress() = sc.symbol->GetAddress();
+            range.SetByteSize(sc.symbol->GetByteSize());
+          } else
+            range.GetBaseAddress() = frame->GetFrameCodeAddress();
+        } else {
+          result.AppendError("invalid frame");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+        ranges.push_back(range);
+      }
+
+      bool print_sc_header = ranges.size() > 1;
+      for (AddressRange cur_range : ranges) {
+        if (cur_range.GetByteSize() == 0)
+          cur_range.SetByteSize(DEFAULT_DISASM_BYTE_SIZE);
+
+        if (Disassembler::Disassemble(
+                m_interpreter.GetDebugger(), m_options.arch, plugin_name,
+                flavor_string, m_exe_ctx, cur_range, m_options.num_instructions,
+                m_options.show_mixed ? m_options.num_lines_context : 0, options,
+                result.GetOutputStream())) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.AppendErrorWithFormat(
+              "Failed to disassemble memory at 0x%8.8" PRIx64 ".\n",
+              m_options.start_addr);
+          result.SetStatus(eReturnStatusFailed);
+        }
+        if (print_sc_header)
+          result.AppendMessage("\n");
+      }
     }
+  }
 
-    return result.Succeeded();
+  return result.Succeeded();
 }

Modified: lldb/trunk/source/Commands/CommandObjectDisassemble.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectDisassemble.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectDisassemble.h (original)
+++ lldb/trunk/source/Commands/CommandObjectDisassemble.h Tue Sep  6 15:57:50 2016
@@ -24,79 +24,64 @@ namespace lldb_private {
 // CommandObjectDisassemble
 //-------------------------------------------------------------------------
 
-class CommandObjectDisassemble : public CommandObjectParsed
-{
+class CommandObjectDisassemble : public CommandObjectParsed {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions();
-
-        ~CommandOptions() override;
-
-        Error
-        SetOptionValue(uint32_t option_idx, const char *option_arg,
-                       ExecutionContext *execution_context) override;
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override;
-
-        const OptionDefinition*
-        GetDefinitions() override;
-
-        const char *
-        GetPluginName ()
-        {
-            return (plugin_name.empty() ? nullptr : plugin_name.c_str());
-        }
-        
-        const char *
-        GetFlavorString ()
-        {
-            if (flavor_string.empty() || flavor_string == "default")
-                return nullptr;
-            return flavor_string.c_str();
-        }
-        
-        Error
-        OptionParsingFinished(ExecutionContext *execution_context) override;
-
-        bool show_mixed; // Show mixed source/assembly
-        bool show_bytes;
-        uint32_t num_lines_context;
-        uint32_t num_instructions;
-        bool raw;
-        std::string func_name;
-        bool current_function;
-        lldb::addr_t start_addr;
-        lldb::addr_t end_addr;
-        bool at_pc;
-        bool frame_line;
-        std::string plugin_name;
-        std::string flavor_string;
-        ArchSpec arch;
-        bool some_location_specified; // If no location was specified, we'll select "at_pc".  This should be set
-                                      // in SetOptionValue if anything the selects a location is set.
-        lldb::addr_t symbol_containing_addr;
-        static OptionDefinition g_option_table[];
-    };
-
-    CommandObjectDisassemble (CommandInterpreter &interpreter);
-
-    ~CommandObjectDisassemble() override;
-
-    Options *
-    GetOptions() override
-    {
-        return &m_options;
+  class CommandOptions : public Options {
+  public:
+    CommandOptions();
+
+    ~CommandOptions() override;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override;
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+    const OptionDefinition *GetDefinitions() override;
+
+    const char *GetPluginName() {
+      return (plugin_name.empty() ? nullptr : plugin_name.c_str());
+    }
+
+    const char *GetFlavorString() {
+      if (flavor_string.empty() || flavor_string == "default")
+        return nullptr;
+      return flavor_string.c_str();
     }
 
+    Error OptionParsingFinished(ExecutionContext *execution_context) override;
+
+    bool show_mixed; // Show mixed source/assembly
+    bool show_bytes;
+    uint32_t num_lines_context;
+    uint32_t num_instructions;
+    bool raw;
+    std::string func_name;
+    bool current_function;
+    lldb::addr_t start_addr;
+    lldb::addr_t end_addr;
+    bool at_pc;
+    bool frame_line;
+    std::string plugin_name;
+    std::string flavor_string;
+    ArchSpec arch;
+    bool some_location_specified; // If no location was specified, we'll select
+                                  // "at_pc".  This should be set
+    // in SetOptionValue if anything the selects a location is set.
+    lldb::addr_t symbol_containing_addr;
+    static OptionDefinition g_option_table[];
+  };
+
+  CommandObjectDisassemble(CommandInterpreter &interpreter);
+
+  ~CommandObjectDisassemble() override;
+
+  Options *GetOptions() override { return &m_options; }
+
 protected:
-    bool
-    DoExecute(Args& command,
-	      CommandReturnObject &result) override;
+  bool DoExecute(Args &command, CommandReturnObject &result) override;
 
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Tue Sep  6 15:57:50 2016
@@ -15,21 +15,21 @@
 
 // Project includes
 #include "CommandObjectExpression.h"
+#include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
+#include "lldb/Core/Debugger.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/ValueObjectVariable.h"
 #include "lldb/DataFormatters/ValueObjectPrinter.h"
-#include "Plugins/ExpressionParser/Clang/ClangExpressionVariable.h"
-#include "lldb/Expression/UserExpression.h"
 #include "lldb/Expression/DWARFExpression.h"
 #include "lldb/Expression/REPL.h"
+#include "lldb/Expression/UserExpression.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/StringConvert.h"
-#include "lldb/Core/Debugger.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Target/Language.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/Variable.h"
+#include "lldb/Target/Language.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/Target.h"
@@ -38,24 +38,19 @@
 using namespace lldb;
 using namespace lldb_private;
 
-CommandObjectExpression::CommandOptions::CommandOptions () :
-    OptionGroup()
-{
-}
+CommandObjectExpression::CommandOptions::CommandOptions() : OptionGroup() {}
 
 CommandObjectExpression::CommandOptions::~CommandOptions() = default;
 
-static OptionEnumValueElement g_description_verbosity_type[] =
-{
-    { eLanguageRuntimeDescriptionDisplayVerbosityCompact,      "compact",       "Only show the description string"},
-    { eLanguageRuntimeDescriptionDisplayVerbosityFull,         "full",          "Show the full output, including persistent variable's name and type"},
-    { 0, nullptr, nullptr }
-};
+static OptionEnumValueElement g_description_verbosity_type[] = {
+    {eLanguageRuntimeDescriptionDisplayVerbosityCompact, "compact",
+     "Only show the description string"},
+    {eLanguageRuntimeDescriptionDisplayVerbosityFull, "full",
+     "Show the full output, including persistent variable's name and type"},
+    {0, nullptr, nullptr}};
 
-OptionDefinition
-CommandObjectExpression::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectExpression::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "all-threads",           'a', OptionParser::eRequiredArgument, nullptr, nullptr,                      0, eArgTypeBoolean,              "Should we run all threads if the execution doesn't complete on one thread."},
   {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "ignore-breakpoints",    'i', OptionParser::eRequiredArgument, nullptr, nullptr,                      0, eArgTypeBoolean,              "Ignore breakpoint hits while running expressions"},
   {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "timeout",               't', OptionParser::eRequiredArgument, nullptr, nullptr,                      0, eArgTypeUnsignedInteger,      "Timeout value (in microseconds) for running the expression."},
@@ -71,604 +66,572 @@ CommandObjectExpression::CommandOptions:
                                                                                                                                                                                   "executed."},
   {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "allow-jit",             'j', OptionParser::eRequiredArgument, nullptr, nullptr,                      0, eArgTypeBoolean,              "Controls whether the expression can fall back to being JITted if it's not supported by "
                                                                                                                                                                                   "the interpreter (defaults to true)."}
-  // clang-format on
+    // clang-format on
 };
 
-uint32_t
-CommandObjectExpression::CommandOptions::GetNumDefinitions ()
-{
-    return llvm::array_lengthof(g_option_table);
-}
-
-Error
-CommandObjectExpression::CommandOptions::SetOptionValue (uint32_t option_idx,
-                                                         const char *option_arg,
-                                            ExecutionContext *execution_context)
-{
-    Error error;
-
-    const int short_option = g_option_table[option_idx].short_option;
-
-    switch (short_option)
-    {
-    case 'l':
-        language = Language::GetLanguageTypeFromString (option_arg);
-        if (language == eLanguageTypeUnknown)
-            error.SetErrorStringWithFormat ("unknown language type: '%s' for expression", option_arg);
-        break;
-
-    case 'a':
-        {
-            bool success;
-            bool result;
-            result = Args::StringToBoolean(option_arg, true, &success);
-            if (!success)
-                error.SetErrorStringWithFormat("invalid all-threads value setting: \"%s\"", option_arg);
-            else
-                try_all_threads = result;
-        }
-        break;
-        
-    case 'i':
-        {
-            bool success;
-            bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
-            if (success)
-                ignore_breakpoints = tmp_value;
-            else
-                error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg);
-            break;
-        }
-
-    case 'j':
-        {
-            bool success;
-            bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
-            if (success)
-                allow_jit = tmp_value;
-            else
-                error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg);
-            break;
-        }
-
-    case 't':
-        {
-            bool success;
-            uint32_t result;
-            result = StringConvert::ToUInt32(option_arg, 0, 0, &success);
-            if (success)
-                timeout = result;
-            else
-                error.SetErrorStringWithFormat ("invalid timeout setting \"%s\"", option_arg);
-        }
-        break;
-        
-    case 'u':
-        {
-            bool success;
-            bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
-            if (success)
-                unwind_on_error = tmp_value;
-            else
-                error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg);
-            break;
-        }
-            
-    case 'v':
-        if (!option_arg)
-        {
-            m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull;
-            break;
-        }
-        m_verbosity = (LanguageRuntimeDescriptionDisplayVerbosity) Args::StringToOptionEnum(option_arg, g_option_table[option_idx].enum_values, 0, error);
-        if (!error.Success())
-            error.SetErrorStringWithFormat ("unrecognized value for description-verbosity '%s'", option_arg);
-        break;
-    
-    case 'g':
-        debug = true;
-        unwind_on_error = false;
-        ignore_breakpoints = false;
-        break;
-    
-    case 'p':
-        top_level = true;
-        break;
-
-    case 'X':
-        {
-            bool success;
-            bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
-            if (success)
-                auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo;
-            else
-                error.SetErrorStringWithFormat("could not convert \"%s\" to a boolean value.", option_arg);
-            break;
-        }
-            
-    default:
-        error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-        break;
-    }
-
-    return error;
+uint32_t CommandObjectExpression::CommandOptions::GetNumDefinitions() {
+  return llvm::array_lengthof(g_option_table);
 }
 
-void
-CommandObjectExpression::CommandOptions::OptionParsingStarting(
-                                            ExecutionContext *execution_context)
-{
-    auto process_sp =
-        execution_context ? execution_context->GetProcessSP() : ProcessSP();
-    if (process_sp)
-    {
-        ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
-        unwind_on_error    = process_sp->GetUnwindOnErrorInExpressions();
-    }
+Error CommandObjectExpression::CommandOptions::SetOptionValue(
+    uint32_t option_idx, const char *option_arg,
+    ExecutionContext *execution_context) {
+  Error error;
+
+  const int short_option = g_option_table[option_idx].short_option;
+
+  switch (short_option) {
+  case 'l':
+    language = Language::GetLanguageTypeFromString(option_arg);
+    if (language == eLanguageTypeUnknown)
+      error.SetErrorStringWithFormat(
+          "unknown language type: '%s' for expression", option_arg);
+    break;
+
+  case 'a': {
+    bool success;
+    bool result;
+    result = Args::StringToBoolean(option_arg, true, &success);
+    if (!success)
+      error.SetErrorStringWithFormat(
+          "invalid all-threads value setting: \"%s\"", option_arg);
+    else
+      try_all_threads = result;
+  } break;
+
+  case 'i': {
+    bool success;
+    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    if (success)
+      ignore_breakpoints = tmp_value;
+    else
+      error.SetErrorStringWithFormat(
+          "could not convert \"%s\" to a boolean value.", option_arg);
+    break;
+  }
+
+  case 'j': {
+    bool success;
+    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    if (success)
+      allow_jit = tmp_value;
+    else
+      error.SetErrorStringWithFormat(
+          "could not convert \"%s\" to a boolean value.", option_arg);
+    break;
+  }
+
+  case 't': {
+    bool success;
+    uint32_t result;
+    result = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+    if (success)
+      timeout = result;
+    else
+      error.SetErrorStringWithFormat("invalid timeout setting \"%s\"",
+                                     option_arg);
+  } break;
+
+  case 'u': {
+    bool success;
+    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    if (success)
+      unwind_on_error = tmp_value;
     else
-    {
-        ignore_breakpoints = true;
-        unwind_on_error = true;
+      error.SetErrorStringWithFormat(
+          "could not convert \"%s\" to a boolean value.", option_arg);
+    break;
+  }
+
+  case 'v':
+    if (!option_arg) {
+      m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull;
+      break;
     }
-    
-    show_summary = true;
-    try_all_threads = true;
-    timeout = 0;
-    debug = false;
-    language = eLanguageTypeUnknown;
-    m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact;
-    auto_apply_fixits = eLazyBoolCalculate;
-    top_level = false;
-    allow_jit = true;
-}
-
-const OptionDefinition*
-CommandObjectExpression::CommandOptions::GetDefinitions ()
-{
-    return g_option_table;
+    m_verbosity =
+        (LanguageRuntimeDescriptionDisplayVerbosity)Args::StringToOptionEnum(
+            option_arg, g_option_table[option_idx].enum_values, 0, error);
+    if (!error.Success())
+      error.SetErrorStringWithFormat(
+          "unrecognized value for description-verbosity '%s'", option_arg);
+    break;
+
+  case 'g':
+    debug = true;
+    unwind_on_error = false;
+    ignore_breakpoints = false;
+    break;
+
+  case 'p':
+    top_level = true;
+    break;
+
+  case 'X': {
+    bool success;
+    bool tmp_value = Args::StringToBoolean(option_arg, true, &success);
+    if (success)
+      auto_apply_fixits = tmp_value ? eLazyBoolYes : eLazyBoolNo;
+    else
+      error.SetErrorStringWithFormat(
+          "could not convert \"%s\" to a boolean value.", option_arg);
+    break;
+  }
+
+  default:
+    error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                   short_option);
+    break;
+  }
+
+  return error;
+}
+
+void CommandObjectExpression::CommandOptions::OptionParsingStarting(
+    ExecutionContext *execution_context) {
+  auto process_sp =
+      execution_context ? execution_context->GetProcessSP() : ProcessSP();
+  if (process_sp) {
+    ignore_breakpoints = process_sp->GetIgnoreBreakpointsInExpressions();
+    unwind_on_error = process_sp->GetUnwindOnErrorInExpressions();
+  } else {
+    ignore_breakpoints = true;
+    unwind_on_error = true;
+  }
+
+  show_summary = true;
+  try_all_threads = true;
+  timeout = 0;
+  debug = false;
+  language = eLanguageTypeUnknown;
+  m_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityCompact;
+  auto_apply_fixits = eLazyBoolCalculate;
+  top_level = false;
+  allow_jit = true;
+}
+
+const OptionDefinition *
+CommandObjectExpression::CommandOptions::GetDefinitions() {
+  return g_option_table;
 }
 
-CommandObjectExpression::CommandObjectExpression(CommandInterpreter &interpreter)
+CommandObjectExpression::CommandObjectExpression(
+    CommandInterpreter &interpreter)
     : CommandObjectRaw(
-          interpreter, "expression",
-          "Evaluate an expression on the current thread.  Displays any returned value with LLDB's default formatting.",
+          interpreter, "expression", "Evaluate an expression on the current "
+                                     "thread.  Displays any returned value "
+                                     "with LLDB's default formatting.",
           nullptr, eCommandProcessMustBePaused | eCommandTryTargetAPILock),
       IOHandlerDelegate(IOHandlerDelegate::Completion::Expression),
-      m_option_group(),
-      m_format_options(eFormatDefault),
-      m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false, true),
-      m_command_options(),
-      m_expr_line_count(0),
-      m_expr_lines()
-{
-    SetHelpLong(
-R"(
+      m_option_group(), m_format_options(eFormatDefault),
+      m_repl_option(LLDB_OPT_SET_1, false, "repl", 'r', "Drop into REPL", false,
+                    true),
+      m_command_options(), m_expr_line_count(0), m_expr_lines() {
+  SetHelpLong(
+      R"(
 Timeouts:
 
-)" "    If the expression can be evaluated statically (without running code) then it will be.  \
+)"
+      "    If the expression can be evaluated statically (without running code) then it will be.  \
 Otherwise, by default the expression will run on the current thread with a short timeout: \
 currently .25 seconds.  If it doesn't return in that time, the evaluation will be interrupted \
 and resumed with all threads running.  You can use the -a option to disable retrying on all \
-threads.  You can use the -t option to set a shorter timeout." R"(
+threads.  You can use the -t option to set a shorter timeout."
+      R"(
 
 User defined variables:
 
-)" "    You can define your own variables for convenience or to be used in subsequent expressions.  \
+)"
+      "    You can define your own variables for convenience or to be used in subsequent expressions.  \
 You define them the same way you would define variables in C.  If the first character of \
 your user defined variable is a $, then the variable's value will be available in future \
-expressions, otherwise it will just be available in the current expression." R"(
+expressions, otherwise it will just be available in the current expression."
+      R"(
 
 Continuing evaluation after a breakpoint:
 
-)" "    If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
+)"
+      "    If the \"-i false\" option is used, and execution is interrupted by a breakpoint hit, once \
 you are done with your investigation, you can either remove the expression execution frames \
 from the stack with \"thread return -x\" or if you are still interested in the expression result \
 you can issue the \"continue\" command and the expression evaluation will complete and the \
 expression result will be available using the \"thread.completed-expression\" key in the thread \
-format." R"(
+format."
+      R"(
 
 Examples:
 
     expr my_struct->a = my_array[3]
     expr -f bin -- (index * 8) + 5
     expr unsigned int $foo = 5
-    expr char c[] = \"foo\"; c[0])"
-    );
+    expr char c[] = \"foo\"; c[0])");
 
-    CommandArgumentEntry arg;
-    CommandArgumentData expression_arg;
+  CommandArgumentEntry arg;
+  CommandArgumentData expression_arg;
 
-    // Define the first (and only) variant of this arg.
-    expression_arg.arg_type = eArgTypeExpression;
-    expression_arg.arg_repetition = eArgRepeatPlain;
-
-    // There is only one variant this argument could be; put it into the argument entry.
-    arg.push_back (expression_arg);
-
-    // Push the data for the first argument into the m_arguments vector.
-    m_arguments.push_back (arg);
-    
-    // Add the "--format" and "--gdb-format"
-    m_option_group.Append (&m_format_options, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_1);
-    m_option_group.Append (&m_command_options);
-    m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1 | LLDB_OPT_SET_2);
-    m_option_group.Append (&m_repl_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_3);
-    m_option_group.Finalize();
+  // Define the first (and only) variant of this arg.
+  expression_arg.arg_type = eArgTypeExpression;
+  expression_arg.arg_repetition = eArgRepeatPlain;
+
+  // There is only one variant this argument could be; put it into the argument
+  // entry.
+  arg.push_back(expression_arg);
+
+  // Push the data for the first argument into the m_arguments vector.
+  m_arguments.push_back(arg);
+
+  // Add the "--format" and "--gdb-format"
+  m_option_group.Append(&m_format_options,
+                        OptionGroupFormat::OPTION_GROUP_FORMAT |
+                            OptionGroupFormat::OPTION_GROUP_GDB_FMT,
+                        LLDB_OPT_SET_1);
+  m_option_group.Append(&m_command_options);
+  m_option_group.Append(&m_varobj_options, LLDB_OPT_SET_ALL,
+                        LLDB_OPT_SET_1 | LLDB_OPT_SET_2);
+  m_option_group.Append(&m_repl_option, LLDB_OPT_SET_ALL, LLDB_OPT_SET_3);
+  m_option_group.Finalize();
 }
 
 CommandObjectExpression::~CommandObjectExpression() = default;
 
-Options *
-CommandObjectExpression::GetOptions ()
-{
-    return &m_option_group;
-}
+Options *CommandObjectExpression::GetOptions() { return &m_option_group; }
 
 static lldb_private::Error
-CanBeUsedForElementCountPrinting (ValueObject& valobj)
-{
-    CompilerType type(valobj.GetCompilerType());
-    CompilerType pointee;
-    if (!type.IsPointerType(&pointee))
-        return Error("as it does not refer to a pointer");
-    if (pointee.IsVoidType())
-        return Error("as it refers to a pointer to void");
-    return Error();
-}
-
-bool
-CommandObjectExpression::EvaluateExpression(const char *expr,
-                                            Stream *output_stream,
-                                            Stream *error_stream,
-                                            CommandReturnObject *result)
-{
-    // Don't use m_exe_ctx as this might be called asynchronously
-    // after the command object DoExecute has finished when doing
-    // multi-line expression that use an input reader...
-    ExecutionContext exe_ctx (m_interpreter.GetExecutionContext());
-
-    Target *target = exe_ctx.GetTargetPtr();
-    
-    if (!target)
-        target = GetDummyTarget();
-    
-    if (target)
-    {
-        lldb::ValueObjectSP result_valobj_sp;
-        bool keep_in_memory = true;
-        StackFrame *frame = exe_ctx.GetFramePtr();
-
-        EvaluateExpressionOptions options;
-        options.SetCoerceToId(m_varobj_options.use_objc);
-        options.SetUnwindOnError(m_command_options.unwind_on_error);
-        options.SetIgnoreBreakpoints (m_command_options.ignore_breakpoints);
-        options.SetKeepInMemory(keep_in_memory);
-        options.SetUseDynamic(m_varobj_options.use_dynamic);
-        options.SetTryAllThreads(m_command_options.try_all_threads);
-        options.SetDebug(m_command_options.debug);
-        options.SetLanguage(m_command_options.language);
-        options.SetExecutionPolicy(m_command_options.allow_jit ?
-            EvaluateExpressionOptions::default_execution_policy :
-            lldb_private::eExecutionPolicyNever);
-        
-        bool auto_apply_fixits;
-        if (m_command_options.auto_apply_fixits == eLazyBoolCalculate)
-            auto_apply_fixits = target->GetEnableAutoApplyFixIts();
-        else
-            auto_apply_fixits = m_command_options.auto_apply_fixits == eLazyBoolYes ? true : false;
-        
-        options.SetAutoApplyFixIts(auto_apply_fixits);
-        
-        if (m_command_options.top_level)
-            options.SetExecutionPolicy(eExecutionPolicyTopLevel);
-
-        // If there is any chance we are going to stop and want to see
-        // what went wrong with our expression, we should generate debug info
-        if (!m_command_options.ignore_breakpoints ||
-            !m_command_options.unwind_on_error)
-            options.SetGenerateDebugInfo(true);
-        
-        if (m_command_options.timeout > 0)
-            options.SetTimeoutUsec(m_command_options.timeout);
-        else
-            options.SetTimeoutUsec(0);
-
-        ExpressionResults success = target->EvaluateExpression(expr, frame, result_valobj_sp, options, &m_fixed_expression);
-        
-        // We only tell you about the FixIt if we applied it.  The compiler errors will suggest the FixIt if it parsed.
-        if (error_stream && !m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts())
-        {
-            if (success == eExpressionCompleted)
-                error_stream->Printf ("  Fix-it applied, fixed expression was: \n    %s\n", m_fixed_expression.c_str());
-        }
+CanBeUsedForElementCountPrinting(ValueObject &valobj) {
+  CompilerType type(valobj.GetCompilerType());
+  CompilerType pointee;
+  if (!type.IsPointerType(&pointee))
+    return Error("as it does not refer to a pointer");
+  if (pointee.IsVoidType())
+    return Error("as it refers to a pointer to void");
+  return Error();
+}
+
+bool CommandObjectExpression::EvaluateExpression(const char *expr,
+                                                 Stream *output_stream,
+                                                 Stream *error_stream,
+                                                 CommandReturnObject *result) {
+  // Don't use m_exe_ctx as this might be called asynchronously
+  // after the command object DoExecute has finished when doing
+  // multi-line expression that use an input reader...
+  ExecutionContext exe_ctx(m_interpreter.GetExecutionContext());
+
+  Target *target = exe_ctx.GetTargetPtr();
+
+  if (!target)
+    target = GetDummyTarget();
+
+  if (target) {
+    lldb::ValueObjectSP result_valobj_sp;
+    bool keep_in_memory = true;
+    StackFrame *frame = exe_ctx.GetFramePtr();
+
+    EvaluateExpressionOptions options;
+    options.SetCoerceToId(m_varobj_options.use_objc);
+    options.SetUnwindOnError(m_command_options.unwind_on_error);
+    options.SetIgnoreBreakpoints(m_command_options.ignore_breakpoints);
+    options.SetKeepInMemory(keep_in_memory);
+    options.SetUseDynamic(m_varobj_options.use_dynamic);
+    options.SetTryAllThreads(m_command_options.try_all_threads);
+    options.SetDebug(m_command_options.debug);
+    options.SetLanguage(m_command_options.language);
+    options.SetExecutionPolicy(
+        m_command_options.allow_jit
+            ? EvaluateExpressionOptions::default_execution_policy
+            : lldb_private::eExecutionPolicyNever);
+
+    bool auto_apply_fixits;
+    if (m_command_options.auto_apply_fixits == eLazyBoolCalculate)
+      auto_apply_fixits = target->GetEnableAutoApplyFixIts();
+    else
+      auto_apply_fixits =
+          m_command_options.auto_apply_fixits == eLazyBoolYes ? true : false;
 
-        if (result_valobj_sp)
-        {
-            Format format = m_format_options.GetFormat();
-
-            if (result_valobj_sp->GetError().Success())
-            {
-                if (format != eFormatVoid)
-                {
-                    if (format != eFormatDefault)
-                        result_valobj_sp->SetFormat (format);
-
-                    if (m_varobj_options.elem_count > 0)
-                    {
-                        Error error(CanBeUsedForElementCountPrinting(*result_valobj_sp));
-                        if (error.Fail())
-                        {
-                            result->AppendErrorWithFormat("expression cannot be used with --element-count %s\n", error.AsCString(""));
-                            result->SetStatus(eReturnStatusFailed);
-                            return false;
-                        }
-                    }
-
-                    DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(m_command_options.m_verbosity,format));
-                    options.SetVariableFormatDisplayLanguage(result_valobj_sp->GetPreferredDisplayLanguage());
-
-                    result_valobj_sp->Dump(*output_stream,options);
-                    
-                    if (result)
-                        result->SetStatus (eReturnStatusSuccessFinishResult);
-                }
-            }
-            else
-            {
-                if (result_valobj_sp->GetError().GetError() == UserExpression::kNoResult)
-                {
-                    if (format != eFormatVoid && m_interpreter.GetDebugger().GetNotifyVoid())
-                    {
-                        error_stream->PutCString("(void)\n");
-                    }
-                    
-                    if (result)
-                        result->SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    const char *error_cstr = result_valobj_sp->GetError().AsCString();
-                    if (error_cstr && error_cstr[0])
-                    {
-                        const size_t error_cstr_len = strlen (error_cstr);
-                        const bool ends_with_newline = error_cstr[error_cstr_len - 1] == '\n';
-                        if (strstr(error_cstr, "error:") != error_cstr)
-                            error_stream->PutCString ("error: ");
-                        error_stream->Write(error_cstr, error_cstr_len);
-                        if (!ends_with_newline)
-                            error_stream->EOL();
-                    }
-                    else
-                    {
-                        error_stream->PutCString ("error: unknown error\n");
-                    }
-                    
-                    if (result)
-                        result->SetStatus (eReturnStatusFailed);
-                }
-            }
-        }
-    }
+    options.SetAutoApplyFixIts(auto_apply_fixits);
+
+    if (m_command_options.top_level)
+      options.SetExecutionPolicy(eExecutionPolicyTopLevel);
+
+    // If there is any chance we are going to stop and want to see
+    // what went wrong with our expression, we should generate debug info
+    if (!m_command_options.ignore_breakpoints ||
+        !m_command_options.unwind_on_error)
+      options.SetGenerateDebugInfo(true);
+
+    if (m_command_options.timeout > 0)
+      options.SetTimeoutUsec(m_command_options.timeout);
     else
-    {
-        error_stream->Printf ("error: invalid execution context for expression\n");
-        return false;
+      options.SetTimeoutUsec(0);
+
+    ExpressionResults success = target->EvaluateExpression(
+        expr, frame, result_valobj_sp, options, &m_fixed_expression);
+
+    // We only tell you about the FixIt if we applied it.  The compiler errors
+    // will suggest the FixIt if it parsed.
+    if (error_stream && !m_fixed_expression.empty() &&
+        target->GetEnableNotifyAboutFixIts()) {
+      if (success == eExpressionCompleted)
+        error_stream->Printf(
+            "  Fix-it applied, fixed expression was: \n    %s\n",
+            m_fixed_expression.c_str());
     }
-        
-    return true;
-}
 
-void
-CommandObjectExpression::IOHandlerInputComplete (IOHandler &io_handler, std::string &line)
-{
-    io_handler.SetIsDone(true);
-//    StreamSP output_stream = io_handler.GetDebugger().GetAsyncOutputStream();
-//    StreamSP error_stream = io_handler.GetDebugger().GetAsyncErrorStream();
-    StreamFileSP output_sp(io_handler.GetOutputStreamFile());
-    StreamFileSP error_sp(io_handler.GetErrorStreamFile());
-
-    EvaluateExpression (line.c_str(),
-                        output_sp.get(),
-                        error_sp.get());
-    if (output_sp)
-        output_sp->Flush();
-    if (error_sp)
-        error_sp->Flush();
-}
-
-bool
-CommandObjectExpression::IOHandlerIsInputComplete (IOHandler &io_handler,
-                                                   StringList &lines)
-{
-    // An empty lines is used to indicate the end of input
-    const size_t num_lines = lines.GetSize();
-    if (num_lines > 0 && lines[num_lines - 1].empty())
-    {
-        // Remove the last empty line from "lines" so it doesn't appear
-        // in our resulting input and return true to indicate we are done
-        // getting lines
-        lines.PopBack();
-        return true;
+    if (result_valobj_sp) {
+      Format format = m_format_options.GetFormat();
+
+      if (result_valobj_sp->GetError().Success()) {
+        if (format != eFormatVoid) {
+          if (format != eFormatDefault)
+            result_valobj_sp->SetFormat(format);
+
+          if (m_varobj_options.elem_count > 0) {
+            Error error(CanBeUsedForElementCountPrinting(*result_valobj_sp));
+            if (error.Fail()) {
+              result->AppendErrorWithFormat(
+                  "expression cannot be used with --element-count %s\n",
+                  error.AsCString(""));
+              result->SetStatus(eReturnStatusFailed);
+              return false;
+            }
+          }
+
+          DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
+              m_command_options.m_verbosity, format));
+          options.SetVariableFormatDisplayLanguage(
+              result_valobj_sp->GetPreferredDisplayLanguage());
+
+          result_valobj_sp->Dump(*output_stream, options);
+
+          if (result)
+            result->SetStatus(eReturnStatusSuccessFinishResult);
+        }
+      } else {
+        if (result_valobj_sp->GetError().GetError() ==
+            UserExpression::kNoResult) {
+          if (format != eFormatVoid &&
+              m_interpreter.GetDebugger().GetNotifyVoid()) {
+            error_stream->PutCString("(void)\n");
+          }
+
+          if (result)
+            result->SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          const char *error_cstr = result_valobj_sp->GetError().AsCString();
+          if (error_cstr && error_cstr[0]) {
+            const size_t error_cstr_len = strlen(error_cstr);
+            const bool ends_with_newline =
+                error_cstr[error_cstr_len - 1] == '\n';
+            if (strstr(error_cstr, "error:") != error_cstr)
+              error_stream->PutCString("error: ");
+            error_stream->Write(error_cstr, error_cstr_len);
+            if (!ends_with_newline)
+              error_stream->EOL();
+          } else {
+            error_stream->PutCString("error: unknown error\n");
+          }
+
+          if (result)
+            result->SetStatus(eReturnStatusFailed);
+        }
+      }
     }
+  } else {
+    error_stream->Printf("error: invalid execution context for expression\n");
     return false;
+  }
+
+  return true;
 }
 
-void
-CommandObjectExpression::GetMultilineExpression ()
-{
-    m_expr_lines.clear();
-    m_expr_line_count = 0;
-    
-    Debugger &debugger = GetCommandInterpreter().GetDebugger();
-    bool color_prompt = debugger.GetUseColor();
-    const bool multiple_lines = true; // Get multiple lines
-    IOHandlerSP io_handler_sp(new IOHandlerEditline(debugger,
-                                                    IOHandler::Type::Expression,
-                                                    "lldb-expr",      // Name of input reader for history
-                                                    nullptr,          // No prompt
-                                                    nullptr,          // Continuation prompt
-                                                    multiple_lines,
-                                                    color_prompt,
-                                                    1,                // Show line numbers starting at 1
-                                                    *this));
-    
-    StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile());
-    if (output_sp)
-    {
-        output_sp->PutCString("Enter expressions, then terminate with an empty line to evaluate:\n");
-        output_sp->Flush();
-    }
-    debugger.PushIOHandler(io_handler_sp);
+void CommandObjectExpression::IOHandlerInputComplete(IOHandler &io_handler,
+                                                     std::string &line) {
+  io_handler.SetIsDone(true);
+  //    StreamSP output_stream =
+  //    io_handler.GetDebugger().GetAsyncOutputStream();
+  //    StreamSP error_stream = io_handler.GetDebugger().GetAsyncErrorStream();
+  StreamFileSP output_sp(io_handler.GetOutputStreamFile());
+  StreamFileSP error_sp(io_handler.GetErrorStreamFile());
+
+  EvaluateExpression(line.c_str(), output_sp.get(), error_sp.get());
+  if (output_sp)
+    output_sp->Flush();
+  if (error_sp)
+    error_sp->Flush();
+}
+
+bool CommandObjectExpression::IOHandlerIsInputComplete(IOHandler &io_handler,
+                                                       StringList &lines) {
+  // An empty lines is used to indicate the end of input
+  const size_t num_lines = lines.GetSize();
+  if (num_lines > 0 && lines[num_lines - 1].empty()) {
+    // Remove the last empty line from "lines" so it doesn't appear
+    // in our resulting input and return true to indicate we are done
+    // getting lines
+    lines.PopBack();
+    return true;
+  }
+  return false;
 }
 
-bool
-CommandObjectExpression::DoExecute(const char *command,
-                                   CommandReturnObject &result)
-{
-    m_fixed_expression.clear();
-    auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
-    m_option_group.NotifyOptionParsingStarting(&exe_ctx);
-
-    const char * expr = nullptr;
-
-    if (command[0] == '\0')
-    {
-        GetMultilineExpression ();
-        return result.Succeeded();
+void CommandObjectExpression::GetMultilineExpression() {
+  m_expr_lines.clear();
+  m_expr_line_count = 0;
+
+  Debugger &debugger = GetCommandInterpreter().GetDebugger();
+  bool color_prompt = debugger.GetUseColor();
+  const bool multiple_lines = true; // Get multiple lines
+  IOHandlerSP io_handler_sp(
+      new IOHandlerEditline(debugger, IOHandler::Type::Expression,
+                            "lldb-expr", // Name of input reader for history
+                            nullptr,     // No prompt
+                            nullptr,     // Continuation prompt
+                            multiple_lines, color_prompt,
+                            1, // Show line numbers starting at 1
+                            *this));
+
+  StreamFileSP output_sp(io_handler_sp->GetOutputStreamFile());
+  if (output_sp) {
+    output_sp->PutCString(
+        "Enter expressions, then terminate with an empty line to evaluate:\n");
+    output_sp->Flush();
+  }
+  debugger.PushIOHandler(io_handler_sp);
+}
+
+bool CommandObjectExpression::DoExecute(const char *command,
+                                        CommandReturnObject &result) {
+  m_fixed_expression.clear();
+  auto exe_ctx = GetCommandInterpreter().GetExecutionContext();
+  m_option_group.NotifyOptionParsingStarting(&exe_ctx);
+
+  const char *expr = nullptr;
+
+  if (command[0] == '\0') {
+    GetMultilineExpression();
+    return result.Succeeded();
+  }
+
+  if (command[0] == '-') {
+    // We have some options and these options MUST end with --.
+    const char *end_options = nullptr;
+    const char *s = command;
+    while (s && s[0]) {
+      end_options = ::strstr(s, "--");
+      if (end_options) {
+        end_options += 2; // Get past the "--"
+        if (::isspace(end_options[0])) {
+          expr = end_options;
+          while (::isspace(*expr))
+            ++expr;
+          break;
+        }
+      }
+      s = end_options;
     }
 
-    if (command[0] == '-')
-    {
-        // We have some options and these options MUST end with --.
-        const char *end_options = nullptr;
-        const char *s = command;
-        while (s && s[0])
-        {
-            end_options = ::strstr (s, "--");
-            if (end_options)
-            {
-                end_options += 2; // Get past the "--"
-                if (::isspace (end_options[0]))
-                {
-                    expr = end_options;
-                    while (::isspace (*expr))
-                        ++expr;
-                    break;
-                }
-            }
-            s = end_options;
-        }
+    if (end_options) {
+      Args args(llvm::StringRef(command, end_options - command));
+      if (!ParseOptions(args, result))
+        return false;
 
-        if (end_options)
-        {
-            Args args (llvm::StringRef(command, end_options - command));
-            if (!ParseOptions (args, result))
-                return false;
-            
-            Error error (m_option_group.NotifyOptionParsingFinished(&exe_ctx));
-            if (error.Fail())
-            {
-                result.AppendError (error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-            
-            if (m_repl_option.GetOptionValue().GetCurrentValue())
-            {
-                Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
-                if (target)
-                {
-                    // Drop into REPL
-                    m_expr_lines.clear();
-                    m_expr_line_count = 0;
-                    
-                    Debugger &debugger = target->GetDebugger();
-                    
-                    // Check if the LLDB command interpreter is sitting on top of a REPL that
-                    // launched it...
-                    if (debugger.CheckTopIOHandlerTypes(IOHandler::Type::CommandInterpreter, IOHandler::Type::REPL))
-                    {
-                        // the LLDB command interpreter is sitting on top of a REPL that launched it,
-                        // so just say the command interpreter is done and fall back to the existing REPL
-                        m_interpreter.GetIOHandler(false)->SetIsDone(true);
-                    }
-                    else
-                    {
-                        // We are launching the REPL on top of the current LLDB command interpreter,
-                        // so just push one
-                        bool initialize = false;
-                        Error repl_error;
-                        REPLSP repl_sp (target->GetREPL(repl_error, m_command_options.language, nullptr, false));
-                        
-                        if (!repl_sp)
-                        {
-                            initialize = true;
-                            repl_sp = target->GetREPL(repl_error, m_command_options.language, nullptr, true);
-                            if (!repl_error.Success())
-                            {
-                                result.SetError(repl_error);
-                                return result.Succeeded();
-                            }
-                        }
-                        
-                        if (repl_sp)
-                        {
-                            if (initialize)
-                            {
-                                repl_sp->SetCommandOptions(m_command_options);
-                                repl_sp->SetFormatOptions(m_format_options);
-                                repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
-                            }
-                            
-                            IOHandlerSP io_handler_sp (repl_sp->GetIOHandler());
-                            
-                            io_handler_sp->SetIsDone(false);
-                            
-                            debugger.PushIOHandler(io_handler_sp);
-                        }
-                        else
-                        {
-                            repl_error.SetErrorStringWithFormat("Couldn't create a REPL for %s", Language::GetNameForLanguageType(m_command_options.language));
-                            result.SetError(repl_error);
-                            return result.Succeeded();
-                        }
-                    }
-                }
-            }
-            // No expression following options
-            else if (expr == nullptr || expr[0] == '\0')
-            {
-                GetMultilineExpression ();
+      Error error(m_option_group.NotifyOptionParsingFinished(&exe_ctx));
+      if (error.Fail()) {
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      if (m_repl_option.GetOptionValue().GetCurrentValue()) {
+        Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
+        if (target) {
+          // Drop into REPL
+          m_expr_lines.clear();
+          m_expr_line_count = 0;
+
+          Debugger &debugger = target->GetDebugger();
+
+          // Check if the LLDB command interpreter is sitting on top of a REPL
+          // that
+          // launched it...
+          if (debugger.CheckTopIOHandlerTypes(
+                  IOHandler::Type::CommandInterpreter, IOHandler::Type::REPL)) {
+            // the LLDB command interpreter is sitting on top of a REPL that
+            // launched it,
+            // so just say the command interpreter is done and fall back to the
+            // existing REPL
+            m_interpreter.GetIOHandler(false)->SetIsDone(true);
+          } else {
+            // We are launching the REPL on top of the current LLDB command
+            // interpreter,
+            // so just push one
+            bool initialize = false;
+            Error repl_error;
+            REPLSP repl_sp(target->GetREPL(
+                repl_error, m_command_options.language, nullptr, false));
+
+            if (!repl_sp) {
+              initialize = true;
+              repl_sp = target->GetREPL(repl_error, m_command_options.language,
+                                        nullptr, true);
+              if (!repl_error.Success()) {
+                result.SetError(repl_error);
                 return result.Succeeded();
+              }
             }
-        }
-    }
 
-    if (expr == nullptr)
-        expr = command;
-    
-    if (EvaluateExpression (expr, &(result.GetOutputStream()), &(result.GetErrorStream()), &result))
-    {
-        Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
-        if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts())
-        {
-            CommandHistory &history = m_interpreter.GetCommandHistory();
-            // FIXME: Can we figure out what the user actually typed (e.g. some alias for expr???)
-            // If we can it would be nice to show that.
-            std::string fixed_command("expression ");
-            if (expr == command)
-                fixed_command.append(m_fixed_expression);
-            else
-            {
-                // Add in any options that might have been in the original command:
-                fixed_command.append(command, expr - command);
-                fixed_command.append(m_fixed_expression);
+            if (repl_sp) {
+              if (initialize) {
+                repl_sp->SetCommandOptions(m_command_options);
+                repl_sp->SetFormatOptions(m_format_options);
+                repl_sp->SetValueObjectDisplayOptions(m_varobj_options);
+              }
+
+              IOHandlerSP io_handler_sp(repl_sp->GetIOHandler());
+
+              io_handler_sp->SetIsDone(false);
+
+              debugger.PushIOHandler(io_handler_sp);
+            } else {
+              repl_error.SetErrorStringWithFormat(
+                  "Couldn't create a REPL for %s",
+                  Language::GetNameForLanguageType(m_command_options.language));
+              result.SetError(repl_error);
+              return result.Succeeded();
             }
-            history.AppendString(fixed_command);
+          }
         }
-        return true;
+      }
+      // No expression following options
+      else if (expr == nullptr || expr[0] == '\0') {
+        GetMultilineExpression();
+        return result.Succeeded();
+      }
     }
+  }
 
-    result.SetStatus (eReturnStatusFailed);
-    return false;
+  if (expr == nullptr)
+    expr = command;
+
+  if (EvaluateExpression(expr, &(result.GetOutputStream()),
+                         &(result.GetErrorStream()), &result)) {
+    Target *target = m_interpreter.GetExecutionContext().GetTargetPtr();
+    if (!m_fixed_expression.empty() && target->GetEnableNotifyAboutFixIts()) {
+      CommandHistory &history = m_interpreter.GetCommandHistory();
+      // FIXME: Can we figure out what the user actually typed (e.g. some alias
+      // for expr???)
+      // If we can it would be nice to show that.
+      std::string fixed_command("expression ");
+      if (expr == command)
+        fixed_command.append(m_fixed_expression);
+      else {
+        // Add in any options that might have been in the original command:
+        fixed_command.append(command, expr - command);
+        fixed_command.append(m_fixed_expression);
+      }
+      history.AppendString(fixed_command);
+    }
+    return true;
+  }
+
+  result.SetStatus(eReturnStatusFailed);
+  return false;
 }

Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Tue Sep  6 15:57:50 2016
@@ -14,101 +14,82 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private-enumerations.h"
 #include "lldb/Core/IOHandler.h"
 #include "lldb/Interpreter/CommandObject.h"
 #include "lldb/Interpreter/OptionGroupBoolean.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
 #include "lldb/Target/ExecutionContext.h"
+#include "lldb/lldb-private-enumerations.h"
 namespace lldb_private {
 
-class CommandObjectExpression :
-    public CommandObjectRaw,
-    public IOHandlerDelegate
-{
+class CommandObjectExpression : public CommandObjectRaw,
+                                public IOHandlerDelegate {
 public:
+  class CommandOptions : public OptionGroup {
+  public:
+    CommandOptions();
+
+    ~CommandOptions() override;
+
+    uint32_t GetNumDefinitions() override;
+
+    const OptionDefinition *GetDefinitions() override;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_value,
+                         ExecutionContext *execution_context) override;
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+    // Options table: Required for subclasses of Options.
 
-    class CommandOptions : public OptionGroup
-    {
-    public:
-
-        CommandOptions ();
-
-        ~CommandOptions() override;
-
-        uint32_t
-        GetNumDefinitions() override;
-        
-        const OptionDefinition*
-        GetDefinitions() override;
-        
-        Error
-        SetOptionValue(uint32_t option_idx,
-                       const char *option_value,
-                       ExecutionContext *execution_context) override;
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override;
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
-        bool        top_level;
-        bool        unwind_on_error;
-        bool        ignore_breakpoints;
-        bool        allow_jit;
-        bool        show_types;
-        bool        show_summary;
-        bool        debug;
-        uint32_t    timeout;
-        bool        try_all_threads;
-        lldb::LanguageType language;
-        LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
-        LazyBool        auto_apply_fixits;
-    };
+    static OptionDefinition g_option_table[];
+    bool top_level;
+    bool unwind_on_error;
+    bool ignore_breakpoints;
+    bool allow_jit;
+    bool show_types;
+    bool show_summary;
+    bool debug;
+    uint32_t timeout;
+    bool try_all_threads;
+    lldb::LanguageType language;
+    LanguageRuntimeDescriptionDisplayVerbosity m_verbosity;
+    LazyBool auto_apply_fixits;
+  };
 
-    CommandObjectExpression (CommandInterpreter &interpreter);
+  CommandObjectExpression(CommandInterpreter &interpreter);
 
-    ~CommandObjectExpression() override;
+  ~CommandObjectExpression() override;
 
-    Options *
-    GetOptions() override;
+  Options *GetOptions() override;
 
 protected:
-    
-    //------------------------------------------------------------------
-    // IOHandler::Delegate functions
-    //------------------------------------------------------------------
-    void
-    IOHandlerInputComplete(IOHandler &io_handler,
-			   std::string &line) override;
-    
-    bool
-    IOHandlerIsInputComplete (IOHandler &io_handler,
-                              StringList &lines) override;
-    
-    bool
-    DoExecute(const char *command,
-	      CommandReturnObject &result) override;
-
-    bool
-    EvaluateExpression (const char *expr,
-                        Stream *output_stream,
-                        Stream *error_stream,
-                        CommandReturnObject *result = NULL);
-    
-    void
-    GetMultilineExpression ();
-
-    OptionGroupOptions m_option_group;
-    OptionGroupFormat m_format_options;
-    OptionGroupValueObjectDisplay m_varobj_options;
-    OptionGroupBoolean m_repl_option;
-    CommandOptions m_command_options;
-    uint32_t m_expr_line_count;
-    std::string m_expr_lines; // Multi-line expression support
-    std::string m_fixed_expression;  // Holds the current expression's fixed text.
+  //------------------------------------------------------------------
+  // IOHandler::Delegate functions
+  //------------------------------------------------------------------
+  void IOHandlerInputComplete(IOHandler &io_handler,
+                              std::string &line) override;
+
+  bool IOHandlerIsInputComplete(IOHandler &io_handler,
+                                StringList &lines) override;
+
+  bool DoExecute(const char *command, CommandReturnObject &result) override;
+
+  bool EvaluateExpression(const char *expr, Stream *output_stream,
+                          Stream *error_stream,
+                          CommandReturnObject *result = NULL);
+
+  void GetMultilineExpression();
+
+  OptionGroupOptions m_option_group;
+  OptionGroupFormat m_format_options;
+  OptionGroupValueObjectDisplay m_varobj_options;
+  OptionGroupBoolean m_repl_option;
+  CommandOptions m_command_options;
+  uint32_t m_expr_line_count;
+  std::string m_expr_lines;       // Multi-line expression support
+  std::string m_fixed_expression; // Holds the current expression's fixed text.
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.cpp Tue Sep  6 15:57:50 2016
@@ -29,12 +29,12 @@
 #include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/OptionGroupFormat.h"
 #include "lldb/Interpreter/OptionGroupValueObjectDisplay.h"
 #include "lldb/Interpreter/OptionGroupVariable.h"
-#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/ClangASTContext.h"
+#include "lldb/Symbol/CompilerType.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolContext.h"
@@ -44,8 +44,8 @@
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/StopInfo.h"
-#include "lldb/Target/Thread.h"
 #include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
 #include "lldb/Utility/LLDBAssert.h"
 
 using namespace lldb;
@@ -61,194 +61,168 @@ using namespace lldb_private;
 // CommandObjectFrameDiagnose
 //-------------------------------------------------------------------------
 
-class CommandObjectFrameDiagnose : public CommandObjectParsed
-{
+class CommandObjectFrameDiagnose : public CommandObjectParsed {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-        Options()
-        {
-            OptionParsingStarting(nullptr);
-        }
-        
-        ~CommandOptions() override = default;
-        
-        Error
-        SetOptionValue(uint32_t option_idx, const char *option_arg,
-                       ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            switch (short_option)
-            {
-            case 'r':
-                reg = ConstString(option_arg);
-                break;
-
-            case 'a':
-                {
-                    bool success = false;
-
-                    address = StringConvert::ToUInt64 (option_arg, 0, 0, &success);
-                    if (!success)
-                    {
-                        address.reset();
-                        error.SetErrorStringWithFormat ("invalid address argument '%s'", option_arg);
-                    }
-                }
-                break;
-        
-            case 'o':
-                {
-                    bool success = false;
-                    
-                    offset = StringConvert::ToSInt64 (option_arg, 0, 0, &success);
-                    if (!success)
-                    {
-                        offset.reset();
-                        error.SetErrorStringWithFormat ("invalid offset argument '%s'", option_arg);
-                    }
-                }
-                break;
-                
-            default:
-                error.SetErrorStringWithFormat ("invalid short option character '%c'", short_option);
-                break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            address.reset();
-            reg.reset();
-            offset.reset();
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        // Options table: Required for subclasses of Options.
-        static OptionDefinition g_option_table[];
-        
-        // Options.
-        llvm::Optional<lldb::addr_t> address;
-        llvm::Optional<ConstString> reg;
-        llvm::Optional<int64_t> offset;
-    };
-    
-    CommandObjectFrameDiagnose(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "frame diagnose",
-                              "Try to determine what path path the current stop location used to get to a register or address",
-                              nullptr, eCommandRequiresThread | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
-                              eCommandProcessMustBePaused),
-          m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData index_arg;
-        
-        // Define the first (and only) variant of this arg.
-        index_arg.arg_type = eArgTypeFrameIndex;
-        index_arg.arg_repetition = eArgRepeatOptional;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (index_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-    
-    ~CommandObjectFrameDiagnose() override = default;
-    
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() { OptionParsingStarting(nullptr); }
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+      switch (short_option) {
+      case 'r':
+        reg = ConstString(option_arg);
+        break;
+
+      case 'a': {
+        bool success = false;
+
+        address = StringConvert::ToUInt64(option_arg, 0, 0, &success);
+        if (!success) {
+          address.reset();
+          error.SetErrorStringWithFormat("invalid address argument '%s'",
+                                         option_arg);
+        }
+      } break;
+
+      case 'o': {
+        bool success = false;
+
+        offset = StringConvert::ToSInt64(option_arg, 0, 0, &success);
+        if (!success) {
+          offset.reset();
+          error.SetErrorStringWithFormat("invalid offset argument '%s'",
+                                         option_arg);
+        }
+      } break;
+
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      address.reset();
+      reg.reset();
+      offset.reset();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+    static OptionDefinition g_option_table[];
+
+    // Options.
+    llvm::Optional<lldb::addr_t> address;
+    llvm::Optional<ConstString> reg;
+    llvm::Optional<int64_t> offset;
+  };
+
+  CommandObjectFrameDiagnose(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "frame diagnose",
+                            "Try to determine what path path the current stop "
+                            "location used to get to a register or address",
+                            nullptr,
+                            eCommandRequiresThread | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched |
+                                eCommandProcessMustBePaused),
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData index_arg;
+
+    // Define the first (and only) variant of this arg.
+    index_arg.arg_type = eArgTypeFrameIndex;
+    index_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(index_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectFrameDiagnose() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Thread *thread = m_exe_ctx.GetThreadPtr();
-        StackFrameSP frame_sp = thread->GetSelectedFrame();
-        
-        ValueObjectSP valobj_sp;
-        
-        if (m_options.address.hasValue())
-        {
-            if (m_options.reg.hasValue() || m_options.offset.hasValue())
-            {
-                result.AppendError("`frame diagnose --address` is incompatible with other arguments.");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            valobj_sp = frame_sp->GuessValueForAddress(m_options.address.getValue());
-        }
-        else if (m_options.reg.hasValue())
-        {
-            valobj_sp = frame_sp->GuessValueForRegisterAndOffset(m_options.reg.getValue(), m_options.offset.getValueOr(0));
-        }
-        else
-        {
-            StopInfoSP stop_info_sp = thread->GetStopInfo();
-            if (!stop_info_sp)
-            {
-                result.AppendError("No arguments provided, and no stop info.");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Thread *thread = m_exe_ctx.GetThreadPtr();
+    StackFrameSP frame_sp = thread->GetSelectedFrame();
+
+    ValueObjectSP valobj_sp;
+
+    if (m_options.address.hasValue()) {
+      if (m_options.reg.hasValue() || m_options.offset.hasValue()) {
+        result.AppendError(
+            "`frame diagnose --address` is incompatible with other arguments.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      valobj_sp = frame_sp->GuessValueForAddress(m_options.address.getValue());
+    } else if (m_options.reg.hasValue()) {
+      valobj_sp = frame_sp->GuessValueForRegisterAndOffset(
+          m_options.reg.getValue(), m_options.offset.getValueOr(0));
+    } else {
+      StopInfoSP stop_info_sp = thread->GetStopInfo();
+      if (!stop_info_sp) {
+        result.AppendError("No arguments provided, and no stop info.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      valobj_sp = StopInfo::GetCrashingDereference(stop_info_sp);
+    }
+
+    if (!valobj_sp) {
+      result.AppendError("No diagnosis available.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const bool qualify_cxx_base_classes = false;
+
+    DumpValueObjectOptions::DeclPrintingHelper helper =
+        [&valobj_sp, qualify_cxx_base_classes](
+            ConstString type, ConstString var,
+            const DumpValueObjectOptions &opts, Stream &stream) -> bool {
+      const ValueObject::GetExpressionPathFormat format = ValueObject::
+          GetExpressionPathFormat::eGetExpressionPathFormatHonorPointers;
+      valobj_sp->GetExpressionPath(stream, qualify_cxx_base_classes, format);
+      stream.PutCString(" =");
+      return true;
+    };
 
-            valobj_sp = StopInfo::GetCrashingDereference(stop_info_sp);
-        }
-        
-        if (!valobj_sp)
-        {
-            result.AppendError("No diagnosis available.");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
+    DumpValueObjectOptions options;
+    options.SetDeclPrintingHelper(helper);
+    ValueObjectPrinter printer(valobj_sp.get(), &result.GetOutputStream(),
+                               options);
+    printer.PrintValueObject();
 
-        const bool qualify_cxx_base_classes = false;
+    return true;
+  }
 
-        DumpValueObjectOptions::DeclPrintingHelper helper = [&valobj_sp, qualify_cxx_base_classes](ConstString type,
-                                                                         ConstString var,
-                                                                         const DumpValueObjectOptions &opts,
-                                                                         Stream &stream) -> bool {
-            const ValueObject::GetExpressionPathFormat format = ValueObject::GetExpressionPathFormat::eGetExpressionPathFormatHonorPointers;
-            valobj_sp->GetExpressionPath(stream, qualify_cxx_base_classes, format);
-            stream.PutCString(" =");
-            return true;
-        };
-
-        DumpValueObjectOptions options;
-        options.SetDeclPrintingHelper(helper);
-        ValueObjectPrinter printer(valobj_sp.get(), &result.GetOutputStream(), options);
-        printer.PrintValueObject();
-        
-        return true;
-    }
-    
 protected:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectFrameDiagnose::CommandOptions::g_option_table[] =
-{
-    // clang-format off
+OptionDefinition CommandObjectFrameDiagnose::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
     {LLDB_OPT_SET_1, false, "register", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeRegisterName,    "A register to diagnose."},
     {LLDB_OPT_SET_1, false, "address",  'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeAddress,         "An address to diagnose."},
     {LLDB_OPT_SET_1, false, "offset",   'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset,          "An optional offset.  Requires --register."},
     {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-    // clang-format on
+        // clang-format on
 };
 
 #pragma mark CommandObjectFrameInfo
@@ -257,27 +231,24 @@ CommandObjectFrameDiagnose::CommandOptio
 // CommandObjectFrameInfo
 //-------------------------------------------------------------------------
 
-class CommandObjectFrameInfo : public CommandObjectParsed
-{
+class CommandObjectFrameInfo : public CommandObjectParsed {
 public:
-    CommandObjectFrameInfo(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "frame info",
-                              "List information about the current stack frame in the current thread.", "frame info",
-                              eCommandRequiresFrame | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
-                                  eCommandProcessMustBePaused)
-    {
-    }
+  CommandObjectFrameInfo(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "frame info", "List information about the current "
+                                       "stack frame in the current thread.",
+            "frame info",
+            eCommandRequiresFrame | eCommandTryTargetAPILock |
+                eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
 
-    ~CommandObjectFrameInfo() override = default;
+  ~CommandObjectFrameInfo() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        m_exe_ctx.GetFrameRef().DumpUsingSettingsFormat (&result.GetOutputStream());
-        result.SetStatus (eReturnStatusSuccessFinishResult);
-        return result.Succeeded();
-    }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    m_exe_ctx.GetFrameRef().DumpUsingSettingsFormat(&result.GetOutputStream());
+    result.SetStatus(eReturnStatusSuccessFinishResult);
+    return result.Succeeded();
+  }
 };
 
 #pragma mark CommandObjectFrameSelect
@@ -286,521 +257,484 @@ protected:
 // CommandObjectFrameSelect
 //-------------------------------------------------------------------------
 
-class CommandObjectFrameSelect : public CommandObjectParsed
-{
+class CommandObjectFrameSelect : public CommandObjectParsed {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options()
-        {
-            OptionParsingStarting(nullptr);
-        }
-
-        ~CommandOptions() override = default;
-
-        Error
-        SetOptionValue(uint32_t option_idx, const char *option_arg,
-                       ExecutionContext *execution_context) override
-        {
-            Error error;
-            bool success = false;
-            const int short_option = m_getopt_table[option_idx].val;
-            switch (short_option)
-            {
-            case 'r':   
-                relative_frame_offset = StringConvert::ToSInt32 (option_arg, INT32_MIN, 0, &success);
-                if (!success)
-                    error.SetErrorStringWithFormat ("invalid frame offset argument '%s'", option_arg);
-                break;
-
-            default:
-                error.SetErrorStringWithFormat ("invalid short option character '%c'", short_option);
-                break;
-            }
-
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            relative_frame_offset = INT32_MIN;
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() { OptionParsingStarting(nullptr); }
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      bool success = false;
+      const int short_option = m_getopt_table[option_idx].val;
+      switch (short_option) {
+      case 'r':
+        relative_frame_offset =
+            StringConvert::ToSInt32(option_arg, INT32_MIN, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid frame offset argument '%s'",
+                                         option_arg);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      relative_frame_offset = INT32_MIN;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+    int32_t relative_frame_offset;
+  };
+
+  CommandObjectFrameSelect(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "frame select", "Select the current stack frame by "
+                                         "index from within the current thread "
+                                         "(see 'thread backtrace'.)",
+            nullptr,
+            eCommandRequiresThread | eCommandTryTargetAPILock |
+                eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData index_arg;
+
+    // Define the first (and only) variant of this arg.
+    index_arg.arg_type = eArgTypeFrameIndex;
+    index_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(index_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
-        int32_t relative_frame_offset;
-    };
-
-    CommandObjectFrameSelect(CommandInterpreter &interpreter)
-        : CommandObjectParsed(
-              interpreter, "frame select",
-              "Select the current stack frame by index from within the current thread (see 'thread backtrace'.)",
-              nullptr, eCommandRequiresThread | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
-                           eCommandProcessMustBePaused),
-          m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData index_arg;
-
-        // Define the first (and only) variant of this arg.
-        index_arg.arg_type = eArgTypeFrameIndex;
-        index_arg.arg_repetition = eArgRepeatOptional;
+  ~CommandObjectFrameSelect() override = default;
 
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (index_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectFrameSelect() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        // No need to check "thread" for validity as eCommandRequiresThread ensures it is valid
-        Thread *thread = m_exe_ctx.GetThreadPtr();
-
-        uint32_t frame_idx = UINT32_MAX;
-        if (m_options.relative_frame_offset != INT32_MIN)
-        {
-            // The one and only argument is a signed relative frame index
-            frame_idx = thread->GetSelectedFrameIndex ();
-            if (frame_idx == UINT32_MAX)
-                frame_idx = 0;
-            
-            if (m_options.relative_frame_offset < 0)
-            {
-                if (static_cast<int32_t>(frame_idx) >= -m_options.relative_frame_offset)
-                    frame_idx += m_options.relative_frame_offset;
-                else
-                {
-                    if (frame_idx == 0)
-                    {
-                        //If you are already at the bottom of the stack, then just warn and don't reset the frame.
-                        result.AppendError("Already at the bottom of the stack.");
-                        result.SetStatus(eReturnStatusFailed);
-                        return false;
-                    }
-                    else
-                        frame_idx = 0;
-                }
-            }
-            else if (m_options.relative_frame_offset > 0)
-            {
-                // I don't want "up 20" where "20" takes you past the top of the stack to produce
-                // an error, but rather to just go to the top.  So I have to count the stack here...
-                const uint32_t num_frames = thread->GetStackFrameCount();
-                if (static_cast<int32_t>(num_frames - frame_idx) > m_options.relative_frame_offset)
-                    frame_idx += m_options.relative_frame_offset;
-                else
-                {
-                    if (frame_idx == num_frames - 1)
-                    {
-                        //If we are already at the top of the stack, just warn and don't reset the frame.
-                        result.AppendError("Already at the top of the stack.");
-                        result.SetStatus(eReturnStatusFailed);
-                        return false;
-                    }
-                    else
-                        frame_idx = num_frames - 1;
-                }
-            }
-        }
-        else 
-        {
-            if (command.GetArgumentCount() == 1)
-            {
-                const char *frame_idx_cstr = command.GetArgumentAtIndex(0);
-                bool success = false;
-                frame_idx = StringConvert::ToUInt32 (frame_idx_cstr, UINT32_MAX, 0, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat("invalid frame index argument '%s'.", frame_idx_cstr);
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
-            else if (command.GetArgumentCount() == 0)
-            {
-                frame_idx = thread->GetSelectedFrameIndex ();
-                if (frame_idx == UINT32_MAX)
-                {
-                    frame_idx = 0;
-                }
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("too many arguments; expected frame-index, saw '%s'.\n",
-                                              command.GetArgumentAtIndex(0));
-                m_options.GenerateOptionUsage(result.GetErrorStream(), this,
-                                              GetCommandInterpreter()
-                                                .GetDebugger()
-                                                .GetTerminalWidth());
-                return false;
-            }
-        }
-
-        bool success = thread->SetSelectedFrameByIndexNoisily (frame_idx, result.GetOutputStream());
-        if (success)
-        {
-            m_exe_ctx.SetFrameSP(thread->GetSelectedFrame ());
-            result.SetStatus (eReturnStatusSuccessFinishResult);
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    // No need to check "thread" for validity as eCommandRequiresThread ensures
+    // it is valid
+    Thread *thread = m_exe_ctx.GetThreadPtr();
+
+    uint32_t frame_idx = UINT32_MAX;
+    if (m_options.relative_frame_offset != INT32_MIN) {
+      // The one and only argument is a signed relative frame index
+      frame_idx = thread->GetSelectedFrameIndex();
+      if (frame_idx == UINT32_MAX)
+        frame_idx = 0;
+
+      if (m_options.relative_frame_offset < 0) {
+        if (static_cast<int32_t>(frame_idx) >= -m_options.relative_frame_offset)
+          frame_idx += m_options.relative_frame_offset;
+        else {
+          if (frame_idx == 0) {
+            // If you are already at the bottom of the stack, then just warn and
+            // don't reset the frame.
+            result.AppendError("Already at the bottom of the stack.");
+            result.SetStatus(eReturnStatusFailed);
+            return false;
+          } else
+            frame_idx = 0;
         }
-        else
-        {
-            result.AppendErrorWithFormat ("Frame index (%u) out of range.\n", frame_idx);
-            result.SetStatus (eReturnStatusFailed);
+      } else if (m_options.relative_frame_offset > 0) {
+        // I don't want "up 20" where "20" takes you past the top of the stack
+        // to produce
+        // an error, but rather to just go to the top.  So I have to count the
+        // stack here...
+        const uint32_t num_frames = thread->GetStackFrameCount();
+        if (static_cast<int32_t>(num_frames - frame_idx) >
+            m_options.relative_frame_offset)
+          frame_idx += m_options.relative_frame_offset;
+        else {
+          if (frame_idx == num_frames - 1) {
+            // If we are already at the top of the stack, just warn and don't
+            // reset the frame.
+            result.AppendError("Already at the top of the stack.");
+            result.SetStatus(eReturnStatusFailed);
+            return false;
+          } else
+            frame_idx = num_frames - 1;
         }
-        
-        return result.Succeeded();
+      }
+    } else {
+      if (command.GetArgumentCount() == 1) {
+        const char *frame_idx_cstr = command.GetArgumentAtIndex(0);
+        bool success = false;
+        frame_idx =
+            StringConvert::ToUInt32(frame_idx_cstr, UINT32_MAX, 0, &success);
+        if (!success) {
+          result.AppendErrorWithFormat("invalid frame index argument '%s'.",
+                                       frame_idx_cstr);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      } else if (command.GetArgumentCount() == 0) {
+        frame_idx = thread->GetSelectedFrameIndex();
+        if (frame_idx == UINT32_MAX) {
+          frame_idx = 0;
+        }
+      } else {
+        result.AppendErrorWithFormat(
+            "too many arguments; expected frame-index, saw '%s'.\n",
+            command.GetArgumentAtIndex(0));
+        m_options.GenerateOptionUsage(
+            result.GetErrorStream(), this,
+            GetCommandInterpreter().GetDebugger().GetTerminalWidth());
+        return false;
+      }
+    }
+
+    bool success = thread->SetSelectedFrameByIndexNoisily(
+        frame_idx, result.GetOutputStream());
+    if (success) {
+      m_exe_ctx.SetFrameSP(thread->GetSelectedFrame());
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendErrorWithFormat("Frame index (%u) out of range.\n",
+                                   frame_idx);
+      result.SetStatus(eReturnStatusFailed);
     }
 
+    return result.Succeeded();
+  }
+
 protected:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectFrameSelect::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectFrameSelect::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1, false, "relative", 'r', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset, "A relative frame index offset from the current frame index."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
 #pragma mark CommandObjectFrameVariable
 //----------------------------------------------------------------------
 // List images with associated information
 //----------------------------------------------------------------------
-class CommandObjectFrameVariable : public CommandObjectParsed
-{
+class CommandObjectFrameVariable : public CommandObjectParsed {
 public:
-    CommandObjectFrameVariable(CommandInterpreter &interpreter)
-        : CommandObjectParsed(
-              interpreter, "frame variable", "Show variables for the current stack frame. Defaults to all "
-                                             "arguments and local variables in scope. Names of argument, "
-                                             "local, file static and file global variables can be specified. "
-                                             "Children of aggregate variables can be specified such as "
-                                             "'var->child.x'.",
-              nullptr, eCommandRequiresFrame | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched |
-                           eCommandProcessMustBePaused | eCommandRequiresProcess),
-          m_option_group(),
-          m_option_variable(true), // Include the frame specific options by passing "true"
-          m_option_format(eFormatDefault),
-          m_varobj_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData var_name_arg;
-        
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeVarName;
-        var_name_arg.arg_repetition = eArgRepeatStar;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (var_name_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-        
-        m_option_group.Append (&m_option_variable, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
-        m_option_group.Append (&m_option_format, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_1);
-        m_option_group.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
-        m_option_group.Finalize();
-    }
-
-    ~CommandObjectFrameVariable() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_option_group;
-    }
-    
-    int
-    HandleArgumentCompletion (Args &input,
-                              int &cursor_index,
-                              int &cursor_char_position,
-                              OptionElementVector &opt_element_vector,
-                              int match_start_point,
-                              int max_return_elements,
-                              bool &word_complete,
-                              StringList &matches) override
-    {
-        // Arguments are the standard source file completer.
-        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
-        completion_str.erase (cursor_char_position);
-
-        CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                            CommandCompletions::eVariablePathCompletion,
-                                                            completion_str.c_str(),
-                                                            match_start_point,
-                                                            max_return_elements,
-                                                            nullptr,
-                                                            word_complete,
-                                                            matches);
-        return matches.GetSize();
-    }
+  CommandObjectFrameVariable(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "frame variable",
+            "Show variables for the current stack frame. Defaults to all "
+            "arguments and local variables in scope. Names of argument, "
+            "local, file static and file global variables can be specified. "
+            "Children of aggregate variables can be specified such as "
+            "'var->child.x'.",
+            nullptr, eCommandRequiresFrame | eCommandTryTargetAPILock |
+                         eCommandProcessMustBeLaunched |
+                         eCommandProcessMustBePaused | eCommandRequiresProcess),
+        m_option_group(),
+        m_option_variable(
+            true), // Include the frame specific options by passing "true"
+        m_option_format(eFormatDefault),
+        m_varobj_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData var_name_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeVarName;
+    var_name_arg.arg_repetition = eArgRepeatStar;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(var_name_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+
+    m_option_group.Append(&m_option_variable, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+    m_option_group.Append(&m_option_format,
+                          OptionGroupFormat::OPTION_GROUP_FORMAT |
+                              OptionGroupFormat::OPTION_GROUP_GDB_FMT,
+                          LLDB_OPT_SET_1);
+    m_option_group.Append(&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+    m_option_group.Finalize();
+  }
+
+  ~CommandObjectFrameVariable() override = default;
+
+  Options *GetOptions() override { return &m_option_group; }
+
+  int HandleArgumentCompletion(Args &input, int &cursor_index,
+                               int &cursor_char_position,
+                               OptionElementVector &opt_element_vector,
+                               int match_start_point, int max_return_elements,
+                               bool &word_complete,
+                               StringList &matches) override {
+    // Arguments are the standard source file completer.
+    std::string completion_str(input.GetArgumentAtIndex(cursor_index));
+    completion_str.erase(cursor_char_position);
+
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eVariablePathCompletion,
+        completion_str.c_str(), match_start_point, max_return_elements, nullptr,
+        word_complete, matches);
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        // No need to check "frame" for validity as eCommandRequiresFrame ensures it is valid
-        StackFrame *frame = m_exe_ctx.GetFramePtr();
-
-        Stream &s = result.GetOutputStream();
-
-        // Be careful about the stack frame, if any summary formatter runs code, it might clear the StackFrameList
-        // for the thread.  So hold onto a shared pointer to the frame so it stays alive.
-        
-        VariableList *variable_list = frame->GetVariableList (m_option_variable.show_globals);
-
-        VariableSP var_sp;
-        ValueObjectSP valobj_sp;
-
-        const char *name_cstr = nullptr;
-        size_t idx;
-        
-        TypeSummaryImplSP summary_format_sp;
-        if (!m_option_variable.summary.IsCurrentValueEmpty())
-            DataVisualization::NamedSummaryFormats::GetSummaryFormat(ConstString(m_option_variable.summary.GetCurrentValue()), summary_format_sp);
-        else if (!m_option_variable.summary_string.IsCurrentValueEmpty())
-            summary_format_sp.reset(new StringSummaryFormat(TypeSummaryImpl::Flags(),m_option_variable.summary_string.GetCurrentValue()));
-        
-        DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(eLanguageRuntimeDescriptionDisplayVerbosityFull,eFormatDefault,summary_format_sp));
-        
-        const SymbolContext& sym_ctx = frame->GetSymbolContext(eSymbolContextFunction);
-        if (sym_ctx.function && sym_ctx.function->IsTopLevelFunction())
-            m_option_variable.show_globals = true;
-        
-        if (variable_list)
-        {
-            const Format format = m_option_format.GetFormat();
-            options.SetFormat(format);
-
-            if (command.GetArgumentCount() > 0)
-            {
-                VariableList regex_var_list;
-
-                // If we have any args to the variable command, we will make
-                // variable objects from them...
-                for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != nullptr; ++idx)
-                {
-                    if (m_option_variable.use_regex)
-                    {
-                        const size_t regex_start_index = regex_var_list.GetSize();
-                        RegularExpression regex (name_cstr);
-                        if (regex.Compile(name_cstr))
-                        {
-                            size_t num_matches = 0;
-                            const size_t num_new_regex_vars = variable_list->AppendVariablesIfUnique(regex, 
-                                                                                                     regex_var_list, 
-                                                                                                     num_matches);
-                            if (num_new_regex_vars > 0)
-                            {
-                                for (size_t regex_idx = regex_start_index, end_index = regex_var_list.GetSize();
-                                     regex_idx < end_index;
-                                     ++regex_idx)
-                                {
-                                    var_sp = regex_var_list.GetVariableAtIndex (regex_idx);
-                                    if (var_sp)
-                                    {
-                                        valobj_sp = frame->GetValueObjectForFrameVariable (var_sp, m_varobj_options.use_dynamic);
-                                        if (valobj_sp)
-                                        {
-//                                            if (format != eFormatDefault)
-//                                                valobj_sp->SetFormat (format);
-                                            
-                                            if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
-                                            {
-                                                bool show_fullpaths = false;
-                                                bool show_module = true;
-                                                if (var_sp->DumpDeclaration(&s, show_fullpaths, show_module))
-                                                    s.PutCString (": ");
-                                            }
-                                            valobj_sp->Dump(result.GetOutputStream(),options);
-                                        }
-                                    }
-                                }
-                            }
-                            else if (num_matches == 0)
-                            {
-                                result.GetErrorStream().Printf ("error: no variables matched the regular expression '%s'.\n", name_cstr);
-                            }
-                        }
-                        else
-                        {
-                            char regex_error[1024];
-                            if (regex.GetErrorAsCString(regex_error, sizeof(regex_error)))
-                                result.GetErrorStream().Printf ("error: %s\n", regex_error);
-                            else
-                                result.GetErrorStream().Printf ("error: unknown regex error when compiling '%s'\n", name_cstr);
-                        }
-                    }
-                    else // No regex, either exact variable names or variable expressions.
-                    {
-                        Error error;
-                        uint32_t expr_path_options = StackFrame::eExpressionPathOptionCheckPtrVsMember |
-                                                     StackFrame::eExpressionPathOptionsAllowDirectIVarAccess |
-                                                     StackFrame::eExpressionPathOptionsInspectAnonymousUnions;
-                        lldb::VariableSP var_sp;
-                        valobj_sp = frame->GetValueForVariableExpressionPath (name_cstr, 
-                                                                              m_varobj_options.use_dynamic, 
-                                                                              expr_path_options,
-                                                                              var_sp,
-                                                                              error);
-                        if (valobj_sp)
-                        {
-//                            if (format != eFormatDefault)
-//                                valobj_sp->SetFormat (format);
-                            if (m_option_variable.show_decl && var_sp && var_sp->GetDeclaration ().GetFile())
-                            {
-                                var_sp->GetDeclaration ().DumpStopContext (&s, false);
-                                s.PutCString (": ");
-                            }
-                            
-                            options.SetFormat(format);
-                            options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage());
-
-                            Stream &output_stream = result.GetOutputStream();
-                            options.SetRootValueObjectName(valobj_sp->GetParent() ? name_cstr : nullptr);
-                            valobj_sp->Dump(output_stream,options);
-                        }
-                        else
-                        {
-                            const char *error_cstr = error.AsCString(nullptr);
-                            if (error_cstr)
-                                result.GetErrorStream().Printf("error: %s\n", error_cstr);
-                            else
-                                result.GetErrorStream().Printf(
-                                    "error: unable to find any variable expression path that matches '%s'.\n",
-                                    name_cstr);
-                        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    // No need to check "frame" for validity as eCommandRequiresFrame ensures it
+    // is valid
+    StackFrame *frame = m_exe_ctx.GetFramePtr();
+
+    Stream &s = result.GetOutputStream();
+
+    // Be careful about the stack frame, if any summary formatter runs code, it
+    // might clear the StackFrameList
+    // for the thread.  So hold onto a shared pointer to the frame so it stays
+    // alive.
+
+    VariableList *variable_list =
+        frame->GetVariableList(m_option_variable.show_globals);
+
+    VariableSP var_sp;
+    ValueObjectSP valobj_sp;
+
+    const char *name_cstr = nullptr;
+    size_t idx;
+
+    TypeSummaryImplSP summary_format_sp;
+    if (!m_option_variable.summary.IsCurrentValueEmpty())
+      DataVisualization::NamedSummaryFormats::GetSummaryFormat(
+          ConstString(m_option_variable.summary.GetCurrentValue()),
+          summary_format_sp);
+    else if (!m_option_variable.summary_string.IsCurrentValueEmpty())
+      summary_format_sp.reset(new StringSummaryFormat(
+          TypeSummaryImpl::Flags(),
+          m_option_variable.summary_string.GetCurrentValue()));
+
+    DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
+        eLanguageRuntimeDescriptionDisplayVerbosityFull, eFormatDefault,
+        summary_format_sp));
+
+    const SymbolContext &sym_ctx =
+        frame->GetSymbolContext(eSymbolContextFunction);
+    if (sym_ctx.function && sym_ctx.function->IsTopLevelFunction())
+      m_option_variable.show_globals = true;
+
+    if (variable_list) {
+      const Format format = m_option_format.GetFormat();
+      options.SetFormat(format);
+
+      if (command.GetArgumentCount() > 0) {
+        VariableList regex_var_list;
+
+        // If we have any args to the variable command, we will make
+        // variable objects from them...
+        for (idx = 0; (name_cstr = command.GetArgumentAtIndex(idx)) != nullptr;
+             ++idx) {
+          if (m_option_variable.use_regex) {
+            const size_t regex_start_index = regex_var_list.GetSize();
+            RegularExpression regex(name_cstr);
+            if (regex.Compile(name_cstr)) {
+              size_t num_matches = 0;
+              const size_t num_new_regex_vars =
+                  variable_list->AppendVariablesIfUnique(regex, regex_var_list,
+                                                         num_matches);
+              if (num_new_regex_vars > 0) {
+                for (size_t regex_idx = regex_start_index,
+                            end_index = regex_var_list.GetSize();
+                     regex_idx < end_index; ++regex_idx) {
+                  var_sp = regex_var_list.GetVariableAtIndex(regex_idx);
+                  if (var_sp) {
+                    valobj_sp = frame->GetValueObjectForFrameVariable(
+                        var_sp, m_varobj_options.use_dynamic);
+                    if (valobj_sp) {
+                      //                                            if (format
+                      //                                            !=
+                      //                                            eFormatDefault)
+                      //                                                valobj_sp->SetFormat
+                      //                                                (format);
+
+                      if (m_option_variable.show_decl &&
+                          var_sp->GetDeclaration().GetFile()) {
+                        bool show_fullpaths = false;
+                        bool show_module = true;
+                        if (var_sp->DumpDeclaration(&s, show_fullpaths,
+                                                    show_module))
+                          s.PutCString(": ");
+                      }
+                      valobj_sp->Dump(result.GetOutputStream(), options);
                     }
+                  }
                 }
+              } else if (num_matches == 0) {
+                result.GetErrorStream().Printf("error: no variables matched "
+                                               "the regular expression '%s'.\n",
+                                               name_cstr);
+              }
+            } else {
+              char regex_error[1024];
+              if (regex.GetErrorAsCString(regex_error, sizeof(regex_error)))
+                result.GetErrorStream().Printf("error: %s\n", regex_error);
+              else
+                result.GetErrorStream().Printf(
+                    "error: unknown regex error when compiling '%s'\n",
+                    name_cstr);
+            }
+          } else // No regex, either exact variable names or variable
+                 // expressions.
+          {
+            Error error;
+            uint32_t expr_path_options =
+                StackFrame::eExpressionPathOptionCheckPtrVsMember |
+                StackFrame::eExpressionPathOptionsAllowDirectIVarAccess |
+                StackFrame::eExpressionPathOptionsInspectAnonymousUnions;
+            lldb::VariableSP var_sp;
+            valobj_sp = frame->GetValueForVariableExpressionPath(
+                name_cstr, m_varobj_options.use_dynamic, expr_path_options,
+                var_sp, error);
+            if (valobj_sp) {
+              //                            if (format != eFormatDefault)
+              //                                valobj_sp->SetFormat (format);
+              if (m_option_variable.show_decl && var_sp &&
+                  var_sp->GetDeclaration().GetFile()) {
+                var_sp->GetDeclaration().DumpStopContext(&s, false);
+                s.PutCString(": ");
+              }
+
+              options.SetFormat(format);
+              options.SetVariableFormatDisplayLanguage(
+                  valobj_sp->GetPreferredDisplayLanguage());
+
+              Stream &output_stream = result.GetOutputStream();
+              options.SetRootValueObjectName(valobj_sp->GetParent() ? name_cstr
+                                                                    : nullptr);
+              valobj_sp->Dump(output_stream, options);
+            } else {
+              const char *error_cstr = error.AsCString(nullptr);
+              if (error_cstr)
+                result.GetErrorStream().Printf("error: %s\n", error_cstr);
+              else
+                result.GetErrorStream().Printf("error: unable to find any "
+                                               "variable expression path that "
+                                               "matches '%s'.\n",
+                                               name_cstr);
+            }
+          }
+        }
+      } else // No command arg specified.  Use variable_list, instead.
+      {
+        const size_t num_variables = variable_list->GetSize();
+        if (num_variables > 0) {
+          for (size_t i = 0; i < num_variables; i++) {
+            var_sp = variable_list->GetVariableAtIndex(i);
+            bool dump_variable = true;
+            std::string scope_string;
+            switch (var_sp->GetScope()) {
+            case eValueTypeVariableGlobal:
+              // Always dump globals since we only fetched them if
+              // m_option_variable.show_scope was true
+              if (dump_variable && m_option_variable.show_scope)
+                scope_string = "GLOBAL: ";
+              break;
+
+            case eValueTypeVariableStatic:
+              // Always dump globals since we only fetched them if
+              // m_option_variable.show_scope was true, or this is
+              // a static variable from a block in the current scope
+              if (dump_variable && m_option_variable.show_scope)
+                scope_string = "STATIC: ";
+              break;
+
+            case eValueTypeVariableArgument:
+              dump_variable = m_option_variable.show_args;
+              if (dump_variable && m_option_variable.show_scope)
+                scope_string = "   ARG: ";
+              break;
+
+            case eValueTypeVariableLocal:
+              dump_variable = m_option_variable.show_locals;
+              if (dump_variable && m_option_variable.show_scope)
+                scope_string = " LOCAL: ";
+              break;
+
+            case eValueTypeVariableThreadLocal:
+              if (dump_variable && m_option_variable.show_scope)
+                scope_string = "THREAD: ";
+              break;
+            default:
+              break;
             }
-            else // No command arg specified.  Use variable_list, instead.
-            {
-                const size_t num_variables = variable_list->GetSize();
-                if (num_variables > 0)
-                {
-                    for (size_t i=0; i<num_variables; i++)
-                    {
-                        var_sp = variable_list->GetVariableAtIndex(i);
-                        bool dump_variable = true;
-                        std::string scope_string;
-                        switch (var_sp->GetScope())
-                        {
-                            case eValueTypeVariableGlobal:
-                                // Always dump globals since we only fetched them if
-                                // m_option_variable.show_scope was true
-                                if (dump_variable && m_option_variable.show_scope)
-                                    scope_string = "GLOBAL: ";
-                                break;
-
-                            case eValueTypeVariableStatic:
-                                // Always dump globals since we only fetched them if
-                                // m_option_variable.show_scope was true, or this is
-                                // a static variable from a block in the current scope
-                                if (dump_variable && m_option_variable.show_scope)
-                                    scope_string = "STATIC: ";
-                                break;
-
-                            case eValueTypeVariableArgument:
-                                dump_variable = m_option_variable.show_args;
-                                if (dump_variable && m_option_variable.show_scope)
-                                    scope_string = "   ARG: ";
-                                break;
-
-                            case eValueTypeVariableLocal:
-                                dump_variable = m_option_variable.show_locals;
-                                if (dump_variable && m_option_variable.show_scope)
-                                    scope_string = " LOCAL: ";
-                                break;
-
-                            case eValueTypeVariableThreadLocal:
-                                if (dump_variable && m_option_variable.show_scope)
-                                    scope_string = "THREAD: ";
-                                break;
-                            default:
-                                break;
-                        }
-
-                        if (dump_variable)
-                        {
-                            // Use the variable object code to make sure we are
-                            // using the same APIs as the public API will be
-                            // using...
-                            valobj_sp = frame->GetValueObjectForFrameVariable (var_sp, 
-                                                                               m_varobj_options.use_dynamic);
-                            if (valobj_sp)
-                            {
-//                                if (format != eFormatDefault)
-//                                    valobj_sp->SetFormat (format);
-
-                                // When dumping all variables, don't print any variables
-                                // that are not in scope to avoid extra unneeded output
-                                if (valobj_sp->IsInScope ())
-                                {
-                                    if (!valobj_sp->GetTargetSP()->GetDisplayRuntimeSupportValues() &&
-                                        valobj_sp->IsRuntimeSupportValue())
-                                        continue;
-                                    
-                                    if (!scope_string.empty())
-                                        s.PutCString(scope_string.c_str());
-                                    
-                                    if (m_option_variable.show_decl && var_sp->GetDeclaration ().GetFile())
-                                    {
-                                        var_sp->GetDeclaration ().DumpStopContext (&s, false);
-                                        s.PutCString (": ");
-                                    }
-                                    
-                                    options.SetFormat(format);
-                                    options.SetVariableFormatDisplayLanguage(valobj_sp->GetPreferredDisplayLanguage());
-                                    options.SetRootValueObjectName(name_cstr);
-                                    valobj_sp->Dump(result.GetOutputStream(),options);
-                                }
-                            }
-                        }
-                    }
+
+            if (dump_variable) {
+              // Use the variable object code to make sure we are
+              // using the same APIs as the public API will be
+              // using...
+              valobj_sp = frame->GetValueObjectForFrameVariable(
+                  var_sp, m_varobj_options.use_dynamic);
+              if (valobj_sp) {
+                //                                if (format != eFormatDefault)
+                //                                    valobj_sp->SetFormat
+                //                                    (format);
+
+                // When dumping all variables, don't print any variables
+                // that are not in scope to avoid extra unneeded output
+                if (valobj_sp->IsInScope()) {
+                  if (!valobj_sp->GetTargetSP()
+                           ->GetDisplayRuntimeSupportValues() &&
+                      valobj_sp->IsRuntimeSupportValue())
+                    continue;
+
+                  if (!scope_string.empty())
+                    s.PutCString(scope_string.c_str());
+
+                  if (m_option_variable.show_decl &&
+                      var_sp->GetDeclaration().GetFile()) {
+                    var_sp->GetDeclaration().DumpStopContext(&s, false);
+                    s.PutCString(": ");
+                  }
+
+                  options.SetFormat(format);
+                  options.SetVariableFormatDisplayLanguage(
+                      valobj_sp->GetPreferredDisplayLanguage());
+                  options.SetRootValueObjectName(name_cstr);
+                  valobj_sp->Dump(result.GetOutputStream(), options);
                 }
+              }
             }
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        
-        if (m_interpreter.TruncationWarningNecessary())
-        {
-            result.GetOutputStream().Printf(m_interpreter.TruncationWarningText(),
-                                            m_cmd_name.c_str());
-            m_interpreter.TruncationWarningGiven();
+          }
         }
-        
-        return result.Succeeded();
+      }
+      result.SetStatus(eReturnStatusSuccessFinishResult);
     }
 
+    if (m_interpreter.TruncationWarningNecessary()) {
+      result.GetOutputStream().Printf(m_interpreter.TruncationWarningText(),
+                                      m_cmd_name.c_str());
+      m_interpreter.TruncationWarningGiven();
+    }
+
+    return result.Succeeded();
+  }
+
 protected:
-    OptionGroupOptions m_option_group;
-    OptionGroupVariable m_option_variable;
-    OptionGroupFormat m_option_format;
-    OptionGroupValueObjectDisplay m_varobj_options;
+  OptionGroupOptions m_option_group;
+  OptionGroupVariable m_option_variable;
+  OptionGroupFormat m_option_format;
+  OptionGroupValueObjectDisplay m_varobj_options;
 };
 
 #pragma mark CommandObjectMultiwordFrame
@@ -809,15 +743,20 @@ protected:
 // CommandObjectMultiwordFrame
 //-------------------------------------------------------------------------
 
-CommandObjectMultiwordFrame::CommandObjectMultiwordFrame(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "frame",
-                             "Commands for selecting and examing the current thread's stack frames.",
-                             "frame <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand ("diagnose", CommandObjectSP (new CommandObjectFrameDiagnose (interpreter)));
-    LoadSubCommand ("info",   CommandObjectSP (new CommandObjectFrameInfo (interpreter)));
-    LoadSubCommand ("select", CommandObjectSP (new CommandObjectFrameSelect (interpreter)));
-    LoadSubCommand ("variable", CommandObjectSP (new CommandObjectFrameVariable (interpreter)));
+CommandObjectMultiwordFrame::CommandObjectMultiwordFrame(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(interpreter, "frame", "Commands for selecting and "
+                                                   "examing the current "
+                                                   "thread's stack frames.",
+                             "frame <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("diagnose",
+                 CommandObjectSP(new CommandObjectFrameDiagnose(interpreter)));
+  LoadSubCommand("info",
+                 CommandObjectSP(new CommandObjectFrameInfo(interpreter)));
+  LoadSubCommand("select",
+                 CommandObjectSP(new CommandObjectFrameSelect(interpreter)));
+  LoadSubCommand("variable",
+                 CommandObjectSP(new CommandObjectFrameVariable(interpreter)));
 }
 
 CommandObjectMultiwordFrame::~CommandObjectMultiwordFrame() = default;

Modified: lldb/trunk/source/Commands/CommandObjectFrame.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectFrame.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectFrame.h (original)
+++ lldb/trunk/source/Commands/CommandObjectFrame.h Tue Sep  6 15:57:50 2016
@@ -14,9 +14,9 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Core/ArchSpec.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/Interpreter/Options.h"
 
 namespace lldb_private {
 
@@ -24,13 +24,11 @@ namespace lldb_private {
 // CommandObjectMultiwordFrame
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordFrame : public CommandObjectMultiword
-{
+class CommandObjectMultiwordFrame : public CommandObjectMultiword {
 public:
+  CommandObjectMultiwordFrame(CommandInterpreter &interpreter);
 
-    CommandObjectMultiwordFrame (CommandInterpreter &interpreter);
-
-    ~CommandObjectMultiwordFrame() override;
+  ~CommandObjectMultiwordFrame() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectGUI.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectGUI.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectGUI.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectGUI.cpp Tue Sep  6 15:57:50 2016
@@ -13,9 +13,9 @@
 // C++ Includes
 // Other libraries and framework includes
 // Project includes
-#include "lldb/lldb-private.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -24,48 +24,35 @@ using namespace lldb_private;
 // CommandObjectGUI
 //-------------------------------------------------------------------------
 
-CommandObjectGUI::CommandObjectGUI (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter, "gui", "Switch into the curses based GUI mode.", "gui")
-{
-}
+CommandObjectGUI::CommandObjectGUI(CommandInterpreter &interpreter)
+    : CommandObjectParsed(interpreter, "gui",
+                          "Switch into the curses based GUI mode.", "gui") {}
 
-CommandObjectGUI::~CommandObjectGUI ()
-{
-}
+CommandObjectGUI::~CommandObjectGUI() {}
 
-bool
-CommandObjectGUI::DoExecute (Args& args, CommandReturnObject &result)
-{
+bool CommandObjectGUI::DoExecute(Args &args, CommandReturnObject &result) {
 #ifndef LLDB_DISABLE_CURSES
-    if (args.GetArgumentCount() == 0)
-    {
-        Debugger &debugger = m_interpreter.GetDebugger();
-
-        lldb::StreamFileSP input_sp = debugger.GetInputFile();
-        if (input_sp &&
-            input_sp->GetFile().GetIsRealTerminal() &&
-            input_sp->GetFile().GetIsInteractive())
-        {
-            IOHandlerSP io_handler_sp (new IOHandlerCursesGUI (debugger));
-            if (io_handler_sp)
-                debugger.PushIOHandler(io_handler_sp);
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendError("the gui command requires an interactive terminal.");
-            result.SetStatus (eReturnStatusFailed);
-        }
-    }
-    else
-    {
-        result.AppendError("the gui command takes no arguments.");
-        result.SetStatus (eReturnStatusFailed);
+  if (args.GetArgumentCount() == 0) {
+    Debugger &debugger = m_interpreter.GetDebugger();
+
+    lldb::StreamFileSP input_sp = debugger.GetInputFile();
+    if (input_sp && input_sp->GetFile().GetIsRealTerminal() &&
+        input_sp->GetFile().GetIsInteractive()) {
+      IOHandlerSP io_handler_sp(new IOHandlerCursesGUI(debugger));
+      if (io_handler_sp)
+        debugger.PushIOHandler(io_handler_sp);
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendError("the gui command requires an interactive terminal.");
+      result.SetStatus(eReturnStatusFailed);
     }
-    return true;
+  } else {
+    result.AppendError("the gui command takes no arguments.");
+    result.SetStatus(eReturnStatusFailed);
+  }
+  return true;
 #else
-    result.AppendError("lldb was not build with gui support");
-    return false;
+  result.AppendError("lldb was not build with gui support");
+  return false;
 #endif
 }
-

Modified: lldb/trunk/source/Commands/CommandObjectGUI.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectGUI.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectGUI.h (original)
+++ lldb/trunk/source/Commands/CommandObjectGUI.h Tue Sep  6 15:57:50 2016
@@ -22,18 +22,14 @@ namespace lldb_private {
 // CommandObjectGUI
 //-------------------------------------------------------------------------
 
-class CommandObjectGUI : public CommandObjectParsed
-{
+class CommandObjectGUI : public CommandObjectParsed {
 public:
+  CommandObjectGUI(CommandInterpreter &interpreter);
 
-    CommandObjectGUI (CommandInterpreter &interpreter);
-
-    ~CommandObjectGUI() override;
+  ~CommandObjectGUI() override;
 
 protected:
-    bool
-    DoExecute(Args& args,
-	      CommandReturnObject &result) override;
+  bool DoExecute(Args &args, CommandReturnObject &result) override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectHelp.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.cpp Tue Sep  6 15:57:50 2016
@@ -12,10 +12,10 @@
 // Other libraries and framework includes
 // Project includes
 #include "CommandObjectHelp.h"
-#include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/Options.h"
+#include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -24,254 +24,216 @@ using namespace lldb_private;
 // CommandObjectHelp
 //-------------------------------------------------------------------------
 
-void
-CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage (Stream *s,
-                                                         const char* command,
-                                                         const char* prefix,
-                                                         const char* subcommand,
-                                                         bool include_apropos,
-                                                         bool include_type_lookup)
-{
-    if (s && command && *command)
-    {
-        s->Printf("'%s' is not a known command.\n", command);
-        s->Printf("Try '%shelp' to see a current list of commands.\n", prefix ? prefix : "");
-        if (include_apropos)
-        {
-	  s->Printf("Try '%sapropos %s' for a list of related commands.\n",
-                    prefix ? prefix : "", subcommand ? subcommand : command);
-        }
-        if (include_type_lookup)
-        {
-            s->Printf("Try '%stype lookup %s' for information on types, methods, functions, modules, etc.",
-		      prefix ? prefix : "", subcommand ? subcommand : command);
-        }
+void CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(
+    Stream *s, const char *command, const char *prefix, const char *subcommand,
+    bool include_apropos, bool include_type_lookup) {
+  if (s && command && *command) {
+    s->Printf("'%s' is not a known command.\n", command);
+    s->Printf("Try '%shelp' to see a current list of commands.\n",
+              prefix ? prefix : "");
+    if (include_apropos) {
+      s->Printf("Try '%sapropos %s' for a list of related commands.\n",
+                prefix ? prefix : "", subcommand ? subcommand : command);
+    }
+    if (include_type_lookup) {
+      s->Printf("Try '%stype lookup %s' for information on types, methods, "
+                "functions, modules, etc.",
+                prefix ? prefix : "", subcommand ? subcommand : command);
     }
+  }
 }
 
 CommandObjectHelp::CommandObjectHelp(CommandInterpreter &interpreter)
-    : CommandObjectParsed(interpreter, "help",
-                          "Show a list of all debugger commands, or give details about a specific command.",
+    : CommandObjectParsed(interpreter, "help", "Show a list of all debugger "
+                                               "commands, or give details "
+                                               "about a specific command.",
                           "help [<cmd-name>]"),
-      m_options()
-{
-    CommandArgumentEntry arg;
-    CommandArgumentData command_arg;
-
-    // Define the first (and only) variant of this arg.
-    command_arg.arg_type = eArgTypeCommandName;
-    command_arg.arg_repetition = eArgRepeatStar;
+      m_options() {
+  CommandArgumentEntry arg;
+  CommandArgumentData command_arg;
+
+  // Define the first (and only) variant of this arg.
+  command_arg.arg_type = eArgTypeCommandName;
+  command_arg.arg_repetition = eArgRepeatStar;
+
+  // There is only one variant this argument could be; put it into the argument
+  // entry.
+  arg.push_back(command_arg);
 
-    // There is only one variant this argument could be; put it into the argument entry.
-    arg.push_back (command_arg);
-
-    // Push the data for the first argument into the m_arguments vector.
-    m_arguments.push_back (arg);
+  // Push the data for the first argument into the m_arguments vector.
+  m_arguments.push_back(arg);
 }
 
 CommandObjectHelp::~CommandObjectHelp() = default;
 
-OptionDefinition
-CommandObjectHelp::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectHelp::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_ALL, false, "hide-aliases",         'a', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Hide aliases in the command list."},
   {LLDB_OPT_SET_ALL, false, "hide-user-commands",   'u', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Hide user-defined commands from the list."},
   {LLDB_OPT_SET_ALL, false, "show-hidden-commands", 'h', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Include commands prefixed with an underscore."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
-bool
-CommandObjectHelp::DoExecute (Args& command, CommandReturnObject &result)
-{
-    CommandObject::CommandMap::iterator pos;
-    CommandObject *cmd_obj;
-    const size_t argc = command.GetArgumentCount ();
-    
-    // 'help' doesn't take any arguments, other than command names.  If argc is 0, we show the user
-    // all commands (aliases and user commands if asked for).  Otherwise every argument must be the name of a command or a sub-command.
-    if (argc == 0)
-    {
-        uint32_t cmd_types = CommandInterpreter::eCommandTypesBuiltin;
-        if (m_options.m_show_aliases)
-            cmd_types |= CommandInterpreter::eCommandTypesAliases;
-        if (m_options.m_show_user_defined)
-            cmd_types |= CommandInterpreter::eCommandTypesUserDef;
-        if (m_options.m_show_hidden)
-            cmd_types |= CommandInterpreter::eCommandTypesHidden;
-
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        m_interpreter.GetHelp (result, cmd_types);  // General help
+bool CommandObjectHelp::DoExecute(Args &command, CommandReturnObject &result) {
+  CommandObject::CommandMap::iterator pos;
+  CommandObject *cmd_obj;
+  const size_t argc = command.GetArgumentCount();
+
+  // 'help' doesn't take any arguments, other than command names.  If argc is 0,
+  // we show the user
+  // all commands (aliases and user commands if asked for).  Otherwise every
+  // argument must be the name of a command or a sub-command.
+  if (argc == 0) {
+    uint32_t cmd_types = CommandInterpreter::eCommandTypesBuiltin;
+    if (m_options.m_show_aliases)
+      cmd_types |= CommandInterpreter::eCommandTypesAliases;
+    if (m_options.m_show_user_defined)
+      cmd_types |= CommandInterpreter::eCommandTypesUserDef;
+    if (m_options.m_show_hidden)
+      cmd_types |= CommandInterpreter::eCommandTypesHidden;
+
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    m_interpreter.GetHelp(result, cmd_types); // General help
+  } else {
+    // Get command object for the first command argument. Only search built-in
+    // command dictionary.
+    StringList matches;
+    cmd_obj =
+        m_interpreter.GetCommandObject(command.GetArgumentAtIndex(0), &matches);
+    bool is_alias_command =
+        m_interpreter.AliasExists(command.GetArgumentAtIndex(0));
+    std::string alias_name = command.GetArgumentAtIndex(0);
+
+    if (cmd_obj != nullptr) {
+      StringList matches;
+      bool all_okay = true;
+      CommandObject *sub_cmd_obj = cmd_obj;
+      // Loop down through sub_command dictionaries until we find the command
+      // object that corresponds
+      // to the help command entered.
+      std::string sub_command;
+      for (size_t i = 1; i < argc && all_okay; ++i) {
+        sub_command = command.GetArgumentAtIndex(i);
+        matches.Clear();
+        if (sub_cmd_obj->IsAlias())
+          sub_cmd_obj =
+              ((CommandAlias *)sub_cmd_obj)->GetUnderlyingCommand().get();
+        if (!sub_cmd_obj->IsMultiwordObject()) {
+          all_okay = false;
+        } else {
+          CommandObject *found_cmd;
+          found_cmd =
+              sub_cmd_obj->GetSubcommandObject(sub_command.c_str(), &matches);
+          if (found_cmd == nullptr)
+            all_okay = false;
+          else if (matches.GetSize() > 1)
+            all_okay = false;
+          else
+            sub_cmd_obj = found_cmd;
+        }
+      }
+
+      if (!all_okay || (sub_cmd_obj == nullptr)) {
+        std::string cmd_string;
+        command.GetCommandString(cmd_string);
+        if (matches.GetSize() >= 2) {
+          StreamString s;
+          s.Printf("ambiguous command %s", cmd_string.c_str());
+          size_t num_matches = matches.GetSize();
+          for (size_t match_idx = 0; match_idx < num_matches; match_idx++) {
+            s.Printf("\n\t%s", matches.GetStringAtIndex(match_idx));
+          }
+          s.Printf("\n");
+          result.AppendError(s.GetData());
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else if (!sub_cmd_obj) {
+          StreamString error_msg_stream;
+          GenerateAdditionalHelpAvenuesMessage(
+              &error_msg_stream, cmd_string.c_str(),
+              m_interpreter.GetCommandPrefix(), sub_command.c_str());
+          result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else {
+          GenerateAdditionalHelpAvenuesMessage(
+              &result.GetOutputStream(), cmd_string.c_str(),
+              m_interpreter.GetCommandPrefix(), sub_command.c_str());
+          result.GetOutputStream().Printf(
+              "\nThe closest match is '%s'. Help on it follows.\n\n",
+              sub_cmd_obj->GetCommandName());
+        }
+      }
+
+      sub_cmd_obj->GenerateHelpText(result);
+
+      if (is_alias_command) {
+        StreamString sstr;
+        m_interpreter.GetAlias(alias_name.c_str())->GetAliasExpansion(sstr);
+        result.GetOutputStream().Printf("\n'%s' is an abbreviation for %s\n",
+                                        alias_name.c_str(), sstr.GetData());
+      }
+    } else if (matches.GetSize() > 0) {
+      Stream &output_strm = result.GetOutputStream();
+      output_strm.Printf("Help requested with ambiguous command name, possible "
+                         "completions:\n");
+      const size_t match_count = matches.GetSize();
+      for (size_t i = 0; i < match_count; i++) {
+        output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i));
+      }
+    } else {
+      // Maybe the user is asking for help about a command argument rather than
+      // a command.
+      const CommandArgumentType arg_type =
+          CommandObject::LookupArgumentName(command.GetArgumentAtIndex(0));
+      if (arg_type != eArgTypeLastArg) {
+        Stream &output_strm = result.GetOutputStream();
+        CommandObject::GetArgumentHelp(output_strm, arg_type, m_interpreter);
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        StreamString error_msg_stream;
+        GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
+                                             command.GetArgumentAtIndex(0),
+                                             m_interpreter.GetCommandPrefix());
+        result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+        result.SetStatus(eReturnStatusFailed);
+      }
     }
-    else
-    {
-        // Get command object for the first command argument. Only search built-in command dictionary.
-        StringList matches;
-        cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex (0), &matches);
-        bool is_alias_command = m_interpreter.AliasExists (command.GetArgumentAtIndex (0));
-        std::string alias_name = command.GetArgumentAtIndex(0);
-        
-        if (cmd_obj != nullptr)
-        {
-            StringList matches;
-            bool all_okay = true;
-            CommandObject *sub_cmd_obj = cmd_obj;
-            // Loop down through sub_command dictionaries until we find the command object that corresponds
-            // to the help command entered.
-            std::string sub_command;
-            for (size_t i = 1; i < argc && all_okay; ++i)
-            {
-                sub_command = command.GetArgumentAtIndex(i);
-                matches.Clear();
-                if (sub_cmd_obj->IsAlias())
-                    sub_cmd_obj = ((CommandAlias*)sub_cmd_obj)->GetUnderlyingCommand().get();
-                if (! sub_cmd_obj->IsMultiwordObject ())
-                {
-                    all_okay = false;
-                }
-                else
-                {
-                    CommandObject *found_cmd;
-                    found_cmd = sub_cmd_obj->GetSubcommandObject(sub_command.c_str(), &matches);
-                    if (found_cmd == nullptr)
-                        all_okay = false;
-                    else if (matches.GetSize() > 1)
-                        all_okay = false;
-                    else
-                        sub_cmd_obj = found_cmd;
-                }
-            }
-            
-            if (!all_okay || (sub_cmd_obj == nullptr))
-            {
-                std::string cmd_string;
-                command.GetCommandString (cmd_string);
-                if (matches.GetSize() >= 2)
-                {
-                    StreamString s;
-                    s.Printf ("ambiguous command %s", cmd_string.c_str());
-                    size_t num_matches = matches.GetSize();
-                    for (size_t match_idx = 0; match_idx < num_matches; match_idx++)
-                    {
-                        s.Printf ("\n\t%s", matches.GetStringAtIndex(match_idx));
-                    }
-                    s.Printf ("\n");
-                    result.AppendError(s.GetData());
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-                else if (!sub_cmd_obj)
-                {
-                    StreamString error_msg_stream;
-                    GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
-                                                         cmd_string.c_str(),
-                                                         m_interpreter.GetCommandPrefix(),
-                                                         sub_command.c_str());
-                    result.AppendErrorWithFormat("%s",error_msg_stream.GetData());
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-                else
-                {
-                    GenerateAdditionalHelpAvenuesMessage(&result.GetOutputStream(),
-                                                         cmd_string.c_str(),
-                                                         m_interpreter.GetCommandPrefix(),
-                                                         sub_command.c_str());
-                    result.GetOutputStream().Printf("\nThe closest match is '%s'. Help on it follows.\n\n", sub_cmd_obj->GetCommandName());
-                }
-            }
-            
-            sub_cmd_obj->GenerateHelpText(result);
-            
-            if (is_alias_command)
-            {
-                StreamString sstr;
-                m_interpreter.GetAlias(alias_name.c_str())->GetAliasExpansion(sstr);
-                result.GetOutputStream().Printf ("\n'%s' is an abbreviation for %s\n", alias_name.c_str(), sstr.GetData());
-            }
-        }
-        else if (matches.GetSize() > 0)
-        {
-            Stream &output_strm = result.GetOutputStream();
-            output_strm.Printf("Help requested with ambiguous command name, possible completions:\n");
-            const size_t match_count = matches.GetSize();
-            for (size_t i = 0; i < match_count; i++)
-            {
-                output_strm.Printf("\t%s\n", matches.GetStringAtIndex(i));
-            }
-        }
-        else
-        {
-            // Maybe the user is asking for help about a command argument rather than a command.
-            const CommandArgumentType arg_type = CommandObject::LookupArgumentName (command.GetArgumentAtIndex (0));
-            if (arg_type != eArgTypeLastArg)
-            {
-                Stream &output_strm = result.GetOutputStream ();
-                CommandObject::GetArgumentHelp (output_strm, arg_type, m_interpreter);
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-            else
-            {
-                StreamString error_msg_stream;
-                GenerateAdditionalHelpAvenuesMessage(&error_msg_stream, command.GetArgumentAtIndex(0), m_interpreter.GetCommandPrefix());
-                result.AppendErrorWithFormat("%s",error_msg_stream.GetData());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-    }
-    
-    return result.Succeeded();
+  }
+
+  return result.Succeeded();
 }
 
-int
-CommandObjectHelp::HandleCompletion(Args &input,
-                                    int &cursor_index,
-                                    int &cursor_char_position,
-                                    int match_start_point,
-                                    int max_return_elements,
-                                    bool &word_complete,
-                                    StringList &matches)
-{
-    // Return the completions of the commands in the help system:
-    if (cursor_index == 0)
-    {
-        return m_interpreter.HandleCompletionMatches (input, 
-                                                    cursor_index, 
-                                                    cursor_char_position, 
-                                                    match_start_point, 
-                                                    max_return_elements, 
-                                                    word_complete, 
-                                                    matches);
-    }
-    else
-    {
-        CommandObject *cmd_obj = m_interpreter.GetCommandObject (input.GetArgumentAtIndex(0));
-        
-        // The command that they are getting help on might be ambiguous, in which case we should complete that,
-        // otherwise complete with the command the user is getting help on...
-        
-        if (cmd_obj)
-        {
-            input.Shift();
-            cursor_index--;
-            return cmd_obj->HandleCompletion (input, 
-                                              cursor_index, 
-                                              cursor_char_position, 
-                                              match_start_point, 
-                                              max_return_elements, 
-                                              word_complete, 
-                                              matches);
-        }
-        else
-        {
-            return m_interpreter.HandleCompletionMatches (input, 
-                                                        cursor_index, 
-                                                        cursor_char_position, 
-                                                        match_start_point, 
-                                                        max_return_elements, 
-                                                        word_complete, 
-                                                        matches);
-        }
+int CommandObjectHelp::HandleCompletion(Args &input, int &cursor_index,
+                                        int &cursor_char_position,
+                                        int match_start_point,
+                                        int max_return_elements,
+                                        bool &word_complete,
+                                        StringList &matches) {
+  // Return the completions of the commands in the help system:
+  if (cursor_index == 0) {
+    return m_interpreter.HandleCompletionMatches(
+        input, cursor_index, cursor_char_position, match_start_point,
+        max_return_elements, word_complete, matches);
+  } else {
+    CommandObject *cmd_obj =
+        m_interpreter.GetCommandObject(input.GetArgumentAtIndex(0));
+
+    // The command that they are getting help on might be ambiguous, in which
+    // case we should complete that,
+    // otherwise complete with the command the user is getting help on...
+
+    if (cmd_obj) {
+      input.Shift();
+      cursor_index--;
+      return cmd_obj->HandleCompletion(
+          input, cursor_index, cursor_char_position, match_start_point,
+          max_return_elements, word_complete, matches);
+    } else {
+      return m_interpreter.HandleCompletionMatches(
+          input, cursor_index, cursor_char_position, match_start_point,
+          max_return_elements, word_complete, matches);
     }
+  }
 }

Modified: lldb/trunk/source/Commands/CommandObjectHelp.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectHelp.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectHelp.h (original)
+++ lldb/trunk/source/Commands/CommandObjectHelp.h Tue Sep  6 15:57:50 2016
@@ -23,106 +23,78 @@ namespace lldb_private {
 // CommandObjectHelp
 //-------------------------------------------------------------------------
 
-class CommandObjectHelp : public CommandObjectParsed
-{
+class CommandObjectHelp : public CommandObjectParsed {
 public:
+  CommandObjectHelp(CommandInterpreter &interpreter);
 
-    CommandObjectHelp (CommandInterpreter &interpreter);
+  ~CommandObjectHelp() override;
 
-    ~CommandObjectHelp() override;
+  int HandleCompletion(Args &input, int &cursor_index,
+                       int &cursor_char_position, int match_start_point,
+                       int max_return_elements, bool &word_complete,
+                       StringList &matches) override;
 
-    int
-    HandleCompletion(Args &input,
-		     int &cursor_index,
-		     int &cursor_char_position,
-		     int match_start_point,
-		     int max_return_elements,
-		     bool &word_complete,
-		     StringList &matches) override;
-    
-    static void
-    GenerateAdditionalHelpAvenuesMessage (Stream *s,
-                                          const char* command,
-                                          const char* prefix = nullptr,
-                                          const char* subcommand = nullptr,
-                                          bool include_apropos = true,
-                                          bool include_type_lookup = true);
-    
-    class CommandOptions : public Options
-    {
-    public:
-        
-        CommandOptions() :
-        Options()
-        {
-        }
-        
-        ~CommandOptions() override {}
-        
-        Error
-        SetOptionValue(uint32_t option_idx, const char *option_arg,
-                       ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-            
-            switch (short_option)
-            {
-                case 'a':
-                    m_show_aliases = false;
-                    break;
-                case 'u':
-                    m_show_user_defined = false;
-                    break;
-                case 'h':
-                    m_show_hidden = true;
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_show_aliases = true;
-            m_show_user_defined = true;
-            m_show_hidden = false;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions() override
-        {
-            return g_option_table;
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static OptionDefinition g_option_table[];
-        
-        // Instance variables to hold the values for command options.
-        
-        bool m_show_aliases;
-        bool m_show_user_defined;
-        bool m_show_hidden;
-    };
-    
-    Options *
-    GetOptions() override
-    {
-        return &m_options;
+  static void GenerateAdditionalHelpAvenuesMessage(
+      Stream *s, const char *command, const char *prefix = nullptr,
+      const char *subcommand = nullptr, bool include_apropos = true,
+      bool include_type_lookup = true);
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {}
+
+    ~CommandOptions() override {}
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'a':
+        m_show_aliases = false;
+        break;
+      case 'u':
+        m_show_user_defined = false;
+        break;
+      case 'h':
+        m_show_hidden = true;
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_show_aliases = true;
+      m_show_user_defined = true;
+      m_show_hidden = false;
     }
-    
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    bool m_show_aliases;
+    bool m_show_user_defined;
+    bool m_show_hidden;
+  };
+
+  Options *GetOptions() override { return &m_options; }
+
 protected:
-    bool
-    DoExecute(Args& command,
-	      CommandReturnObject &result) override;
-    
+  bool DoExecute(Args &command, CommandReturnObject &result) override;
+
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectLanguage.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLanguage.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLanguage.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLanguage.cpp Tue Sep  6 15:57:50 2016
@@ -21,13 +21,11 @@ using namespace lldb;
 using namespace lldb_private;
 
 CommandObjectLanguage::CommandObjectLanguage(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "language", "Commands specific to a source language.",
-                             "language <language-name> <subcommand> [<subcommand-options>]")
-{
-    //Let the LanguageRuntime populates this command with subcommands
-    LanguageRuntime::InitializeCommands(this);
+    : CommandObjectMultiword(
+          interpreter, "language", "Commands specific to a source language.",
+          "language <language-name> <subcommand> [<subcommand-options>]") {
+  // Let the LanguageRuntime populates this command with subcommands
+  LanguageRuntime::InitializeCommands(this);
 }
 
-CommandObjectLanguage::~CommandObjectLanguage ()
-{
-}
+CommandObjectLanguage::~CommandObjectLanguage() {}

Modified: lldb/trunk/source/Commands/CommandObjectLanguage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLanguage.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLanguage.h (original)
+++ lldb/trunk/source/Commands/CommandObjectLanguage.h Tue Sep  6 15:57:50 2016
@@ -16,21 +16,19 @@
 // Other libraries and framework includes
 // Project includes
 
-#include "lldb/lldb-types.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/lldb-types.h"
 
 namespace lldb_private {
-    class CommandObjectLanguage : public CommandObjectMultiword
-    {
-    public:
-        CommandObjectLanguage (CommandInterpreter &interpreter);
-        
-        ~CommandObjectLanguage() override;
-        
-    protected:
-        bool
-        DoExecute (Args& command, CommandReturnObject &result);
-    };
+class CommandObjectLanguage : public CommandObjectMultiword {
+public:
+  CommandObjectLanguage(CommandInterpreter &interpreter);
+
+  ~CommandObjectLanguage() override;
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result);
+};
 } // namespace lldb_private
 
 #endif // liblldb_CommandObjectLanguage_h_

Modified: lldb/trunk/source/Commands/CommandObjectLog.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.cpp Tue Sep  6 15:57:50 2016
@@ -12,20 +12,20 @@
 // Other libraries and framework includes
 // Project includes
 #include "CommandObjectLog.h"
-#include "lldb/Interpreter/Args.h"
 #include "lldb/Core/Debugger.h"
-#include "lldb/Host/FileSpec.h"
+#include "lldb/Core/Debugger.h"
 #include "lldb/Core/Log.h"
 #include "lldb/Core/Module.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Core/Stream.h"
 #include "lldb/Core/StreamFile.h"
 #include "lldb/Core/Timer.h"
-#include "lldb/Core/Debugger.h"
+#include "lldb/Host/FileSpec.h"
 #include "lldb/Host/StringConvert.h"
+#include "lldb/Interpreter/Args.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/LineTable.h"
 #include "lldb/Symbol/ObjectFile.h"
 #include "lldb/Symbol/SymbolFile.h"
@@ -36,171 +36,163 @@
 using namespace lldb;
 using namespace lldb_private;
 
-class CommandObjectLogEnable : public CommandObjectParsed
-{
+class CommandObjectLogEnable : public CommandObjectParsed {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectLogEnable(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "log enable",
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectLogEnable(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "log enable",
                             "Enable logging for a single log channel.",
                             nullptr),
-        m_options()
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData channel_arg;
-        CommandArgumentData category_arg;
-        
-        // Define the first (and only) variant of this arg.
-        channel_arg.arg_type = eArgTypeLogChannel;
-        channel_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (channel_arg);
-        
-        category_arg.arg_type = eArgTypeLogCategory;
-        category_arg.arg_repetition = eArgRepeatPlus;
-
-        arg2.push_back (category_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-    }
-
-    ~CommandObjectLogEnable() override = default;
+        m_options() {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData channel_arg;
+    CommandArgumentData category_arg;
+
+    // Define the first (and only) variant of this arg.
+    channel_arg.arg_type = eArgTypeLogChannel;
+    channel_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(channel_arg);
+
+    category_arg.arg_type = eArgTypeLogCategory;
+    category_arg.arg_repetition = eArgRepeatPlus;
+
+    arg2.push_back(category_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+  }
+
+  ~CommandObjectLogEnable() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  //    int
+  //    HandleArgumentCompletion (Args &input,
+  //                              int &cursor_index,
+  //                              int &cursor_char_position,
+  //                              OptionElementVector &opt_element_vector,
+  //                              int match_start_point,
+  //                              int max_return_elements,
+  //                              bool &word_complete,
+  //                              StringList &matches)
+  //    {
+  //        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
+  //        completion_str.erase (cursor_char_position);
+  //
+  //        if (cursor_index == 1)
+  //        {
+  //            //
+  //            Log::AutoCompleteChannelName (completion_str.c_str(), matches);
+  //        }
+  //        return matches.GetSize();
+  //    }
+  //
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), log_file(), log_options(0) {}
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option = m_getopt_table[option_idx].val;
+
+      switch (short_option) {
+      case 'f':
+        log_file.SetFile(option_arg, true);
+        break;
+      case 't':
+        log_options |= LLDB_LOG_OPTION_THREADSAFE;
+        break;
+      case 'v':
+        log_options |= LLDB_LOG_OPTION_VERBOSE;
+        break;
+      case 'g':
+        log_options |= LLDB_LOG_OPTION_DEBUG;
+        break;
+      case 's':
+        log_options |= LLDB_LOG_OPTION_PREPEND_SEQUENCE;
+        break;
+      case 'T':
+        log_options |= LLDB_LOG_OPTION_PREPEND_TIMESTAMP;
+        break;
+      case 'p':
+        log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;
+        break;
+      case 'n':
+        log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME;
+        break;
+      case 'S':
+        log_options |= LLDB_LOG_OPTION_BACKTRACE;
+        break;
+      case 'a':
+        log_options |= LLDB_LOG_OPTION_APPEND;
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
+      return error;
     }
 
-//    int
-//    HandleArgumentCompletion (Args &input,
-//                              int &cursor_index,
-//                              int &cursor_char_position,
-//                              OptionElementVector &opt_element_vector,
-//                              int match_start_point,
-//                              int max_return_elements,
-//                              bool &word_complete,
-//                              StringList &matches)
-//    {
-//        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
-//        completion_str.erase (cursor_char_position);
-//        
-//        if (cursor_index == 1)
-//        {
-//            //
-//            Log::AutoCompleteChannelName (completion_str.c_str(), matches);
-//        }
-//        return matches.GetSize();
-//    }
-//
-
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            log_file(),
-            log_options(0)
-        {
-        }
-
-        ~CommandOptions () override = default;
-
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = m_getopt_table[option_idx].val;
-
-            switch (short_option)
-            {
-            case 'f':  log_file.SetFile(option_arg, true);                    break;
-            case 't':  log_options |= LLDB_LOG_OPTION_THREADSAFE;             break;
-            case 'v':  log_options |= LLDB_LOG_OPTION_VERBOSE;                break;
-            case 'g':  log_options |= LLDB_LOG_OPTION_DEBUG;                  break;
-            case 's':  log_options |= LLDB_LOG_OPTION_PREPEND_SEQUENCE;       break;
-            case 'T':  log_options |= LLDB_LOG_OPTION_PREPEND_TIMESTAMP;      break;
-            case 'p':  log_options |= LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD;break;
-            case 'n':  log_options |= LLDB_LOG_OPTION_PREPEND_THREAD_NAME;    break;
-            case 'S':  log_options |= LLDB_LOG_OPTION_BACKTRACE;              break;
-            case 'a':  log_options |= LLDB_LOG_OPTION_APPEND;                 break;
-            default:
-                error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                break;
-            }
-
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            log_file.Clear();
-            log_options = 0;
-        }
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      log_file.Clear();
+      log_options = 0;
+    }
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        // Options table: Required for subclasses of Options.
+    // Options table: Required for subclasses of Options.
 
-        static OptionDefinition g_option_table[];
+    static OptionDefinition g_option_table[];
 
-        // Instance variables to hold the values for command options.
+    // Instance variables to hold the values for command options.
 
-        FileSpec log_file;
-        uint32_t log_options;
-    };
+    FileSpec log_file;
+    uint32_t log_options;
+  };
 
 protected:
-    bool
-    DoExecute (Args& args,
-             CommandReturnObject &result) override
-    {
-        if (args.GetArgumentCount() < 2)
-        {
-            result.AppendErrorWithFormat("%s takes a log channel and one or more log types.\n", m_cmd_name.c_str());
-        }
-        else
-        {
-            std::string channel(args.GetArgumentAtIndex(0));
-            args.Shift ();  // Shift off the channel
-            char log_file[PATH_MAX];
-            if (m_options.log_file)
-                m_options.log_file.GetPath(log_file, sizeof(log_file));
-            else
-                log_file[0] = '\0';
-            bool success = m_interpreter.GetDebugger().EnableLog (channel.c_str(), 
-                                                                  args.GetConstArgumentVector(), 
-                                                                  log_file, 
-                                                                  m_options.log_options, 
-                                                                  result.GetErrorStream());
-            if (success)
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            else
-                result.SetStatus (eReturnStatusFailed);
-        }    
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    if (args.GetArgumentCount() < 2) {
+      result.AppendErrorWithFormat(
+          "%s takes a log channel and one or more log types.\n",
+          m_cmd_name.c_str());
+    } else {
+      std::string channel(args.GetArgumentAtIndex(0));
+      args.Shift(); // Shift off the channel
+      char log_file[PATH_MAX];
+      if (m_options.log_file)
+        m_options.log_file.GetPath(log_file, sizeof(log_file));
+      else
+        log_file[0] = '\0';
+      bool success = m_interpreter.GetDebugger().EnableLog(
+          channel.c_str(), args.GetConstArgumentVector(), log_file,
+          m_options.log_options, result.GetErrorStream());
+      if (success)
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      else
+        result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectLogEnable::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectLogEnable::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1, false, "file",       'f', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Set the destination file to log to."},
   {LLDB_OPT_SET_1, false, "threadsafe", 't', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,     "Enable thread safe logging to avoid interweaved log lines."},
   {LLDB_OPT_SET_1, false, "verbose",    'v', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,     "Enable verbose logging."},
@@ -212,256 +204,219 @@ CommandObjectLogEnable::CommandOptions::
   {LLDB_OPT_SET_1, false, "stack",      'S', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,     "Append a stack backtrace to each log line."},
   {LLDB_OPT_SET_1, false, "append",     'a', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,     "Append to the log file instead of overwriting."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
-class CommandObjectLogDisable : public CommandObjectParsed
-{
+class CommandObjectLogDisable : public CommandObjectParsed {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectLogDisable(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "log disable",
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectLogDisable(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "log disable",
                             "Disable one or more log channel categories.",
-                            nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData channel_arg;
-        CommandArgumentData category_arg;
-        
-        // Define the first (and only) variant of this arg.
-        channel_arg.arg_type = eArgTypeLogChannel;
-        channel_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (channel_arg);
-        
-        category_arg.arg_type = eArgTypeLogCategory;
-        category_arg.arg_repetition = eArgRepeatPlus;
-
-        arg2.push_back (category_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-    }
+                            nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData channel_arg;
+    CommandArgumentData category_arg;
+
+    // Define the first (and only) variant of this arg.
+    channel_arg.arg_type = eArgTypeLogChannel;
+    channel_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(channel_arg);
+
+    category_arg.arg_type = eArgTypeLogCategory;
+    category_arg.arg_repetition = eArgRepeatPlus;
+
+    arg2.push_back(category_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+  }
 
-    ~CommandObjectLogDisable() override = default;
+  ~CommandObjectLogDisable() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args,
-             CommandReturnObject &result) override
-    {
-        const size_t argc = args.GetArgumentCount();
-        if (argc == 0)
-        {
-            result.AppendErrorWithFormat("%s takes a log channel and one or more log types.\n", m_cmd_name.c_str());
-        }
-        else
-        {
-            Log::Callbacks log_callbacks;
-
-            std::string channel(args.GetArgumentAtIndex(0));
-            args.Shift ();  // Shift off the channel
-            if (Log::GetLogChannelCallbacks (ConstString(channel.c_str()), log_callbacks))
-            {
-                log_callbacks.disable (args.GetConstArgumentVector(), &result.GetErrorStream());
-                result.SetStatus(eReturnStatusSuccessFinishNoResult);
-            }
-            else if (channel == "all")
-            {
-                Log::DisableAllLogChannels(&result.GetErrorStream());
-            }
-            else
-            {
-                LogChannelSP log_channel_sp (LogChannel::FindPlugin(channel.c_str()));
-                if (log_channel_sp)
-                {
-                    log_channel_sp->Disable(args.GetConstArgumentVector(), &result.GetErrorStream());
-                    result.SetStatus(eReturnStatusSuccessFinishNoResult);
-                }
-                else
-                    result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0));
-            }
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    const size_t argc = args.GetArgumentCount();
+    if (argc == 0) {
+      result.AppendErrorWithFormat(
+          "%s takes a log channel and one or more log types.\n",
+          m_cmd_name.c_str());
+    } else {
+      Log::Callbacks log_callbacks;
+
+      std::string channel(args.GetArgumentAtIndex(0));
+      args.Shift(); // Shift off the channel
+      if (Log::GetLogChannelCallbacks(ConstString(channel.c_str()),
+                                      log_callbacks)) {
+        log_callbacks.disable(args.GetConstArgumentVector(),
+                              &result.GetErrorStream());
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else if (channel == "all") {
+        Log::DisableAllLogChannels(&result.GetErrorStream());
+      } else {
+        LogChannelSP log_channel_sp(LogChannel::FindPlugin(channel.c_str()));
+        if (log_channel_sp) {
+          log_channel_sp->Disable(args.GetConstArgumentVector(),
+                                  &result.GetErrorStream());
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else
+          result.AppendErrorWithFormat("Invalid log channel '%s'.\n",
+                                       args.GetArgumentAtIndex(0));
+      }
     }
+    return result.Succeeded();
+  }
 };
 
-class CommandObjectLogList : public CommandObjectParsed
-{
+class CommandObjectLogList : public CommandObjectParsed {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectLogList(CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "log list",
-                            "List the log categories for one or more log channels.  If none specified, lists them all.",
-                            nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData channel_arg;
-        
-        // Define the first (and only) variant of this arg.
-        channel_arg.arg_type = eArgTypeLogChannel;
-        channel_arg.arg_repetition = eArgRepeatStar;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (channel_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectLogList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "log list",
+                            "List the log categories for one or more log "
+                            "channels.  If none specified, lists them all.",
+                            nullptr) {
+    CommandArgumentEntry arg;
+    CommandArgumentData channel_arg;
+
+    // Define the first (and only) variant of this arg.
+    channel_arg.arg_type = eArgTypeLogChannel;
+    channel_arg.arg_repetition = eArgRepeatStar;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(channel_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectLogList() override = default;
+  ~CommandObjectLogList() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args,
-             CommandReturnObject &result) override
-    {
-        const size_t argc = args.GetArgumentCount();
-        if (argc == 0)
-        {
-            Log::ListAllLogChannels (&result.GetOutputStream());
-            result.SetStatus(eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            for (size_t i=0; i<argc; ++i)
-            {
-                Log::Callbacks log_callbacks;
-
-                std::string channel(args.GetArgumentAtIndex(i));
-                if (Log::GetLogChannelCallbacks (ConstString(channel.c_str()), log_callbacks))
-                {
-                    log_callbacks.list_categories (&result.GetOutputStream());
-                    result.SetStatus(eReturnStatusSuccessFinishResult);
-                }
-                else if (channel == "all")
-                {
-                    Log::ListAllLogChannels (&result.GetOutputStream());
-                    result.SetStatus(eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    LogChannelSP log_channel_sp (LogChannel::FindPlugin(channel.c_str()));
-                    if (log_channel_sp)
-                    {
-                        log_channel_sp->ListCategories(&result.GetOutputStream());
-                        result.SetStatus(eReturnStatusSuccessFinishNoResult);
-                    }
-                    else
-                        result.AppendErrorWithFormat("Invalid log channel '%s'.\n", args.GetArgumentAtIndex(0));
-                }
-            }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    const size_t argc = args.GetArgumentCount();
+    if (argc == 0) {
+      Log::ListAllLogChannels(&result.GetOutputStream());
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      for (size_t i = 0; i < argc; ++i) {
+        Log::Callbacks log_callbacks;
+
+        std::string channel(args.GetArgumentAtIndex(i));
+        if (Log::GetLogChannelCallbacks(ConstString(channel.c_str()),
+                                        log_callbacks)) {
+          log_callbacks.list_categories(&result.GetOutputStream());
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else if (channel == "all") {
+          Log::ListAllLogChannels(&result.GetOutputStream());
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          LogChannelSP log_channel_sp(LogChannel::FindPlugin(channel.c_str()));
+          if (log_channel_sp) {
+            log_channel_sp->ListCategories(&result.GetOutputStream());
+            result.SetStatus(eReturnStatusSuccessFinishNoResult);
+          } else
+            result.AppendErrorWithFormat("Invalid log channel '%s'.\n",
+                                         args.GetArgumentAtIndex(0));
         }
-        return result.Succeeded();
+      }
     }
+    return result.Succeeded();
+  }
 };
 
-class CommandObjectLogTimer : public CommandObjectParsed
-{
+class CommandObjectLogTimer : public CommandObjectParsed {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectLogTimer(CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                           "log timers",
-                           "Enable, disable, dump, and reset LLDB internal performance timers.",
-                           "log timers < enable <depth> | disable | dump | increment <bool> | reset >")
-    {
-    }
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectLogTimer(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "log timers",
+                            "Enable, disable, dump, and reset LLDB internal "
+                            "performance timers.",
+                            "log timers < enable <depth> | disable | dump | "
+                            "increment <bool> | reset >") {}
 
-    ~CommandObjectLogTimer() override = default;
+  ~CommandObjectLogTimer() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args,
-             CommandReturnObject &result) override
-    {
-        const size_t argc = args.GetArgumentCount();
-        result.SetStatus(eReturnStatusFailed);
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    const size_t argc = args.GetArgumentCount();
+    result.SetStatus(eReturnStatusFailed);
+
+    if (argc == 1) {
+      const char *sub_command = args.GetArgumentAtIndex(0);
+
+      if (strcasecmp(sub_command, "enable") == 0) {
+        Timer::SetDisplayDepth(UINT32_MAX);
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else if (strcasecmp(sub_command, "disable") == 0) {
+        Timer::DumpCategoryTimes(&result.GetOutputStream());
+        Timer::SetDisplayDepth(0);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else if (strcasecmp(sub_command, "dump") == 0) {
+        Timer::DumpCategoryTimes(&result.GetOutputStream());
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else if (strcasecmp(sub_command, "reset") == 0) {
+        Timer::ResetCategoryTimes();
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      }
+    } else if (argc == 2) {
+      const char *sub_command = args.GetArgumentAtIndex(0);
+
+      if (strcasecmp(sub_command, "enable") == 0) {
+        bool success;
+        uint32_t depth =
+            StringConvert::ToUInt32(args.GetArgumentAtIndex(1), 0, 0, &success);
+        if (success) {
+          Timer::SetDisplayDepth(depth);
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else
+          result.AppendError(
+              "Could not convert enable depth to an unsigned integer.");
+      }
+      if (strcasecmp(sub_command, "increment") == 0) {
+        bool success;
+        bool increment =
+            Args::StringToBoolean(args.GetArgumentAtIndex(1), false, &success);
+        if (success) {
+          Timer::SetQuiet(!increment);
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else
+          result.AppendError("Could not convert increment value to boolean.");
+      }
+    }
 
-        if (argc == 1)
-        {
-            const char *sub_command = args.GetArgumentAtIndex(0);
-
-            if (strcasecmp(sub_command, "enable") == 0)
-            {
-                Timer::SetDisplayDepth (UINT32_MAX);
-                result.SetStatus(eReturnStatusSuccessFinishNoResult);
-            }
-            else if (strcasecmp(sub_command, "disable") == 0)
-            {
-                Timer::DumpCategoryTimes (&result.GetOutputStream());
-                Timer::SetDisplayDepth (0);
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            }
-            else if (strcasecmp(sub_command, "dump") == 0)
-            {
-                Timer::DumpCategoryTimes (&result.GetOutputStream());
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            }
-            else if (strcasecmp(sub_command, "reset") == 0)
-            {
-                Timer::ResetCategoryTimes ();
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            }
-        }
-        else if (argc == 2)
-        {
-            const char *sub_command = args.GetArgumentAtIndex(0);
-
-            if (strcasecmp(sub_command, "enable") == 0)
-            {
-                bool success;
-                uint32_t depth = StringConvert::ToUInt32(args.GetArgumentAtIndex(1), 0, 0, &success);
-                if (success)
-                {
-                    Timer::SetDisplayDepth (depth);
-                    result.SetStatus(eReturnStatusSuccessFinishNoResult);
-                }
-                else
-                    result.AppendError("Could not convert enable depth to an unsigned integer.");
-            }
-            if (strcasecmp(sub_command, "increment") == 0)
-            {
-                bool success;
-                bool increment = Args::StringToBoolean(args.GetArgumentAtIndex(1), false, &success);
-                if (success)
-                {
-                    Timer::SetQuiet (!increment);
-                    result.SetStatus(eReturnStatusSuccessFinishNoResult);
-                }
-                else
-                    result.AppendError("Could not convert increment value to boolean.");
-            }
-        }
-        
-        if (!result.Succeeded())
-        {
-            result.AppendError("Missing subcommand");
-            result.AppendErrorWithFormat("Usage: %s\n", m_cmd_syntax.c_str());
-        }
-        return result.Succeeded();
+    if (!result.Succeeded()) {
+      result.AppendError("Missing subcommand");
+      result.AppendErrorWithFormat("Usage: %s\n", m_cmd_syntax.c_str());
     }
+    return result.Succeeded();
+  }
 };
 
 CommandObjectLog::CommandObjectLog(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "log", "Commands controlling LLDB internal logging.",
-                             "log <subcommand> [<command-options>]")
-{
-    LoadSubCommand ("enable",  CommandObjectSP (new CommandObjectLogEnable (interpreter)));
-    LoadSubCommand ("disable", CommandObjectSP (new CommandObjectLogDisable (interpreter)));
-    LoadSubCommand ("list",    CommandObjectSP (new CommandObjectLogList (interpreter)));
-    LoadSubCommand ("timers",  CommandObjectSP (new CommandObjectLogTimer (interpreter)));
+    : CommandObjectMultiword(interpreter, "log",
+                             "Commands controlling LLDB internal logging.",
+                             "log <subcommand> [<command-options>]") {
+  LoadSubCommand("enable",
+                 CommandObjectSP(new CommandObjectLogEnable(interpreter)));
+  LoadSubCommand("disable",
+                 CommandObjectSP(new CommandObjectLogDisable(interpreter)));
+  LoadSubCommand("list",
+                 CommandObjectSP(new CommandObjectLogList(interpreter)));
+  LoadSubCommand("timers",
+                 CommandObjectSP(new CommandObjectLogTimer(interpreter)));
 }
 
 CommandObjectLog::~CommandObjectLog() = default;

Modified: lldb/trunk/source/Commands/CommandObjectLog.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectLog.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectLog.h (original)
+++ lldb/trunk/source/Commands/CommandObjectLog.h Tue Sep  6 15:57:50 2016
@@ -25,21 +25,20 @@ namespace lldb_private {
 // CommandObjectLog
 //-------------------------------------------------------------------------
 
-class CommandObjectLog : public CommandObjectMultiword
-{
+class CommandObjectLog : public CommandObjectMultiword {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectLog(CommandInterpreter &interpreter);
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectLog(CommandInterpreter &interpreter);
 
-    ~CommandObjectLog() override;
+  ~CommandObjectLog() override;
 
 private:
-    //------------------------------------------------------------------
-    // For CommandObjectLog only
-    //------------------------------------------------------------------
-    DISALLOW_COPY_AND_ASSIGN (CommandObjectLog);
+  //------------------------------------------------------------------
+  // For CommandObjectLog only
+  //------------------------------------------------------------------
+  DISALLOW_COPY_AND_ASSIGN(CommandObjectLog);
 };
 
 } // namespace lldb_private




More information about the lldb-commits mailing list