[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/Commands/CommandObjectMemory.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMemory.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMemory.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMemory.cpp Tue Sep  6 15:57:50 2016
@@ -48,10 +48,8 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static OptionDefinition
-g_option_table[] =
-{
-  // clang-format off
+static OptionDefinition g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1, false, "num-per-line", 'l', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeNumberPerLine, "The number of items per line to display." },
   {LLDB_OPT_SET_2, false, "binary",       'b', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,          "If true, memory will be saved as binary. If false, the memory is saved save as an ASCII dump that "
                                                                                                                             "uses the format, size, count and number per line settings." },
@@ -60,1766 +58,1634 @@ g_option_table[] =
   {LLDB_OPT_SET_1 |
    LLDB_OPT_SET_2 |
    LLDB_OPT_SET_3, false, "force",        'r', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,          "Necessary if reading over target.max-memory-read-size bytes." },
-  // clang-format on
+    // clang-format on
 };
 
-class OptionGroupReadMemory : public OptionGroup
-{
+class OptionGroupReadMemory : public OptionGroup {
 public:
-    OptionGroupReadMemory () :
-        m_num_per_line (1,1),
-        m_output_as_binary (false),
-        m_view_as_type(),
-        m_offset(0,0)
-    {
-    }
-
-    ~OptionGroupReadMemory() override = default;
-
-    uint32_t
-    GetNumDefinitions () override
-    {
-        return sizeof (g_option_table) / sizeof (OptionDefinition);
-    }
-    
-    const OptionDefinition*
-    GetDefinitions () override
-    {
-        return g_option_table;
-    }
-    
-    Error
-    SetOptionValue (uint32_t option_idx,
-                    const char *option_arg,
-                    ExecutionContext *execution_context) override
-    {
-        Error error;
-        const int short_option = g_option_table[option_idx].short_option;
-        
-        switch (short_option)
-        {
-            case 'l':
-                error = m_num_per_line.SetValueFromString (option_arg);
-                if (m_num_per_line.GetCurrentValue() == 0)
-                    error.SetErrorStringWithFormat("invalid value for --num-per-line option '%s'", option_arg);
-                break;
-
-            case 'b':
-                m_output_as_binary = true;
-                break;
-                
-            case 't':
-                error = m_view_as_type.SetValueFromString (option_arg);
-                break;
-            
-            case 'r':
-                m_force = true;
-                break;
-                
-            case 'E':
-                error = m_offset.SetValueFromString(option_arg);
-                break;
-                
-            default:
-                error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-                break;
-        }
-        return error;
-    }
-    
-    void
-    OptionParsingStarting(ExecutionContext *execution_context) override
-    {
-        m_num_per_line.Clear();
-        m_output_as_binary = false;
-        m_view_as_type.Clear();
-        m_force = false;
-        m_offset.Clear();
-    }
-    
-    Error
-    FinalizeSettings (Target *target, OptionGroupFormat& format_options)
-    {
-        Error error;
-        OptionValueUInt64 &byte_size_value = format_options.GetByteSizeValue();
-        OptionValueUInt64 &count_value = format_options.GetCountValue();
-        const bool byte_size_option_set = byte_size_value.OptionWasSet();
-        const bool num_per_line_option_set = m_num_per_line.OptionWasSet();
-        const bool count_option_set = format_options.GetCountValue().OptionWasSet();
-        
-        switch (format_options.GetFormat())
-        {
-            default:
-                break;
-                
-            case eFormatBoolean:
-                if (!byte_size_option_set)
-                    byte_size_value = 1;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 1;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 8;
-                break;
-                
-            case eFormatCString:
-                break;
-
-            case eFormatInstruction:
-                if (count_option_set)
-                    byte_size_value = target->GetArchitecture().GetMaximumOpcodeByteSize();
-                m_num_per_line = 1;
-                break;
-
-            case eFormatAddressInfo:
-                if (!byte_size_option_set)
-                    byte_size_value = target->GetArchitecture().GetAddressByteSize();
-                m_num_per_line = 1;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 8;
-                break;
-
-            case eFormatPointer:
-                byte_size_value = target->GetArchitecture().GetAddressByteSize();
-                if (!num_per_line_option_set)
-                    m_num_per_line = 4;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 8;
-                break;
-                
-            case eFormatBinary:
-            case eFormatFloat:
-            case eFormatOctal:
-            case eFormatDecimal:
-            case eFormatEnum:
-            case eFormatUnicode16:
-            case eFormatUnicode32:
-            case eFormatUnsigned:
-            case eFormatHexFloat:
-                if (!byte_size_option_set)
-                    byte_size_value = 4;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 1;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 8;
-                break;
-            
-            case eFormatBytes:
-            case eFormatBytesWithASCII:
-                if (byte_size_option_set)
-                {
-                    if (byte_size_value > 1)
-                        error.SetErrorStringWithFormat(
-                            "display format (bytes/bytes with ASCII) conflicts with the specified byte size %" PRIu64
-                            "\n"
-                            "\tconsider using a different display format or don't specify the byte size.",
-                            byte_size_value.GetCurrentValue());
-                }
-                else
-                    byte_size_value = 1;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 16;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 32;
-                break;
-
-            case eFormatCharArray:
-            case eFormatChar:
-            case eFormatCharPrintable:
-                if (!byte_size_option_set)
-                    byte_size_value = 1;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 32;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 64;
-                break;
-
-            case eFormatComplex:
-                if (!byte_size_option_set)
-                    byte_size_value = 8;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 1;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 8;
-                break;
-
-            case eFormatComplexInteger:
-                if (!byte_size_option_set)
-                    byte_size_value = 8;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 1;
-                if (!count_option_set)
-                    format_options.GetCountValue() = 8;
-                break;
-
-            case eFormatHex:
-                if (!byte_size_option_set)
-                    byte_size_value = 4;
-                if (!num_per_line_option_set)
-                {
-                    switch (byte_size_value)
-                    {
-                        case 1:
-                        case 2:
-                            m_num_per_line = 8;
-                            break;
-                        case 4:
-                            m_num_per_line = 4;
-                            break;
-                        case 8:
-                            m_num_per_line = 2;
-                            break;
-                        default:
-                            m_num_per_line = 1;
-                            break;
-                    }
-                }
-                if (!count_option_set)
-                    count_value = 8;
-                break;
-                
-            case eFormatVectorOfChar:
-            case eFormatVectorOfSInt8:
-            case eFormatVectorOfUInt8:
-            case eFormatVectorOfSInt16:
-            case eFormatVectorOfUInt16:
-            case eFormatVectorOfSInt32:
-            case eFormatVectorOfUInt32:
-            case eFormatVectorOfSInt64:
-            case eFormatVectorOfUInt64:
-            case eFormatVectorOfFloat16:
-            case eFormatVectorOfFloat32:
-            case eFormatVectorOfFloat64:
-            case eFormatVectorOfUInt128:
-                if (!byte_size_option_set)
-                    byte_size_value = 128;
-                if (!num_per_line_option_set)
-                    m_num_per_line = 1;
-                if (!count_option_set)
-                    count_value = 4;
-                break;
-        }
-        return error;
-    }
-
-    bool
-    AnyOptionWasSet () const
-    {
-        return m_num_per_line.OptionWasSet() ||
-               m_output_as_binary ||
-               m_view_as_type.OptionWasSet() ||
-               m_offset.OptionWasSet();
-    }
-    
-    OptionValueUInt64 m_num_per_line;
-    bool m_output_as_binary;
-    OptionValueString m_view_as_type;
-    bool m_force;
-    OptionValueUInt64 m_offset;
+  OptionGroupReadMemory()
+      : m_num_per_line(1, 1), m_output_as_binary(false), m_view_as_type(),
+        m_offset(0, 0) {}
+
+  ~OptionGroupReadMemory() override = default;
+
+  uint32_t GetNumDefinitions() override {
+    return sizeof(g_option_table) / sizeof(OptionDefinition);
+  }
+
+  const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+  Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                       ExecutionContext *execution_context) override {
+    Error error;
+    const int short_option = g_option_table[option_idx].short_option;
+
+    switch (short_option) {
+    case 'l':
+      error = m_num_per_line.SetValueFromString(option_arg);
+      if (m_num_per_line.GetCurrentValue() == 0)
+        error.SetErrorStringWithFormat(
+            "invalid value for --num-per-line option '%s'", option_arg);
+      break;
+
+    case 'b':
+      m_output_as_binary = true;
+      break;
+
+    case 't':
+      error = m_view_as_type.SetValueFromString(option_arg);
+      break;
+
+    case 'r':
+      m_force = true;
+      break;
+
+    case 'E':
+      error = m_offset.SetValueFromString(option_arg);
+      break;
+
+    default:
+      error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                     short_option);
+      break;
+    }
+    return error;
+  }
+
+  void OptionParsingStarting(ExecutionContext *execution_context) override {
+    m_num_per_line.Clear();
+    m_output_as_binary = false;
+    m_view_as_type.Clear();
+    m_force = false;
+    m_offset.Clear();
+  }
+
+  Error FinalizeSettings(Target *target, OptionGroupFormat &format_options) {
+    Error error;
+    OptionValueUInt64 &byte_size_value = format_options.GetByteSizeValue();
+    OptionValueUInt64 &count_value = format_options.GetCountValue();
+    const bool byte_size_option_set = byte_size_value.OptionWasSet();
+    const bool num_per_line_option_set = m_num_per_line.OptionWasSet();
+    const bool count_option_set = format_options.GetCountValue().OptionWasSet();
+
+    switch (format_options.GetFormat()) {
+    default:
+      break;
+
+    case eFormatBoolean:
+      if (!byte_size_option_set)
+        byte_size_value = 1;
+      if (!num_per_line_option_set)
+        m_num_per_line = 1;
+      if (!count_option_set)
+        format_options.GetCountValue() = 8;
+      break;
+
+    case eFormatCString:
+      break;
+
+    case eFormatInstruction:
+      if (count_option_set)
+        byte_size_value = target->GetArchitecture().GetMaximumOpcodeByteSize();
+      m_num_per_line = 1;
+      break;
+
+    case eFormatAddressInfo:
+      if (!byte_size_option_set)
+        byte_size_value = target->GetArchitecture().GetAddressByteSize();
+      m_num_per_line = 1;
+      if (!count_option_set)
+        format_options.GetCountValue() = 8;
+      break;
+
+    case eFormatPointer:
+      byte_size_value = target->GetArchitecture().GetAddressByteSize();
+      if (!num_per_line_option_set)
+        m_num_per_line = 4;
+      if (!count_option_set)
+        format_options.GetCountValue() = 8;
+      break;
+
+    case eFormatBinary:
+    case eFormatFloat:
+    case eFormatOctal:
+    case eFormatDecimal:
+    case eFormatEnum:
+    case eFormatUnicode16:
+    case eFormatUnicode32:
+    case eFormatUnsigned:
+    case eFormatHexFloat:
+      if (!byte_size_option_set)
+        byte_size_value = 4;
+      if (!num_per_line_option_set)
+        m_num_per_line = 1;
+      if (!count_option_set)
+        format_options.GetCountValue() = 8;
+      break;
+
+    case eFormatBytes:
+    case eFormatBytesWithASCII:
+      if (byte_size_option_set) {
+        if (byte_size_value > 1)
+          error.SetErrorStringWithFormat(
+              "display format (bytes/bytes with ASCII) conflicts with the "
+              "specified byte size %" PRIu64 "\n"
+              "\tconsider using a different display format or don't specify "
+              "the byte size.",
+              byte_size_value.GetCurrentValue());
+      } else
+        byte_size_value = 1;
+      if (!num_per_line_option_set)
+        m_num_per_line = 16;
+      if (!count_option_set)
+        format_options.GetCountValue() = 32;
+      break;
+
+    case eFormatCharArray:
+    case eFormatChar:
+    case eFormatCharPrintable:
+      if (!byte_size_option_set)
+        byte_size_value = 1;
+      if (!num_per_line_option_set)
+        m_num_per_line = 32;
+      if (!count_option_set)
+        format_options.GetCountValue() = 64;
+      break;
+
+    case eFormatComplex:
+      if (!byte_size_option_set)
+        byte_size_value = 8;
+      if (!num_per_line_option_set)
+        m_num_per_line = 1;
+      if (!count_option_set)
+        format_options.GetCountValue() = 8;
+      break;
+
+    case eFormatComplexInteger:
+      if (!byte_size_option_set)
+        byte_size_value = 8;
+      if (!num_per_line_option_set)
+        m_num_per_line = 1;
+      if (!count_option_set)
+        format_options.GetCountValue() = 8;
+      break;
+
+    case eFormatHex:
+      if (!byte_size_option_set)
+        byte_size_value = 4;
+      if (!num_per_line_option_set) {
+        switch (byte_size_value) {
+        case 1:
+        case 2:
+          m_num_per_line = 8;
+          break;
+        case 4:
+          m_num_per_line = 4;
+          break;
+        case 8:
+          m_num_per_line = 2;
+          break;
+        default:
+          m_num_per_line = 1;
+          break;
+        }
+      }
+      if (!count_option_set)
+        count_value = 8;
+      break;
+
+    case eFormatVectorOfChar:
+    case eFormatVectorOfSInt8:
+    case eFormatVectorOfUInt8:
+    case eFormatVectorOfSInt16:
+    case eFormatVectorOfUInt16:
+    case eFormatVectorOfSInt32:
+    case eFormatVectorOfUInt32:
+    case eFormatVectorOfSInt64:
+    case eFormatVectorOfUInt64:
+    case eFormatVectorOfFloat16:
+    case eFormatVectorOfFloat32:
+    case eFormatVectorOfFloat64:
+    case eFormatVectorOfUInt128:
+      if (!byte_size_option_set)
+        byte_size_value = 128;
+      if (!num_per_line_option_set)
+        m_num_per_line = 1;
+      if (!count_option_set)
+        count_value = 4;
+      break;
+    }
+    return error;
+  }
+
+  bool AnyOptionWasSet() const {
+    return m_num_per_line.OptionWasSet() || m_output_as_binary ||
+           m_view_as_type.OptionWasSet() || m_offset.OptionWasSet();
+  }
+
+  OptionValueUInt64 m_num_per_line;
+  bool m_output_as_binary;
+  OptionValueString m_view_as_type;
+  bool m_force;
+  OptionValueUInt64 m_offset;
 };
 
 //----------------------------------------------------------------------
 // Read memory from the inferior process
 //----------------------------------------------------------------------
-class CommandObjectMemoryRead : public CommandObjectParsed
-{
+class CommandObjectMemoryRead : public CommandObjectParsed {
 public:
-    CommandObjectMemoryRead(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "memory read", "Read from the memory of the current target process.",
-                              nullptr, eCommandRequiresTarget | eCommandProcessMustBePaused),
-          m_option_group(),
-          m_format_options(eFormatBytesWithASCII, 1, 8),
-          m_memory_options(),
-          m_outfile_options(),
-          m_varobj_options(),
-          m_next_addr(LLDB_INVALID_ADDRESS),
-          m_prev_byte_size(0),
-          m_prev_format_options(eFormatBytesWithASCII, 1, 8),
-          m_prev_memory_options(),
-          m_prev_outfile_options(),
-          m_prev_varobj_options()
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData start_addr_arg;
-        CommandArgumentData end_addr_arg;
-        
-        // Define the first (and only) variant of this arg.
-        start_addr_arg.arg_type = eArgTypeAddressOrExpression;
-        start_addr_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (start_addr_arg);
-        
-        // Define the first (and only) variant of this arg.
-        end_addr_arg.arg_type = eArgTypeAddressOrExpression;
-        end_addr_arg.arg_repetition = eArgRepeatOptional;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (end_addr_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-        
-        // Add the "--format" and "--count" options to group 1 and 3
-        m_option_group.Append (&m_format_options, 
-                               OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_COUNT, 
-                               LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
-        m_option_group.Append (&m_format_options, 
-                               OptionGroupFormat::OPTION_GROUP_GDB_FMT, 
-                               LLDB_OPT_SET_1 | LLDB_OPT_SET_3);
-        // Add the "--size" option to group 1 and 2
-        m_option_group.Append (&m_format_options, 
-                               OptionGroupFormat::OPTION_GROUP_SIZE, 
-                               LLDB_OPT_SET_1 | LLDB_OPT_SET_2);
-        m_option_group.Append (&m_memory_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.Append (&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_3);
-        m_option_group.Finalize();
-    }
-
-    ~CommandObjectMemoryRead() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_option_group;
-    }
-
-    const char *
-    GetRepeatCommand (Args &current_command_args, uint32_t index) override
-    {
-        return m_cmd_name.c_str();
-    }
+  CommandObjectMemoryRead(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "memory read",
+            "Read from the memory of the current target process.", nullptr,
+            eCommandRequiresTarget | eCommandProcessMustBePaused),
+        m_option_group(), m_format_options(eFormatBytesWithASCII, 1, 8),
+        m_memory_options(), m_outfile_options(), m_varobj_options(),
+        m_next_addr(LLDB_INVALID_ADDRESS), m_prev_byte_size(0),
+        m_prev_format_options(eFormatBytesWithASCII, 1, 8),
+        m_prev_memory_options(), m_prev_outfile_options(),
+        m_prev_varobj_options() {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData start_addr_arg;
+    CommandArgumentData end_addr_arg;
 
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        // No need to check "target" for validity as eCommandRequiresTarget ensures it is valid
-        Target *target = m_exe_ctx.GetTargetPtr();
-
-        const size_t argc = command.GetArgumentCount();
-
-        if ((argc == 0 && m_next_addr == LLDB_INVALID_ADDRESS) || argc > 2)
-        {
-            result.AppendErrorWithFormat ("%s takes a start address expression with an optional end address expression.\n", m_cmd_name.c_str());
-            result.AppendRawWarning("Expressions should be quoted if they contain spaces or other special characters.\n");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
+    // Define the first (and only) variant of this arg.
+    start_addr_arg.arg_type = eArgTypeAddressOrExpression;
+    start_addr_arg.arg_repetition = eArgRepeatPlain;
 
-        CompilerType clang_ast_type;        
-        Error error;
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(start_addr_arg);
+
+    // Define the first (and only) variant of this arg.
+    end_addr_arg.arg_type = eArgTypeAddressOrExpression;
+    end_addr_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(end_addr_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+
+    // Add the "--format" and "--count" options to group 1 and 3
+    m_option_group.Append(&m_format_options,
+                          OptionGroupFormat::OPTION_GROUP_FORMAT |
+                              OptionGroupFormat::OPTION_GROUP_COUNT,
+                          LLDB_OPT_SET_1 | LLDB_OPT_SET_2 | LLDB_OPT_SET_3);
+    m_option_group.Append(&m_format_options,
+                          OptionGroupFormat::OPTION_GROUP_GDB_FMT,
+                          LLDB_OPT_SET_1 | LLDB_OPT_SET_3);
+    // Add the "--size" option to group 1 and 2
+    m_option_group.Append(&m_format_options,
+                          OptionGroupFormat::OPTION_GROUP_SIZE,
+                          LLDB_OPT_SET_1 | LLDB_OPT_SET_2);
+    m_option_group.Append(&m_memory_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.Append(&m_varobj_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_3);
+    m_option_group.Finalize();
+  }
+
+  ~CommandObjectMemoryRead() override = default;
+
+  Options *GetOptions() override { return &m_option_group; }
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override {
+    return m_cmd_name.c_str();
+  }
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    // No need to check "target" for validity as eCommandRequiresTarget ensures
+    // it is valid
+    Target *target = m_exe_ctx.GetTargetPtr();
+
+    const size_t argc = command.GetArgumentCount();
+
+    if ((argc == 0 && m_next_addr == LLDB_INVALID_ADDRESS) || argc > 2) {
+      result.AppendErrorWithFormat("%s takes a start address expression with "
+                                   "an optional end address expression.\n",
+                                   m_cmd_name.c_str());
+      result.AppendRawWarning("Expressions should be quoted if they contain "
+                              "spaces or other special characters.\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    CompilerType clang_ast_type;
+    Error error;
+
+    const char *view_as_type_cstr =
+        m_memory_options.m_view_as_type.GetCurrentValue();
+    if (view_as_type_cstr && view_as_type_cstr[0]) {
+      // We are viewing memory as a type
+
+      SymbolContext sc;
+      const bool exact_match = false;
+      TypeList type_list;
+      uint32_t reference_count = 0;
+      uint32_t pointer_count = 0;
+      size_t idx;
+
+#define ALL_KEYWORDS                                                           \
+  KEYWORD("const")                                                             \
+  KEYWORD("volatile")                                                          \
+  KEYWORD("restrict")                                                          \
+  KEYWORD("struct")                                                            \
+  KEYWORD("class")                                                             \
+  KEYWORD("union")
 
-        const char *view_as_type_cstr = m_memory_options.m_view_as_type.GetCurrentValue();
-        if (view_as_type_cstr && view_as_type_cstr[0])
-        {
-            // We are viewing memory as a type
-            
-            SymbolContext sc;
-            const bool exact_match = false;
-            TypeList type_list;
-            uint32_t reference_count = 0;
-            uint32_t pointer_count = 0;
-            size_t idx;
-            
-#define ALL_KEYWORDS        \
-    KEYWORD("const")        \
-    KEYWORD("volatile")     \
-    KEYWORD("restrict")     \
-    KEYWORD("struct")       \
-    KEYWORD("class")        \
-    KEYWORD("union")
-            
 #define KEYWORD(s) s,
-            static const char *g_keywords[] =
-            {
-                ALL_KEYWORDS
-            };
+      static const char *g_keywords[] = {ALL_KEYWORDS};
 #undef KEYWORD
 
 #define KEYWORD(s) (sizeof(s) - 1),
-            static const int g_keyword_lengths[] =
-            {
-                ALL_KEYWORDS
-            };
+      static const int g_keyword_lengths[] = {ALL_KEYWORDS};
 #undef KEYWORD
-            
+
 #undef ALL_KEYWORDS
-            
-            static size_t g_num_keywords = sizeof(g_keywords) / sizeof(const char *);
-            std::string type_str(view_as_type_cstr);
-            
-            // Remove all instances of g_keywords that are followed by spaces
-            for (size_t i = 0; i < g_num_keywords; ++i)
-            {
-                const char *keyword = g_keywords[i];
-                int keyword_len = g_keyword_lengths[i];
-                
-                idx = 0;
-                while ((idx = type_str.find (keyword, idx)) != std::string::npos)
-                {
-                    if (type_str[idx + keyword_len] == ' ' || type_str[idx + keyword_len] == '\t')
-                    {
-                        type_str.erase(idx, keyword_len+1);
-                        idx = 0;
-                    }
-                    else
-                    {
-                        idx += keyword_len;
-                    }
-                }
-            }
-            bool done = type_str.empty();
-            // 
-            idx = type_str.find_first_not_of (" \t");
-            if (idx > 0 && idx != std::string::npos)
-                type_str.erase (0, idx);
-            while (!done)
-            {
-                // Strip trailing spaces
-                if (type_str.empty())
-                    done = true;
-                else
-                {
-                    switch (type_str[type_str.size()-1])
-                    {
-                    case '*':
-                        ++pointer_count;
-                        LLVM_FALLTHROUGH;
-                    case ' ':
-                    case '\t':
-                        type_str.erase(type_str.size()-1);
-                        break;
-
-                    case '&':
-                        if (reference_count == 0)
-                        {
-                            reference_count = 1;
-                            type_str.erase(type_str.size()-1);
-                        }
-                        else
-                        {
-                            result.AppendErrorWithFormat ("invalid type string: '%s'\n", view_as_type_cstr);
-                            result.SetStatus(eReturnStatusFailed);
-                            return false;
-                        }
-                        break;
-
-                    default:
-                        done = true;
-                        break;
-                    }
-                }
-            }
-                    
-            llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
-            ConstString lookup_type_name(type_str.c_str());
-            StackFrame *frame = m_exe_ctx.GetFramePtr();
-            if (frame)
-            {
-                sc = frame->GetSymbolContext (eSymbolContextModule);
-                if (sc.module_sp)
-                {
-                    sc.module_sp->FindTypes (sc,
-                                             lookup_type_name,
-                                             exact_match,
-                                             1,
-                                             searched_symbol_files,
-                                             type_list);
-                }
-            }
-            if (type_list.GetSize() == 0)
-            {
-                target->GetImages().FindTypes (sc, 
-                                               lookup_type_name, 
-                                               exact_match, 
-                                               1,
-                                               searched_symbol_files,
-                                               type_list);
-            }
 
-            if (type_list.GetSize() == 0 && lookup_type_name.GetCString() && *lookup_type_name.GetCString() == '$')
-            {
-                if (ClangPersistentVariables *persistent_vars = llvm::dyn_cast_or_null<ClangPersistentVariables>(target->GetPersistentExpressionStateForLanguage(lldb::eLanguageTypeC)))
-                {
-                    clang::TypeDecl *tdecl = llvm::dyn_cast_or_null<clang::TypeDecl>(persistent_vars->GetPersistentDecl(ConstString(lookup_type_name)));
-
-                    if (tdecl)
-                    {
-                        clang_ast_type.SetCompilerType(ClangASTContext::GetASTContext(&tdecl->getASTContext()),
-                                                       reinterpret_cast<lldb::opaque_compiler_type_t>(const_cast<clang::Type*>(tdecl->getTypeForDecl())));
-                    }
-                }
-            }
+      static size_t g_num_keywords = sizeof(g_keywords) / sizeof(const char *);
+      std::string type_str(view_as_type_cstr);
 
-            if (!clang_ast_type.IsValid())
-            {
-                if (type_list.GetSize() == 0)
-                {
-                    result.AppendErrorWithFormat ("unable to find any types that match the raw type '%s' for full type '%s'\n",
-                                                  lookup_type_name.GetCString(),
-                                                  view_as_type_cstr);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                else
-                {
-                    TypeSP type_sp (type_list.GetTypeAtIndex(0));
-                    clang_ast_type = type_sp->GetFullCompilerType ();
-                }
-            }
-            
-            while (pointer_count > 0)
-            {
-                CompilerType pointer_type = clang_ast_type.GetPointerType();
-                if (pointer_type.IsValid())
-                    clang_ast_type = pointer_type;
-                else
-                {
-                    result.AppendError ("unable make a pointer type\n");
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                --pointer_count;
+      // Remove all instances of g_keywords that are followed by spaces
+      for (size_t i = 0; i < g_num_keywords; ++i) {
+        const char *keyword = g_keywords[i];
+        int keyword_len = g_keyword_lengths[i];
+
+        idx = 0;
+        while ((idx = type_str.find(keyword, idx)) != std::string::npos) {
+          if (type_str[idx + keyword_len] == ' ' ||
+              type_str[idx + keyword_len] == '\t') {
+            type_str.erase(idx, keyword_len + 1);
+            idx = 0;
+          } else {
+            idx += keyword_len;
+          }
+        }
+      }
+      bool done = type_str.empty();
+      //
+      idx = type_str.find_first_not_of(" \t");
+      if (idx > 0 && idx != std::string::npos)
+        type_str.erase(0, idx);
+      while (!done) {
+        // Strip trailing spaces
+        if (type_str.empty())
+          done = true;
+        else {
+          switch (type_str[type_str.size() - 1]) {
+          case '*':
+            ++pointer_count;
+            LLVM_FALLTHROUGH;
+          case ' ':
+          case '\t':
+            type_str.erase(type_str.size() - 1);
+            break;
+
+          case '&':
+            if (reference_count == 0) {
+              reference_count = 1;
+              type_str.erase(type_str.size() - 1);
+            } else {
+              result.AppendErrorWithFormat("invalid type string: '%s'\n",
+                                           view_as_type_cstr);
+              result.SetStatus(eReturnStatusFailed);
+              return false;
             }
+            break;
 
-            m_format_options.GetByteSizeValue() = clang_ast_type.GetByteSize(nullptr);
-            
-            if (m_format_options.GetByteSizeValue() == 0)
-            {
-                result.AppendErrorWithFormat ("unable to get the byte size of the type '%s'\n", 
-                                              view_as_type_cstr);
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            
-            if (!m_format_options.GetCountValue().OptionWasSet())
-                m_format_options.GetCountValue() = 1;
-        }
-        else
-        {
-            error = m_memory_options.FinalizeSettings (target, m_format_options);
+          default:
+            done = true;
+            break;
+          }
         }
+      }
 
-        // Look for invalid combinations of settings
-        if (error.Fail())
-        {
-            result.AppendError(error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-            return false;
+      llvm::DenseSet<lldb_private::SymbolFile *> searched_symbol_files;
+      ConstString lookup_type_name(type_str.c_str());
+      StackFrame *frame = m_exe_ctx.GetFramePtr();
+      if (frame) {
+        sc = frame->GetSymbolContext(eSymbolContextModule);
+        if (sc.module_sp) {
+          sc.module_sp->FindTypes(sc, lookup_type_name, exact_match, 1,
+                                  searched_symbol_files, type_list);
         }
+      }
+      if (type_list.GetSize() == 0) {
+        target->GetImages().FindTypes(sc, lookup_type_name, exact_match, 1,
+                                      searched_symbol_files, type_list);
+      }
 
-        lldb::addr_t addr;
-        size_t total_byte_size = 0;
-        if (argc == 0)
-        {
-            // Use the last address and byte size and all options as they were
-            // if no options have been set
-            addr = m_next_addr;
-            total_byte_size = m_prev_byte_size;
-            clang_ast_type = m_prev_clang_ast_type;
-            if (!m_format_options.AnyOptionWasSet() &&
-                !m_memory_options.AnyOptionWasSet() &&
-                !m_outfile_options.AnyOptionWasSet() &&
-                !m_varobj_options.AnyOptionWasSet())
-            {
-                m_format_options = m_prev_format_options;
-                m_memory_options = m_prev_memory_options;
-                m_outfile_options = m_prev_outfile_options;
-                m_varobj_options = m_prev_varobj_options;
-            }
+      if (type_list.GetSize() == 0 && lookup_type_name.GetCString() &&
+          *lookup_type_name.GetCString() == '$') {
+        if (ClangPersistentVariables *persistent_vars =
+                llvm::dyn_cast_or_null<ClangPersistentVariables>(
+                    target->GetPersistentExpressionStateForLanguage(
+                        lldb::eLanguageTypeC))) {
+          clang::TypeDecl *tdecl = llvm::dyn_cast_or_null<clang::TypeDecl>(
+              persistent_vars->GetPersistentDecl(
+                  ConstString(lookup_type_name)));
+
+          if (tdecl) {
+            clang_ast_type.SetCompilerType(
+                ClangASTContext::GetASTContext(&tdecl->getASTContext()),
+                reinterpret_cast<lldb::opaque_compiler_type_t>(
+                    const_cast<clang::Type *>(tdecl->getTypeForDecl())));
+          }
         }
+      }
 
-        size_t item_count = m_format_options.GetCountValue().GetCurrentValue();
+      if (!clang_ast_type.IsValid()) {
+        if (type_list.GetSize() == 0) {
+          result.AppendErrorWithFormat("unable to find any types that match "
+                                       "the raw type '%s' for full type '%s'\n",
+                                       lookup_type_name.GetCString(),
+                                       view_as_type_cstr);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else {
+          TypeSP type_sp(type_list.GetTypeAtIndex(0));
+          clang_ast_type = type_sp->GetFullCompilerType();
+        }
+      }
 
-        // TODO For non-8-bit byte addressable architectures this needs to be
-        // revisited to fully support all lldb's range of formatting options.
-        // Furthermore code memory reads (for those architectures) will not
-        // be correctly formatted even w/o formatting options.
-        size_t item_byte_size =
-            target->GetArchitecture().GetDataByteSize() > 1 ?
-            target->GetArchitecture().GetDataByteSize() :
-            m_format_options.GetByteSizeValue().GetCurrentValue();
-
-        const size_t num_per_line = m_memory_options.m_num_per_line.GetCurrentValue();
-
-        if (total_byte_size == 0)
-        {
-            total_byte_size = item_count * item_byte_size;
-            if (total_byte_size == 0)
-                total_byte_size = 32;
-        }
-
-        if (argc > 0)
-            addr = Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(0), LLDB_INVALID_ADDRESS, &error);
-
-        if (addr == LLDB_INVALID_ADDRESS)
-        {
-            result.AppendError("invalid start address expression.");
-            result.AppendError(error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-            return false;
+      while (pointer_count > 0) {
+        CompilerType pointer_type = clang_ast_type.GetPointerType();
+        if (pointer_type.IsValid())
+          clang_ast_type = pointer_type;
+        else {
+          result.AppendError("unable make a pointer type\n");
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
+        --pointer_count;
+      }
 
-        if (argc == 2)
-        {
-            lldb::addr_t end_addr = Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(1),
-                                                          LLDB_INVALID_ADDRESS, nullptr);
-            if (end_addr == LLDB_INVALID_ADDRESS)
-            {
-                result.AppendError("invalid end address expression.");
-                result.AppendError(error.AsCString());
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            else if (end_addr <= addr)
-            {
-                result.AppendErrorWithFormat("end address (0x%" PRIx64 ") must be greater that the start address (0x%" PRIx64 ").\n", end_addr, addr);
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            else if (m_format_options.GetCountValue().OptionWasSet())
-            {
-                result.AppendErrorWithFormat("specify either the end address (0x%" PRIx64 ") or the count (--count %" PRIu64 "), not both.\n", end_addr, (uint64_t)item_count);
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
+      m_format_options.GetByteSizeValue() = clang_ast_type.GetByteSize(nullptr);
 
-            total_byte_size = end_addr - addr;
-            item_count = total_byte_size / item_byte_size;
-        }
+      if (m_format_options.GetByteSizeValue() == 0) {
+        result.AppendErrorWithFormat(
+            "unable to get the byte size of the type '%s'\n",
+            view_as_type_cstr);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
 
-        uint32_t max_unforced_size = target->GetMaximumMemReadSize();
-        
-        if (total_byte_size > max_unforced_size && !m_memory_options.m_force)
-        {
-            result.AppendErrorWithFormat("Normally, \'memory read\' will not read over %" PRIu32 " bytes of data.\n",max_unforced_size);
-            result.AppendErrorWithFormat("Please use --force to override this restriction just once.\n");
-            result.AppendErrorWithFormat("or set target.max-memory-read-size if you will often need a larger limit.\n");
-            return false;
-        }
-        
-        DataBufferSP data_sp;
-        size_t bytes_read = 0;
-        if (clang_ast_type.GetOpaqueQualType())
-        {
-            // Make sure we don't display our type as ASCII bytes like the default memory read
-            if (!m_format_options.GetFormatValue().OptionWasSet())
-                m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
-
-            bytes_read = clang_ast_type.GetByteSize(nullptr) * m_format_options.GetCountValue().GetCurrentValue();
-                
-            if (argc > 0)
-                addr = addr + (clang_ast_type.GetByteSize(nullptr) * m_memory_options.m_offset.GetCurrentValue());
-        }
-        else if (m_format_options.GetFormatValue().GetCurrentValue() != eFormatCString)
-        {
-            data_sp.reset (new DataBufferHeap (total_byte_size, '\0'));
-            if (data_sp->GetBytes() == nullptr)
-            {
-                result.AppendErrorWithFormat ("can't allocate 0x%" PRIx32 " bytes for the memory read buffer, specify a smaller size to read", (uint32_t)total_byte_size);
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
+      if (!m_format_options.GetCountValue().OptionWasSet())
+        m_format_options.GetCountValue() = 1;
+    } else {
+      error = m_memory_options.FinalizeSettings(target, m_format_options);
+    }
+
+    // Look for invalid combinations of settings
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    lldb::addr_t addr;
+    size_t total_byte_size = 0;
+    if (argc == 0) {
+      // Use the last address and byte size and all options as they were
+      // if no options have been set
+      addr = m_next_addr;
+      total_byte_size = m_prev_byte_size;
+      clang_ast_type = m_prev_clang_ast_type;
+      if (!m_format_options.AnyOptionWasSet() &&
+          !m_memory_options.AnyOptionWasSet() &&
+          !m_outfile_options.AnyOptionWasSet() &&
+          !m_varobj_options.AnyOptionWasSet()) {
+        m_format_options = m_prev_format_options;
+        m_memory_options = m_prev_memory_options;
+        m_outfile_options = m_prev_outfile_options;
+        m_varobj_options = m_prev_varobj_options;
+      }
+    }
 
-            Address address(addr, nullptr);
-            bytes_read = target->ReadMemory(address, false, data_sp->GetBytes (), data_sp->GetByteSize(), error);
-            if (bytes_read == 0)
-            {
-                const char *error_cstr = error.AsCString();
-                if (error_cstr && error_cstr[0])
-                {
-                    result.AppendError(error_cstr);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat("failed to read memory from 0x%" PRIx64 ".\n", addr);
-                }
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            
-            if (bytes_read < total_byte_size)
-                result.AppendWarningWithFormat("Not all bytes (%" PRIu64 "/%" PRIu64 ") were able to be read from 0x%" PRIx64 ".\n", (uint64_t)bytes_read, (uint64_t)total_byte_size, addr);
-        }
-        else
-        {
-            // we treat c-strings as a special case because they do not have a fixed size
-            if (m_format_options.GetByteSizeValue().OptionWasSet() && !m_format_options.HasGDBFormat())
-                item_byte_size = m_format_options.GetByteSizeValue().GetCurrentValue();
-            else
-                item_byte_size = target->GetMaximumSizeOfStringSummary();
-            if (!m_format_options.GetCountValue().OptionWasSet())
-                item_count = 1;
-            data_sp.reset (new DataBufferHeap ((item_byte_size+1) * item_count, '\0')); // account for NULLs as necessary
-            if (data_sp->GetBytes() == nullptr)
-            {
-                result.AppendErrorWithFormat ("can't allocate 0x%" PRIx64 " bytes for the memory read buffer, specify a smaller size to read", (uint64_t)((item_byte_size+1) * item_count));
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-            uint8_t *data_ptr = data_sp->GetBytes();
-            auto data_addr = addr;
-            auto count = item_count;
-            item_count = 0;
-            bool break_on_no_NULL = false;
-            while (item_count < count)
-            {
-                std::string buffer;
-                buffer.resize(item_byte_size+1,0);
-                Error error;
-                size_t read = target->ReadCStringFromMemory(data_addr, &buffer[0], item_byte_size+1, error);
-                if (error.Fail())
-                {
-                    result.AppendErrorWithFormat("failed to read memory from 0x%" PRIx64 ".\n", addr);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                
-                if (item_byte_size == read)
-                {
-                    result.AppendWarningWithFormat("unable to find a NULL terminated string at 0x%" PRIx64 ".Consider increasing the maximum read length.\n", data_addr);
-                    --read;
-                    break_on_no_NULL = true;
-                }
-                else
-                    ++read; // account for final NULL byte
-                
-                memcpy(data_ptr, &buffer[0], read);
-                data_ptr += read;
-                data_addr += read;
-                bytes_read += read;
-                item_count++; // if we break early we know we only read item_count strings
-                
-                if (break_on_no_NULL)
-                    break;
-            }
-            data_sp.reset(new DataBufferHeap(data_sp->GetBytes(),bytes_read+1));
+    size_t item_count = m_format_options.GetCountValue().GetCurrentValue();
+
+    // TODO For non-8-bit byte addressable architectures this needs to be
+    // revisited to fully support all lldb's range of formatting options.
+    // Furthermore code memory reads (for those architectures) will not
+    // be correctly formatted even w/o formatting options.
+    size_t item_byte_size =
+        target->GetArchitecture().GetDataByteSize() > 1
+            ? target->GetArchitecture().GetDataByteSize()
+            : m_format_options.GetByteSizeValue().GetCurrentValue();
+
+    const size_t num_per_line =
+        m_memory_options.m_num_per_line.GetCurrentValue();
+
+    if (total_byte_size == 0) {
+      total_byte_size = item_count * item_byte_size;
+      if (total_byte_size == 0)
+        total_byte_size = 32;
+    }
+
+    if (argc > 0)
+      addr = Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(0),
+                                   LLDB_INVALID_ADDRESS, &error);
+
+    if (addr == LLDB_INVALID_ADDRESS) {
+      result.AppendError("invalid start address expression.");
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (argc == 2) {
+      lldb::addr_t end_addr =
+          Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(1),
+                                LLDB_INVALID_ADDRESS, nullptr);
+      if (end_addr == LLDB_INVALID_ADDRESS) {
+        result.AppendError("invalid end address expression.");
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      } else if (end_addr <= addr) {
+        result.AppendErrorWithFormat(
+            "end address (0x%" PRIx64
+            ") must be greater that the start address (0x%" PRIx64 ").\n",
+            end_addr, addr);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      } else if (m_format_options.GetCountValue().OptionWasSet()) {
+        result.AppendErrorWithFormat(
+            "specify either the end address (0x%" PRIx64
+            ") or the count (--count %" PRIu64 "), not both.\n",
+            end_addr, (uint64_t)item_count);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      total_byte_size = end_addr - addr;
+      item_count = total_byte_size / item_byte_size;
+    }
+
+    uint32_t max_unforced_size = target->GetMaximumMemReadSize();
+
+    if (total_byte_size > max_unforced_size && !m_memory_options.m_force) {
+      result.AppendErrorWithFormat(
+          "Normally, \'memory read\' will not read over %" PRIu32
+          " bytes of data.\n",
+          max_unforced_size);
+      result.AppendErrorWithFormat(
+          "Please use --force to override this restriction just once.\n");
+      result.AppendErrorWithFormat("or set target.max-memory-read-size if you "
+                                   "will often need a larger limit.\n");
+      return false;
+    }
+
+    DataBufferSP data_sp;
+    size_t bytes_read = 0;
+    if (clang_ast_type.GetOpaqueQualType()) {
+      // Make sure we don't display our type as ASCII bytes like the default
+      // memory read
+      if (!m_format_options.GetFormatValue().OptionWasSet())
+        m_format_options.GetFormatValue().SetCurrentValue(eFormatDefault);
+
+      bytes_read = clang_ast_type.GetByteSize(nullptr) *
+                   m_format_options.GetCountValue().GetCurrentValue();
+
+      if (argc > 0)
+        addr = addr + (clang_ast_type.GetByteSize(nullptr) *
+                       m_memory_options.m_offset.GetCurrentValue());
+    } else if (m_format_options.GetFormatValue().GetCurrentValue() !=
+               eFormatCString) {
+      data_sp.reset(new DataBufferHeap(total_byte_size, '\0'));
+      if (data_sp->GetBytes() == nullptr) {
+        result.AppendErrorWithFormat(
+            "can't allocate 0x%" PRIx32
+            " bytes for the memory read buffer, specify a smaller size to read",
+            (uint32_t)total_byte_size);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      Address address(addr, nullptr);
+      bytes_read = target->ReadMemory(address, false, data_sp->GetBytes(),
+                                      data_sp->GetByteSize(), error);
+      if (bytes_read == 0) {
+        const char *error_cstr = error.AsCString();
+        if (error_cstr && error_cstr[0]) {
+          result.AppendError(error_cstr);
+        } else {
+          result.AppendErrorWithFormat(
+              "failed to read memory from 0x%" PRIx64 ".\n", addr);
         }
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
 
-        m_next_addr = addr + bytes_read;
-        m_prev_byte_size = bytes_read;
-        m_prev_format_options = m_format_options;
-        m_prev_memory_options = m_memory_options;
-        m_prev_outfile_options = m_outfile_options;
-        m_prev_varobj_options = m_varobj_options;
-        m_prev_clang_ast_type = clang_ast_type;
-
-        StreamFile outfile_stream;
-        Stream *output_stream = nullptr;
-        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;
-            const bool append = m_outfile_options.GetAppend().GetCurrentValue();
-            if (append)
-                open_options |= File::eOpenOptionAppend;
-            
-            if (outfile_stream.GetFile ().Open (path, open_options).Success())
-            {
-                if (m_memory_options.m_output_as_binary)
-                {
-                    const size_t bytes_written = outfile_stream.Write (data_sp->GetBytes(), bytes_read);
-                    if (bytes_written > 0)
-                    {
-                        result.GetOutputStream().Printf ("%zi bytes %s to '%s'\n", 
-                                                         bytes_written, 
-                                                         append ? "appended" : "written", 
-                                                         path);
-                        return true;
-                    }
-                    else 
-                    {
-                        result.AppendErrorWithFormat("Failed to write %" PRIu64 " bytes to '%s'.\n", (uint64_t)bytes_read, path);
-                        result.SetStatus(eReturnStatusFailed);
-                        return false;
-                    }
-                }
-                else
-                {
-                    // We are going to write ASCII to the file just point the
-                    // output_stream to our outfile_stream...
-                    output_stream = &outfile_stream;
-                }
-            }
-            else 
-            {
-                result.AppendErrorWithFormat("Failed to open file '%s' for %s.\n", path, append ? "append" : "write");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
+      if (bytes_read < total_byte_size)
+        result.AppendWarningWithFormat(
+            "Not all bytes (%" PRIu64 "/%" PRIu64
+            ") were able to be read from 0x%" PRIx64 ".\n",
+            (uint64_t)bytes_read, (uint64_t)total_byte_size, addr);
+    } else {
+      // we treat c-strings as a special case because they do not have a fixed
+      // size
+      if (m_format_options.GetByteSizeValue().OptionWasSet() &&
+          !m_format_options.HasGDBFormat())
+        item_byte_size = m_format_options.GetByteSizeValue().GetCurrentValue();
+      else
+        item_byte_size = target->GetMaximumSizeOfStringSummary();
+      if (!m_format_options.GetCountValue().OptionWasSet())
+        item_count = 1;
+      data_sp.reset(new DataBufferHeap((item_byte_size + 1) * item_count,
+                                       '\0')); // account for NULLs as necessary
+      if (data_sp->GetBytes() == nullptr) {
+        result.AppendErrorWithFormat(
+            "can't allocate 0x%" PRIx64
+            " bytes for the memory read buffer, specify a smaller size to read",
+            (uint64_t)((item_byte_size + 1) * item_count));
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+      uint8_t *data_ptr = data_sp->GetBytes();
+      auto data_addr = addr;
+      auto count = item_count;
+      item_count = 0;
+      bool break_on_no_NULL = false;
+      while (item_count < count) {
+        std::string buffer;
+        buffer.resize(item_byte_size + 1, 0);
+        Error error;
+        size_t read = target->ReadCStringFromMemory(data_addr, &buffer[0],
+                                                    item_byte_size + 1, error);
+        if (error.Fail()) {
+          result.AppendErrorWithFormat(
+              "failed to read memory from 0x%" PRIx64 ".\n", addr);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
-        else 
-        {
-            output_stream = &result.GetOutputStream();
-        }
-
-        ExecutionContextScope *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
-        if (clang_ast_type.GetOpaqueQualType())
-        {
-            for (uint32_t i = 0; i<item_count; ++i)
-            {
-                addr_t item_addr = addr + (i * item_byte_size);
-                Address address (item_addr);
-                StreamString name_strm;
-                name_strm.Printf ("0x%" PRIx64, item_addr);
-                ValueObjectSP valobj_sp (ValueObjectMemory::Create (exe_scope, 
-                                                                    name_strm.GetString().c_str(), 
-                                                                    address, 
-                                                                    clang_ast_type));
-                if (valobj_sp)
-                {
-                    Format format = m_format_options.GetFormat();
-                    if (format != eFormatDefault)
-                        valobj_sp->SetFormat (format);
-
-                    DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(eLanguageRuntimeDescriptionDisplayVerbosityFull,format));
-                    
-                    valobj_sp->Dump(*output_stream,options);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("failed to create a value object for: (%s) %s\n", 
-                                                  view_as_type_cstr, 
-                                                  name_strm.GetString().c_str());
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-            }
+
+        if (item_byte_size == read) {
+          result.AppendWarningWithFormat(
+              "unable to find a NULL terminated string at 0x%" PRIx64
+              ".Consider increasing the maximum read length.\n",
+              data_addr);
+          --read;
+          break_on_no_NULL = true;
+        } else
+          ++read; // account for final NULL byte
+
+        memcpy(data_ptr, &buffer[0], read);
+        data_ptr += read;
+        data_addr += read;
+        bytes_read += read;
+        item_count++; // if we break early we know we only read item_count
+                      // strings
+
+        if (break_on_no_NULL)
+          break;
+      }
+      data_sp.reset(new DataBufferHeap(data_sp->GetBytes(), bytes_read + 1));
+    }
+
+    m_next_addr = addr + bytes_read;
+    m_prev_byte_size = bytes_read;
+    m_prev_format_options = m_format_options;
+    m_prev_memory_options = m_memory_options;
+    m_prev_outfile_options = m_outfile_options;
+    m_prev_varobj_options = m_varobj_options;
+    m_prev_clang_ast_type = clang_ast_type;
+
+    StreamFile outfile_stream;
+    Stream *output_stream = nullptr;
+    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;
+      const bool append = m_outfile_options.GetAppend().GetCurrentValue();
+      if (append)
+        open_options |= File::eOpenOptionAppend;
+
+      if (outfile_stream.GetFile().Open(path, open_options).Success()) {
+        if (m_memory_options.m_output_as_binary) {
+          const size_t bytes_written =
+              outfile_stream.Write(data_sp->GetBytes(), bytes_read);
+          if (bytes_written > 0) {
+            result.GetOutputStream().Printf(
+                "%zi bytes %s to '%s'\n", bytes_written,
+                append ? "appended" : "written", path);
             return true;
-        }
+          } else {
+            result.AppendErrorWithFormat("Failed to write %" PRIu64
+                                         " bytes to '%s'.\n",
+                                         (uint64_t)bytes_read, path);
+            result.SetStatus(eReturnStatusFailed);
+            return false;
+          }
+        } else {
+          // We are going to write ASCII to the file just point the
+          // output_stream to our outfile_stream...
+          output_stream = &outfile_stream;
+        }
+      } else {
+        result.AppendErrorWithFormat("Failed to open file '%s' for %s.\n", path,
+                                     append ? "append" : "write");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else {
+      output_stream = &result.GetOutputStream();
+    }
 
-        result.SetStatus(eReturnStatusSuccessFinishResult);
-        DataExtractor data (data_sp, 
-                            target->GetArchitecture().GetByteOrder(), 
-                            target->GetArchitecture().GetAddressByteSize(),
-                            target->GetArchitecture().GetDataByteSize());
-        
-        Format format = m_format_options.GetFormat();
-        if ( ( (format == eFormatChar) || (format == eFormatCharPrintable) )
-            && (item_byte_size != 1))
-        {
-            // if a count was not passed, or it is 1
-            if (!m_format_options.GetCountValue().OptionWasSet() || item_count == 1)
-            {
-                // this turns requests such as
-                // memory read -fc -s10 -c1 *charPtrPtr
-                // which make no sense (what is a char of size 10?)
-                // into a request for fetching 10 chars of size 1 from the same memory location
-                format = eFormatCharArray;
-                item_count = item_byte_size;
-                item_byte_size = 1;
-            }
-            else
-            {
-                // here we passed a count, and it was not 1
-                // so we have a byte_size and a count
-                // we could well multiply those, but instead let's just fail
-                result.AppendErrorWithFormat("reading memory as characters of size %" PRIu64 " is not supported", (uint64_t)item_byte_size);
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
+    ExecutionContextScope *exe_scope = m_exe_ctx.GetBestExecutionContextScope();
+    if (clang_ast_type.GetOpaqueQualType()) {
+      for (uint32_t i = 0; i < item_count; ++i) {
+        addr_t item_addr = addr + (i * item_byte_size);
+        Address address(item_addr);
+        StreamString name_strm;
+        name_strm.Printf("0x%" PRIx64, item_addr);
+        ValueObjectSP valobj_sp(ValueObjectMemory::Create(
+            exe_scope, name_strm.GetString().c_str(), address, clang_ast_type));
+        if (valobj_sp) {
+          Format format = m_format_options.GetFormat();
+          if (format != eFormatDefault)
+            valobj_sp->SetFormat(format);
+
+          DumpValueObjectOptions options(m_varobj_options.GetAsDumpOptions(
+              eLanguageRuntimeDescriptionDisplayVerbosityFull, format));
+
+          valobj_sp->Dump(*output_stream, options);
+        } else {
+          result.AppendErrorWithFormat(
+              "failed to create a value object for: (%s) %s\n",
+              view_as_type_cstr, name_strm.GetString().c_str());
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
+      }
+      return true;
+    }
 
-        assert (output_stream);
-        size_t bytes_dumped = data.Dump (output_stream,
-                                         0,
-                                         format,
-                                         item_byte_size,
-                                         item_count,
-                                         num_per_line / target->GetArchitecture().GetDataByteSize(),
-                                         addr,
-                                         0,
-                                         0,
-                                         exe_scope);
-        m_next_addr = addr + bytes_dumped;
-        output_stream->EOL();
-        return true;
+    result.SetStatus(eReturnStatusSuccessFinishResult);
+    DataExtractor data(data_sp, target->GetArchitecture().GetByteOrder(),
+                       target->GetArchitecture().GetAddressByteSize(),
+                       target->GetArchitecture().GetDataByteSize());
+
+    Format format = m_format_options.GetFormat();
+    if (((format == eFormatChar) || (format == eFormatCharPrintable)) &&
+        (item_byte_size != 1)) {
+      // if a count was not passed, or it is 1
+      if (!m_format_options.GetCountValue().OptionWasSet() || item_count == 1) {
+        // this turns requests such as
+        // memory read -fc -s10 -c1 *charPtrPtr
+        // which make no sense (what is a char of size 10?)
+        // into a request for fetching 10 chars of size 1 from the same memory
+        // location
+        format = eFormatCharArray;
+        item_count = item_byte_size;
+        item_byte_size = 1;
+      } else {
+        // here we passed a count, and it was not 1
+        // so we have a byte_size and a count
+        // we could well multiply those, but instead let's just fail
+        result.AppendErrorWithFormat(
+            "reading memory as characters of size %" PRIu64 " is not supported",
+            (uint64_t)item_byte_size);
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
     }
 
-    OptionGroupOptions m_option_group;
-    OptionGroupFormat m_format_options;
-    OptionGroupReadMemory m_memory_options;
-    OptionGroupOutputFile m_outfile_options;
-    OptionGroupValueObjectDisplay m_varobj_options;
-    lldb::addr_t m_next_addr;
-    lldb::addr_t m_prev_byte_size; 
-    OptionGroupFormat m_prev_format_options;
-    OptionGroupReadMemory m_prev_memory_options;
-    OptionGroupOutputFile m_prev_outfile_options;
-    OptionGroupValueObjectDisplay m_prev_varobj_options;
-    CompilerType m_prev_clang_ast_type;
+    assert(output_stream);
+    size_t bytes_dumped =
+        data.Dump(output_stream, 0, format, item_byte_size, item_count,
+                  num_per_line / target->GetArchitecture().GetDataByteSize(),
+                  addr, 0, 0, exe_scope);
+    m_next_addr = addr + bytes_dumped;
+    output_stream->EOL();
+    return true;
+  }
+
+  OptionGroupOptions m_option_group;
+  OptionGroupFormat m_format_options;
+  OptionGroupReadMemory m_memory_options;
+  OptionGroupOutputFile m_outfile_options;
+  OptionGroupValueObjectDisplay m_varobj_options;
+  lldb::addr_t m_next_addr;
+  lldb::addr_t m_prev_byte_size;
+  OptionGroupFormat m_prev_format_options;
+  OptionGroupReadMemory m_prev_memory_options;
+  OptionGroupOutputFile m_prev_outfile_options;
+  OptionGroupValueObjectDisplay m_prev_varobj_options;
+  CompilerType m_prev_clang_ast_type;
 };
 
-OptionDefinition
-g_memory_find_option_table[] =
-{
-  // clang-format off
+OptionDefinition g_memory_find_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1,   true,  "expression",  'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeExpression, "Evaluate an expression to obtain a byte pattern."},
   {LLDB_OPT_SET_2,   true,  "string",      's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeName,       "Use text to find a byte pattern."},
   {LLDB_OPT_SET_ALL, false, "count",       'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount,      "How many times to perform the search."},
   {LLDB_OPT_SET_ALL, false, "dump-offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset,     "When dumping memory for a match, an offset from the match location to start dumping from."},
-  // clang-format on
+    // clang-format on
 };
 
 //----------------------------------------------------------------------
 // Find the specified data in memory
 //----------------------------------------------------------------------
-class CommandObjectMemoryFind : public CommandObjectParsed
-{
+class CommandObjectMemoryFind : public CommandObjectParsed {
 public:
-  class OptionGroupFindMemory : public OptionGroup
-  {
+  class OptionGroupFindMemory : public OptionGroup {
   public:
-    OptionGroupFindMemory () :
-      OptionGroup(),
-      m_count(1),
-      m_offset(0)
-    {
-    }
+    OptionGroupFindMemory() : OptionGroup(), m_count(1), m_offset(0) {}
 
     ~OptionGroupFindMemory() override = default;
 
-    uint32_t
-    GetNumDefinitions () override
-    {
-      return sizeof (g_memory_find_option_table) / sizeof (OptionDefinition);
-    }
-    
-    const OptionDefinition*
-    GetDefinitions () override
-    {
+    uint32_t GetNumDefinitions() override {
+      return sizeof(g_memory_find_option_table) / sizeof(OptionDefinition);
+    }
+
+    const OptionDefinition *GetDefinitions() override {
       return g_memory_find_option_table;
     }
-    
-    Error
-    SetOptionValue (uint32_t option_idx,
-                    const char *option_arg,
-                    ExecutionContext *execution_context) override
-    {
-        Error error;
-        const int short_option = g_memory_find_option_table[option_idx].short_option;
-      
-        switch (short_option)
-        {
-        case 'e':
-              m_expr.SetValueFromString(option_arg);
-              break;
-          
-        case 's':
-              m_string.SetValueFromString(option_arg);
-              break;
-          
-        case 'c':
-              if (m_count.SetValueFromString(option_arg).Fail())
-                  error.SetErrorString("unrecognized value for count");
-              break;
-                
-        case 'o':
-               if (m_offset.SetValueFromString(option_arg).Fail())
-                   error.SetErrorString("unrecognized value for dump-offset");
-                break;
 
-        default:
-              error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-              break;
-        }
-        return error;
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option =
+          g_memory_find_option_table[option_idx].short_option;
+
+      switch (short_option) {
+      case 'e':
+        m_expr.SetValueFromString(option_arg);
+        break;
+
+      case 's':
+        m_string.SetValueFromString(option_arg);
+        break;
+
+      case 'c':
+        if (m_count.SetValueFromString(option_arg).Fail())
+          error.SetErrorString("unrecognized value for count");
+        break;
+
+      case 'o':
+        if (m_offset.SetValueFromString(option_arg).Fail())
+          error.SetErrorString("unrecognized value for dump-offset");
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
     }
-    
-    void
-    OptionParsingStarting(ExecutionContext *execution_context) override
-    {
-        m_expr.Clear();
-        m_string.Clear();
-        m_count.Clear();
-    }
-    
-      OptionValueString m_expr;
-      OptionValueString m_string;
-      OptionValueUInt64 m_count;
-      OptionValueUInt64 m_offset;
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_expr.Clear();
+      m_string.Clear();
+      m_count.Clear();
+    }
+
+    OptionValueString m_expr;
+    OptionValueString m_string;
+    OptionValueUInt64 m_count;
+    OptionValueUInt64 m_offset;
   };
 
   CommandObjectMemoryFind(CommandInterpreter &interpreter)
-      : CommandObjectParsed(interpreter, "memory find", "Find a value in the memory of the current target process.",
-                            nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched),
-        m_option_group(),
-        m_memory_options()
-  {
+      : CommandObjectParsed(
+            interpreter, "memory find",
+            "Find a value in the memory of the current target process.",
+            nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched),
+        m_option_group(), m_memory_options() {
     CommandArgumentEntry arg1;
     CommandArgumentEntry arg2;
     CommandArgumentData addr_arg;
     CommandArgumentData value_arg;
-    
+
     // Define the first (and only) variant of this arg.
     addr_arg.arg_type = eArgTypeAddressOrExpression;
     addr_arg.arg_repetition = eArgRepeatPlain;
-    
-    // There is only one variant this argument could be; put it into the argument entry.
-    arg1.push_back (addr_arg);
-    
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(addr_arg);
+
     // Define the first (and only) variant of this arg.
     value_arg.arg_type = eArgTypeAddressOrExpression;
     value_arg.arg_repetition = eArgRepeatPlain;
-    
-    // There is only one variant this argument could be; put it into the argument entry.
-    arg2.push_back (value_arg);
-    
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(value_arg);
+
     // Push the data for the first argument into the m_arguments vector.
-    m_arguments.push_back (arg1);
-    m_arguments.push_back (arg2);
-    
-    m_option_group.Append (&m_memory_options);
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+
+    m_option_group.Append(&m_memory_options);
     m_option_group.Finalize();
   }
 
   ~CommandObjectMemoryFind() override = default;
 
-  Options *
-  GetOptions () override
-  {
-    return &m_option_group;
-  }
-  
+  Options *GetOptions() override { return &m_option_group; }
+
 protected:
-  class ProcessMemoryIterator
-  {
+  class ProcessMemoryIterator {
   public:
-      ProcessMemoryIterator (ProcessSP process_sp,
-                             lldb::addr_t base) :
-      m_process_sp(process_sp),
-      m_base_addr(base),
-      m_is_valid(true)
-      {
-          lldbassert(process_sp.get() != nullptr);
-      }
-      
-      bool
-      IsValid ()
-      {
-          return m_is_valid;
-      }
-      
-      uint8_t
-      operator [](lldb::addr_t offset)
-      {
-          if (!IsValid())
-              return 0;
+    ProcessMemoryIterator(ProcessSP process_sp, lldb::addr_t base)
+        : m_process_sp(process_sp), m_base_addr(base), m_is_valid(true) {
+      lldbassert(process_sp.get() != nullptr);
+    }
 
-          uint8_t retval = 0;
-          Error error;
-          if (0 == m_process_sp->ReadMemory(m_base_addr+offset, &retval, 1, error))
-          {
-              m_is_valid = false;
-              return 0;
-          }
+    bool IsValid() { return m_is_valid; }
+
+    uint8_t operator[](lldb::addr_t offset) {
+      if (!IsValid())
+        return 0;
 
-          return retval;
+      uint8_t retval = 0;
+      Error error;
+      if (0 ==
+          m_process_sp->ReadMemory(m_base_addr + offset, &retval, 1, error)) {
+        m_is_valid = false;
+        return 0;
       }
-  private:
-      ProcessSP m_process_sp;
-      lldb::addr_t m_base_addr;
-      bool m_is_valid;
-  };
-  bool
-  DoExecute (Args& command, CommandReturnObject &result) override
-  {
-      // No need to check "process" for validity as eCommandRequiresProcess ensures it is valid
-      Process *process = m_exe_ctx.GetProcessPtr();
 
-      const size_t argc = command.GetArgumentCount();
+      return retval;
+    }
 
-      if (argc != 2)
-      {
-          result.AppendError("two addresses needed for memory find");
+  private:
+    ProcessSP m_process_sp;
+    lldb::addr_t m_base_addr;
+    bool m_is_valid;
+  };
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    // No need to check "process" for validity as eCommandRequiresProcess
+    // ensures it is valid
+    Process *process = m_exe_ctx.GetProcessPtr();
+
+    const size_t argc = command.GetArgumentCount();
+
+    if (argc != 2) {
+      result.AppendError("two addresses needed for memory find");
+      return false;
+    }
+
+    Error error;
+    lldb::addr_t low_addr =
+        Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(0),
+                              LLDB_INVALID_ADDRESS, &error);
+    if (low_addr == LLDB_INVALID_ADDRESS || error.Fail()) {
+      result.AppendError("invalid low address");
+      return false;
+    }
+    lldb::addr_t high_addr =
+        Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(1),
+                              LLDB_INVALID_ADDRESS, &error);
+    if (high_addr == LLDB_INVALID_ADDRESS || error.Fail()) {
+      result.AppendError("invalid high address");
+      return false;
+    }
+
+    if (high_addr <= low_addr) {
+      result.AppendError(
+          "starting address must be smaller than ending address");
+      return false;
+    }
+
+    lldb::addr_t found_location = LLDB_INVALID_ADDRESS;
+
+    DataBufferHeap buffer;
+
+    if (m_memory_options.m_string.OptionWasSet())
+      buffer.CopyData(m_memory_options.m_string.GetStringValue(),
+                      strlen(m_memory_options.m_string.GetStringValue()));
+    else if (m_memory_options.m_expr.OptionWasSet()) {
+      StackFrame *frame = m_exe_ctx.GetFramePtr();
+      ValueObjectSP result_sp;
+      if ((eExpressionCompleted ==
+           process->GetTarget().EvaluateExpression(
+               m_memory_options.m_expr.GetStringValue(), frame, result_sp)) &&
+          result_sp) {
+        uint64_t value = result_sp->GetValueAsUnsigned(0);
+        switch (result_sp->GetCompilerType().GetByteSize(nullptr)) {
+        case 1: {
+          uint8_t byte = (uint8_t)value;
+          buffer.CopyData(&byte, 1);
+        } break;
+        case 2: {
+          uint16_t word = (uint16_t)value;
+          buffer.CopyData(&word, 2);
+        } break;
+        case 4: {
+          uint32_t lword = (uint32_t)value;
+          buffer.CopyData(&lword, 4);
+        } break;
+        case 8: {
+          buffer.CopyData(&value, 8);
+        } break;
+        case 3:
+        case 5:
+        case 6:
+        case 7:
+          result.AppendError("unknown type. pass a string instead");
           return false;
-      }
-
-      Error error;
-      lldb::addr_t low_addr = Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(0),LLDB_INVALID_ADDRESS,&error);
-      if (low_addr == LLDB_INVALID_ADDRESS || error.Fail())
-      {
-          result.AppendError("invalid low address");
+        default:
+          result.AppendError(
+              "result size larger than 8 bytes. pass a string instead");
           return false;
+        }
+      } else {
+        result.AppendError(
+            "expression evaluation failed. pass a string instead");
+        return false;
       }
-      lldb::addr_t high_addr = Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(1),LLDB_INVALID_ADDRESS,&error);
-      if (high_addr == LLDB_INVALID_ADDRESS || error.Fail())
-      {
-          result.AppendError("invalid high address");
-          return false;
+    } else {
+      result.AppendError(
+          "please pass either a block of text, or an expression to evaluate.");
+      return false;
+    }
+
+    size_t count = m_memory_options.m_count.GetCurrentValue();
+    found_location = low_addr;
+    bool ever_found = false;
+    while (count) {
+      found_location = FastSearch(found_location, high_addr, buffer.GetBytes(),
+                                  buffer.GetByteSize());
+      if (found_location == LLDB_INVALID_ADDRESS) {
+        if (!ever_found) {
+          result.AppendMessage("data not found within the range.\n");
+          result.SetStatus(lldb::eReturnStatusSuccessFinishNoResult);
+        } else
+          result.AppendMessage("no more matches within the range.\n");
+        break;
       }
+      result.AppendMessageWithFormat("data found at location: 0x%" PRIx64 "\n",
+                                     found_location);
 
-      if (high_addr <= low_addr)
-      {
-          result.AppendError("starting address must be smaller than ending address");
-          return false;
-      }
-      
-      lldb::addr_t found_location = LLDB_INVALID_ADDRESS;
-      
-      DataBufferHeap buffer;
-      
-      if (m_memory_options.m_string.OptionWasSet())
-          buffer.CopyData(m_memory_options.m_string.GetStringValue(), strlen(m_memory_options.m_string.GetStringValue()));
-      else if (m_memory_options.m_expr.OptionWasSet())
-      {
-          StackFrame* frame = m_exe_ctx.GetFramePtr();
-          ValueObjectSP result_sp;
-          if ((eExpressionCompleted == process->GetTarget().EvaluateExpression(m_memory_options.m_expr.GetStringValue(), frame, result_sp)) &&
-              result_sp)
-          {
-              uint64_t value = result_sp->GetValueAsUnsigned(0);
-              switch (result_sp->GetCompilerType().GetByteSize(nullptr))
-              {
-                  case 1: {
-                      uint8_t byte = (uint8_t)value;
-                      buffer.CopyData(&byte,1);
-                  }
-                      break;
-                  case 2: {
-                      uint16_t word = (uint16_t)value;
-                      buffer.CopyData(&word,2);
-                  }
-                      break;
-                  case 4: {
-                      uint32_t lword = (uint32_t)value;
-                      buffer.CopyData(&lword,4);
-                  }
-                      break;
-                  case 8: {
-                      buffer.CopyData(&value, 8);
-                  }
-                      break;
-                  case 3:
-                  case 5:
-                  case 6:
-                  case 7:
-                      result.AppendError("unknown type. pass a string instead");
-                      return false;
-                  default:
-                      result.AppendError("result size larger than 8 bytes. pass a string instead");
-                      return false;
-              }
-          }
-          else
-          {
-              result.AppendError("expression evaluation failed. pass a string instead");
-              return false;
-          }
-      }
-      else
-      {
-          result.AppendError("please pass either a block of text, or an expression to evaluate.");
-          return false;
+      DataBufferHeap dumpbuffer(32, 0);
+      process->ReadMemory(
+          found_location + m_memory_options.m_offset.GetCurrentValue(),
+          dumpbuffer.GetBytes(), dumpbuffer.GetByteSize(), error);
+      if (!error.Fail()) {
+        DataExtractor data(dumpbuffer.GetBytes(), dumpbuffer.GetByteSize(),
+                           process->GetByteOrder(),
+                           process->GetAddressByteSize());
+        data.Dump(&result.GetOutputStream(), 0, lldb::eFormatBytesWithASCII, 1,
+                  dumpbuffer.GetByteSize(), 16,
+                  found_location + m_memory_options.m_offset.GetCurrentValue(),
+                  0, 0);
+        result.GetOutputStream().EOL();
       }
-      
-      size_t count = m_memory_options.m_count.GetCurrentValue();
-      found_location = low_addr;
-      bool ever_found = false;
-      while (count)
-      {
-          found_location = FastSearch(found_location, high_addr, buffer.GetBytes(), buffer.GetByteSize());
-          if (found_location == LLDB_INVALID_ADDRESS)
-          {
-              if (!ever_found)
-              {
-                  result.AppendMessage("data not found within the range.\n");
-                  result.SetStatus(lldb::eReturnStatusSuccessFinishNoResult);
-              }
-              else
-                  result.AppendMessage("no more matches within the range.\n");
-              break;
-          }
-          result.AppendMessageWithFormat("data found at location: 0x%" PRIx64 "\n", found_location);
 
-          DataBufferHeap dumpbuffer(32,0);
-          process->ReadMemory(found_location+m_memory_options.m_offset.GetCurrentValue(), dumpbuffer.GetBytes(), dumpbuffer.GetByteSize(), error);
-          if (!error.Fail())
-          {
-              DataExtractor data(dumpbuffer.GetBytes(), dumpbuffer.GetByteSize(), process->GetByteOrder(), process->GetAddressByteSize());
-              data.Dump(&result.GetOutputStream(), 0, lldb::eFormatBytesWithASCII, 1, dumpbuffer.GetByteSize(), 16, found_location+m_memory_options.m_offset.GetCurrentValue(), 0, 0);
-              result.GetOutputStream().EOL();
-          }
+      --count;
+      found_location++;
+      ever_found = true;
+    }
 
-          --count;
-          found_location++;
-          ever_found = true;
-      }
-      
-      result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
-      return true;
+    result.SetStatus(lldb::eReturnStatusSuccessFinishResult);
+    return true;
+  }
+
+  lldb::addr_t FastSearch(lldb::addr_t low, lldb::addr_t high, uint8_t *buffer,
+                          size_t buffer_size) {
+    const size_t region_size = high - low;
+
+    if (region_size < buffer_size)
+      return LLDB_INVALID_ADDRESS;
+
+    std::vector<size_t> bad_char_heuristic(256, buffer_size);
+    ProcessSP process_sp = m_exe_ctx.GetProcessSP();
+    ProcessMemoryIterator iterator(process_sp, low);
+
+    for (size_t idx = 0; idx < buffer_size - 1; idx++) {
+      decltype(bad_char_heuristic)::size_type bcu_idx = buffer[idx];
+      bad_char_heuristic[bcu_idx] = buffer_size - idx - 1;
+    }
+    for (size_t s = 0; s <= (region_size - buffer_size);) {
+      int64_t j = buffer_size - 1;
+      while (j >= 0 && buffer[j] == iterator[s + j])
+        j--;
+      if (j < 0)
+        return low + s;
+      else
+        s += bad_char_heuristic[iterator[s + buffer_size - 1]];
+    }
+
+    return LLDB_INVALID_ADDRESS;
   }
-    
-    lldb::addr_t
-    FastSearch (lldb::addr_t low,
-                lldb::addr_t high,
-                uint8_t *buffer,
-                size_t buffer_size)
-    {
-        const size_t region_size = high-low;
-
-        if (region_size < buffer_size)
-            return LLDB_INVALID_ADDRESS;
-        
-        std::vector<size_t> bad_char_heuristic(256, buffer_size);
-        ProcessSP process_sp = m_exe_ctx.GetProcessSP();
-        ProcessMemoryIterator iterator(process_sp, low);
-        
-        for (size_t idx = 0;
-             idx < buffer_size-1;
-             idx++)
-        {
-            decltype(bad_char_heuristic)::size_type bcu_idx = buffer[idx];
-            bad_char_heuristic[bcu_idx] = buffer_size - idx - 1;
-        }
-        for (size_t s = 0;
-             s <= (region_size - buffer_size);
-             )
-        {
-            int64_t j = buffer_size-1;
-            while (j >= 0 && buffer[j] == iterator[s + j])
-                j--;
-            if (j < 0)
-                return low+s;
-            else
-                s += bad_char_heuristic[iterator[s + buffer_size - 1]];
-        }
-        
-        return LLDB_INVALID_ADDRESS;
-    }
-  
-    OptionGroupOptions m_option_group;
-    OptionGroupFindMemory m_memory_options;
+
+  OptionGroupOptions m_option_group;
+  OptionGroupFindMemory m_memory_options;
 };
 
-OptionDefinition
-g_memory_write_option_table[] =
-{
-  // clang-format off
+OptionDefinition g_memory_write_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_1, true,  "infile", 'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeFilename, "Write memory using the contents of a file."},
   {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeOffset,   "Start writing bytes from an offset within the input file."},
-  // clang-format on
+    // clang-format on
 };
 
 //----------------------------------------------------------------------
 // Write memory to the inferior process
 //----------------------------------------------------------------------
-class CommandObjectMemoryWrite : public CommandObjectParsed
-{
+class CommandObjectMemoryWrite : public CommandObjectParsed {
 public:
-    class OptionGroupWriteMemory : public OptionGroup
-    {
-    public:
-        OptionGroupWriteMemory () :
-            OptionGroup()
-        {
-        }
-
-        ~OptionGroupWriteMemory() override = default;
-
-        uint32_t
-        GetNumDefinitions () override
-        {
-            return sizeof (g_memory_write_option_table) / sizeof (OptionDefinition);
-        }
-      
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_memory_write_option_table;
-        }
-      
-        Error
-        SetOptionValue (uint32_t option_idx,
-                        const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            const int short_option = g_memory_write_option_table[option_idx].short_option;
-          
-            switch (short_option)
-            {
-                case 'i':
-                    m_infile.SetFile (option_arg, true);
-                    if (!m_infile.Exists())
-                    {
-                        m_infile.Clear();
-                        error.SetErrorStringWithFormat("input file does not exist: '%s'", option_arg);
-                    }
-                    break;
-                
-                case 'o':
-                    {
-                        bool success;
-                        m_infile_offset = StringConvert::ToUInt64(option_arg, 0, 0, &success);
-                        if (!success)
-                        {
-                            error.SetErrorStringWithFormat("invalid offset string '%s'", option_arg);
-                        }
-                    }
-                    break;
-                    
-                default:
-                    error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-                    break;
-            }
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_infile.Clear();
-            m_infile_offset = 0;
-        }
-
-        FileSpec m_infile;
-        off_t m_infile_offset;
-    };
-
-    CommandObjectMemoryWrite(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "memory write", "Write to the memory of the current target process.",
-                              nullptr, eCommandRequiresProcess | eCommandProcessMustBeLaunched),
-          m_option_group(),
-          m_format_options(eFormatBytes, 1, UINT64_MAX),
-          m_memory_options()
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData addr_arg;
-        CommandArgumentData value_arg;
-        
-        // Define the first (and only) variant of this arg.
-        addr_arg.arg_type = eArgTypeAddress;
-        addr_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (addr_arg);
-        
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlus;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (value_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-        
-        m_option_group.Append (&m_format_options, OptionGroupFormat::OPTION_GROUP_FORMAT, LLDB_OPT_SET_1);
-        m_option_group.Append (&m_format_options, OptionGroupFormat::OPTION_GROUP_SIZE  , LLDB_OPT_SET_1|LLDB_OPT_SET_2);
-        m_option_group.Append (&m_memory_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_2);
-        m_option_group.Finalize();
-    }
-
-    ~CommandObjectMemoryWrite() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_option_group;
-    }
-
-    bool
-    UIntValueIsValidForSize (uint64_t uval64, size_t total_byte_size)
-    {
-        if (total_byte_size > 8)
-            return false;
+  class OptionGroupWriteMemory : public OptionGroup {
+  public:
+    OptionGroupWriteMemory() : OptionGroup() {}
 
-        if (total_byte_size == 8)
-            return true;
+    ~OptionGroupWriteMemory() override = default;
 
-        const uint64_t max = ((uint64_t)1 << (uint64_t)(total_byte_size * 8)) - 1;
-        return uval64 <= max;
+    uint32_t GetNumDefinitions() override {
+      return sizeof(g_memory_write_option_table) / sizeof(OptionDefinition);
     }
 
-    bool
-    SIntValueIsValidForSize (int64_t sval64, size_t total_byte_size)
-    {
-        if (total_byte_size > 8)
-            return false;
+    const OptionDefinition *GetDefinitions() override {
+      return g_memory_write_option_table;
+    }
 
-        if (total_byte_size == 8)
-            return true;
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      const int short_option =
+          g_memory_write_option_table[option_idx].short_option;
 
-        const int64_t max = ((int64_t)1 << (uint64_t)(total_byte_size * 8 - 1)) - 1;
-        const int64_t min = ~(max);
-        return min <= sval64 && sval64 <= max;
+      switch (short_option) {
+      case 'i':
+        m_infile.SetFile(option_arg, true);
+        if (!m_infile.Exists()) {
+          m_infile.Clear();
+          error.SetErrorStringWithFormat("input file does not exist: '%s'",
+                                         option_arg);
+        }
+        break;
+
+      case 'o': {
+        bool success;
+        m_infile_offset = StringConvert::ToUInt64(option_arg, 0, 0, &success);
+        if (!success) {
+          error.SetErrorStringWithFormat("invalid offset string '%s'",
+                                         option_arg);
+        }
+      } break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_infile.Clear();
+      m_infile_offset = 0;
     }
 
+    FileSpec m_infile;
+    off_t m_infile_offset;
+  };
+
+  CommandObjectMemoryWrite(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "memory write",
+            "Write to the memory of the current target process.", nullptr,
+            eCommandRequiresProcess | eCommandProcessMustBeLaunched),
+        m_option_group(), m_format_options(eFormatBytes, 1, UINT64_MAX),
+        m_memory_options() {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData addr_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    addr_arg.arg_type = eArgTypeAddress;
+    addr_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(addr_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlus;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(value_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+
+    m_option_group.Append(&m_format_options,
+                          OptionGroupFormat::OPTION_GROUP_FORMAT,
+                          LLDB_OPT_SET_1);
+    m_option_group.Append(&m_format_options,
+                          OptionGroupFormat::OPTION_GROUP_SIZE,
+                          LLDB_OPT_SET_1 | LLDB_OPT_SET_2);
+    m_option_group.Append(&m_memory_options, LLDB_OPT_SET_ALL, LLDB_OPT_SET_2);
+    m_option_group.Finalize();
+  }
+
+  ~CommandObjectMemoryWrite() override = default;
+
+  Options *GetOptions() override { return &m_option_group; }
+
+  bool UIntValueIsValidForSize(uint64_t uval64, size_t total_byte_size) {
+    if (total_byte_size > 8)
+      return false;
+
+    if (total_byte_size == 8)
+      return true;
+
+    const uint64_t max = ((uint64_t)1 << (uint64_t)(total_byte_size * 8)) - 1;
+    return uval64 <= max;
+  }
+
+  bool SIntValueIsValidForSize(int64_t sval64, size_t total_byte_size) {
+    if (total_byte_size > 8)
+      return false;
+
+    if (total_byte_size == 8)
+      return true;
+
+    const int64_t max = ((int64_t)1 << (uint64_t)(total_byte_size * 8 - 1)) - 1;
+    const int64_t min = ~(max);
+    return min <= sval64 && sval64 <= max;
+  }
+
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        // No need to check "process" for validity as eCommandRequiresProcess ensures it is valid
-        Process *process = m_exe_ctx.GetProcessPtr();
-
-        const size_t argc = command.GetArgumentCount();
-
-        if (m_memory_options.m_infile)
-        {
-            if (argc < 1)
-            {
-                result.AppendErrorWithFormat ("%s takes a destination address when writing file contents.\n", m_cmd_name.c_str());
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }       
-        }
-        else if (argc < 2)
-        {
-            result.AppendErrorWithFormat ("%s takes a destination address and at least one value.\n", m_cmd_name.c_str());
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    // No need to check "process" for validity as eCommandRequiresProcess
+    // ensures it is valid
+    Process *process = m_exe_ctx.GetProcessPtr();
+
+    const size_t argc = command.GetArgumentCount();
+
+    if (m_memory_options.m_infile) {
+      if (argc < 1) {
+        result.AppendErrorWithFormat(
+            "%s takes a destination address when writing file contents.\n",
+            m_cmd_name.c_str());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else if (argc < 2) {
+      result.AppendErrorWithFormat(
+          "%s takes a destination address and at least one value.\n",
+          m_cmd_name.c_str());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    StreamString buffer(
+        Stream::eBinary,
+        process->GetTarget().GetArchitecture().GetAddressByteSize(),
+        process->GetTarget().GetArchitecture().GetByteOrder());
+
+    OptionValueUInt64 &byte_size_value = m_format_options.GetByteSizeValue();
+    size_t item_byte_size = byte_size_value.GetCurrentValue();
+
+    Error error;
+    lldb::addr_t addr =
+        Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(0),
+                              LLDB_INVALID_ADDRESS, &error);
+
+    if (addr == LLDB_INVALID_ADDRESS) {
+      result.AppendError("invalid address expression\n");
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (m_memory_options.m_infile) {
+      size_t length = SIZE_MAX;
+      if (item_byte_size > 1)
+        length = item_byte_size;
+      lldb::DataBufferSP data_sp(m_memory_options.m_infile.ReadFileContents(
+          m_memory_options.m_infile_offset, length));
+      if (data_sp) {
+        length = data_sp->GetByteSize();
+        if (length > 0) {
+          Error error;
+          size_t bytes_written =
+              process->WriteMemory(addr, data_sp->GetBytes(), length, error);
+
+          if (bytes_written == length) {
+            // All bytes written
+            result.GetOutputStream().Printf(
+                "%" PRIu64 " bytes were written to 0x%" PRIx64 "\n",
+                (uint64_t)bytes_written, addr);
+            result.SetStatus(eReturnStatusSuccessFinishResult);
+          } else if (bytes_written > 0) {
+            // Some byte written
+            result.GetOutputStream().Printf(
+                "%" PRIu64 " bytes of %" PRIu64
+                " requested were written to 0x%" PRIx64 "\n",
+                (uint64_t)bytes_written, (uint64_t)length, addr);
+            result.SetStatus(eReturnStatusSuccessFinishResult);
+          } else {
+            result.AppendErrorWithFormat("Memory write to 0x%" PRIx64
+                                         " failed: %s.\n",
+                                         addr, error.AsCString());
             result.SetStatus(eReturnStatusFailed);
-            return false;
+          }
         }
+      } else {
+        result.AppendErrorWithFormat("Unable to read contents of file.\n");
+        result.SetStatus(eReturnStatusFailed);
+      }
+      return result.Succeeded();
+    } else if (item_byte_size == 0) {
+      if (m_format_options.GetFormat() == eFormatPointer)
+        item_byte_size = buffer.GetAddressByteSize();
+      else
+        item_byte_size = 1;
+    }
 
-        StreamString buffer (Stream::eBinary,
-                             process->GetTarget().GetArchitecture().GetAddressByteSize(),
-                             process->GetTarget().GetArchitecture().GetByteOrder());
+    command.Shift(); // shift off the address argument
+    uint64_t uval64;
+    int64_t sval64;
+    bool success = false;
+    const size_t num_value_args = command.GetArgumentCount();
+    for (size_t i = 0; i < num_value_args; ++i) {
+      const char *value_str = command.GetArgumentAtIndex(i);
+
+      switch (m_format_options.GetFormat()) {
+      case kNumFormats:
+      case eFormatFloat: // TODO: add support for floats soon
+      case eFormatCharPrintable:
+      case eFormatBytesWithASCII:
+      case eFormatComplex:
+      case eFormatEnum:
+      case eFormatUnicode16:
+      case eFormatUnicode32:
+      case eFormatVectorOfChar:
+      case eFormatVectorOfSInt8:
+      case eFormatVectorOfUInt8:
+      case eFormatVectorOfSInt16:
+      case eFormatVectorOfUInt16:
+      case eFormatVectorOfSInt32:
+      case eFormatVectorOfUInt32:
+      case eFormatVectorOfSInt64:
+      case eFormatVectorOfUInt64:
+      case eFormatVectorOfFloat16:
+      case eFormatVectorOfFloat32:
+      case eFormatVectorOfFloat64:
+      case eFormatVectorOfUInt128:
+      case eFormatOSType:
+      case eFormatComplexInteger:
+      case eFormatAddressInfo:
+      case eFormatHexFloat:
+      case eFormatInstruction:
+      case eFormatVoid:
+        result.AppendError("unsupported format for writing memory");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+
+      case eFormatDefault:
+      case eFormatBytes:
+      case eFormatHex:
+      case eFormatHexUppercase:
+      case eFormatPointer:
+        // Decode hex bytes
+        uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 16, &success);
+        if (!success) {
+          result.AppendErrorWithFormat(
+              "'%s' is not a valid hex string value.\n", value_str);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else if (!UIntValueIsValidForSize(uval64, item_byte_size)) {
+          result.AppendErrorWithFormat("Value 0x%" PRIx64
+                                       " is too large to fit in a %" PRIu64
+                                       " byte unsigned integer value.\n",
+                                       uval64, (uint64_t)item_byte_size);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+        buffer.PutMaxHex64(uval64, item_byte_size);
+        break;
 
-        OptionValueUInt64 &byte_size_value = m_format_options.GetByteSizeValue();
-        size_t item_byte_size = byte_size_value.GetCurrentValue();
+      case eFormatBoolean:
+        uval64 = Args::StringToBoolean(value_str, false, &success);
+        if (!success) {
+          result.AppendErrorWithFormat(
+              "'%s' is not a valid boolean string value.\n", value_str);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+        buffer.PutMaxHex64(uval64, item_byte_size);
+        break;
 
-        Error error;
-        lldb::addr_t addr = Args::StringToAddress (&m_exe_ctx,
-                                                   command.GetArgumentAtIndex(0),
-                                                   LLDB_INVALID_ADDRESS,
-                                                   &error);
-
-        if (addr == LLDB_INVALID_ADDRESS)
-        {
-            result.AppendError("invalid address expression\n");
-            result.AppendError(error.AsCString());
+      case eFormatBinary:
+        uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 2, &success);
+        if (!success) {
+          result.AppendErrorWithFormat(
+              "'%s' is not a valid binary string value.\n", value_str);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else if (!UIntValueIsValidForSize(uval64, item_byte_size)) {
+          result.AppendErrorWithFormat("Value 0x%" PRIx64
+                                       " is too large to fit in a %" PRIu64
+                                       " byte unsigned integer value.\n",
+                                       uval64, (uint64_t)item_byte_size);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+        buffer.PutMaxHex64(uval64, item_byte_size);
+        break;
+
+      case eFormatCharArray:
+      case eFormatChar:
+      case eFormatCString:
+        if (value_str[0]) {
+          size_t len = strlen(value_str);
+          // Include the NULL for C strings...
+          if (m_format_options.GetFormat() == eFormatCString)
+            ++len;
+          Error error;
+          if (process->WriteMemory(addr, value_str, len, error) == len) {
+            addr += len;
+          } else {
+            result.AppendErrorWithFormat("Memory write to 0x%" PRIx64
+                                         " failed: %s.\n",
+                                         addr, error.AsCString());
             result.SetStatus(eReturnStatusFailed);
             return false;
+          }
         }
-        
-        if (m_memory_options.m_infile)
-        {
-            size_t length = SIZE_MAX;
-            if (item_byte_size > 1)
-                length = item_byte_size;
-            lldb::DataBufferSP data_sp (m_memory_options.m_infile.ReadFileContents (m_memory_options.m_infile_offset, length));
-            if (data_sp)
-            {
-                length = data_sp->GetByteSize();
-                if (length > 0)
-                {
-                    Error error;
-                    size_t bytes_written = process->WriteMemory (addr, data_sp->GetBytes(), length, error);
-                    
-                    if (bytes_written == length)
-                    {
-                        // All bytes written
-                        result.GetOutputStream().Printf("%" PRIu64 " bytes were written to 0x%" PRIx64 "\n", (uint64_t)bytes_written, addr);
-                        result.SetStatus(eReturnStatusSuccessFinishResult);
-                    }
-                    else if (bytes_written > 0)
-                    {
-                        // Some byte written
-                        result.GetOutputStream().Printf("%" PRIu64 " bytes of %" PRIu64 " requested were written to 0x%" PRIx64 "\n", (uint64_t)bytes_written, (uint64_t)length, addr);
-                        result.SetStatus(eReturnStatusSuccessFinishResult);
-                    }
-                    else 
-                    {
-                        result.AppendErrorWithFormat ("Memory write to 0x%" PRIx64 " failed: %s.\n", addr, error.AsCString());
-                        result.SetStatus(eReturnStatusFailed);
-                    }
-                }
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("Unable to read contents of file.\n");
-                result.SetStatus(eReturnStatusFailed);
-            }
-            return result.Succeeded();
+        break;
+
+      case eFormatDecimal:
+        sval64 = StringConvert::ToSInt64(value_str, INT64_MAX, 0, &success);
+        if (!success) {
+          result.AppendErrorWithFormat(
+              "'%s' is not a valid signed decimal value.\n", value_str);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else if (!SIntValueIsValidForSize(sval64, item_byte_size)) {
+          result.AppendErrorWithFormat(
+              "Value %" PRIi64 " is too large or small to fit in a %" PRIu64
+              " byte signed integer value.\n",
+              sval64, (uint64_t)item_byte_size);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
-        else if (item_byte_size == 0)
-        {
-            if (m_format_options.GetFormat() == eFormatPointer)
-                item_byte_size = buffer.GetAddressByteSize();
-            else
-                item_byte_size = 1;
-        }
-
-        command.Shift(); // shift off the address argument
-        uint64_t uval64;
-        int64_t sval64;
-        bool success = false;
-        const size_t num_value_args = command.GetArgumentCount();
-        for (size_t i=0; i<num_value_args; ++i)
-        {
-            const char *value_str = command.GetArgumentAtIndex(i);
-
-            switch (m_format_options.GetFormat())
-            {
-            case kNumFormats:
-            case eFormatFloat:  // TODO: add support for floats soon
-            case eFormatCharPrintable:
-            case eFormatBytesWithASCII:
-            case eFormatComplex:
-            case eFormatEnum:
-            case eFormatUnicode16:
-            case eFormatUnicode32:
-            case eFormatVectorOfChar:
-            case eFormatVectorOfSInt8:
-            case eFormatVectorOfUInt8:
-            case eFormatVectorOfSInt16:
-            case eFormatVectorOfUInt16:
-            case eFormatVectorOfSInt32:
-            case eFormatVectorOfUInt32:
-            case eFormatVectorOfSInt64:
-            case eFormatVectorOfUInt64:
-            case eFormatVectorOfFloat16:
-            case eFormatVectorOfFloat32:
-            case eFormatVectorOfFloat64:
-            case eFormatVectorOfUInt128:
-            case eFormatOSType:
-            case eFormatComplexInteger:
-            case eFormatAddressInfo:
-            case eFormatHexFloat:
-            case eFormatInstruction:
-            case eFormatVoid:
-                result.AppendError("unsupported format for writing memory");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-
-            case eFormatDefault:
-            case eFormatBytes:
-            case eFormatHex:
-            case eFormatHexUppercase:
-            case eFormatPointer:
-                // Decode hex bytes
-                uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 16, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat ("'%s' is not a valid hex string value.\n", value_str);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                else if (!UIntValueIsValidForSize (uval64, item_byte_size))
-                {
-                    result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                buffer.PutMaxHex64 (uval64, item_byte_size);
-                break;
-
-            case eFormatBoolean:
-                uval64 = Args::StringToBoolean(value_str, false, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat ("'%s' is not a valid boolean string value.\n", value_str);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                buffer.PutMaxHex64 (uval64, item_byte_size);
-                break;
-
-            case eFormatBinary:
-                uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 2, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat ("'%s' is not a valid binary string value.\n", value_str);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                else if (!UIntValueIsValidForSize (uval64, item_byte_size))
-                {
-                    result.AppendErrorWithFormat("Value 0x%" PRIx64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                buffer.PutMaxHex64 (uval64, item_byte_size);
-                break;
-
-            case eFormatCharArray:
-            case eFormatChar:
-            case eFormatCString:
-                if (value_str[0])
-                {
-                    size_t len = strlen (value_str);
-                    // Include the NULL for C strings...
-                    if (m_format_options.GetFormat() == eFormatCString)
-                        ++len;
-                    Error error;
-                    if (process->WriteMemory (addr, value_str, len, error) == len)
-                    {
-                        addr += len;
-                    }
-                    else
-                    {
-                        result.AppendErrorWithFormat ("Memory write to 0x%" PRIx64 " failed: %s.\n", addr, error.AsCString());
-                        result.SetStatus(eReturnStatusFailed);
-                        return false;
-                    }
-                }
-                break;
-
-            case eFormatDecimal:
-                sval64 = StringConvert::ToSInt64(value_str, INT64_MAX, 0, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat ("'%s' is not a valid signed decimal value.\n", value_str);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                else if (!SIntValueIsValidForSize (sval64, item_byte_size))
-                {
-                    result.AppendErrorWithFormat ("Value %" PRIi64 " is too large or small to fit in a %" PRIu64 " byte signed integer value.\n", sval64, (uint64_t)item_byte_size);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                buffer.PutMaxHex64 (sval64, item_byte_size);
-                break;
-
-            case eFormatUnsigned:
-                uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 0, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat ("'%s' is not a valid unsigned decimal string value.\n", value_str);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                else if (!UIntValueIsValidForSize (uval64, item_byte_size))
-                {
-                    result.AppendErrorWithFormat ("Value %" PRIu64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                buffer.PutMaxHex64 (uval64, item_byte_size);
-                break;
-
-            case eFormatOctal:
-                uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 8, &success);
-                if (!success)
-                {
-                    result.AppendErrorWithFormat ("'%s' is not a valid octal string value.\n", value_str);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                else if (!UIntValueIsValidForSize (uval64, item_byte_size))
-                {
-                    result.AppendErrorWithFormat ("Value %" PRIo64 " is too large to fit in a %" PRIu64 " byte unsigned integer value.\n", uval64, (uint64_t)item_byte_size);
-                    result.SetStatus(eReturnStatusFailed);
-                    return false;
-                }
-                buffer.PutMaxHex64 (uval64, item_byte_size);
-                break;
-            }
+        buffer.PutMaxHex64(sval64, item_byte_size);
+        break;
+
+      case eFormatUnsigned:
+        uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 0, &success);
+        if (!success) {
+          result.AppendErrorWithFormat(
+              "'%s' is not a valid unsigned decimal string value.\n",
+              value_str);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else if (!UIntValueIsValidForSize(uval64, item_byte_size)) {
+          result.AppendErrorWithFormat("Value %" PRIu64
+                                       " is too large to fit in a %" PRIu64
+                                       " byte unsigned integer value.\n",
+                                       uval64, (uint64_t)item_byte_size);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
+        buffer.PutMaxHex64(uval64, item_byte_size);
+        break;
 
-        if (!buffer.GetString().empty())
-        {
-            Error error;
-            if (process->WriteMemory (addr, buffer.GetString().c_str(), buffer.GetString().size(), error) == buffer.GetString().size())
-                return true;
-            else
-            {
-                result.AppendErrorWithFormat ("Memory write to 0x%" PRIx64 " failed: %s.\n", addr, error.AsCString());
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
+      case eFormatOctal:
+        uval64 = StringConvert::ToUInt64(value_str, UINT64_MAX, 8, &success);
+        if (!success) {
+          result.AppendErrorWithFormat(
+              "'%s' is not a valid octal string value.\n", value_str);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else if (!UIntValueIsValidForSize(uval64, item_byte_size)) {
+          result.AppendErrorWithFormat("Value %" PRIo64
+                                       " is too large to fit in a %" PRIu64
+                                       " byte unsigned integer value.\n",
+                                       uval64, (uint64_t)item_byte_size);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
         }
+        buffer.PutMaxHex64(uval64, item_byte_size);
+        break;
+      }
+    }
+
+    if (!buffer.GetString().empty()) {
+      Error error;
+      if (process->WriteMemory(addr, buffer.GetString().c_str(),
+                               buffer.GetString().size(),
+                               error) == buffer.GetString().size())
         return true;
+      else {
+        result.AppendErrorWithFormat("Memory write to 0x%" PRIx64
+                                     " failed: %s.\n",
+                                     addr, error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
     }
+    return true;
+  }
 
-    OptionGroupOptions m_option_group;
-    OptionGroupFormat m_format_options;
-    OptionGroupWriteMemory m_memory_options;
+  OptionGroupOptions m_option_group;
+  OptionGroupFormat m_format_options;
+  OptionGroupWriteMemory m_memory_options;
 };
 
 //----------------------------------------------------------------------
 // Get malloc/free history of a memory address.
 //----------------------------------------------------------------------
-class CommandObjectMemoryHistory : public CommandObjectParsed
-{
+class CommandObjectMemoryHistory : public CommandObjectParsed {
 public:
-    CommandObjectMemoryHistory(CommandInterpreter &interpreter)
-        : CommandObjectParsed(
-              interpreter, "memory history",
-              "Print recorded stack traces for allocation/deallocation events associated with an address.", nullptr,
-              eCommandRequiresTarget | eCommandRequiresProcess | eCommandProcessMustBePaused |
-                  eCommandProcessMustBeLaunched)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentData addr_arg;
-        
-        // Define the first (and only) variant of this arg.
-        addr_arg.arg_type = eArgTypeAddress;
-        addr_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (addr_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-    }
-
-    ~CommandObjectMemoryHistory() override = default;
-
-    const char *
-    GetRepeatCommand (Args &current_command_args, uint32_t index) override
-    {
-        return m_cmd_name.c_str();
-    }
-    
+  CommandObjectMemoryHistory(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "memory history", "Print recorded stack traces for "
+                                           "allocation/deallocation events "
+                                           "associated with an address.",
+            nullptr,
+            eCommandRequiresTarget | eCommandRequiresProcess |
+                eCommandProcessMustBePaused | eCommandProcessMustBeLaunched) {
+    CommandArgumentEntry arg1;
+    CommandArgumentData addr_arg;
+
+    // Define the first (and only) variant of this arg.
+    addr_arg.arg_type = eArgTypeAddress;
+    addr_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(addr_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+  }
+
+  ~CommandObjectMemoryHistory() override = default;
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override {
+    return m_cmd_name.c_str();
+  }
+
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        const size_t argc = command.GetArgumentCount();
-        
-        if (argc == 0 || argc > 1)
-        {
-            result.AppendErrorWithFormat ("%s takes an address expression", m_cmd_name.c_str());
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-        
-        Error error;
-        lldb::addr_t addr = Args::StringToAddress (&m_exe_ctx,
-                                                   command.GetArgumentAtIndex(0),
-                                                   LLDB_INVALID_ADDRESS,
-                                                   &error);
-        
-        if (addr == LLDB_INVALID_ADDRESS)
-        {
-            result.AppendError("invalid address expression");
-            result.AppendError(error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-        
-        Stream *output_stream = &result.GetOutputStream();
-        
-        const ProcessSP &process_sp = m_exe_ctx.GetProcessSP();
-        const MemoryHistorySP &memory_history = MemoryHistory::FindPlugin(process_sp);
-        
-        if (!memory_history)
-        {
-            result.AppendError("no available memory history provider");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-        
-        HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
-        
-        for (auto thread : thread_list) {
-            thread->GetStatus(*output_stream, 0, UINT32_MAX, 0);
-        }
-        
-        result.SetStatus(eReturnStatusSuccessFinishResult);
-        
-        return true;
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    const size_t argc = command.GetArgumentCount();
+
+    if (argc == 0 || argc > 1) {
+      result.AppendErrorWithFormat("%s takes an address expression",
+                                   m_cmd_name.c_str());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    Error error;
+    lldb::addr_t addr =
+        Args::StringToAddress(&m_exe_ctx, command.GetArgumentAtIndex(0),
+                              LLDB_INVALID_ADDRESS, &error);
+
+    if (addr == LLDB_INVALID_ADDRESS) {
+      result.AppendError("invalid address expression");
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    Stream *output_stream = &result.GetOutputStream();
+
+    const ProcessSP &process_sp = m_exe_ctx.GetProcessSP();
+    const MemoryHistorySP &memory_history =
+        MemoryHistory::FindPlugin(process_sp);
+
+    if (!memory_history) {
+      result.AppendError("no available memory history provider");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    HistoryThreads thread_list = memory_history->GetHistoryThreads(addr);
+
+    for (auto thread : thread_list) {
+      thread->GetStatus(*output_stream, 0, UINT32_MAX, 0);
     }
+
+    result.SetStatus(eReturnStatusSuccessFinishResult);
+
+    return true;
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1827,102 +1693,90 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectMemoryRegion
 
-class CommandObjectMemoryRegion : public CommandObjectParsed
-{
+class CommandObjectMemoryRegion : public CommandObjectParsed {
 public:
-    CommandObjectMemoryRegion(CommandInterpreter &interpreter)
-        : CommandObjectParsed(
-              interpreter, "memory region",
-              "Get information on the memory region containing an address in the current target process.",
-              "memory region ADDR", eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched),
-          m_prev_end_addr(LLDB_INVALID_ADDRESS)
-    {
-    }
+  CommandObjectMemoryRegion(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "memory region",
+                            "Get information on the memory region containing "
+                            "an address in the current target process.",
+                            "memory region ADDR",
+                            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched),
+        m_prev_end_addr(LLDB_INVALID_ADDRESS) {}
 
-    ~CommandObjectMemoryRegion() override = default;
+  ~CommandObjectMemoryRegion() override = default;
 
 protected:
-    bool
-    DoExecute(Args &command, CommandReturnObject &result) override
-    {
-        ProcessSP process_sp = m_exe_ctx.GetProcessSP();
-        if (process_sp)
-        {
-            Error error;
-            lldb::addr_t load_addr = m_prev_end_addr;
-            m_prev_end_addr = LLDB_INVALID_ADDRESS;
-
-            const size_t argc = command.GetArgumentCount();
-            if (argc > 1 || (argc == 0 && load_addr == LLDB_INVALID_ADDRESS))
-            {
-                result.AppendErrorWithFormat("'%s' takes one argument:\nUsage: %s\n", m_cmd_name.c_str(),
-                                             m_cmd_syntax.c_str());
-                result.SetStatus(eReturnStatusFailed);
-            }
-            else
-            {
-                const char *load_addr_cstr = command.GetArgumentAtIndex(0);
-                if (command.GetArgumentCount() == 1)
-                {
-                    load_addr = Args::StringToAddress(&m_exe_ctx, load_addr_cstr, LLDB_INVALID_ADDRESS, &error);
-                    if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS)
-                    {
-                        result.AppendErrorWithFormat("invalid address argument \"%s\": %s\n", load_addr_cstr,
-                                                     error.AsCString());
-                        result.SetStatus(eReturnStatusFailed);
-                    }
-                }
-
-                lldb_private::MemoryRegionInfo range_info;
-                error = process_sp->GetMemoryRegionInfo(load_addr, range_info);
-                if (error.Success())
-                {
-                    lldb_private::Address addr;
-                    ConstString section_name;
-                    if (process_sp->GetTarget().ResolveLoadAddress(load_addr, addr))
-                    {
-                        SectionSP section_sp(addr.GetSection());
-                        if (section_sp)
-                        {
-                            // Got the top most section, not the deepest section
-                            while (section_sp->GetParent())
-                                section_sp = section_sp->GetParent();
-                            section_name = section_sp->GetName();
-                        }
-                    }
-                    result.AppendMessageWithFormat(
-                        "[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") %c%c%c%s%s\n", range_info.GetRange().GetRangeBase(),
-                        range_info.GetRange().GetRangeEnd(), range_info.GetReadable() ? 'r' : '-',
-                        range_info.GetWritable() ? 'w' : '-', range_info.GetExecutable() ? 'x' : '-',
-                        section_name ? " " : "", section_name ? section_name.AsCString() : "");
-                    m_prev_end_addr = range_info.GetRange().GetRangeEnd();
-                    result.SetStatus(eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.SetStatus(eReturnStatusFailed);
-                    result.AppendErrorWithFormat("%s\n", error.AsCString());
-                }
-            }
-        }
-        else
-        {
-            m_prev_end_addr = LLDB_INVALID_ADDRESS;
-            result.AppendError("invalid process");
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    ProcessSP process_sp = m_exe_ctx.GetProcessSP();
+    if (process_sp) {
+      Error error;
+      lldb::addr_t load_addr = m_prev_end_addr;
+      m_prev_end_addr = LLDB_INVALID_ADDRESS;
+
+      const size_t argc = command.GetArgumentCount();
+      if (argc > 1 || (argc == 0 && load_addr == LLDB_INVALID_ADDRESS)) {
+        result.AppendErrorWithFormat("'%s' takes one argument:\nUsage: %s\n",
+                                     m_cmd_name.c_str(), m_cmd_syntax.c_str());
+        result.SetStatus(eReturnStatusFailed);
+      } else {
+        const char *load_addr_cstr = command.GetArgumentAtIndex(0);
+        if (command.GetArgumentCount() == 1) {
+          load_addr = Args::StringToAddress(&m_exe_ctx, load_addr_cstr,
+                                            LLDB_INVALID_ADDRESS, &error);
+          if (error.Fail() || load_addr == LLDB_INVALID_ADDRESS) {
+            result.AppendErrorWithFormat(
+                "invalid address argument \"%s\": %s\n", load_addr_cstr,
+                error.AsCString());
             result.SetStatus(eReturnStatusFailed);
+          }
         }
-        return result.Succeeded();
-    }
 
-    const char *
-    GetRepeatCommand(Args &current_command_args, uint32_t index) override
-    {
-        // If we repeat this command, repeat it without any arguments so we can
-        // show the next memory range
-        return m_cmd_name.c_str();
+        lldb_private::MemoryRegionInfo range_info;
+        error = process_sp->GetMemoryRegionInfo(load_addr, range_info);
+        if (error.Success()) {
+          lldb_private::Address addr;
+          ConstString section_name;
+          if (process_sp->GetTarget().ResolveLoadAddress(load_addr, addr)) {
+            SectionSP section_sp(addr.GetSection());
+            if (section_sp) {
+              // Got the top most section, not the deepest section
+              while (section_sp->GetParent())
+                section_sp = section_sp->GetParent();
+              section_name = section_sp->GetName();
+            }
+          }
+          result.AppendMessageWithFormat(
+              "[0x%16.16" PRIx64 "-0x%16.16" PRIx64 ") %c%c%c%s%s\n",
+              range_info.GetRange().GetRangeBase(),
+              range_info.GetRange().GetRangeEnd(),
+              range_info.GetReadable() ? 'r' : '-',
+              range_info.GetWritable() ? 'w' : '-',
+              range_info.GetExecutable() ? 'x' : '-', section_name ? " " : "",
+              section_name ? section_name.AsCString() : "");
+          m_prev_end_addr = range_info.GetRange().GetRangeEnd();
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.SetStatus(eReturnStatusFailed);
+          result.AppendErrorWithFormat("%s\n", error.AsCString());
+        }
+      }
+    } else {
+      m_prev_end_addr = LLDB_INVALID_ADDRESS;
+      result.AppendError("invalid process");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override {
+    // If we repeat this command, repeat it without any arguments so we can
+    // show the next memory range
+    return m_cmd_name.c_str();
+  }
 
-    lldb::addr_t m_prev_end_addr;
+  lldb::addr_t m_prev_end_addr;
 };
 
 //-------------------------------------------------------------------------
@@ -1930,14 +1784,20 @@ protected:
 //-------------------------------------------------------------------------
 
 CommandObjectMemory::CommandObjectMemory(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "memory", "Commands for operating on memory in the current target process.",
-                             "memory <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand("find", CommandObjectSP(new CommandObjectMemoryFind(interpreter)));
-    LoadSubCommand("read", CommandObjectSP(new CommandObjectMemoryRead(interpreter)));
-    LoadSubCommand("write", CommandObjectSP(new CommandObjectMemoryWrite(interpreter)));
-    LoadSubCommand("history", CommandObjectSP(new CommandObjectMemoryHistory(interpreter)));
-    LoadSubCommand("region", CommandObjectSP(new CommandObjectMemoryRegion(interpreter)));
+    : CommandObjectMultiword(
+          interpreter, "memory",
+          "Commands for operating on memory in the current target process.",
+          "memory <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("find",
+                 CommandObjectSP(new CommandObjectMemoryFind(interpreter)));
+  LoadSubCommand("read",
+                 CommandObjectSP(new CommandObjectMemoryRead(interpreter)));
+  LoadSubCommand("write",
+                 CommandObjectSP(new CommandObjectMemoryWrite(interpreter)));
+  LoadSubCommand("history",
+                 CommandObjectSP(new CommandObjectMemoryHistory(interpreter)));
+  LoadSubCommand("region",
+                 CommandObjectSP(new CommandObjectMemoryRegion(interpreter)));
 }
 
 CommandObjectMemory::~CommandObjectMemory() = default;

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

Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Tue Sep  6 15:57:50 2016
@@ -14,8 +14,8 @@
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Core/Debugger.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -28,496 +28,388 @@ CommandObjectMultiword::CommandObjectMul
                                                const char *name,
                                                const char *help,
                                                const char *syntax,
-                                               uint32_t flags) :
-    CommandObject (interpreter, name, help, syntax, flags),
-    m_can_be_removed(false)
-{
-}
+                                               uint32_t flags)
+    : CommandObject(interpreter, name, help, syntax, flags),
+      m_can_be_removed(false) {}
 
 CommandObjectMultiword::~CommandObjectMultiword() = default;
 
-CommandObjectSP
-CommandObjectMultiword::GetSubcommandSP (const char *sub_cmd, StringList *matches)
-{
-    CommandObjectSP return_cmd_sp;
-    CommandObject::CommandMap::iterator pos;
-
-    if (!m_subcommand_dict.empty())
-    {
-        pos = m_subcommand_dict.find (sub_cmd);
-        if (pos != m_subcommand_dict.end()) {
-            // An exact match; append the sub_cmd to the 'matches' string list.
-            if (matches)
-                matches->AppendString(sub_cmd);
-            return_cmd_sp = pos->second;
-        }
-        else
-        {
-            StringList local_matches;
-            if (matches == nullptr)
-                matches = &local_matches;
-            int num_matches = AddNamesMatchingPartialString (m_subcommand_dict, sub_cmd, *matches);
-
-            if (num_matches == 1)
-            {
-                // Cleaner, but slightly less efficient would be to call back into this function, since I now
-                // know I have an exact match...
-
-                sub_cmd = matches->GetStringAtIndex(0);
-                pos = m_subcommand_dict.find(sub_cmd);
-                if (pos != m_subcommand_dict.end())
-                    return_cmd_sp = pos->second;
-            }
-        }
+CommandObjectSP CommandObjectMultiword::GetSubcommandSP(const char *sub_cmd,
+                                                        StringList *matches) {
+  CommandObjectSP return_cmd_sp;
+  CommandObject::CommandMap::iterator pos;
+
+  if (!m_subcommand_dict.empty()) {
+    pos = m_subcommand_dict.find(sub_cmd);
+    if (pos != m_subcommand_dict.end()) {
+      // An exact match; append the sub_cmd to the 'matches' string list.
+      if (matches)
+        matches->AppendString(sub_cmd);
+      return_cmd_sp = pos->second;
+    } else {
+      StringList local_matches;
+      if (matches == nullptr)
+        matches = &local_matches;
+      int num_matches =
+          AddNamesMatchingPartialString(m_subcommand_dict, sub_cmd, *matches);
+
+      if (num_matches == 1) {
+        // Cleaner, but slightly less efficient would be to call back into this
+        // function, since I now
+        // know I have an exact match...
+
+        sub_cmd = matches->GetStringAtIndex(0);
+        pos = m_subcommand_dict.find(sub_cmd);
+        if (pos != m_subcommand_dict.end())
+          return_cmd_sp = pos->second;
+      }
     }
-    return return_cmd_sp;
+  }
+  return return_cmd_sp;
 }
 
 CommandObject *
-CommandObjectMultiword::GetSubcommandObject (const char *sub_cmd, StringList *matches)
-{
-    return GetSubcommandSP(sub_cmd, matches).get();
-}
-
-bool
-CommandObjectMultiword::LoadSubCommand(const char *name,
-                                       const CommandObjectSP& cmd_obj)
-{
-    if (cmd_obj)
-        assert((&GetCommandInterpreter() == &cmd_obj->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter");
-    
-    CommandMap::iterator pos;
-    bool success = true;
-
-    pos = m_subcommand_dict.find(name);
-    if (pos == m_subcommand_dict.end())
-    {
-        m_subcommand_dict[name] = cmd_obj;
+CommandObjectMultiword::GetSubcommandObject(const char *sub_cmd,
+                                            StringList *matches) {
+  return GetSubcommandSP(sub_cmd, matches).get();
+}
+
+bool CommandObjectMultiword::LoadSubCommand(const char *name,
+                                            const CommandObjectSP &cmd_obj) {
+  if (cmd_obj)
+    assert((&GetCommandInterpreter() == &cmd_obj->GetCommandInterpreter()) &&
+           "tried to add a CommandObject from a different interpreter");
+
+  CommandMap::iterator pos;
+  bool success = true;
+
+  pos = m_subcommand_dict.find(name);
+  if (pos == m_subcommand_dict.end()) {
+    m_subcommand_dict[name] = cmd_obj;
+  } else
+    success = false;
+
+  return success;
+}
+
+bool CommandObjectMultiword::Execute(const char *args_string,
+                                     CommandReturnObject &result) {
+  Args args(args_string);
+  const size_t argc = args.GetArgumentCount();
+  if (argc == 0) {
+    this->CommandObject::GenerateHelpText(result);
+  } else {
+    const char *sub_command = args.GetArgumentAtIndex(0);
+
+    if (sub_command) {
+      if (::strcasecmp(sub_command, "help") == 0) {
+        this->CommandObject::GenerateHelpText(result);
+      } else if (!m_subcommand_dict.empty()) {
+        StringList matches;
+        CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
+        if (sub_cmd_obj != nullptr) {
+          // Now call CommandObject::Execute to process and options in
+          // 'rest_of_line'.  From there
+          // the command-specific version of Execute will be called, with the
+          // processed arguments.
+
+          args.Shift();
+
+          sub_cmd_obj->Execute(args_string, result);
+        } else {
+          std::string error_msg;
+          const size_t num_subcmd_matches = matches.GetSize();
+          if (num_subcmd_matches > 0)
+            error_msg.assign("ambiguous command ");
+          else
+            error_msg.assign("invalid command ");
+
+          error_msg.append("'");
+          error_msg.append(GetCommandName());
+          error_msg.append(" ");
+          error_msg.append(sub_command);
+          error_msg.append("'.");
+
+          if (num_subcmd_matches > 0) {
+            error_msg.append(" Possible completions:");
+            for (size_t i = 0; i < num_subcmd_matches; i++) {
+              error_msg.append("\n\t");
+              error_msg.append(matches.GetStringAtIndex(i));
+            }
+          }
+          error_msg.append("\n");
+          result.AppendRawError(error_msg.c_str());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        result.AppendErrorWithFormat("'%s' does not have any subcommands.\n",
+                                     GetCommandName());
+        result.SetStatus(eReturnStatusFailed);
+      }
     }
-    else
-        success = false;
+  }
 
-    return success;
+  return result.Succeeded();
 }
 
-bool
-CommandObjectMultiword::Execute(const char *args_string, CommandReturnObject &result)
-{
-    Args args (args_string);
-    const size_t argc = args.GetArgumentCount();
-    if (argc == 0)
-    {
-        this->CommandObject::GenerateHelpText (result);
-    }
-    else
-    {
-        const char *sub_command = args.GetArgumentAtIndex (0);
-
-        if (sub_command)
-        {
-            if (::strcasecmp (sub_command, "help") == 0)
-            {
-                this->CommandObject::GenerateHelpText (result);
-            }
-            else if (!m_subcommand_dict.empty())
-            {
-                StringList matches;
-                CommandObject *sub_cmd_obj = GetSubcommandObject(sub_command, &matches);
-                if (sub_cmd_obj != nullptr)
-                {
-                    // Now call CommandObject::Execute to process and options in 'rest_of_line'.  From there
-                    // the command-specific version of Execute will be called, with the processed arguments.
-
-                    args.Shift();
-
-                    sub_cmd_obj->Execute (args_string, result);
-                }
-                else
-                {
-                    std::string error_msg;
-                    const size_t num_subcmd_matches = matches.GetSize();
-                    if (num_subcmd_matches > 0)
-                        error_msg.assign ("ambiguous command ");
-                    else
-                        error_msg.assign ("invalid command ");
-
-                    error_msg.append ("'");
-                    error_msg.append (GetCommandName());
-                    error_msg.append (" ");
-                    error_msg.append (sub_command);
-                    error_msg.append ("'.");
-
-                    if (num_subcmd_matches > 0)
-                    {
-                        error_msg.append (" Possible completions:");
-                        for (size_t i = 0; i < num_subcmd_matches; i++)
-                        {
-                            error_msg.append ("\n\t");
-                            error_msg.append (matches.GetStringAtIndex (i));
-                        }
-                    }
-                    error_msg.append ("\n");
-                    result.AppendRawError (error_msg.c_str());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("'%s' does not have any subcommands.\n", GetCommandName());
-                result.SetStatus (eReturnStatusFailed);
-            }
+void CommandObjectMultiword::GenerateHelpText(Stream &output_stream) {
+  // First time through here, generate the help text for the object and
+  // push it to the return result object as well
+
+  CommandObject::GenerateHelpText(output_stream);
+  output_stream.PutCString("\nThe following subcommands are supported:\n\n");
+
+  CommandMap::iterator pos;
+  uint32_t max_len = FindLongestCommandWord(m_subcommand_dict);
+
+  if (max_len)
+    max_len += 4; // Indent the output by 4 spaces.
+
+  for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos) {
+    std::string indented_command("    ");
+    indented_command.append(pos->first);
+    if (pos->second->WantsRawCommandString()) {
+      std::string help_text(pos->second->GetHelp());
+      help_text.append("  Expects 'raw' input (see 'help raw-input'.)");
+      m_interpreter.OutputFormattedHelpText(output_stream,
+                                            indented_command.c_str(), "--",
+                                            help_text.c_str(), max_len);
+    } else
+      m_interpreter.OutputFormattedHelpText(output_stream,
+                                            indented_command.c_str(), "--",
+                                            pos->second->GetHelp(), max_len);
+  }
+
+  output_stream.PutCString("\nFor more help on any particular subcommand, type "
+                           "'help <command> <subcommand>'.\n");
+}
+
+int CommandObjectMultiword::HandleCompletion(Args &input, int &cursor_index,
+                                             int &cursor_char_position,
+                                             int match_start_point,
+                                             int max_return_elements,
+                                             bool &word_complete,
+                                             StringList &matches) {
+  // Any of the command matches will provide a complete word, otherwise the
+  // individual
+  // completers will override this.
+  word_complete = true;
+
+  const char *arg0 = input.GetArgumentAtIndex(0);
+  if (cursor_index == 0) {
+    AddNamesMatchingPartialString(m_subcommand_dict, arg0, matches);
+
+    if (matches.GetSize() == 1 && matches.GetStringAtIndex(0) != nullptr &&
+        strcmp(arg0, matches.GetStringAtIndex(0)) == 0) {
+      StringList temp_matches;
+      CommandObject *cmd_obj = GetSubcommandObject(arg0, &temp_matches);
+      if (cmd_obj != nullptr) {
+        if (input.GetArgumentCount() == 1) {
+          word_complete = true;
+        } else {
+          matches.DeleteStringAtIndex(0);
+          input.Shift();
+          cursor_char_position = 0;
+          input.AppendArgument("");
+          return cmd_obj->HandleCompletion(
+              input, cursor_index, cursor_char_position, match_start_point,
+              max_return_elements, word_complete, matches);
         }
+      }
+    }
+    return matches.GetSize();
+  } else {
+    CommandObject *sub_command_object = GetSubcommandObject(arg0, &matches);
+    if (sub_command_object == nullptr) {
+      return matches.GetSize();
+    } else {
+      // Remove the one match that we got from calling GetSubcommandObject.
+      matches.DeleteStringAtIndex(0);
+      input.Shift();
+      cursor_index--;
+      return sub_command_object->HandleCompletion(
+          input, cursor_index, cursor_char_position, match_start_point,
+          max_return_elements, word_complete, matches);
     }
+  }
+}
 
-    return result.Succeeded();
+const char *CommandObjectMultiword::GetRepeatCommand(Args &current_command_args,
+                                                     uint32_t index) {
+  index++;
+  if (current_command_args.GetArgumentCount() <= index)
+    return nullptr;
+  CommandObject *sub_command_object =
+      GetSubcommandObject(current_command_args.GetArgumentAtIndex(index));
+  if (sub_command_object == nullptr)
+    return nullptr;
+  return sub_command_object->GetRepeatCommand(current_command_args, index);
 }
 
-void
-CommandObjectMultiword::GenerateHelpText (Stream &output_stream)
-{
-    // First time through here, generate the help text for the object and
-    // push it to the return result object as well
-
-    CommandObject::GenerateHelpText(output_stream);
-    output_stream.PutCString("\nThe following subcommands are supported:\n\n");
-
-    CommandMap::iterator pos;
-    uint32_t max_len = FindLongestCommandWord (m_subcommand_dict);
-
-    if (max_len)
-        max_len += 4; // Indent the output by 4 spaces.
-
-    for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos)
-    {
-        std::string indented_command ("    ");
-        indented_command.append (pos->first);
-        if (pos->second->WantsRawCommandString ())
-        {
-            std::string help_text (pos->second->GetHelp());
-            help_text.append("  Expects 'raw' input (see 'help raw-input'.)");
-            m_interpreter.OutputFormattedHelpText (output_stream,
-                                                   indented_command.c_str(),
-                                                   "--",
-                                                   help_text.c_str(),
-                                                   max_len);
-        }
-        else
-            m_interpreter.OutputFormattedHelpText (output_stream, 
-                                                   indented_command.c_str(),
-                                                   "--", 
-                                                   pos->second->GetHelp(), 
-                                                   max_len);
+void CommandObjectMultiword::AproposAllSubCommands(const char *prefix,
+                                                   const char *search_word,
+                                                   StringList &commands_found,
+                                                   StringList &commands_help) {
+  CommandObject::CommandMap::const_iterator pos;
+
+  for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos) {
+    const char *command_name = pos->first.c_str();
+    CommandObject *sub_cmd_obj = pos->second.get();
+    StreamString complete_command_name;
+
+    complete_command_name.Printf("%s %s", prefix, command_name);
+
+    if (sub_cmd_obj->HelpTextContainsWord(search_word)) {
+      commands_found.AppendString(complete_command_name.GetData());
+      commands_help.AppendString(sub_cmd_obj->GetHelp());
     }
 
-    output_stream.PutCString ("\nFor more help on any particular subcommand, type 'help <command> <subcommand>'.\n");
+    if (sub_cmd_obj->IsMultiwordObject())
+      sub_cmd_obj->AproposAllSubCommands(complete_command_name.GetData(),
+                                         search_word, commands_found,
+                                         commands_help);
+  }
 }
 
-int
-CommandObjectMultiword::HandleCompletion(Args &input,
-                                         int &cursor_index,
-                                         int &cursor_char_position,
-                                         int match_start_point,
-                                         int max_return_elements,
-                                         bool &word_complete,
-                                         StringList &matches)
-{
-    // Any of the command matches will provide a complete word, otherwise the individual
-    // completers will override this.
-    word_complete = true;
-    
-    const char *arg0 = input.GetArgumentAtIndex(0);
-    if (cursor_index == 0)
-    {
-        AddNamesMatchingPartialString (m_subcommand_dict,
-                                       arg0,
-                                       matches);
-
-        if (matches.GetSize() == 1
-            && matches.GetStringAtIndex(0) != nullptr
-            && strcmp (arg0, matches.GetStringAtIndex(0)) == 0)
-        {
-            StringList temp_matches;
-            CommandObject *cmd_obj = GetSubcommandObject (arg0,
-                                                          &temp_matches);
-            if (cmd_obj != nullptr)
-            {
-                if (input.GetArgumentCount() == 1)
-                {
-                    word_complete = true;
-                }
-                else
-                {
-                    matches.DeleteStringAtIndex (0);
-                    input.Shift();
-                    cursor_char_position = 0;
-                    input.AppendArgument ("");
-                    return cmd_obj->HandleCompletion (input,
-                                                      cursor_index,
-                                                      cursor_char_position,
-                                                      match_start_point,
-                                                      max_return_elements,
-                                                      word_complete,
-                                                      matches);
-                }
-            }
-        }
-        return matches.GetSize();
-    }
-    else
-    {
-        CommandObject *sub_command_object = GetSubcommandObject (arg0,
-                                                                 &matches);
-        if (sub_command_object == nullptr)
-        {
-            return matches.GetSize();
-        }
-        else
-        {
-            // Remove the one match that we got from calling GetSubcommandObject.
-            matches.DeleteStringAtIndex(0);
-            input.Shift();
-            cursor_index--;
-            return sub_command_object->HandleCompletion (input, 
-                                                         cursor_index, 
-                                                         cursor_char_position, 
-                                                         match_start_point,
-                                                         max_return_elements,
-                                                         word_complete,
-                                                         matches);
-        }
-    }
+CommandObjectProxy::CommandObjectProxy(CommandInterpreter &interpreter,
+                                       const char *name, const char *help,
+                                       const char *syntax, uint32_t flags)
+    : CommandObject(interpreter, name, help, syntax, flags) {}
+
+CommandObjectProxy::~CommandObjectProxy() = default;
+
+const char *CommandObjectProxy::GetHelpLong() {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GetHelpLong();
+  return nullptr;
 }
 
-const char *
-CommandObjectMultiword::GetRepeatCommand (Args &current_command_args, uint32_t index)
-{
-    index++;
-    if (current_command_args.GetArgumentCount() <= index)
-        return nullptr;
-    CommandObject *sub_command_object = GetSubcommandObject (current_command_args.GetArgumentAtIndex(index));
-    if (sub_command_object == nullptr)
-        return nullptr;
-    return sub_command_object->GetRepeatCommand(current_command_args, index);
+bool CommandObjectProxy::IsRemovable() const {
+  const CommandObject *proxy_command =
+      const_cast<CommandObjectProxy *>(this)->GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->IsRemovable();
+  return false;
 }
 
-void
-CommandObjectMultiword::AproposAllSubCommands (const char *prefix,
-                                               const char *search_word,
-                                               StringList &commands_found,
-                                               StringList &commands_help)
-{
-    CommandObject::CommandMap::const_iterator pos;
-
-    for (pos = m_subcommand_dict.begin(); pos != m_subcommand_dict.end(); ++pos)
-    {
-        const char * command_name = pos->first.c_str();
-        CommandObject *sub_cmd_obj = pos->second.get();
-        StreamString complete_command_name;
-        
-        complete_command_name.Printf ("%s %s", prefix, command_name);
-        
-        if (sub_cmd_obj->HelpTextContainsWord (search_word))
-        {
-            commands_found.AppendString (complete_command_name.GetData());
-            commands_help.AppendString (sub_cmd_obj->GetHelp());
-        }
-        
-        if (sub_cmd_obj->IsMultiwordObject())
-            sub_cmd_obj->AproposAllSubCommands (complete_command_name.GetData(),
-                                                search_word,
-                                                commands_found,
-                                                commands_help);
-    }
+bool CommandObjectProxy::IsMultiwordObject() {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->IsMultiwordObject();
+  return false;
 }
 
-CommandObjectProxy::CommandObjectProxy (CommandInterpreter &interpreter,
-                                        const char *name,
-                                        const char *help,
-                                        const char *syntax,
-                                        uint32_t flags) :
-    CommandObject (interpreter, name, help, syntax, flags)
-{
+CommandObjectMultiword *CommandObjectProxy::GetAsMultiwordCommand() {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GetAsMultiwordCommand();
+  return nullptr;
 }
 
-CommandObjectProxy::~CommandObjectProxy() = default;
+void CommandObjectProxy::GenerateHelpText(Stream &result) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GenerateHelpText(result);
+}
 
-const char *
-CommandObjectProxy::GetHelpLong ()
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GetHelpLong();
-    return nullptr;
+lldb::CommandObjectSP CommandObjectProxy::GetSubcommandSP(const char *sub_cmd,
+                                                          StringList *matches) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GetSubcommandSP(sub_cmd, matches);
+  return lldb::CommandObjectSP();
 }
 
-bool
-CommandObjectProxy::IsRemovable() const
-{
-    const CommandObject *proxy_command = const_cast<CommandObjectProxy *>(this)->GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->IsRemovable();
-    return false;
-}
-
-bool
-CommandObjectProxy::IsMultiwordObject ()
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->IsMultiwordObject();
-    return false;
-}
-
-CommandObjectMultiword*
-CommandObjectProxy::GetAsMultiwordCommand ()
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GetAsMultiwordCommand();
-    return nullptr;
+CommandObject *CommandObjectProxy::GetSubcommandObject(const char *sub_cmd,
+                                                       StringList *matches) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GetSubcommandObject(sub_cmd, matches);
+  return nullptr;
 }
 
-void
-CommandObjectProxy::GenerateHelpText (Stream &result)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GenerateHelpText(result);
+void CommandObjectProxy::AproposAllSubCommands(const char *prefix,
+                                               const char *search_word,
+                                               StringList &commands_found,
+                                               StringList &commands_help) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->AproposAllSubCommands(prefix, search_word,
+                                                commands_found, commands_help);
 }
 
-lldb::CommandObjectSP
-CommandObjectProxy::GetSubcommandSP (const char *sub_cmd, StringList *matches)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GetSubcommandSP(sub_cmd, matches);
-    return lldb::CommandObjectSP();
+bool CommandObjectProxy::LoadSubCommand(
+    const char *cmd_name, const lldb::CommandObjectSP &command_sp) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->LoadSubCommand(cmd_name, command_sp);
+  return false;
 }
 
-CommandObject *
-CommandObjectProxy::GetSubcommandObject (const char *sub_cmd, StringList *matches)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GetSubcommandObject(sub_cmd, matches);
-    return nullptr;
+bool CommandObjectProxy::WantsRawCommandString() {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->WantsRawCommandString();
+  return false;
 }
 
-void
-CommandObjectProxy::AproposAllSubCommands (const char *prefix,
-                                           const char *search_word,
-                                           StringList &commands_found,
-                                           StringList &commands_help)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->AproposAllSubCommands (prefix,
-                                                     search_word,
-                                                     commands_found,
-                                                     commands_help);
-}
-
-bool
-CommandObjectProxy::LoadSubCommand (const char *cmd_name,
-                                    const lldb::CommandObjectSP& command_sp)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->LoadSubCommand (cmd_name, command_sp);
-    return false;
-}
-
-bool
-CommandObjectProxy::WantsRawCommandString()
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->WantsRawCommandString();
-    return false;
-}
-
-bool
-CommandObjectProxy::WantsCompletion()
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->WantsCompletion();
-    return false;
-}
-
-Options *
-CommandObjectProxy::GetOptions ()
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GetOptions ();
-    return nullptr;
+bool CommandObjectProxy::WantsCompletion() {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->WantsCompletion();
+  return false;
 }
 
-int
-CommandObjectProxy::HandleCompletion (Args &input,
-                                      int &cursor_index,
-                                      int &cursor_char_position,
-                                      int match_start_point,
-                                      int max_return_elements,
-                                      bool &word_complete,
-                                      StringList &matches)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->HandleCompletion (input,
-                                                cursor_index,
-                                                cursor_char_position,
-                                                match_start_point,
-                                                max_return_elements,
-                                                word_complete,
-                                                matches);
-    matches.Clear();
-    return 0;
-}
-
-int
-CommandObjectProxy::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)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->HandleArgumentCompletion (input,
-                                                        cursor_index,
-                                                        cursor_char_position,
-                                                        opt_element_vector,
-                                                        match_start_point,
-                                                        max_return_elements,
-                                                        word_complete,
-                                                        matches);
-    matches.Clear();
-    return 0;
-}
-
-const char *
-CommandObjectProxy::GetRepeatCommand (Args &current_command_args,
-                                      uint32_t index)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->GetRepeatCommand (current_command_args, index);
-    return nullptr;
+Options *CommandObjectProxy::GetOptions() {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GetOptions();
+  return nullptr;
 }
 
-bool
-CommandObjectProxy::Execute (const char *args_string,
-                             CommandReturnObject &result)
-{
-    CommandObject *proxy_command = GetProxyCommandObject();
-    if (proxy_command)
-        return proxy_command->Execute (args_string, result);
-    result.AppendError ("command is not implemented");
-    result.SetStatus (eReturnStatusFailed);
-    return false;
+int CommandObjectProxy::HandleCompletion(Args &input, int &cursor_index,
+                                         int &cursor_char_position,
+                                         int match_start_point,
+                                         int max_return_elements,
+                                         bool &word_complete,
+                                         StringList &matches) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->HandleCompletion(
+        input, cursor_index, cursor_char_position, match_start_point,
+        max_return_elements, word_complete, matches);
+  matches.Clear();
+  return 0;
+}
+
+int CommandObjectProxy::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) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->HandleArgumentCompletion(
+        input, cursor_index, cursor_char_position, opt_element_vector,
+        match_start_point, max_return_elements, word_complete, matches);
+  matches.Clear();
+  return 0;
+}
+
+const char *CommandObjectProxy::GetRepeatCommand(Args &current_command_args,
+                                                 uint32_t index) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->GetRepeatCommand(current_command_args, index);
+  return nullptr;
+}
+
+bool CommandObjectProxy::Execute(const char *args_string,
+                                 CommandReturnObject &result) {
+  CommandObject *proxy_command = GetProxyCommandObject();
+  if (proxy_command)
+    return proxy_command->Execute(args_string, result);
+  result.AppendError("command is not implemented");
+  result.SetStatus(eReturnStatusFailed);
+  return false;
 }

Modified: lldb/trunk/source/Commands/CommandObjectPlatform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlatform.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlatform.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlatform.cpp Tue Sep  6 15:57:50 2016
@@ -32,39 +32,34 @@
 using namespace lldb;
 using namespace lldb_private;
 
-static mode_t
-ParsePermissionString(const char* permissions)
-{
-    if (strlen(permissions) != 9)
-        return (mode_t)(-1);
-    bool user_r,user_w,user_x,
-    group_r,group_w,group_x,
-    world_r,world_w,world_x;
-    
-    user_r = (permissions[0] == 'r');
-    user_w = (permissions[1] == 'w');
-    user_x = (permissions[2] == 'x');
-    
-    group_r = (permissions[3] == 'r');
-    group_w = (permissions[4] == 'w');
-    group_x = (permissions[5] == 'x');
-    
-    world_r = (permissions[6] == 'r');
-    world_w = (permissions[7] == 'w');
-    world_x = (permissions[8] == 'x');
-    
-    mode_t user,group,world;
-    user = (user_r ? 4 : 0) | (user_w ? 2 : 0) | (user_x ? 1 : 0);
-    group = (group_r ? 4 : 0) | (group_w ? 2 : 0) | (group_x ? 1 : 0);
-    world = (world_r ? 4 : 0) | (world_w ? 2 : 0) | (world_x ? 1 : 0);
-    
-    return user | group | world;
+static mode_t ParsePermissionString(const char *permissions) {
+  if (strlen(permissions) != 9)
+    return (mode_t)(-1);
+  bool user_r, user_w, user_x, group_r, group_w, group_x, world_r, world_w,
+      world_x;
+
+  user_r = (permissions[0] == 'r');
+  user_w = (permissions[1] == 'w');
+  user_x = (permissions[2] == 'x');
+
+  group_r = (permissions[3] == 'r');
+  group_w = (permissions[4] == 'w');
+  group_x = (permissions[5] == 'x');
+
+  world_r = (permissions[6] == 'r');
+  world_w = (permissions[7] == 'w');
+  world_x = (permissions[8] == 'x');
+
+  mode_t user, group, world;
+  user = (user_r ? 4 : 0) | (user_w ? 2 : 0) | (user_x ? 1 : 0);
+  group = (group_r ? 4 : 0) | (group_w ? 2 : 0) | (group_x ? 1 : 0);
+  world = (world_r ? 4 : 0) | (world_w ? 2 : 0) | (world_x ? 1 : 0);
+
+  return user | group | world;
 }
 
-static OptionDefinition
-g_permissions_options[] =
-{
-  // clang-format off
+static OptionDefinition g_permissions_options[] = {
+    // clang-format off
   {LLDB_OPT_SET_ALL, false, "permissions-value",   'v', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePermissionsNumber, "Give out the numeric value for permissions (e.g. 757)"},
   {LLDB_OPT_SET_ALL, false, "permissions-string",  's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePermissionsString, "Give out the string value for permissions (e.g. rwxr-xr--)."},
   {LLDB_OPT_SET_ALL, false, "user-read",           'r', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,              "Allow user to read."},
@@ -76,1549 +71,1334 @@ g_permissions_options[] =
   {LLDB_OPT_SET_ALL, false, "world-read",          'd', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,              "Allow world to read."},
   {LLDB_OPT_SET_ALL, false, "world-write",         't', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,              "Allow world to write."},
   {LLDB_OPT_SET_ALL, false, "world-exec",          'e', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,              "Allow world to execute."},
-  // clang-format on
+    // clang-format on
 };
 
-class OptionPermissions : public lldb_private::OptionGroup
-{
+class OptionPermissions : public lldb_private::OptionGroup {
 public:
-    OptionPermissions ()
-    {
-    }
+  OptionPermissions() {}
 
-    ~OptionPermissions() override = default;
+  ~OptionPermissions() override = default;
 
-    lldb_private::Error
-    SetOptionValue(uint32_t option_idx,
-                   const char *option_arg,
-                   ExecutionContext *execution_context) override
-    {
-        Error error;
-        char short_option = (char) GetDefinitions()[option_idx].short_option;
-        switch (short_option)
-        {
-            case 'v':
-            {
-                bool ok;
-                uint32_t perms = StringConvert::ToUInt32(option_arg, 777, 8, &ok);
-                if (!ok)
-                    error.SetErrorStringWithFormat("invalid value for permissions: %s", option_arg);
-                else
-                    m_permissions = perms;
-            }
-                break;
-            case 's':
-            {
-                mode_t perms = ParsePermissionString(option_arg);
-                if (perms == (mode_t)-1)
-                    error.SetErrorStringWithFormat("invalid value for permissions: %s", option_arg);
-                else
-                    m_permissions = perms;
-            }
-                break;
-            case 'r':
-                m_permissions |= lldb::eFilePermissionsUserRead;
-                break;
-            case 'w':
-                m_permissions |= lldb::eFilePermissionsUserWrite;
-                break;
-            case 'x':
-                m_permissions |= lldb::eFilePermissionsUserExecute;
-                break;
-            case 'R':
-                m_permissions |= lldb::eFilePermissionsGroupRead;
-                break;
-            case 'W':
-                m_permissions |= lldb::eFilePermissionsGroupWrite;
-                break;
-            case 'X':
-                m_permissions |= lldb::eFilePermissionsGroupExecute;
-                break;
-            case 'd':
-                m_permissions |= lldb::eFilePermissionsWorldRead;
-                break;
-            case 't':
-                m_permissions |= lldb::eFilePermissionsWorldWrite;
-                break;
-            case 'e':
-                m_permissions |= lldb::eFilePermissionsWorldExecute;
-                break;
-            default:
-                error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                break;
-        }
-        
-        return error;
-    }
-    
-    void
-    OptionParsingStarting(ExecutionContext *execution_context) override
-    {
-        m_permissions = 0;
-    }
-    
-    uint32_t
-    GetNumDefinitions () override
-    {
-        return llvm::array_lengthof(g_permissions_options);
-    }
-    
-    const lldb_private::OptionDefinition*
-    GetDefinitions () override
-    {
-        return g_permissions_options;
-    }
-        
-    // Instance variables to hold the values for command options.
-    
-    uint32_t m_permissions;
+  lldb_private::Error
+  SetOptionValue(uint32_t option_idx, const char *option_arg,
+                 ExecutionContext *execution_context) override {
+    Error error;
+    char short_option = (char)GetDefinitions()[option_idx].short_option;
+    switch (short_option) {
+    case 'v': {
+      bool ok;
+      uint32_t perms = StringConvert::ToUInt32(option_arg, 777, 8, &ok);
+      if (!ok)
+        error.SetErrorStringWithFormat("invalid value for permissions: %s",
+                                       option_arg);
+      else
+        m_permissions = perms;
+    } break;
+    case 's': {
+      mode_t perms = ParsePermissionString(option_arg);
+      if (perms == (mode_t)-1)
+        error.SetErrorStringWithFormat("invalid value for permissions: %s",
+                                       option_arg);
+      else
+        m_permissions = perms;
+    } break;
+    case 'r':
+      m_permissions |= lldb::eFilePermissionsUserRead;
+      break;
+    case 'w':
+      m_permissions |= lldb::eFilePermissionsUserWrite;
+      break;
+    case 'x':
+      m_permissions |= lldb::eFilePermissionsUserExecute;
+      break;
+    case 'R':
+      m_permissions |= lldb::eFilePermissionsGroupRead;
+      break;
+    case 'W':
+      m_permissions |= lldb::eFilePermissionsGroupWrite;
+      break;
+    case 'X':
+      m_permissions |= lldb::eFilePermissionsGroupExecute;
+      break;
+    case 'd':
+      m_permissions |= lldb::eFilePermissionsWorldRead;
+      break;
+    case 't':
+      m_permissions |= lldb::eFilePermissionsWorldWrite;
+      break;
+    case 'e':
+      m_permissions |= lldb::eFilePermissionsWorldExecute;
+      break;
+    default:
+      error.SetErrorStringWithFormat("unrecognized option '%c'", short_option);
+      break;
+    }
+
+    return error;
+  }
+
+  void OptionParsingStarting(ExecutionContext *execution_context) override {
+    m_permissions = 0;
+  }
+
+  uint32_t GetNumDefinitions() override {
+    return llvm::array_lengthof(g_permissions_options);
+  }
+
+  const lldb_private::OptionDefinition *GetDefinitions() override {
+    return g_permissions_options;
+  }
+
+  // Instance variables to hold the values for command options.
+
+  uint32_t m_permissions;
 
 private:
-    DISALLOW_COPY_AND_ASSIGN(OptionPermissions);
+  DISALLOW_COPY_AND_ASSIGN(OptionPermissions);
 };
 
 //----------------------------------------------------------------------
 // "platform select <platform-name>"
 //----------------------------------------------------------------------
-class CommandObjectPlatformSelect : public CommandObjectParsed
-{
+class CommandObjectPlatformSelect : public CommandObjectParsed {
 public:
-    CommandObjectPlatformSelect (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter, 
-                             "platform select",
-                             "Create a platform if needed and select it as the current platform.",
-                             "platform select <platform-name>",
-                             0),
-        m_option_group (),
-        m_platform_options (false) // Don't include the "--platform" option by passing false
-    {
-        m_option_group.Append (&m_platform_options, LLDB_OPT_SET_ALL, 1);
-        m_option_group.Finalize();
-    }
-
-    ~CommandObjectPlatformSelect() override = default;
-
-    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
-    {
-        std::string completion_str (input.GetArgumentAtIndex(cursor_index));
-        completion_str.erase (cursor_char_position);
-        
-        CommandCompletions::PlatformPluginNames(GetCommandInterpreter(),
-                                                completion_str.c_str(),
-                                                match_start_point,
-                                                max_return_elements,
-                                                nullptr,
-                                                word_complete,
-                                                matches);
-        return matches.GetSize();
-    }
+  CommandObjectPlatformSelect(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform select",
+                            "Create a platform if needed and select it as the "
+                            "current platform.",
+                            "platform select <platform-name>", 0),
+        m_option_group(),
+        m_platform_options(
+            false) // Don't include the "--platform" option by passing false
+  {
+    m_option_group.Append(&m_platform_options, LLDB_OPT_SET_ALL, 1);
+    m_option_group.Finalize();
+  }
+
+  ~CommandObjectPlatformSelect() override = default;
+
+  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 {
+    std::string completion_str(input.GetArgumentAtIndex(cursor_index));
+    completion_str.erase(cursor_char_position);
+
+    CommandCompletions::PlatformPluginNames(
+        GetCommandInterpreter(), completion_str.c_str(), match_start_point,
+        max_return_elements, nullptr, word_complete, matches);
+    return matches.GetSize();
+  }
 
-    Options *
-    GetOptions () override
-    {
-        return &m_option_group;
-    }
+  Options *GetOptions() override { return &m_option_group; }
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        if (args.GetArgumentCount() == 1)
-        {
-            const char *platform_name = args.GetArgumentAtIndex (0);
-            if (platform_name && platform_name[0])
-            {
-                const bool select = true;
-                m_platform_options.SetPlatformName (platform_name);
-                Error error;
-                ArchSpec platform_arch;
-                PlatformSP platform_sp (m_platform_options.CreatePlatformWithOptions (m_interpreter, ArchSpec(), select, error, platform_arch));
-                if (platform_sp)
-                {
-                    m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
-
-                    platform_sp->GetStatus (result.GetOutputStream());
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.AppendError(error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            else
-            {
-                result.AppendError ("invalid platform name");
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("platform create takes a platform name as an argument\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    if (args.GetArgumentCount() == 1) {
+      const char *platform_name = args.GetArgumentAtIndex(0);
+      if (platform_name && platform_name[0]) {
+        const bool select = true;
+        m_platform_options.SetPlatformName(platform_name);
+        Error error;
+        ArchSpec platform_arch;
+        PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions(
+            m_interpreter, ArchSpec(), select, error, platform_arch));
+        if (platform_sp) {
+          m_interpreter.GetDebugger().GetPlatformList().SetSelectedPlatform(
+              platform_sp);
+
+          platform_sp->GetStatus(result.GetOutputStream());
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.AppendError(error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        result.AppendError("invalid platform name");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError(
+          "platform create takes a platform name as an argument\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 
-    OptionGroupOptions m_option_group;
-    OptionGroupPlatform m_platform_options;
+  OptionGroupOptions m_option_group;
+  OptionGroupPlatform m_platform_options;
 };
 
 //----------------------------------------------------------------------
 // "platform list"
 //----------------------------------------------------------------------
-class CommandObjectPlatformList : public CommandObjectParsed
-{
+class CommandObjectPlatformList : public CommandObjectParsed {
 public:
-    CommandObjectPlatformList (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform list",
-                            "List all platforms that are available.",
-                            nullptr,
-                            0)
-    {
-    }
+  CommandObjectPlatformList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform list",
+                            "List all platforms that are available.", nullptr,
+                            0) {}
 
-    ~CommandObjectPlatformList() override = default;
+  ~CommandObjectPlatformList() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        Stream &ostrm = result.GetOutputStream();
-        ostrm.Printf("Available platforms:\n");
-        
-        PlatformSP host_platform_sp (Platform::GetHostPlatform());
-        ostrm.Printf ("%s: %s\n", 
-                      host_platform_sp->GetPluginName().GetCString(),
-                      host_platform_sp->GetDescription());
-
-        uint32_t idx;
-        for (idx = 0; 1; ++idx)
-        {
-            const char *plugin_name = PluginManager::GetPlatformPluginNameAtIndex (idx);
-            if (plugin_name == nullptr)
-                break;
-            const char *plugin_desc = PluginManager::GetPlatformPluginDescriptionAtIndex (idx);
-            if (plugin_desc == nullptr)
-                break;
-            ostrm.Printf("%s: %s\n", plugin_name, plugin_desc);
-        }
-        
-        if (idx == 0)
-        {
-            result.AppendError ("no platforms are available\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        else
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        return result.Succeeded();
-    }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    Stream &ostrm = result.GetOutputStream();
+    ostrm.Printf("Available platforms:\n");
+
+    PlatformSP host_platform_sp(Platform::GetHostPlatform());
+    ostrm.Printf("%s: %s\n", host_platform_sp->GetPluginName().GetCString(),
+                 host_platform_sp->GetDescription());
+
+    uint32_t idx;
+    for (idx = 0; 1; ++idx) {
+      const char *plugin_name =
+          PluginManager::GetPlatformPluginNameAtIndex(idx);
+      if (plugin_name == nullptr)
+        break;
+      const char *plugin_desc =
+          PluginManager::GetPlatformPluginDescriptionAtIndex(idx);
+      if (plugin_desc == nullptr)
+        break;
+      ostrm.Printf("%s: %s\n", plugin_name, plugin_desc);
+    }
+
+    if (idx == 0) {
+      result.AppendError("no platforms are available\n");
+      result.SetStatus(eReturnStatusFailed);
+    } else
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform status"
 //----------------------------------------------------------------------
-class CommandObjectPlatformStatus : public CommandObjectParsed
-{
+class CommandObjectPlatformStatus : public CommandObjectParsed {
 public:
-    CommandObjectPlatformStatus(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "platform status", "Display status for the current platform.", nullptr, 0)
-    {
-    }
+  CommandObjectPlatformStatus(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform status",
+                            "Display status for the current platform.", nullptr,
+                            0) {}
 
-    ~CommandObjectPlatformStatus() override = default;
+  ~CommandObjectPlatformStatus() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        Stream &ostrm = result.GetOutputStream();      
-        
-        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-        PlatformSP platform_sp;
-        if (target)
-        {
-            platform_sp = target->GetPlatform();
-        }
-        if (!platform_sp)
-        {
-            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
-        }
-        if (platform_sp)
-        {
-            platform_sp->GetStatus (ostrm);
-            result.SetStatus (eReturnStatusSuccessFinishResult);            
-        }
-        else
-        {
-            result.AppendError ("no platform us currently selected\n");
-            result.SetStatus (eReturnStatusFailed);            
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    Stream &ostrm = result.GetOutputStream();
+
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+    PlatformSP platform_sp;
+    if (target) {
+      platform_sp = target->GetPlatform();
+    }
+    if (!platform_sp) {
+      platform_sp =
+          m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+    }
+    if (platform_sp) {
+      platform_sp->GetStatus(ostrm);
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendError("no platform us currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform connect <connect-url>"
 //----------------------------------------------------------------------
-class CommandObjectPlatformConnect : public CommandObjectParsed
-{
+class CommandObjectPlatformConnect : public CommandObjectParsed {
 public:
-    CommandObjectPlatformConnect(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "platform connect",
-                              "Select the current platform by providing a connection URL.",
-                              "platform connect <connect-url>", 0)
-    {
-    }
+  CommandObjectPlatformConnect(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "platform connect",
+            "Select the current platform by providing a connection URL.",
+            "platform connect <connect-url>", 0) {}
 
-    ~CommandObjectPlatformConnect() override = default;
+  ~CommandObjectPlatformConnect() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        Stream &ostrm = result.GetOutputStream();      
-        
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            Error error (platform_sp->ConnectRemote (args));
-            if (error.Success())
-            {
-                platform_sp->GetStatus (ostrm);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-
-                platform_sp->ConnectToWaitingProcesses(m_interpreter.GetDebugger(), error);
-                if (error.Fail())
-                {
-                    result.AppendError (error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("%s\n", error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform is currently selected\n");
-            result.SetStatus (eReturnStatusFailed);            
-        }
-        return result.Succeeded();
-    }
-    
-    Options *
-    GetOptions () override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        OptionGroupOptions* m_platform_options = nullptr;
-        if (platform_sp)
-        {
-            m_platform_options = platform_sp->GetConnectionOptions(m_interpreter);
-            if (m_platform_options != nullptr && !m_platform_options->m_did_finalize)
-                m_platform_options->Finalize();
-        }
-        return m_platform_options;
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    Stream &ostrm = result.GetOutputStream();
+
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      Error error(platform_sp->ConnectRemote(args));
+      if (error.Success()) {
+        platform_sp->GetStatus(ostrm);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+
+        platform_sp->ConnectToWaitingProcesses(m_interpreter.GetDebugger(),
+                                               error);
+        if (error.Fail()) {
+          result.AppendError(error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        result.AppendErrorWithFormat("%s\n", error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform is currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    OptionGroupOptions *m_platform_options = nullptr;
+    if (platform_sp) {
+      m_platform_options = platform_sp->GetConnectionOptions(m_interpreter);
+      if (m_platform_options != nullptr && !m_platform_options->m_did_finalize)
+        m_platform_options->Finalize();
     }
+    return m_platform_options;
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform disconnect"
 //----------------------------------------------------------------------
-class CommandObjectPlatformDisconnect : public CommandObjectParsed
-{
+class CommandObjectPlatformDisconnect : public CommandObjectParsed {
 public:
-    CommandObjectPlatformDisconnect(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "platform disconnect", "Disconnect from the current platform.",
-                              "platform disconnect", 0)
-    {
-    }
+  CommandObjectPlatformDisconnect(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform disconnect",
+                            "Disconnect from the current platform.",
+                            "platform disconnect", 0) {}
 
-    ~CommandObjectPlatformDisconnect() override = default;
+  ~CommandObjectPlatformDisconnect() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            if (args.GetArgumentCount() == 0)
-            {
-                Error error;
-                
-                if (platform_sp->IsConnected())
-                {
-                    // Cache the instance name if there is one since we are 
-                    // about to disconnect and the name might go with it.
-                    const char *hostname_cstr = platform_sp->GetHostname();
-                    std::string hostname;
-                    if (hostname_cstr)
-                        hostname.assign (hostname_cstr);
-
-                    error = platform_sp->DisconnectRemote ();
-                    if (error.Success())
-                    {
-                        Stream &ostrm = result.GetOutputStream();      
-                        if (hostname.empty())
-                            ostrm.Printf ("Disconnected from \"%s\"\n", platform_sp->GetPluginName().GetCString());
-                        else
-                            ostrm.Printf ("Disconnected from \"%s\"\n", hostname.c_str());
-                        result.SetStatus (eReturnStatusSuccessFinishResult);            
-                    }
-                    else
-                    {
-                        result.AppendErrorWithFormat ("%s", error.AsCString());
-                        result.SetStatus (eReturnStatusFailed);            
-                    }
-                }
-                else
-                {
-                    // Not connected...
-                    result.AppendErrorWithFormat ("not connected to '%s'", platform_sp->GetPluginName().GetCString());
-                    result.SetStatus (eReturnStatusFailed);            
-                }
-            }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      if (args.GetArgumentCount() == 0) {
+        Error error;
+
+        if (platform_sp->IsConnected()) {
+          // Cache the instance name if there is one since we are
+          // about to disconnect and the name might go with it.
+          const char *hostname_cstr = platform_sp->GetHostname();
+          std::string hostname;
+          if (hostname_cstr)
+            hostname.assign(hostname_cstr);
+
+          error = platform_sp->DisconnectRemote();
+          if (error.Success()) {
+            Stream &ostrm = result.GetOutputStream();
+            if (hostname.empty())
+              ostrm.Printf("Disconnected from \"%s\"\n",
+                           platform_sp->GetPluginName().GetCString());
             else
-            {
-                // Bad args
-                result.AppendError ("\"platform disconnect\" doesn't take any arguments");
-                result.SetStatus (eReturnStatusFailed);            
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform is currently selected");
-            result.SetStatus (eReturnStatusFailed);            
-        }
-        return result.Succeeded();
+              ostrm.Printf("Disconnected from \"%s\"\n", hostname.c_str());
+            result.SetStatus(eReturnStatusSuccessFinishResult);
+          } else {
+            result.AppendErrorWithFormat("%s", error.AsCString());
+            result.SetStatus(eReturnStatusFailed);
+          }
+        } else {
+          // Not connected...
+          result.AppendErrorWithFormat(
+              "not connected to '%s'",
+              platform_sp->GetPluginName().GetCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        // Bad args
+        result.AppendError(
+            "\"platform disconnect\" doesn't take any arguments");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform is currently selected");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform settings"
 //----------------------------------------------------------------------
-class CommandObjectPlatformSettings : public CommandObjectParsed
-{
+class CommandObjectPlatformSettings : public CommandObjectParsed {
 public:
-    CommandObjectPlatformSettings (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "platform settings",
-                             "Set settings for the current target's platform, or for a platform by name.",
-                             "platform settings",
-                             0),
+  CommandObjectPlatformSettings(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform settings",
+                            "Set settings for the current target's platform, "
+                            "or for a platform by name.",
+                            "platform settings", 0),
         m_options(),
-        m_option_working_dir (LLDB_OPT_SET_1, false, "working-dir", 'w', 0, eArgTypePath, "The working directory for the platform.")
-    {
-        m_options.Append (&m_option_working_dir, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
-    }
+        m_option_working_dir(LLDB_OPT_SET_1, false, "working-dir", 'w', 0,
+                             eArgTypePath,
+                             "The working directory for the platform.") {
+    m_options.Append(&m_option_working_dir, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
+  }
 
-    ~CommandObjectPlatformSettings() override = default;
+  ~CommandObjectPlatformSettings() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            if (m_option_working_dir.GetOptionValue().OptionWasSet())
-                platform_sp->SetWorkingDirectory(m_option_working_dir.GetOptionValue().GetCurrentValue());
-        }
-        else
-        {
-            result.AppendError ("no platform is currently selected");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
-    }
-    
-    Options *
-    GetOptions () override
-    {
-        if (!m_options.DidFinalize())
-            m_options.Finalize();
-        return &m_options;
-    }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      if (m_option_working_dir.GetOptionValue().OptionWasSet())
+        platform_sp->SetWorkingDirectory(
+            m_option_working_dir.GetOptionValue().GetCurrentValue());
+    } else {
+      result.AppendError("no platform is currently selected");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override {
+    if (!m_options.DidFinalize())
+      m_options.Finalize();
+    return &m_options;
+  }
 
 protected:
-    OptionGroupOptions m_options;
-    OptionGroupFile m_option_working_dir;
+  OptionGroupOptions m_options;
+  OptionGroupFile m_option_working_dir;
 };
 
 //----------------------------------------------------------------------
 // "platform mkdir"
 //----------------------------------------------------------------------
-class CommandObjectPlatformMkDir : public CommandObjectParsed
-{
+class CommandObjectPlatformMkDir : public CommandObjectParsed {
 public:
-    CommandObjectPlatformMkDir (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform mkdir",
-                            "Make a new directory on the remote end.",
-                            nullptr,
+  CommandObjectPlatformMkDir(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform mkdir",
+                            "Make a new directory on the remote end.", nullptr,
                             0),
-        m_options()
-    {
-    }
+        m_options() {}
 
-    ~CommandObjectPlatformMkDir() override = default;
+  ~CommandObjectPlatformMkDir() override = default;
 
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            std::string cmd_line;
-            args.GetCommandString(cmd_line);
-            uint32_t mode;
-            const OptionPermissions* options_permissions = (const OptionPermissions*)m_options.GetGroupWithOption('r');
-            if (options_permissions)
-                mode = options_permissions->m_permissions;
-            else
-                mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX | lldb::eFilePermissionsWorldRX;
-            Error error = platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode);
-            if (error.Success())
-            {
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendError(error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
-    }
-    
-    Options *
-    GetOptions () override
-    {
-        if (!m_options.DidFinalize())
-        {
-            m_options.Append(new OptionPermissions());
-            m_options.Finalize();
-        }
-        return &m_options;
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      std::string cmd_line;
+      args.GetCommandString(cmd_line);
+      uint32_t mode;
+      const OptionPermissions *options_permissions =
+          (const OptionPermissions *)m_options.GetGroupWithOption('r');
+      if (options_permissions)
+        mode = options_permissions->m_permissions;
+      else
+        mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX |
+               lldb::eFilePermissionsWorldRX;
+      Error error = platform_sp->MakeDirectory(FileSpec{cmd_line, false}, mode);
+      if (error.Success()) {
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override {
+    if (!m_options.DidFinalize()) {
+      m_options.Append(new OptionPermissions());
+      m_options.Finalize();
     }
+    return &m_options;
+  }
 
-    OptionGroupOptions m_options;
+  OptionGroupOptions m_options;
 };
 
 //----------------------------------------------------------------------
 // "platform fopen"
 //----------------------------------------------------------------------
-class CommandObjectPlatformFOpen : public CommandObjectParsed
-{
+class CommandObjectPlatformFOpen : public CommandObjectParsed {
 public:
-    CommandObjectPlatformFOpen (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform file open",
-                            "Open a file on the remote end.",
-                            nullptr,
-                            0),
-        m_options()
-    {
-    }
-
-    ~CommandObjectPlatformFOpen() override = default;
-
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            Error error;
-            std::string cmd_line;
-            args.GetCommandString(cmd_line);
-            mode_t perms;
-            const OptionPermissions* options_permissions = (const OptionPermissions*)m_options.GetGroupWithOption('r');
-            if (options_permissions)
-                perms = options_permissions->m_permissions;
-            else
-                perms = lldb::eFilePermissionsUserRW | lldb::eFilePermissionsGroupRW | lldb::eFilePermissionsWorldRead;
-            lldb::user_id_t fd = platform_sp->OpenFile(FileSpec(cmd_line.c_str(),false),
-                                                       File::eOpenOptionRead | File::eOpenOptionWrite |
-                                                       File::eOpenOptionAppend | File::eOpenOptionCanCreate,
-                                                       perms,
-                                                       error);
-            if (error.Success())
-            {
-                result.AppendMessageWithFormat("File Descriptor = %" PRIu64 "\n",fd);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendError(error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
-    }
-
-    Options *
-    GetOptions () override
-    {
-        if (!m_options.DidFinalize())
-        {
-            m_options.Append(new OptionPermissions());
-            m_options.Finalize();
-        }
-        return &m_options;
+  CommandObjectPlatformFOpen(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform file open",
+                            "Open a file on the remote end.", nullptr, 0),
+        m_options() {}
+
+  ~CommandObjectPlatformFOpen() override = default;
+
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      Error error;
+      std::string cmd_line;
+      args.GetCommandString(cmd_line);
+      mode_t perms;
+      const OptionPermissions *options_permissions =
+          (const OptionPermissions *)m_options.GetGroupWithOption('r');
+      if (options_permissions)
+        perms = options_permissions->m_permissions;
+      else
+        perms = lldb::eFilePermissionsUserRW | lldb::eFilePermissionsGroupRW |
+                lldb::eFilePermissionsWorldRead;
+      lldb::user_id_t fd = platform_sp->OpenFile(
+          FileSpec(cmd_line.c_str(), false),
+          File::eOpenOptionRead | File::eOpenOptionWrite |
+              File::eOpenOptionAppend | File::eOpenOptionCanCreate,
+          perms, error);
+      if (error.Success()) {
+        result.AppendMessageWithFormat("File Descriptor = %" PRIu64 "\n", fd);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override {
+    if (!m_options.DidFinalize()) {
+      m_options.Append(new OptionPermissions());
+      m_options.Finalize();
     }
+    return &m_options;
+  }
 
-    OptionGroupOptions m_options;
+  OptionGroupOptions m_options;
 };
 
 //----------------------------------------------------------------------
 // "platform fclose"
 //----------------------------------------------------------------------
-class CommandObjectPlatformFClose : public CommandObjectParsed
-{
+class CommandObjectPlatformFClose : public CommandObjectParsed {
 public:
-    CommandObjectPlatformFClose (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform file close",
-                            "Close a file on the remote end.",
-                            nullptr,
-                            0)
-    {
-    }
-
-    ~CommandObjectPlatformFClose() override = default;
-
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            std::string cmd_line;
-            args.GetCommandString(cmd_line);
-            const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
-            Error error;
-            bool success = platform_sp->CloseFile(fd, error);
-            if (success)
-            {
-                result.AppendMessageWithFormat("file %" PRIu64 " closed.\n", fd);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendError(error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  CommandObjectPlatformFClose(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform file close",
+                            "Close a file on the remote end.", nullptr, 0) {}
+
+  ~CommandObjectPlatformFClose() override = default;
+
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      std::string cmd_line;
+      args.GetCommandString(cmd_line);
+      const lldb::user_id_t fd =
+          StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
+      Error error;
+      bool success = platform_sp->CloseFile(fd, error);
+      if (success) {
+        result.AppendMessageWithFormat("file %" PRIu64 " closed.\n", fd);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform fread"
 //----------------------------------------------------------------------
-class CommandObjectPlatformFRead : public CommandObjectParsed
-{
+class CommandObjectPlatformFRead : public CommandObjectParsed {
 public:
-    CommandObjectPlatformFRead (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform file read",
-                            "Read data from a file on the remote end.",
-                            nullptr,
+  CommandObjectPlatformFRead(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform file read",
+                            "Read data from a file on the remote end.", nullptr,
                             0),
-        m_options()
-    {
-    }
+        m_options() {}
 
-    ~CommandObjectPlatformFRead() override = default;
+  ~CommandObjectPlatformFRead() override = default;
 
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            std::string cmd_line;
-            args.GetCommandString(cmd_line);
-            const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
-            std::string buffer(m_options.m_count,0);
-            Error error;
-            uint32_t retcode = platform_sp->ReadFile(fd, m_options.m_offset, &buffer[0], m_options.m_count, error);
-            result.AppendMessageWithFormat("Return = %d\n",retcode);
-            result.AppendMessageWithFormat("Data = \"%s\"\n",buffer.c_str());
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      std::string cmd_line;
+      args.GetCommandString(cmd_line);
+      const lldb::user_id_t fd =
+          StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
+      std::string buffer(m_options.m_count, 0);
+      Error error;
+      uint32_t retcode = platform_sp->ReadFile(
+          fd, m_options.m_offset, &buffer[0], m_options.m_count, error);
+      result.AppendMessageWithFormat("Return = %d\n", retcode);
+      result.AppendMessageWithFormat("Data = \"%s\"\n", buffer.c_str());
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override { return &m_options; }
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
 protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-        Options()
-        {
-        }
+  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;
+      char short_option = (char)m_getopt_table[option_idx].val;
+      bool success = false;
+
+      switch (short_option) {
+      case 'o':
+        m_offset = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
+        break;
+      case 'c':
+        m_count = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_offset = 0;
+      m_count = 1;
+    }
 
-        ~CommandOptions() override = default;
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            char short_option = (char) m_getopt_table[option_idx].val;
-            bool success = false;
-            
-            switch (short_option)
-            {
-                case 'o':
-                    m_offset = StringConvert::ToUInt32(option_arg, 0, 0, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
-                    break;
-                case 'c':
-                    m_count = StringConvert::ToUInt32(option_arg, 0, 0, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_offset = 0;
-            m_count = 1;
-        }
-        
-        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_offset;
-        uint32_t m_count;
-    };
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
 
-    CommandOptions m_options;
+    // Instance variables to hold the values for command options.
+
+    uint32_t m_offset;
+    uint32_t m_count;
+  };
+
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectPlatformFRead::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectPlatformFRead::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Offset into the file at which to start reading."},
   {LLDB_OPT_SET_1, false, "count",  'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeCount, "Number of bytes to read from the file."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //----------------------------------------------------------------------
 // "platform fwrite"
 //----------------------------------------------------------------------
-class CommandObjectPlatformFWrite : public CommandObjectParsed
-{
+class CommandObjectPlatformFWrite : public CommandObjectParsed {
 public:
-    CommandObjectPlatformFWrite (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform file write",
-                            "Write data to a file on the remote end.",
-                            nullptr,
+  CommandObjectPlatformFWrite(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform file write",
+                            "Write data to a file on the remote end.", nullptr,
                             0),
-        m_options()
-    {
-    }
+        m_options() {}
 
-    ~CommandObjectPlatformFWrite() override = default;
+  ~CommandObjectPlatformFWrite() override = default;
 
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            std::string cmd_line;
-            args.GetCommandString(cmd_line);
-            Error error;
-            const lldb::user_id_t fd = StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
-            uint32_t retcode = platform_sp->WriteFile (fd,
-                                                       m_options.m_offset,
-                                                       &m_options.m_data[0],
-                                                       m_options.m_data.size(),
-                                                       error);
-            result.AppendMessageWithFormat("Return = %d\n",retcode);
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      std::string cmd_line;
+      args.GetCommandString(cmd_line);
+      Error error;
+      const lldb::user_id_t fd =
+          StringConvert::ToUInt64(cmd_line.c_str(), UINT64_MAX);
+      uint32_t retcode =
+          platform_sp->WriteFile(fd, m_options.m_offset, &m_options.m_data[0],
+                                 m_options.m_data.size(), error);
+      result.AppendMessageWithFormat("Return = %d\n", retcode);
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override { return &m_options; }
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
 protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-        Options()
-        {
-        }
+  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;
+      char short_option = (char)m_getopt_table[option_idx].val;
+      bool success = false;
+
+      switch (short_option) {
+      case 'o':
+        m_offset = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
+        break;
+      case 'd':
+        m_data.assign(option_arg);
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_offset = 0;
+      m_data.clear();
+    }
 
-        ~CommandOptions() override = default;
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            char short_option = (char) m_getopt_table[option_idx].val;
-            bool success = false;
-            
-            switch (short_option)
-            {
-                case 'o':
-                    m_offset = StringConvert::ToUInt32(option_arg, 0, 0, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid offset: '%s'", option_arg);
-                    break;
-                case 'd':
-                    m_data.assign(option_arg);
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_offset = 0;
-            m_data.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.
-        
-        uint32_t m_offset;
-        std::string m_data;
-    };
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
 
-    CommandOptions m_options;
+    // Instance variables to hold the values for command options.
+
+    uint32_t m_offset;
+    std::string m_data;
+  };
+
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectPlatformFWrite::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectPlatformFWrite::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "offset", 'o', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Offset into the file at which to start reading."},
   {LLDB_OPT_SET_1, false, "data",   'd', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue, "Text to write to the file."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
-class CommandObjectPlatformFile : public CommandObjectMultiword
-{
+class CommandObjectPlatformFile : public CommandObjectMultiword {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectPlatformFile(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "platform file", "Commands to access files on the current platform.",
-                                 "platform file [open|close|read|write] ...")
-    {
-        LoadSubCommand ("open", CommandObjectSP (new CommandObjectPlatformFOpen  (interpreter)));
-        LoadSubCommand ("close", CommandObjectSP (new CommandObjectPlatformFClose  (interpreter)));
-        LoadSubCommand ("read", CommandObjectSP (new CommandObjectPlatformFRead  (interpreter)));
-        LoadSubCommand ("write", CommandObjectSP (new CommandObjectPlatformFWrite  (interpreter)));
-    }
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectPlatformFile(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(
+            interpreter, "platform file",
+            "Commands to access files on the current platform.",
+            "platform file [open|close|read|write] ...") {
+    LoadSubCommand(
+        "open", CommandObjectSP(new CommandObjectPlatformFOpen(interpreter)));
+    LoadSubCommand(
+        "close", CommandObjectSP(new CommandObjectPlatformFClose(interpreter)));
+    LoadSubCommand(
+        "read", CommandObjectSP(new CommandObjectPlatformFRead(interpreter)));
+    LoadSubCommand(
+        "write", CommandObjectSP(new CommandObjectPlatformFWrite(interpreter)));
+  }
 
-    ~CommandObjectPlatformFile() override = default;
+  ~CommandObjectPlatformFile() override = default;
 
 private:
-    //------------------------------------------------------------------
-    // For CommandObjectPlatform only
-    //------------------------------------------------------------------
-    DISALLOW_COPY_AND_ASSIGN (CommandObjectPlatformFile);
+  //------------------------------------------------------------------
+  // For CommandObjectPlatform only
+  //------------------------------------------------------------------
+  DISALLOW_COPY_AND_ASSIGN(CommandObjectPlatformFile);
 };
 
 //----------------------------------------------------------------------
 // "platform get-file remote-file-path host-file-path"
 //----------------------------------------------------------------------
-class CommandObjectPlatformGetFile : public CommandObjectParsed
-{
+class CommandObjectPlatformGetFile : public CommandObjectParsed {
 public:
-    CommandObjectPlatformGetFile (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "platform get-file",
-                         "Transfer a file from the remote end to the local host.",
-                         "platform get-file <remote-file-spec> <local-file-spec>",
-                         0)
-    {
-        SetHelpLong(
-R"(Examples:
+  CommandObjectPlatformGetFile(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "platform get-file",
+            "Transfer a file from the remote end to the local host.",
+            "platform get-file <remote-file-spec> <local-file-spec>", 0) {
+    SetHelpLong(
+        R"(Examples:
 
 (lldb) platform get-file /the/remote/file/path /the/local/file/path
 
-    Transfer a file from the remote end with file path /the/remote/file/path to the local host.)"
-        );
-
-        CommandArgumentEntry arg1, arg2;
-        CommandArgumentData file_arg_remote, file_arg_host;
-    
-        // Define the first (and only) variant of this arg.
-        file_arg_remote.arg_type = eArgTypeFilename;
-        file_arg_remote.arg_repetition = eArgRepeatPlain;
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (file_arg_remote);
-        
-        // Define the second (and only) variant of this arg.
-        file_arg_host.arg_type = eArgTypeFilename;
-        file_arg_host.arg_repetition = eArgRepeatPlain;
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (file_arg_host);
-
-        // Push the data for the first and the second arguments into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-    }
+    Transfer a file from the remote end with file path /the/remote/file/path to the local host.)");
 
-    ~CommandObjectPlatformGetFile() override = default;
+    CommandArgumentEntry arg1, arg2;
+    CommandArgumentData file_arg_remote, file_arg_host;
 
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        // If the number of arguments is incorrect, issue an error message.
-        if (args.GetArgumentCount() != 2)
-        {
-            result.GetErrorStream().Printf("error: required arguments missing; specify both the source and destination file paths\n");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            const char *remote_file_path = args.GetArgumentAtIndex(0);
-            const char *local_file_path = args.GetArgumentAtIndex(1);
-            Error error = platform_sp->GetFile(FileSpec(remote_file_path, false),
-                                               FileSpec(local_file_path, false));
-            if (error.Success())
-            {
-                result.AppendMessageWithFormat("successfully get-file from %s (remote) to %s (host)\n",
-                                               remote_file_path, local_file_path);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendMessageWithFormat("get-file failed: %s\n", error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+    // Define the first (and only) variant of this arg.
+    file_arg_remote.arg_type = eArgTypeFilename;
+    file_arg_remote.arg_repetition = eArgRepeatPlain;
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(file_arg_remote);
+
+    // Define the second (and only) variant of this arg.
+    file_arg_host.arg_type = eArgTypeFilename;
+    file_arg_host.arg_repetition = eArgRepeatPlain;
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(file_arg_host);
+
+    // Push the data for the first and the second arguments into the m_arguments
+    // vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+  }
+
+  ~CommandObjectPlatformGetFile() override = default;
+
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    // If the number of arguments is incorrect, issue an error message.
+    if (args.GetArgumentCount() != 2) {
+      result.GetErrorStream().Printf("error: required arguments missing; "
+                                     "specify both the source and destination "
+                                     "file paths\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      const char *remote_file_path = args.GetArgumentAtIndex(0);
+      const char *local_file_path = args.GetArgumentAtIndex(1);
+      Error error = platform_sp->GetFile(FileSpec(remote_file_path, false),
+                                         FileSpec(local_file_path, false));
+      if (error.Success()) {
+        result.AppendMessageWithFormat(
+            "successfully get-file from %s (remote) to %s (host)\n",
+            remote_file_path, local_file_path);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendMessageWithFormat("get-file failed: %s\n",
+                                       error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform get-size remote-file-path"
 //----------------------------------------------------------------------
-class CommandObjectPlatformGetSize : public CommandObjectParsed
-{
+class CommandObjectPlatformGetSize : public CommandObjectParsed {
 public:
-    CommandObjectPlatformGetSize (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "platform get-size",
-                         "Get the file size from the remote end.",
-                         "platform get-size <remote-file-spec>",
-                         0)
-    {
-        SetHelpLong(
-R"(Examples:
+  CommandObjectPlatformGetSize(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform get-size",
+                            "Get the file size from the remote end.",
+                            "platform get-size <remote-file-spec>", 0) {
+    SetHelpLong(
+        R"(Examples:
 
 (lldb) platform get-size /the/remote/file/path
 
-    Get the file size from the remote end with path /the/remote/file/path.)"
-        );
-
-        CommandArgumentEntry arg1;
-        CommandArgumentData file_arg_remote;
-    
-        // Define the first (and only) variant of this arg.
-        file_arg_remote.arg_type = eArgTypeFilename;
-        file_arg_remote.arg_repetition = eArgRepeatPlain;
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (file_arg_remote);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-    }
+    Get the file size from the remote end with path /the/remote/file/path.)");
 
-    ~CommandObjectPlatformGetSize() override = default;
+    CommandArgumentEntry arg1;
+    CommandArgumentData file_arg_remote;
 
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        // If the number of arguments is incorrect, issue an error message.
-        if (args.GetArgumentCount() != 1)
-        {
-            result.GetErrorStream().Printf("error: required argument missing; specify the source file path as the only argument\n");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            std::string remote_file_path(args.GetArgumentAtIndex(0));
-            user_id_t size = platform_sp->GetFileSize(FileSpec(remote_file_path.c_str(), false));
-            if (size != UINT64_MAX)
-            {
-                result.AppendMessageWithFormat("File size of %s (remote): %" PRIu64 "\n", remote_file_path.c_str(), size);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendMessageWithFormat("Error getting file size of %s (remote)\n", remote_file_path.c_str());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+    // Define the first (and only) variant of this arg.
+    file_arg_remote.arg_type = eArgTypeFilename;
+    file_arg_remote.arg_repetition = eArgRepeatPlain;
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(file_arg_remote);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+  }
+
+  ~CommandObjectPlatformGetSize() override = default;
+
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    // If the number of arguments is incorrect, issue an error message.
+    if (args.GetArgumentCount() != 1) {
+      result.GetErrorStream().Printf("error: required argument missing; "
+                                     "specify the source file path as the only "
+                                     "argument\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      std::string remote_file_path(args.GetArgumentAtIndex(0));
+      user_id_t size =
+          platform_sp->GetFileSize(FileSpec(remote_file_path.c_str(), false));
+      if (size != UINT64_MAX) {
+        result.AppendMessageWithFormat("File size of %s (remote): %" PRIu64
+                                       "\n",
+                                       remote_file_path.c_str(), size);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendMessageWithFormat(
+            "Error getting file size of %s (remote)\n",
+            remote_file_path.c_str());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform put-file"
 //----------------------------------------------------------------------
-class CommandObjectPlatformPutFile : public CommandObjectParsed
-{
+class CommandObjectPlatformPutFile : public CommandObjectParsed {
 public:
-    CommandObjectPlatformPutFile (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "platform put-file",
-                            "Transfer a file from this system to the remote end.",
-                            nullptr,
-                            0)
-    {
-    }
-
-    ~CommandObjectPlatformPutFile() override = default;
-
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        const char* src = args.GetArgumentAtIndex(0);
-        const char* dst = args.GetArgumentAtIndex(1);
-
-        FileSpec src_fs(src, true);
-        FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString(), false);
-
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            Error error (platform_sp->PutFile(src_fs, dst_fs));
-            if (error.Success())
-            {
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-            else
-            {
-                result.AppendError (error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform currently selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  CommandObjectPlatformPutFile(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "platform put-file",
+            "Transfer a file from this system to the remote end.", nullptr, 0) {
+  }
+
+  ~CommandObjectPlatformPutFile() override = default;
+
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    const char *src = args.GetArgumentAtIndex(0);
+    const char *dst = args.GetArgumentAtIndex(1);
+
+    FileSpec src_fs(src, true);
+    FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString(), false);
+
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      Error error(platform_sp->PutFile(src_fs, dst_fs));
+      if (error.Success()) {
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform currently selected\n");
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
 // "platform process launch"
 //----------------------------------------------------------------------
-class CommandObjectPlatformProcessLaunch : public CommandObjectParsed
-{
+class CommandObjectPlatformProcessLaunch : public CommandObjectParsed {
 public:
-    CommandObjectPlatformProcessLaunch (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "platform process launch",
-                             "Launch a new process on a remote platform.",
-                             "platform process launch program",
-                             eCommandRequiresTarget | eCommandTryTargetAPILock),
-        m_options()
-    {
-    }
+  CommandObjectPlatformProcessLaunch(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform process launch",
+                            "Launch a new process on a remote platform.",
+                            "platform process launch program",
+                            eCommandRequiresTarget | eCommandTryTargetAPILock),
+        m_options() {}
 
-    ~CommandObjectPlatformProcessLaunch() override = default;
+  ~CommandObjectPlatformProcessLaunch() override = default;
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
-protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-        PlatformSP platform_sp;
-        if (target)
-        {   
-            platform_sp = target->GetPlatform();
-        }   
-        if (!platform_sp)
-        {
-            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
-        }   
-
-        if (platform_sp)
-        {
-            Error error;
-            const size_t argc = args.GetArgumentCount();
-            Target *target = m_exe_ctx.GetTargetPtr();
-            Module *exe_module = target->GetExecutableModulePointer();
-            if (exe_module)
-            {
-                m_options.launch_info.GetExecutableFile () = exe_module->GetFileSpec();
-                char exe_path[PATH_MAX];
-                if (m_options.launch_info.GetExecutableFile ().GetPath (exe_path, sizeof(exe_path)))
-                    m_options.launch_info.GetArguments().AppendArgument (exe_path);
-                m_options.launch_info.GetArchitecture() = exe_module->GetArchitecture();
-            }
+  Options *GetOptions() override { return &m_options; }
 
-            if (argc > 0)
-            {
-                if (m_options.launch_info.GetExecutableFile ())
-                {
-                    // We already have an executable file, so we will use this
-                    // and all arguments to this function are extra arguments
-                    m_options.launch_info.GetArguments().AppendArguments (args);
-                }
-                else
-                {
-                    // We don't have any file yet, so the first argument is our
-                    // executable, and the rest are program arguments
-                    const bool first_arg_is_executable = true;
-                    m_options.launch_info.SetArguments (args, first_arg_is_executable);
-                }
-            }
-            
-            if (m_options.launch_info.GetExecutableFile ())
-            {
-                Debugger &debugger = m_interpreter.GetDebugger();
-
-                if (argc == 0)
-                    target->GetRunArguments(m_options.launch_info.GetArguments());
-
-                ProcessSP process_sp (platform_sp->DebugProcess (m_options.launch_info, 
-                                                                 debugger,
-                                                                 target,
-                                                                 error));
-                if (process_sp && process_sp->IsAlive())
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                    return true;
-                }
-                
-                if (error.Success())
-                    result.AppendError ("process launch failed");
-                else
-                    result.AppendError (error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else
-            {
-                result.AppendError ("'platform process launch' uses the current target file and arguments, or the executable and its arguments can be specified in this command");
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
+protected:
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+    PlatformSP platform_sp;
+    if (target) {
+      platform_sp = target->GetPlatform();
+    }
+    if (!platform_sp) {
+      platform_sp =
+          m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+    }
+
+    if (platform_sp) {
+      Error error;
+      const size_t argc = args.GetArgumentCount();
+      Target *target = m_exe_ctx.GetTargetPtr();
+      Module *exe_module = target->GetExecutableModulePointer();
+      if (exe_module) {
+        m_options.launch_info.GetExecutableFile() = exe_module->GetFileSpec();
+        char exe_path[PATH_MAX];
+        if (m_options.launch_info.GetExecutableFile().GetPath(exe_path,
+                                                              sizeof(exe_path)))
+          m_options.launch_info.GetArguments().AppendArgument(exe_path);
+        m_options.launch_info.GetArchitecture() = exe_module->GetArchitecture();
+      }
+
+      if (argc > 0) {
+        if (m_options.launch_info.GetExecutableFile()) {
+          // We already have an executable file, so we will use this
+          // and all arguments to this function are extra arguments
+          m_options.launch_info.GetArguments().AppendArguments(args);
+        } else {
+          // We don't have any file yet, so the first argument is our
+          // executable, and the rest are program arguments
+          const bool first_arg_is_executable = true;
+          m_options.launch_info.SetArguments(args, first_arg_is_executable);
+        }
+      }
+
+      if (m_options.launch_info.GetExecutableFile()) {
+        Debugger &debugger = m_interpreter.GetDebugger();
+
+        if (argc == 0)
+          target->GetRunArguments(m_options.launch_info.GetArguments());
+
+        ProcessSP process_sp(platform_sp->DebugProcess(
+            m_options.launch_info, debugger, target, error));
+        if (process_sp && process_sp->IsAlive()) {
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+          return true;
         }
+
+        if (error.Success())
+          result.AppendError("process launch failed");
         else
-        {
-            result.AppendError ("no platform is selected\n");
-        }
-        return result.Succeeded();
+          result.AppendError(error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      } else {
+        result.AppendError("'platform process launch' uses the current target "
+                           "file and arguments, or the executable and its "
+                           "arguments can be specified in this command");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else {
+      result.AppendError("no platform is selected\n");
     }
-    
+    return result.Succeeded();
+  }
+
 protected:
-    ProcessLaunchCommandOptions m_options;
+  ProcessLaunchCommandOptions m_options;
 };
 
 //----------------------------------------------------------------------
 // "platform process list"
 //----------------------------------------------------------------------
-class CommandObjectPlatformProcessList : public CommandObjectParsed
-{
+class CommandObjectPlatformProcessList : public CommandObjectParsed {
 public:
-    CommandObjectPlatformProcessList (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter, 
-                             "platform process list",
-                             "List processes on a remote platform by name, pid, or many other matching attributes.",
-                             "platform process list",
-                             0),
-        m_options()
-    {
-    }
+  CommandObjectPlatformProcessList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform process list",
+                            "List processes on a remote platform by name, pid, "
+                            "or many other matching attributes.",
+                            "platform process list", 0),
+        m_options() {}
 
-    ~CommandObjectPlatformProcessList() override = default;
+  ~CommandObjectPlatformProcessList() override = default;
+
+  Options *GetOptions() override { return &m_options; }
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-        PlatformSP platform_sp;
-        if (target)
-        {   
-            platform_sp = target->GetPlatform();
-        }   
-        if (!platform_sp)
-        {
-            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
-        }   
-        
-        if (platform_sp)
-        {
-            Error error;
-            if (args.GetArgumentCount() == 0)
-            {
-                if (platform_sp)
-                {
-                    Stream &ostrm = result.GetOutputStream();      
-
-                    lldb::pid_t pid = m_options.match_info.GetProcessInfo().GetProcessID();
-                    if (pid != LLDB_INVALID_PROCESS_ID)
-                    {
-                        ProcessInstanceInfo proc_info;
-                        if (platform_sp->GetProcessInfo (pid, proc_info))
-                        {
-                            ProcessInstanceInfo::DumpTableHeader (ostrm, platform_sp.get(), m_options.show_args, m_options.verbose);
-                            proc_info.DumpAsTableRow(ostrm, platform_sp.get(), m_options.show_args, m_options.verbose);
-                            result.SetStatus (eReturnStatusSuccessFinishResult);
-                        }
-                        else
-                        {
-                            result.AppendErrorWithFormat ("no process found with pid = %" PRIu64 "\n", pid);
-                            result.SetStatus (eReturnStatusFailed);
-                        }
-                    }
-                    else
-                    {
-                        ProcessInstanceInfoList proc_infos;
-                        const uint32_t matches = platform_sp->FindProcesses (m_options.match_info, proc_infos);
-                        const char *match_desc = nullptr;
-                        const char *match_name = m_options.match_info.GetProcessInfo().GetName();
-                        if (match_name && match_name[0])
-                        {
-                            switch (m_options.match_info.GetNameMatchType())
-                            {
-                                case eNameMatchIgnore: break;
-                                case eNameMatchEquals: match_desc = "matched"; break;
-                                case eNameMatchContains: match_desc = "contained"; break;
-                                case eNameMatchStartsWith: match_desc = "started with"; break;
-                                case eNameMatchEndsWith: match_desc = "ended with"; break;
-                                case eNameMatchRegularExpression: match_desc = "matched the regular expression"; break;
-                            }
-                        }
-
-                        if (matches == 0)
-                        {
-                            if (match_desc)
-                                result.AppendErrorWithFormat ("no processes were found that %s \"%s\" on the \"%s\" platform\n", 
-                                                              match_desc,
-                                                              match_name,
-                                                              platform_sp->GetPluginName().GetCString());
-                            else
-                                result.AppendErrorWithFormat ("no processes were found on the \"%s\" platform\n", platform_sp->GetPluginName().GetCString());
-                            result.SetStatus (eReturnStatusFailed);
-                        }
-                        else
-                        {
-                            result.AppendMessageWithFormat ("%u matching process%s found on \"%s\"", 
-                                                            matches,
-                                                            matches > 1 ? "es were" : " was",
-                                                            platform_sp->GetName().GetCString());
-                            if (match_desc)
-                                result.AppendMessageWithFormat (" whose name %s \"%s\"", 
-                                                                match_desc,
-                                                                match_name);
-                            result.AppendMessageWithFormat ("\n");
-                            ProcessInstanceInfo::DumpTableHeader (ostrm, platform_sp.get(), m_options.show_args, m_options.verbose);
-                            for (uint32_t i=0; i<matches; ++i)
-                            {
-                                proc_infos.GetProcessInfoAtIndex(i).DumpAsTableRow(ostrm, platform_sp.get(), m_options.show_args, m_options.verbose);
-                            }
-                        }
-                    }
-                }
-            }
-            else
-            {
-                result.AppendError ("invalid args: process list takes only options\n");
-                result.SetStatus (eReturnStatusFailed);
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+    PlatformSP platform_sp;
+    if (target) {
+      platform_sp = target->GetPlatform();
+    }
+    if (!platform_sp) {
+      platform_sp =
+          m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
+    }
+
+    if (platform_sp) {
+      Error error;
+      if (args.GetArgumentCount() == 0) {
+        if (platform_sp) {
+          Stream &ostrm = result.GetOutputStream();
+
+          lldb::pid_t pid =
+              m_options.match_info.GetProcessInfo().GetProcessID();
+          if (pid != LLDB_INVALID_PROCESS_ID) {
+            ProcessInstanceInfo proc_info;
+            if (platform_sp->GetProcessInfo(pid, proc_info)) {
+              ProcessInstanceInfo::DumpTableHeader(ostrm, platform_sp.get(),
+                                                   m_options.show_args,
+                                                   m_options.verbose);
+              proc_info.DumpAsTableRow(ostrm, platform_sp.get(),
+                                       m_options.show_args, m_options.verbose);
+              result.SetStatus(eReturnStatusSuccessFinishResult);
+            } else {
+              result.AppendErrorWithFormat(
+                  "no process found with pid = %" PRIu64 "\n", pid);
+              result.SetStatus(eReturnStatusFailed);
+            }
+          } else {
+            ProcessInstanceInfoList proc_infos;
+            const uint32_t matches =
+                platform_sp->FindProcesses(m_options.match_info, proc_infos);
+            const char *match_desc = nullptr;
+            const char *match_name =
+                m_options.match_info.GetProcessInfo().GetName();
+            if (match_name && match_name[0]) {
+              switch (m_options.match_info.GetNameMatchType()) {
+              case eNameMatchIgnore:
+                break;
+              case eNameMatchEquals:
+                match_desc = "matched";
+                break;
+              case eNameMatchContains:
+                match_desc = "contained";
+                break;
+              case eNameMatchStartsWith:
+                match_desc = "started with";
+                break;
+              case eNameMatchEndsWith:
+                match_desc = "ended with";
+                break;
+              case eNameMatchRegularExpression:
+                match_desc = "matched the regular expression";
+                break;
+              }
             }
-        }
-        else
-        {
-            result.AppendError ("no platform is selected\n");
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+
+            if (matches == 0) {
+              if (match_desc)
+                result.AppendErrorWithFormat(
+                    "no processes were found that %s \"%s\" on the \"%s\" "
+                    "platform\n",
+                    match_desc, match_name,
+                    platform_sp->GetPluginName().GetCString());
+              else
+                result.AppendErrorWithFormat(
+                    "no processes were found on the \"%s\" platform\n",
+                    platform_sp->GetPluginName().GetCString());
+              result.SetStatus(eReturnStatusFailed);
+            } else {
+              result.AppendMessageWithFormat(
+                  "%u matching process%s found on \"%s\"", matches,
+                  matches > 1 ? "es were" : " was",
+                  platform_sp->GetName().GetCString());
+              if (match_desc)
+                result.AppendMessageWithFormat(" whose name %s \"%s\"",
+                                               match_desc, match_name);
+              result.AppendMessageWithFormat("\n");
+              ProcessInstanceInfo::DumpTableHeader(ostrm, platform_sp.get(),
+                                                   m_options.show_args,
+                                                   m_options.verbose);
+              for (uint32_t i = 0; i < matches; ++i) {
+                proc_infos.GetProcessInfoAtIndex(i).DumpAsTableRow(
+                    ostrm, platform_sp.get(), m_options.show_args,
+                    m_options.verbose);
+              }
+            }
+          }
+        }
+      } else {
+        result.AppendError("invalid args: process list takes only options\n");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform is selected\n");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions()
+        : Options(), match_info(), show_args(false), verbose(false) {
+      static std::once_flag g_once_flag;
+      std::call_once(g_once_flag, []() {
+        PosixPlatformCommandOptionValidator *posix_validator =
+            new PosixPlatformCommandOptionValidator();
+        for (size_t i = 0; g_option_table[i].short_option != 0; ++i) {
+          switch (g_option_table[i].short_option) {
+          case 'u':
+          case 'U':
+          case 'g':
+          case 'G':
+            g_option_table[i].validator = posix_validator;
+            break;
+          default:
+            break;
+          }
+        }
+      });
+    }
+
+    ~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;
+      bool success = false;
+
+      switch (short_option) {
+      case 'p':
+        match_info.GetProcessInfo().SetProcessID(StringConvert::ToUInt32(
+            option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
+        if (!success)
+          error.SetErrorStringWithFormat("invalid process ID string: '%s'",
+                                         option_arg);
+        break;
+
+      case 'P':
+        match_info.GetProcessInfo().SetParentProcessID(StringConvert::ToUInt32(
+            option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "invalid parent process ID string: '%s'", option_arg);
+        break;
+
+      case 'u':
+        match_info.GetProcessInfo().SetUserID(
+            StringConvert::ToUInt32(option_arg, UINT32_MAX, 0, &success));
+        if (!success)
+          error.SetErrorStringWithFormat("invalid user ID string: '%s'",
+                                         option_arg);
+        break;
+
+      case 'U':
+        match_info.GetProcessInfo().SetEffectiveUserID(
+            StringConvert::ToUInt32(option_arg, UINT32_MAX, 0, &success));
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "invalid effective user ID string: '%s'", option_arg);
+        break;
+
+      case 'g':
+        match_info.GetProcessInfo().SetGroupID(
+            StringConvert::ToUInt32(option_arg, UINT32_MAX, 0, &success));
+        if (!success)
+          error.SetErrorStringWithFormat("invalid group ID string: '%s'",
+                                         option_arg);
+        break;
+
+      case 'G':
+        match_info.GetProcessInfo().SetEffectiveGroupID(
+            StringConvert::ToUInt32(option_arg, UINT32_MAX, 0, &success));
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "invalid effective group ID string: '%s'", option_arg);
+        break;
+
+      case 'a': {
+        TargetSP target_sp =
+            execution_context ? execution_context->GetTargetSP() : TargetSP();
+        DebuggerSP debugger_sp =
+            target_sp ? target_sp->GetDebugger().shared_from_this()
+                      : DebuggerSP();
+        PlatformSP platform_sp =
+            debugger_sp ? debugger_sp->GetPlatformList().GetSelectedPlatform()
+                        : PlatformSP();
+        match_info.GetProcessInfo().GetArchitecture().SetTriple(
+            option_arg, platform_sp.get());
+      } break;
+
+      case 'n':
+        match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg,
+                                                                false);
+        match_info.SetNameMatchType(eNameMatchEquals);
+        break;
+
+      case 'e':
+        match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg,
+                                                                false);
+        match_info.SetNameMatchType(eNameMatchEndsWith);
+        break;
+
+      case 's':
+        match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg,
+                                                                false);
+        match_info.SetNameMatchType(eNameMatchStartsWith);
+        break;
+
+      case 'c':
+        match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg,
+                                                                false);
+        match_info.SetNameMatchType(eNameMatchContains);
+        break;
+
+      case 'r':
+        match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg,
+                                                                false);
+        match_info.SetNameMatchType(eNameMatchRegularExpression);
+        break;
+
+      case 'A':
+        show_args = true;
+        break;
+
+      case 'v':
+        verbose = true;
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized option '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      match_info.Clear();
+      show_args = false;
+      verbose = false;
     }
-    
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            match_info(),
-            show_args(false),
-            verbose(false)
-        {
-            static std::once_flag g_once_flag;
-            std::call_once(g_once_flag,  []() {
-                PosixPlatformCommandOptionValidator *posix_validator = new PosixPlatformCommandOptionValidator();
-                for (size_t i=0; g_option_table[i].short_option != 0; ++i)
-                {
-                    switch (g_option_table[i].short_option)
-                    {
-                    case 'u':
-                    case 'U':
-                    case 'g':
-                    case 'G':
-                        g_option_table[i].validator = posix_validator;
-                        break;
-                    default:
-                        break;
-                    }
-                }
-            });
-        }
 
-        ~CommandOptions() override = default;
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        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;
-            bool success = false;
-
-            switch (short_option)
-            {
-                case 'p':
-                    match_info.GetProcessInfo().SetProcessID (StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid process ID string: '%s'", option_arg);
-                    break;
-                
-                case 'P':
-                    match_info.GetProcessInfo().SetParentProcessID (StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success));
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid parent process ID string: '%s'", option_arg);
-                    break;
-
-                case 'u':
-                    match_info.GetProcessInfo().SetUserID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid user ID string: '%s'", option_arg);
-                    break;
-
-                case 'U':
-                    match_info.GetProcessInfo().SetEffectiveUserID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid effective user ID string: '%s'", option_arg);
-                    break;
-
-                case 'g':
-                    match_info.GetProcessInfo().SetGroupID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid group ID string: '%s'", option_arg);
-                    break;
-
-                case 'G':
-                    match_info.GetProcessInfo().SetEffectiveGroupID (StringConvert::ToUInt32 (option_arg, UINT32_MAX, 0, &success));
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid effective group ID string: '%s'", option_arg);
-                    break;
-
-                case 'a':
-                    {
-                        TargetSP target_sp = execution_context ?
-                        execution_context->GetTargetSP() : TargetSP();
-                        DebuggerSP debugger_sp = target_sp ?
-                            target_sp->GetDebugger().shared_from_this() :
-                            DebuggerSP();
-                        PlatformSP platform_sp = debugger_sp ?
-                            debugger_sp->GetPlatformList().GetSelectedPlatform() :
-                            PlatformSP();
-                        match_info.GetProcessInfo().GetArchitecture().SetTriple(
-                                            option_arg, platform_sp.get());
-                    }
-                    break;
-
-                case 'n':
-                    match_info.GetProcessInfo().GetExecutableFile().SetFile (option_arg, false);
-                    match_info.SetNameMatchType (eNameMatchEquals);
-                    break;
-
-                case 'e':
-                    match_info.GetProcessInfo().GetExecutableFile().SetFile (option_arg, false);
-                    match_info.SetNameMatchType (eNameMatchEndsWith);
-                    break;
-
-                case 's':
-                    match_info.GetProcessInfo().GetExecutableFile().SetFile (option_arg, false);
-                    match_info.SetNameMatchType (eNameMatchStartsWith);
-                    break;
-                    
-                case 'c':
-                    match_info.GetProcessInfo().GetExecutableFile().SetFile (option_arg, false);
-                    match_info.SetNameMatchType (eNameMatchContains);
-                    break;
-                    
-                case 'r':
-                    match_info.GetProcessInfo().GetExecutableFile().SetFile (option_arg, false);
-                    match_info.SetNameMatchType (eNameMatchRegularExpression);
-                    break;
-
-                case 'A':
-                    show_args = true;
-                    break;
-
-                case 'v':
-                    verbose = true;
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized option '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            match_info.Clear();
-            show_args = false;
-            verbose = 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.
-        
-        ProcessInstanceInfoMatch match_info;
-        bool show_args;
-        bool verbose;
-    };
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
 
-    CommandOptions m_options;
+    ProcessInstanceInfoMatch match_info;
+    bool show_args;
+    bool verbose;
+  };
+
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectPlatformProcessList::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectPlatformProcessList::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_1,             false, "pid",         'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid,               "List the process info for a specific process ID."},
   {LLDB_OPT_SET_2,             true,  "name",        'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName,       "Find processes with executable basenames that match a string."},
   {LLDB_OPT_SET_3,             true,  "ends-with",   'e', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName,       "Find processes with executable basenames that end with a string."},
@@ -1634,596 +1414,519 @@ CommandObjectPlatformProcessList::Comman
   {LLDB_OPT_SET_FROM_TO(1, 6), false, "show-args",   'A', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,              "Show process arguments instead of the process executable basename."},
   {LLDB_OPT_SET_FROM_TO(1, 6), false, "verbose",     'v', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,              "Enable verbose output."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //----------------------------------------------------------------------
 // "platform process info"
 //----------------------------------------------------------------------
-class CommandObjectPlatformProcessInfo : public CommandObjectParsed
-{
+class CommandObjectPlatformProcessInfo : public CommandObjectParsed {
 public:
-    CommandObjectPlatformProcessInfo (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter, 
-                         "platform process info",
-                         "Get detailed information for one or more process by process ID.",
-                         "platform process info <pid> [<pid> <pid> ...]",
-                         0)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData pid_args;
-        
-        // Define the first (and only) variant of this arg.
-        pid_args.arg_type = eArgTypePid;
-        pid_args.arg_repetition = eArgRepeatStar;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (pid_args);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  CommandObjectPlatformProcessInfo(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "platform process info",
+            "Get detailed information for one or more process by process ID.",
+            "platform process info <pid> [<pid> <pid> ...]", 0) {
+    CommandArgumentEntry arg;
+    CommandArgumentData pid_args;
+
+    // Define the first (and only) variant of this arg.
+    pid_args.arg_type = eArgTypePid;
+    pid_args.arg_repetition = eArgRepeatStar;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(pid_args);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectPlatformProcessInfo() override = default;
+  ~CommandObjectPlatformProcessInfo() override = default;
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-        PlatformSP platform_sp;
-        if (target)
-        {   
-            platform_sp = target->GetPlatform();
-        }   
-        if (!platform_sp)
-        {
-            platform_sp = m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
-        }   
-
-        if (platform_sp)
-        {
-            const size_t argc = args.GetArgumentCount();
-            if (argc > 0)
-            {
-                Error error;
-                
-                if (platform_sp->IsConnected())
-                {
-                    Stream &ostrm = result.GetOutputStream();      
-                    bool success;
-                    for (size_t i=0; i<argc; ++ i)
-                    {
-                        const char *arg = args.GetArgumentAtIndex(i);
-                        lldb::pid_t pid = StringConvert::ToUInt32 (arg, LLDB_INVALID_PROCESS_ID, 0, &success);
-                        if (success)
-                        {
-                            ProcessInstanceInfo proc_info;
-                            if (platform_sp->GetProcessInfo (pid, proc_info))
-                            {
-                                ostrm.Printf ("Process information for process %" PRIu64 ":\n", pid);
-                                proc_info.Dump (ostrm, platform_sp.get());
-                            }
-                            else
-                            {
-                                ostrm.Printf ("error: no process information is available for process %" PRIu64 "\n", pid);
-                            }
-                            ostrm.EOL();
-                        }
-                        else
-                        {
-                            result.AppendErrorWithFormat ("invalid process ID argument '%s'", arg);
-                            result.SetStatus (eReturnStatusFailed);            
-                            break;
-                        }
-                    }
-                }
-                else
-                {
-                    // Not connected...
-                    result.AppendErrorWithFormat ("not connected to '%s'", platform_sp->GetPluginName().GetCString());
-                    result.SetStatus (eReturnStatusFailed);            
-                }
-            }
-            else
-            {
-                // No args
-                result.AppendError ("one or more process id(s) must be specified");
-                result.SetStatus (eReturnStatusFailed);            
-            }
-        }
-        else
-        {
-            result.AppendError ("no platform is currently selected");
-            result.SetStatus (eReturnStatusFailed);            
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+    PlatformSP platform_sp;
+    if (target) {
+      platform_sp = target->GetPlatform();
+    }
+    if (!platform_sp) {
+      platform_sp =
+          m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform();
     }
-};
 
-class CommandObjectPlatformProcessAttach : public CommandObjectParsed
-{
-public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-        Options()
-        {
-            // Keep default values of all options in one place: OptionParsingStarting ()
-            OptionParsingStarting(nullptr);
-        }
-
-        ~CommandOptions() override = default;
+    if (platform_sp) {
+      const size_t argc = args.GetArgumentCount();
+      if (argc > 0) {
+        Error error;
 
-        Error
-        SetOptionValue (uint32_t option_idx, const char *option_arg,
-                        ExecutionContext *execution_context) override
-        {
-            Error error;
-            char short_option = (char) m_getopt_table[option_idx].val;
-            bool success = false;
-            switch (short_option)
-            {
-                case 'p':   
-                {
-                    lldb::pid_t pid = StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
-                    if (!success || pid == LLDB_INVALID_PROCESS_ID)
-                    {
-                        error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
-                    }
-                    else
-                    {
-                        attach_info.SetProcessID (pid);
-                    }
-                }
-                    break;
-                    
-                case 'P':
-                    attach_info.SetProcessPluginName (option_arg);
-                    break;
-                    
-                case 'n': 
-                    attach_info.GetExecutableFile().SetFile(option_arg, false);
-                    break;
-                    
-                case 'w':   
-                    attach_info.SetWaitForLaunch(true);
-                    break;
-                    
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            return error;
+        if (platform_sp->IsConnected()) {
+          Stream &ostrm = result.GetOutputStream();
+          bool success;
+          for (size_t i = 0; i < argc; ++i) {
+            const char *arg = args.GetArgumentAtIndex(i);
+            lldb::pid_t pid = StringConvert::ToUInt32(
+                arg, LLDB_INVALID_PROCESS_ID, 0, &success);
+            if (success) {
+              ProcessInstanceInfo proc_info;
+              if (platform_sp->GetProcessInfo(pid, proc_info)) {
+                ostrm.Printf("Process information for process %" PRIu64 ":\n",
+                             pid);
+                proc_info.Dump(ostrm, platform_sp.get());
+              } else {
+                ostrm.Printf("error: no process information is available for "
+                             "process %" PRIu64 "\n",
+                             pid);
+              }
+              ostrm.EOL();
+            } else {
+              result.AppendErrorWithFormat("invalid process ID argument '%s'",
+                                           arg);
+              result.SetStatus(eReturnStatusFailed);
+              break;
+            }
+          }
+        } else {
+          // Not connected...
+          result.AppendErrorWithFormat(
+              "not connected to '%s'",
+              platform_sp->GetPluginName().GetCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        // No args
+        result.AppendError("one or more process id(s) must be specified");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("no platform is currently selected");
+      result.SetStatus(eReturnStatusFailed);
+    }
+    return result.Succeeded();
+  }
+};
+
+class CommandObjectPlatformProcessAttach : public CommandObjectParsed {
+public:
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {
+      // Keep default values of all options in one place: OptionParsingStarting
+      // ()
+      OptionParsingStarting(nullptr);
+    }
+
+    ~CommandOptions() override = default;
+
+    Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+                         ExecutionContext *execution_context) override {
+      Error error;
+      char short_option = (char)m_getopt_table[option_idx].val;
+      bool success = false;
+      switch (short_option) {
+      case 'p': {
+        lldb::pid_t pid = StringConvert::ToUInt32(
+            option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
+        if (!success || pid == LLDB_INVALID_PROCESS_ID) {
+          error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
+        } else {
+          attach_info.SetProcessID(pid);
+        }
+      } break;
+
+      case 'P':
+        attach_info.SetProcessPluginName(option_arg);
+        break;
+
+      case 'n':
+        attach_info.GetExecutableFile().SetFile(option_arg, false);
+        break;
+
+      case 'w':
+        attach_info.SetWaitForLaunch(true);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      attach_info.Clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    bool HandleOptionArgumentCompletion(
+        Args &input, int cursor_index, int char_pos,
+        OptionElementVector &opt_element_vector, int opt_element_index,
+        int match_start_point, int max_return_elements,
+        CommandInterpreter &interpreter, bool &word_complete,
+        StringList &matches) override {
+      int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
+      int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
+
+      // We are only completing the name option for now...
+
+      const OptionDefinition *opt_defs = GetDefinitions();
+      if (opt_defs[opt_defs_index].short_option == 'n') {
+        // Are we in the name?
+
+        // Look to see if there is a -P argument provided, and if so use that
+        // plugin, otherwise
+        // use the default plugin.
+
+        const char *partial_name = nullptr;
+        partial_name = input.GetArgumentAtIndex(opt_arg_pos);
+
+        PlatformSP platform_sp(interpreter.GetPlatform(true));
+        if (platform_sp) {
+          ProcessInstanceInfoList process_infos;
+          ProcessInstanceInfoMatch match_info;
+          if (partial_name) {
+            match_info.GetProcessInfo().GetExecutableFile().SetFile(
+                partial_name, false);
+            match_info.SetNameMatchType(eNameMatchStartsWith);
+          }
+          platform_sp->FindProcesses(match_info, process_infos);
+          const uint32_t num_matches = process_infos.GetSize();
+          if (num_matches > 0) {
+            for (uint32_t i = 0; i < num_matches; ++i) {
+              matches.AppendString(
+                  process_infos.GetProcessNameAtIndex(i),
+                  process_infos.GetProcessNameLengthAtIndex(i));
+            }
+          }
         }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            attach_info.Clear();
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        bool
-        HandleOptionArgumentCompletion (Args &input,
-                                        int cursor_index,
-                                        int char_pos,
-                                        OptionElementVector &opt_element_vector,
-                                        int opt_element_index,
-                                        int match_start_point,
-                                        int max_return_elements,
-                                        CommandInterpreter &interpreter,
-                                        bool &word_complete,
-                                        StringList &matches) override
-        {
-            int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
-            int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
-            
-            // We are only completing the name option for now...
-            
-            const OptionDefinition *opt_defs = GetDefinitions();
-            if (opt_defs[opt_defs_index].short_option == 'n')
-            {
-                // Are we in the name?
-                
-                // Look to see if there is a -P argument provided, and if so use that plugin, otherwise
-                // use the default plugin.
-                
-                const char *partial_name = nullptr;
-                partial_name = input.GetArgumentAtIndex(opt_arg_pos);
-                
-                PlatformSP platform_sp(interpreter.GetPlatform(true));
-                if (platform_sp)
-                {
-                    ProcessInstanceInfoList process_infos;
-                    ProcessInstanceInfoMatch match_info;
-                    if (partial_name)
-                    {
-                        match_info.GetProcessInfo().GetExecutableFile().SetFile(partial_name, false);
-                        match_info.SetNameMatchType(eNameMatchStartsWith);
-                    }
-                    platform_sp->FindProcesses (match_info, process_infos);
-                    const uint32_t num_matches = process_infos.GetSize();
-                    if (num_matches > 0)
-                    {
-                        for (uint32_t i=0; i<num_matches; ++i)
-                        {
-                            matches.AppendString (process_infos.GetProcessNameAtIndex(i), 
-                                                  process_infos.GetProcessNameLengthAtIndex(i));
-                        }
-                    }
-                }
-            }
-            
-            return false;
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static OptionDefinition g_option_table[];
-        
-        // Instance variables to hold the values for command options.
-        
-        ProcessAttachInfo attach_info;
-    };
-    
-    CommandObjectPlatformProcessAttach (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "platform process attach",
-                         "Attach to a process.",
-                         "platform process attach <cmd-options>"),
-    m_options()
-    {
+      }
+
+      return false;
     }
 
-    ~CommandObjectPlatformProcessAttach() override = default;
+    // Options table: Required for subclasses of Options.
 
-    bool
-    DoExecute (Args& command,
-             CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (platform_sp)
-        {
-            Error err;
-            ProcessSP remote_process_sp =
-            platform_sp->Attach(m_options.attach_info, m_interpreter.GetDebugger(), nullptr, err);
-            if (err.Fail())
-            {
-                result.AppendError(err.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else if (!remote_process_sp)
-            {
-                result.AppendError("could not attach: unknown reason");
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendError ("no platform is currently selected");
-            result.SetStatus (eReturnStatusFailed);            
-        }
-        return result.Succeeded();
-    }
-    
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    ProcessAttachInfo attach_info;
+  };
+
+  CommandObjectPlatformProcessAttach(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "platform process attach",
+                            "Attach to a process.",
+                            "platform process attach <cmd-options>"),
+        m_options() {}
+
+  ~CommandObjectPlatformProcessAttach() override = default;
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (platform_sp) {
+      Error err;
+      ProcessSP remote_process_sp = platform_sp->Attach(
+          m_options.attach_info, m_interpreter.GetDebugger(), nullptr, err);
+      if (err.Fail()) {
+        result.AppendError(err.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      } else if (!remote_process_sp) {
+        result.AppendError("could not attach: unknown reason");
+        result.SetStatus(eReturnStatusFailed);
+      } else
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendError("no platform is currently selected");
+      result.SetStatus(eReturnStatusFailed);
     }
-    
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override { return &m_options; }
+
 protected:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectPlatformProcessAttach::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectPlatformProcessAttach::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "plugin",  'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin,      "Name of the process plugin you want to use."},
   {LLDB_OPT_SET_1,   false, "pid",     'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid,         "The process ID of an existing process to attach to."},
   {LLDB_OPT_SET_2,   false, "name",    'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeProcessName, "The name of the process to attach to."},
   {LLDB_OPT_SET_2,   false, "waitfor", 'w', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,        "Wait for the process with <process-name> to launch."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
-class CommandObjectPlatformProcess : public CommandObjectMultiword
-{
+class CommandObjectPlatformProcess : public CommandObjectMultiword {
 public:
-    //------------------------------------------------------------------
-    // Constructors and Destructors
-    //------------------------------------------------------------------
-    CommandObjectPlatformProcess(CommandInterpreter &interpreter)
-        : CommandObjectMultiword(interpreter, "platform process",
-                                 "Commands to query, launch and attach to processes on the current platform.",
-                                 "platform process [attach|launch|list] ...")
-    {
-        LoadSubCommand ("attach", CommandObjectSP (new CommandObjectPlatformProcessAttach (interpreter)));
-        LoadSubCommand ("launch", CommandObjectSP (new CommandObjectPlatformProcessLaunch (interpreter)));
-        LoadSubCommand ("info"  , CommandObjectSP (new CommandObjectPlatformProcessInfo (interpreter)));
-        LoadSubCommand ("list"  , CommandObjectSP (new CommandObjectPlatformProcessList (interpreter)));
-    }
+  //------------------------------------------------------------------
+  // Constructors and Destructors
+  //------------------------------------------------------------------
+  CommandObjectPlatformProcess(CommandInterpreter &interpreter)
+      : CommandObjectMultiword(interpreter, "platform process",
+                               "Commands to query, launch and attach to "
+                               "processes on the current platform.",
+                               "platform process [attach|launch|list] ...") {
+    LoadSubCommand(
+        "attach",
+        CommandObjectSP(new CommandObjectPlatformProcessAttach(interpreter)));
+    LoadSubCommand(
+        "launch",
+        CommandObjectSP(new CommandObjectPlatformProcessLaunch(interpreter)));
+    LoadSubCommand("info", CommandObjectSP(new CommandObjectPlatformProcessInfo(
+                               interpreter)));
+    LoadSubCommand("list", CommandObjectSP(new CommandObjectPlatformProcessList(
+                               interpreter)));
+  }
 
-    ~CommandObjectPlatformProcess() override = default;
+  ~CommandObjectPlatformProcess() override = default;
 
 private:
-    //------------------------------------------------------------------
-    // For CommandObjectPlatform only
-    //------------------------------------------------------------------
-    DISALLOW_COPY_AND_ASSIGN (CommandObjectPlatformProcess);
+  //------------------------------------------------------------------
+  // For CommandObjectPlatform only
+  //------------------------------------------------------------------
+  DISALLOW_COPY_AND_ASSIGN(CommandObjectPlatformProcess);
 };
 
 //----------------------------------------------------------------------
 // "platform shell"
 //----------------------------------------------------------------------
-class CommandObjectPlatformShell : public CommandObjectRaw
-{
+class CommandObjectPlatformShell : public CommandObjectRaw {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-        Options(),
-        timeout(10)
-        {
-        }
-
-        ~CommandOptions() override = default;
-
-        virtual uint32_t
-        GetNumDefinitions ()
-        {
-            return 1;
-        }
-        
-        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 char short_option = (char) g_option_table[option_idx].short_option;
-            
-            switch (short_option)
-            {
-                case 't':
-                {
-                    bool success;
-                    timeout = StringConvert::ToUInt32(option_value, 10, 10, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("could not convert \"%s\" to a numeric value.", option_value);
-                    break;
-                }
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static OptionDefinition g_option_table[];
-        uint32_t timeout;
-    };
-
-    CommandObjectPlatformShell(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "platform shell", "Run a shell command on the current platform.",
-                           "platform shell <shell-command>", 0),
-          m_options()
-    {
-    }
-
-    ~CommandObjectPlatformShell() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
-    bool
-    DoExecute (const char *raw_command_line, CommandReturnObject &result) override
-    {
-        ExecutionContext exe_ctx =
-            GetCommandInterpreter().GetExecutionContext();
-        m_options.NotifyOptionParsingStarting(&exe_ctx);
-        
-        const char* expr = nullptr;
-
-        // Print out an usage syntax on an empty command line.
-        if (raw_command_line[0] == '\0')
-        {
-            result.GetOutputStream().Printf("%s\n", this->GetSyntax());
-            return true;
-        }
-
-        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]))
-                    {
-                        expr = end_options;
-                        while (::isspace (*expr))
-                            ++expr;
-                        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;
-            }
-        }
-        
-        if (expr == nullptr)
-            expr = raw_command_line;
-        
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        Error error;
-        if (platform_sp)
-        {
-            FileSpec working_dir{};
-            std::string output;
-            int status = -1;
-            int signo = -1;
-            error = (platform_sp->RunShellCommand (expr, working_dir, &status, &signo, &output, m_options.timeout));
-            if (!output.empty())
-                result.GetOutputStream().PutCString(output.c_str());
-            if (status > 0)
-            {
-                if (signo > 0)
-                {
-                    const char *signo_cstr = Host::GetSignalAsCString(signo);
-                    if (signo_cstr)
-                        result.GetOutputStream().Printf("error: command returned with status %i and signal %s\n", status, signo_cstr);
-                    else
-                        result.GetOutputStream().Printf("error: command returned with status %i and signal %i\n", status, signo);
-                }
-                else
-                    result.GetOutputStream().Printf("error: command returned with status %i\n", status);
-            }
-        }
-        else
-        {
-            result.GetOutputStream().Printf("error: cannot run remote shell commands without a platform\n");
-            error.SetErrorString("error: cannot run remote shell commands without a platform");
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), timeout(10) {}
+
+    ~CommandOptions() override = default;
+
+    virtual uint32_t GetNumDefinitions() { return 1; }
+
+    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 char short_option = (char)g_option_table[option_idx].short_option;
+
+      switch (short_option) {
+      case 't': {
+        bool success;
+        timeout = StringConvert::ToUInt32(option_value, 10, 10, &success);
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "could not convert \"%s\" to a numeric value.", option_value);
+        break;
+      }
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {}
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+    uint32_t timeout;
+  };
+
+  CommandObjectPlatformShell(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "platform shell",
+                         "Run a shell command on the current platform.",
+                         "platform shell <shell-command>", 0),
+        m_options() {}
+
+  ~CommandObjectPlatformShell() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  bool DoExecute(const char *raw_command_line,
+                 CommandReturnObject &result) override {
+    ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
+    m_options.NotifyOptionParsingStarting(&exe_ctx);
+
+    const char *expr = nullptr;
+
+    // Print out an usage syntax on an empty command line.
+    if (raw_command_line[0] == '\0') {
+      result.GetOutputStream().Printf("%s\n", this->GetSyntax());
+      return true;
+    }
+
+    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])) {
+            expr = end_options;
+            while (::isspace(*expr))
+              ++expr;
+            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;
+      }
+    }
+
+    if (expr == nullptr)
+      expr = raw_command_line;
+
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    Error error;
+    if (platform_sp) {
+      FileSpec working_dir{};
+      std::string output;
+      int status = -1;
+      int signo = -1;
+      error = (platform_sp->RunShellCommand(expr, working_dir, &status, &signo,
+                                            &output, m_options.timeout));
+      if (!output.empty())
+        result.GetOutputStream().PutCString(output.c_str());
+      if (status > 0) {
+        if (signo > 0) {
+          const char *signo_cstr = Host::GetSignalAsCString(signo);
+          if (signo_cstr)
+            result.GetOutputStream().Printf(
+                "error: command returned with status %i and signal %s\n",
+                status, signo_cstr);
+          else
+            result.GetOutputStream().Printf(
+                "error: command returned with status %i and signal %i\n",
+                status, signo);
+        } else
+          result.GetOutputStream().Printf(
+              "error: command returned with status %i\n", status);
+      }
+    } else {
+      result.GetOutputStream().Printf(
+          "error: cannot run remote shell commands without a platform\n");
+      error.SetErrorString(
+          "error: cannot run remote shell commands without a platform");
+    }
+
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+    } else {
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    }
+    return true;
+  }
 
-        if (error.Fail())
-        {
-            result.AppendError(error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        else
-        {
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        return true;
-    }
-
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectPlatformShell::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectPlatformShell::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "timeout", 't', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeValue, "Seconds to wait for the remote host to finish running the command."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //----------------------------------------------------------------------
 // "platform install" - install a target to a remote end
 //----------------------------------------------------------------------
-class CommandObjectPlatformInstall : public CommandObjectParsed
-{
+class CommandObjectPlatformInstall : public CommandObjectParsed {
 public:
-    CommandObjectPlatformInstall (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "platform target-install",
-                         "Install a target (bundle or executable file) to the remote end.",
-                         "platform target-install <local-thing> <remote-sandbox>",
-                         0)
-    {
-    }
-
-    ~CommandObjectPlatformInstall() override = default;
-
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        if (args.GetArgumentCount() != 2)
-        {
-            result.AppendError("platform target-install takes two arguments");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-        // TODO: move the bulk of this code over to the platform itself
-        FileSpec src(args.GetArgumentAtIndex(0), true);
-        FileSpec dst(args.GetArgumentAtIndex(1), false);
-        if (!src.Exists())
-        {
-            result.AppendError("source location does not exist or is not accessible");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-        if (!platform_sp)
-        {
-            result.AppendError ("no platform currently selected");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        Error error = platform_sp->Install(src, dst);
-        if (error.Success())
-        {
-            result.SetStatus(eReturnStatusSuccessFinishNoResult);
-        }
-        else
-        {
-            result.AppendErrorWithFormat("install failed: %s", error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  CommandObjectPlatformInstall(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "platform target-install",
+            "Install a target (bundle or executable file) to the remote end.",
+            "platform target-install <local-thing> <remote-sandbox>", 0) {}
+
+  ~CommandObjectPlatformInstall() override = default;
+
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    if (args.GetArgumentCount() != 2) {
+      result.AppendError("platform target-install takes two arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+    // TODO: move the bulk of this code over to the platform itself
+    FileSpec src(args.GetArgumentAtIndex(0), true);
+    FileSpec dst(args.GetArgumentAtIndex(1), false);
+    if (!src.Exists()) {
+      result.AppendError("source location does not exist or is not accessible");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+    if (!platform_sp) {
+      result.AppendError("no platform currently selected");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    Error error = platform_sp->Install(src, dst);
+    if (error.Success()) {
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    } else {
+      result.AppendErrorWithFormat("install failed: %s", error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 CommandObjectPlatform::CommandObjectPlatform(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "platform", "Commands to manage and create platforms.",
-                             "platform [connect|disconnect|info|list|status|select] ...")
-{
-    LoadSubCommand ("select", CommandObjectSP (new CommandObjectPlatformSelect (interpreter)));
-    LoadSubCommand ("list"  , CommandObjectSP (new CommandObjectPlatformList (interpreter)));
-    LoadSubCommand ("status", CommandObjectSP (new CommandObjectPlatformStatus (interpreter)));
-    LoadSubCommand ("connect", CommandObjectSP (new CommandObjectPlatformConnect (interpreter)));
-    LoadSubCommand ("disconnect", CommandObjectSP (new CommandObjectPlatformDisconnect (interpreter)));
-    LoadSubCommand ("settings", CommandObjectSP (new CommandObjectPlatformSettings (interpreter)));
-    LoadSubCommand ("mkdir", CommandObjectSP (new CommandObjectPlatformMkDir (interpreter)));
-    LoadSubCommand ("file", CommandObjectSP (new CommandObjectPlatformFile (interpreter)));
-    LoadSubCommand ("get-file", CommandObjectSP (new CommandObjectPlatformGetFile (interpreter)));
-    LoadSubCommand ("get-size", CommandObjectSP (new CommandObjectPlatformGetSize (interpreter)));
-    LoadSubCommand ("put-file", CommandObjectSP (new CommandObjectPlatformPutFile (interpreter)));
-    LoadSubCommand ("process", CommandObjectSP (new CommandObjectPlatformProcess (interpreter)));
-    LoadSubCommand ("shell", CommandObjectSP (new CommandObjectPlatformShell (interpreter)));
-    LoadSubCommand ("target-install", CommandObjectSP (new CommandObjectPlatformInstall (interpreter)));
+    : CommandObjectMultiword(
+          interpreter, "platform", "Commands to manage and create platforms.",
+          "platform [connect|disconnect|info|list|status|select] ...") {
+  LoadSubCommand("select",
+                 CommandObjectSP(new CommandObjectPlatformSelect(interpreter)));
+  LoadSubCommand("list",
+                 CommandObjectSP(new CommandObjectPlatformList(interpreter)));
+  LoadSubCommand("status",
+                 CommandObjectSP(new CommandObjectPlatformStatus(interpreter)));
+  LoadSubCommand("connect", CommandObjectSP(
+                                new CommandObjectPlatformConnect(interpreter)));
+  LoadSubCommand(
+      "disconnect",
+      CommandObjectSP(new CommandObjectPlatformDisconnect(interpreter)));
+  LoadSubCommand("settings", CommandObjectSP(new CommandObjectPlatformSettings(
+                                 interpreter)));
+  LoadSubCommand("mkdir",
+                 CommandObjectSP(new CommandObjectPlatformMkDir(interpreter)));
+  LoadSubCommand("file",
+                 CommandObjectSP(new CommandObjectPlatformFile(interpreter)));
+  LoadSubCommand("get-file", CommandObjectSP(new CommandObjectPlatformGetFile(
+                                 interpreter)));
+  LoadSubCommand("get-size", CommandObjectSP(new CommandObjectPlatformGetSize(
+                                 interpreter)));
+  LoadSubCommand("put-file", CommandObjectSP(new CommandObjectPlatformPutFile(
+                                 interpreter)));
+  LoadSubCommand("process", CommandObjectSP(
+                                new CommandObjectPlatformProcess(interpreter)));
+  LoadSubCommand("shell",
+                 CommandObjectSP(new CommandObjectPlatformShell(interpreter)));
+  LoadSubCommand(
+      "target-install",
+      CommandObjectSP(new CommandObjectPlatformInstall(interpreter)));
 }
 
 CommandObjectPlatform::~CommandObjectPlatform() = default;

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

Modified: lldb/trunk/source/Commands/CommandObjectPlugin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlugin.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlugin.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectPlugin.cpp Tue Sep  6 15:57:50 2016
@@ -19,91 +19,78 @@
 using namespace lldb;
 using namespace lldb_private;
 
-class CommandObjectPluginLoad : public CommandObjectParsed
-{
+class CommandObjectPluginLoad : public CommandObjectParsed {
 public:
-    CommandObjectPluginLoad (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "plugin load",
+  CommandObjectPluginLoad(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "plugin load",
                             "Import a dylib that implements an LLDB plugin.",
-                            nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentData cmd_arg;
-        
-        // Define the first (and only) variant of this arg.
-        cmd_arg.arg_type = eArgTypeFilename;
-        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);
-    }
+                            nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentData cmd_arg;
+
+    // Define the first (and only) variant of this arg.
+    cmd_arg.arg_type = eArgTypeFilename;
+    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);
+  }
+
+  ~CommandObjectPluginLoad() 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();
+  }
 
-    ~CommandObjectPluginLoad() override = default;
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    size_t argc = command.GetArgumentCount();
 
-    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();
+    if (argc != 1) {
+      result.AppendError("'plugin load' requires one argument");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
 
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        size_t argc = command.GetArgumentCount();
-        
-        if (argc != 1)
-        {
-            result.AppendError ("'plugin load' requires one argument");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        const char* path = command.GetArgumentAtIndex(0);
-        
-        Error error;
-        
-        FileSpec dylib_fspec(path,true);
-        
-        if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec, error))
-            result.SetStatus(eReturnStatusSuccessFinishResult);
-        else
-        {
-            result.AppendError(error.AsCString());
-            result.SetStatus(eReturnStatusFailed);
-        }
-        
-        return result.Succeeded();
+    const char *path = command.GetArgumentAtIndex(0);
+
+    Error error;
+
+    FileSpec dylib_fspec(path, true);
+
+    if (m_interpreter.GetDebugger().LoadPlugin(dylib_fspec, error))
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    else {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
     }
+
+    return result.Succeeded();
+  }
 };
 
 CommandObjectPlugin::CommandObjectPlugin(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "plugin", "Commands for managing LLDB plugins.",
-                             "plugin <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand ("load",  CommandObjectSP (new CommandObjectPluginLoad (interpreter)));
+    : CommandObjectMultiword(interpreter, "plugin",
+                             "Commands for managing LLDB plugins.",
+                             "plugin <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("load",
+                 CommandObjectSP(new CommandObjectPluginLoad(interpreter)));
 }
-    
+
 CommandObjectPlugin::~CommandObjectPlugin() = default;

Modified: lldb/trunk/source/Commands/CommandObjectPlugin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectPlugin.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectPlugin.h (original)
+++ lldb/trunk/source/Commands/CommandObjectPlugin.h Tue Sep  6 15:57:50 2016
@@ -16,19 +16,18 @@
 // 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 CommandObjectPlugin : public CommandObjectMultiword
-    {
-    public:
-        CommandObjectPlugin (CommandInterpreter &interpreter);
-        
-        ~CommandObjectPlugin() override;
-    };
-    
+
+class CommandObjectPlugin : public CommandObjectMultiword {
+public:
+  CommandObjectPlugin(CommandInterpreter &interpreter);
+
+  ~CommandObjectPlugin() override;
+};
+
 } // namespace lldb_private
 
 #endif // liblldb_CommandObjectPlugin_h_

Modified: lldb/trunk/source/Commands/CommandObjectProcess.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectProcess.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectProcess.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectProcess.cpp Tue Sep  6 15:57:50 2016
@@ -15,15 +15,15 @@
 #include "lldb/Breakpoint/Breakpoint.h"
 #include "lldb/Breakpoint/BreakpointLocation.h"
 #include "lldb/Breakpoint/BreakpointSite.h"
-#include "lldb/Core/State.h"
 #include "lldb/Core/Module.h"
 #include "lldb/Core/PluginManager.h"
+#include "lldb/Core/State.h"
 #include "lldb/Host/Host.h"
 #include "lldb/Host/StringConvert.h"
 #include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Target/Platform.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/StopInfo.h"
@@ -34,284 +34,273 @@
 using namespace lldb;
 using namespace lldb_private;
 
-class CommandObjectProcessLaunchOrAttach : public CommandObjectParsed
-{
+class CommandObjectProcessLaunchOrAttach : public CommandObjectParsed {
 public:
-    CommandObjectProcessLaunchOrAttach (CommandInterpreter &interpreter,
-                                       const char *name,
-                                       const char *help,
-                                       const char *syntax,
-                                       uint32_t flags,
-                                       const char *new_process_action) :
-        CommandObjectParsed (interpreter, name, help, syntax, flags),
-        m_new_process_action (new_process_action) {}
+  CommandObjectProcessLaunchOrAttach(CommandInterpreter &interpreter,
+                                     const char *name, const char *help,
+                                     const char *syntax, uint32_t flags,
+                                     const char *new_process_action)
+      : CommandObjectParsed(interpreter, name, help, syntax, flags),
+        m_new_process_action(new_process_action) {}
 
-    ~CommandObjectProcessLaunchOrAttach() override = default;
+  ~CommandObjectProcessLaunchOrAttach() override = default;
 
 protected:
-    bool
-    StopProcessIfNecessary (Process *process, StateType &state, CommandReturnObject &result)
-    {
-        state = eStateInvalid;
-        if (process)
-        {
-            state = process->GetState();
-            
-            if (process->IsAlive() && state != eStateConnected)
-            {       
-                char message[1024];
-                if (process->GetState() == eStateAttaching)
-                    ::snprintf (message, sizeof(message), "There is a pending attach, abort it and %s?", m_new_process_action.c_str());
-                else if (process->GetShouldDetach())
-                    ::snprintf (message, sizeof(message), "There is a running process, detach from it and %s?", m_new_process_action.c_str());
-                else
-                    ::snprintf (message, sizeof(message), "There is a running process, kill it and %s?", m_new_process_action.c_str());
-        
-                if (!m_interpreter.Confirm (message, true))
-                {
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-                else
-                {
-                    if (process->GetShouldDetach())
-                    {
-                        bool keep_stopped = false;
-                        Error detach_error (process->Detach(keep_stopped));
-                        if (detach_error.Success())
-                        {
-                            result.SetStatus (eReturnStatusSuccessFinishResult);
-                            process = nullptr;
-                        }
-                        else
-                        {
-                            result.AppendErrorWithFormat ("Failed to detach from process: %s\n", detach_error.AsCString());
-                            result.SetStatus (eReturnStatusFailed);
-                        }
-                    }
-                    else
-                    {
-                        Error destroy_error (process->Destroy(false));
-                        if (destroy_error.Success())
-                        {
-                            result.SetStatus (eReturnStatusSuccessFinishResult);
-                            process = nullptr;
-                        }
-                        else
-                        {
-                            result.AppendErrorWithFormat ("Failed to kill process: %s\n", destroy_error.AsCString());
-                            result.SetStatus (eReturnStatusFailed);
-                        }
-                    }
-                }
+  bool StopProcessIfNecessary(Process *process, StateType &state,
+                              CommandReturnObject &result) {
+    state = eStateInvalid;
+    if (process) {
+      state = process->GetState();
+
+      if (process->IsAlive() && state != eStateConnected) {
+        char message[1024];
+        if (process->GetState() == eStateAttaching)
+          ::snprintf(message, sizeof(message),
+                     "There is a pending attach, abort it and %s?",
+                     m_new_process_action.c_str());
+        else if (process->GetShouldDetach())
+          ::snprintf(message, sizeof(message),
+                     "There is a running process, detach from it and %s?",
+                     m_new_process_action.c_str());
+        else
+          ::snprintf(message, sizeof(message),
+                     "There is a running process, kill it and %s?",
+                     m_new_process_action.c_str());
+
+        if (!m_interpreter.Confirm(message, true)) {
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        } else {
+          if (process->GetShouldDetach()) {
+            bool keep_stopped = false;
+            Error detach_error(process->Detach(keep_stopped));
+            if (detach_error.Success()) {
+              result.SetStatus(eReturnStatusSuccessFinishResult);
+              process = nullptr;
+            } else {
+              result.AppendErrorWithFormat(
+                  "Failed to detach from process: %s\n",
+                  detach_error.AsCString());
+              result.SetStatus(eReturnStatusFailed);
+            }
+          } else {
+            Error destroy_error(process->Destroy(false));
+            if (destroy_error.Success()) {
+              result.SetStatus(eReturnStatusSuccessFinishResult);
+              process = nullptr;
+            } else {
+              result.AppendErrorWithFormat("Failed to kill process: %s\n",
+                                           destroy_error.AsCString());
+              result.SetStatus(eReturnStatusFailed);
             }
+          }
         }
-        return result.Succeeded();
+      }
     }
+    return result.Succeeded();
+  }
 
-    std::string m_new_process_action;
+  std::string m_new_process_action;
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectProcessLaunch
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessLaunch
-class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach
-{
+class CommandObjectProcessLaunch : public CommandObjectProcessLaunchOrAttach {
 public:
-    CommandObjectProcessLaunch (CommandInterpreter &interpreter) :
-        CommandObjectProcessLaunchOrAttach(interpreter,
-                                           "process launch",
-                                           "Launch the executable in the debugger.",
-                                           nullptr,
-                                           eCommandRequiresTarget,
-                                           "restart"),
-        m_options()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData run_args_arg;
-        
-        // Define the first (and only) variant of this arg.
-        run_args_arg.arg_type = eArgTypeRunArgs;
-        run_args_arg.arg_repetition = eArgRepeatOptional;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (run_args_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectProcessLaunch() 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();
-    }
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-
-    const char *
-    GetRepeatCommand (Args &current_command_args, uint32_t index) override
-    {
-        // No repeat for "process launch"...
-        return "";
-    }
+  CommandObjectProcessLaunch(CommandInterpreter &interpreter)
+      : CommandObjectProcessLaunchOrAttach(
+            interpreter, "process launch",
+            "Launch the executable in the debugger.", nullptr,
+            eCommandRequiresTarget, "restart"),
+        m_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData run_args_arg;
+
+    // Define the first (and only) variant of this arg.
+    run_args_arg.arg_type = eArgTypeRunArgs;
+    run_args_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(run_args_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectProcessLaunch() 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();
+  }
+
+  Options *GetOptions() override { return &m_options; }
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override {
+    // No repeat for "process launch"...
+    return "";
+  }
 
 protected:
-    bool
-    DoExecute (Args& launch_args, CommandReturnObject &result) override
-    {
-        Debugger &debugger = m_interpreter.GetDebugger();
-        Target *target = debugger.GetSelectedTarget().get();
-        // If our listener is nullptr, users aren't allows to launch
-        ModuleSP exe_module_sp = target->GetExecutableModule();
-
-        if (exe_module_sp == nullptr)
-        {
-            result.AppendError ("no file in target, create a debug target using the 'target create' command");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        StateType state = eStateInvalid;
-        
-        if (!StopProcessIfNecessary(m_exe_ctx.GetProcessPtr(), state, result))
-            return false;
-        
-        const char *target_settings_argv0 = target->GetArg0();
-        
-        // Determine whether we will disable ASLR or leave it in the default state (i.e. enabled if the platform supports it).
-        // First check if the process launch options explicitly turn on/off disabling ASLR.  If so, use that setting;
-        // otherwise, use the 'settings target.disable-aslr' setting.
-        bool disable_aslr = false;
-        if (m_options.disable_aslr != eLazyBoolCalculate)
-        {
-            // The user specified an explicit setting on the process launch line.  Use it.
-            disable_aslr = (m_options.disable_aslr == eLazyBoolYes);
-        }
-        else
-        {
-            // The user did not explicitly specify whether to disable ASLR.  Fall back to the target.disable-aslr setting.
-            disable_aslr = target->GetDisableASLR ();
-        }
-        
-        if (disable_aslr)
-            m_options.launch_info.GetFlags().Set (eLaunchFlagDisableASLR);
-        else
-            m_options.launch_info.GetFlags().Clear (eLaunchFlagDisableASLR);
-        
-        if (target->GetDetachOnError())
-            m_options.launch_info.GetFlags().Set (eLaunchFlagDetachOnError);
-        
-        if (target->GetDisableSTDIO())
-            m_options.launch_info.GetFlags().Set (eLaunchFlagDisableSTDIO);
-        
-        Args environment;
-        target->GetEnvironmentAsArgs (environment);
-        if (environment.GetArgumentCount() > 0)
-            m_options.launch_info.GetEnvironmentEntries ().AppendArguments (environment);
-
-        if (target_settings_argv0)
-        {
-            m_options.launch_info.GetArguments().AppendArgument (target_settings_argv0);
-            m_options.launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), false);
-        }
-        else
-        {
-            m_options.launch_info.SetExecutableFile(exe_module_sp->GetPlatformFileSpec(), true);
-        }
-
-        if (launch_args.GetArgumentCount() == 0)
-        {
-            m_options.launch_info.GetArguments().AppendArguments (target->GetProcessLaunchInfo().GetArguments());
-        }
-        else
-        {
-            m_options.launch_info.GetArguments().AppendArguments (launch_args);
-            // Save the arguments for subsequent runs in the current target.
-            target->SetRunArguments (launch_args);
-        }
-
-        StreamString stream;
-        Error error = target->Launch(m_options.launch_info, &stream);
-        
-        if (error.Success())
-        {
-            ProcessSP process_sp (target->GetProcessSP());
-            if (process_sp)
-            {
-                // There is a race condition where this thread will return up the call stack to the main command
-                // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
-                // a chance to call PushProcessIOHandler().
-                process_sp->SyncIOHandler (0, 2000);
-
-                const char *data = stream.GetData();
-                if (data && strlen(data) > 0)
-                    result.AppendMessage(stream.GetData());
-                const char *archname = exe_module_sp->GetArchitecture().GetArchitectureName();
-                result.AppendMessageWithFormat ("Process %" PRIu64 " launched: '%s' (%s)\n", process_sp->GetID(), exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-                result.SetDidChangeProcessState (true);
-            }
-            else
-            {
-                result.AppendError("no error returned from Target::Launch, and target has no process");
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError(error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &launch_args, CommandReturnObject &result) override {
+    Debugger &debugger = m_interpreter.GetDebugger();
+    Target *target = debugger.GetSelectedTarget().get();
+    // If our listener is nullptr, users aren't allows to launch
+    ModuleSP exe_module_sp = target->GetExecutableModule();
+
+    if (exe_module_sp == nullptr) {
+      result.AppendError("no file in target, create a debug target using the "
+                         "'target create' command");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    StateType state = eStateInvalid;
+
+    if (!StopProcessIfNecessary(m_exe_ctx.GetProcessPtr(), state, result))
+      return false;
+
+    const char *target_settings_argv0 = target->GetArg0();
+
+    // Determine whether we will disable ASLR or leave it in the default state
+    // (i.e. enabled if the platform supports it).
+    // First check if the process launch options explicitly turn on/off
+    // disabling ASLR.  If so, use that setting;
+    // otherwise, use the 'settings target.disable-aslr' setting.
+    bool disable_aslr = false;
+    if (m_options.disable_aslr != eLazyBoolCalculate) {
+      // The user specified an explicit setting on the process launch line.  Use
+      // it.
+      disable_aslr = (m_options.disable_aslr == eLazyBoolYes);
+    } else {
+      // The user did not explicitly specify whether to disable ASLR.  Fall back
+      // to the target.disable-aslr setting.
+      disable_aslr = target->GetDisableASLR();
+    }
+
+    if (disable_aslr)
+      m_options.launch_info.GetFlags().Set(eLaunchFlagDisableASLR);
+    else
+      m_options.launch_info.GetFlags().Clear(eLaunchFlagDisableASLR);
+
+    if (target->GetDetachOnError())
+      m_options.launch_info.GetFlags().Set(eLaunchFlagDetachOnError);
+
+    if (target->GetDisableSTDIO())
+      m_options.launch_info.GetFlags().Set(eLaunchFlagDisableSTDIO);
+
+    Args environment;
+    target->GetEnvironmentAsArgs(environment);
+    if (environment.GetArgumentCount() > 0)
+      m_options.launch_info.GetEnvironmentEntries().AppendArguments(
+          environment);
+
+    if (target_settings_argv0) {
+      m_options.launch_info.GetArguments().AppendArgument(
+          target_settings_argv0);
+      m_options.launch_info.SetExecutableFile(
+          exe_module_sp->GetPlatformFileSpec(), false);
+    } else {
+      m_options.launch_info.SetExecutableFile(
+          exe_module_sp->GetPlatformFileSpec(), true);
+    }
+
+    if (launch_args.GetArgumentCount() == 0) {
+      m_options.launch_info.GetArguments().AppendArguments(
+          target->GetProcessLaunchInfo().GetArguments());
+    } else {
+      m_options.launch_info.GetArguments().AppendArguments(launch_args);
+      // Save the arguments for subsequent runs in the current target.
+      target->SetRunArguments(launch_args);
+    }
+
+    StreamString stream;
+    Error error = target->Launch(m_options.launch_info, &stream);
+
+    if (error.Success()) {
+      ProcessSP process_sp(target->GetProcessSP());
+      if (process_sp) {
+        // There is a race condition where this thread will return up the call
+        // stack to the main command
+        // handler and show an (lldb) prompt before HandlePrivateEvent (from
+        // PrivateStateThread) has
+        // a chance to call PushProcessIOHandler().
+        process_sp->SyncIOHandler(0, 2000);
+
+        const char *data = stream.GetData();
+        if (data && strlen(data) > 0)
+          result.AppendMessage(stream.GetData());
+        const char *archname =
+            exe_module_sp->GetArchitecture().GetArchitectureName();
+        result.AppendMessageWithFormat(
+            "Process %" PRIu64 " launched: '%s' (%s)\n", process_sp->GetID(),
+            exe_module_sp->GetFileSpec().GetPath().c_str(), archname);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+        result.SetDidChangeProcessState(true);
+      } else {
+        result.AppendError(
+            "no error returned from Target::Launch, and target has no process");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 
 protected:
-    ProcessLaunchCommandOptions m_options;
+  ProcessLaunchCommandOptions m_options;
 };
 
-
 //#define SET1 LLDB_OPT_SET_1
 //#define SET2 LLDB_OPT_SET_2
 //#define SET3 LLDB_OPT_SET_3
 //
-//OptionDefinition
-//CommandObjectProcessLaunch::CommandOptions::g_option_table[] =
+// OptionDefinition
+// CommandObjectProcessLaunch::CommandOptions::g_option_table[] =
 //{
 //  // clang-format off
-//  {SET1 | SET2 | SET3, false, "stop-at-entry", 's', OptionParser::eNoArgument,       nullptr, 0, eArgTypeNone,          "Stop at the entry point of the program when launching a process."},
-//  {SET1,               false, "stdin",         'i', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stdin for the process to <path>."},
-//  {SET1,               false, "stdout",        'o', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stdout for the process to <path>."},
-//  {SET1,               false, "stderr",        'e', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Redirect stderr for the process to <path>."},
-//  {SET1 | SET2 | SET3, false, "plugin",        'p', OptionParser::eRequiredArgument, nullptr, 0, eArgTypePlugin,        "Name of the process plugin you want to use."},
-//  {       SET2,        false, "tty",           't', OptionParser::eOptionalArgument, nullptr, 0, eArgTypeDirectoryName, "Start the process in a terminal. If <path> is specified, look for a terminal whose name contains <path>, else start the process in a new terminal."},
-//  {              SET3, false, "no-stdio",      'n', OptionParser::eNoArgument,       nullptr, 0, eArgTypeNone,          "Do not set up for terminal I/O to go to running process."},
-//  {SET1 | SET2 | SET3, false, "working-dir",   'w', OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Set the current working directory to <path> when running the inferior."},
+//  {SET1 | SET2 | SET3, false, "stop-at-entry", 's', OptionParser::eNoArgument,
+//  nullptr, 0, eArgTypeNone,          "Stop at the entry point of the program
+//  when launching a process."},
+//  {SET1,               false, "stdin",         'i',
+//  OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName,
+//  "Redirect stdin for the process to <path>."},
+//  {SET1,               false, "stdout",        'o',
+//  OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName,
+//  "Redirect stdout for the process to <path>."},
+//  {SET1,               false, "stderr",        'e',
+//  OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName,
+//  "Redirect stderr for the process to <path>."},
+//  {SET1 | SET2 | SET3, false, "plugin",        'p',
+//  OptionParser::eRequiredArgument, nullptr, 0, eArgTypePlugin,        "Name of
+//  the process plugin you want to use."},
+//  {       SET2,        false, "tty",           't',
+//  OptionParser::eOptionalArgument, nullptr, 0, eArgTypeDirectoryName, "Start
+//  the process in a terminal. If <path> is specified, look for a terminal whose
+//  name contains <path>, else start the process in a new terminal."},
+//  {              SET3, false, "no-stdio",      'n', OptionParser::eNoArgument,
+//  nullptr, 0, eArgTypeNone,          "Do not set up for terminal I/O to go to
+//  running process."},
+//  {SET1 | SET2 | SET3, false, "working-dir",   'w',
+//  OptionParser::eRequiredArgument, nullptr, 0, eArgTypeDirectoryName, "Set the
+//  current working directory to <path> when running the inferior."},
 //  {0, false, nullptr, 0, 0, nullptr, 0, eArgTypeNone, nullptr}
 //  // clang-format on
 //};
@@ -324,293 +313,255 @@ protected:
 // CommandObjectProcessAttach
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessAttach
-class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach
-{
+class CommandObjectProcessAttach : public CommandObjectProcessLaunchOrAttach {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options()
-        {
-            // Keep default values of all options in one place: OptionParsingStarting ()
-            OptionParsingStarting(nullptr);
-        }
-
-        ~CommandOptions() override = default;
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {
+      // Keep default values of all options in one place: OptionParsingStarting
+      // ()
+      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;
+      bool success = false;
+      switch (short_option) {
+      case 'c':
+        attach_info.SetContinueOnceAttached(true);
+        break;
+
+      case 'p': {
+        lldb::pid_t pid = StringConvert::ToUInt32(
+            option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
+        if (!success || pid == LLDB_INVALID_PROCESS_ID) {
+          error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
+        } else {
+          attach_info.SetProcessID(pid);
+        }
+      } break;
+
+      case 'P':
+        attach_info.SetProcessPluginName(option_arg);
+        break;
+
+      case 'n':
+        attach_info.GetExecutableFile().SetFile(option_arg, false);
+        break;
+
+      case 'w':
+        attach_info.SetWaitForLaunch(true);
+        break;
+
+      case 'i':
+        attach_info.SetIgnoreExisting(false);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      attach_info.Clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    bool HandleOptionArgumentCompletion(
+        Args &input, int cursor_index, int char_pos,
+        OptionElementVector &opt_element_vector, int opt_element_index,
+        int match_start_point, int max_return_elements,
+        CommandInterpreter &interpreter, bool &word_complete,
+        StringList &matches) override {
+      int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
+      int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
+
+      // We are only completing the name option for now...
+
+      const OptionDefinition *opt_defs = GetDefinitions();
+      if (opt_defs[opt_defs_index].short_option == 'n') {
+        // Are we in the name?
+
+        // Look to see if there is a -P argument provided, and if so use that
+        // plugin, otherwise
+        // use the default plugin.
+
+        const char *partial_name = nullptr;
+        partial_name = input.GetArgumentAtIndex(opt_arg_pos);
+
+        PlatformSP platform_sp(interpreter.GetPlatform(true));
+        if (platform_sp) {
+          ProcessInstanceInfoList process_infos;
+          ProcessInstanceInfoMatch match_info;
+          if (partial_name) {
+            match_info.GetProcessInfo().GetExecutableFile().SetFile(
+                partial_name, false);
+            match_info.SetNameMatchType(eNameMatchStartsWith);
+          }
+          platform_sp->FindProcesses(match_info, process_infos);
+          const size_t num_matches = process_infos.GetSize();
+          if (num_matches > 0) {
+            for (size_t i = 0; i < num_matches; ++i) {
+              matches.AppendString(
+                  process_infos.GetProcessNameAtIndex(i),
+                  process_infos.GetProcessNameLengthAtIndex(i));
+            }
+          }
+        }
+      }
+
+      return false;
+    }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+
+    ProcessAttachInfo attach_info;
+  };
+
+  CommandObjectProcessAttach(CommandInterpreter &interpreter)
+      : CommandObjectProcessLaunchOrAttach(
+            interpreter, "process attach", "Attach to a process.",
+            "process attach <cmd-options>", 0, "attach"),
+        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;
-            bool success = false;
-            switch (short_option)
-            {
-                case 'c':
-                    attach_info.SetContinueOnceAttached(true);
-                    break;
-
-                case 'p':   
-                    {
-                        lldb::pid_t pid = StringConvert::ToUInt32 (option_arg, LLDB_INVALID_PROCESS_ID, 0, &success);
-                        if (!success || pid == LLDB_INVALID_PROCESS_ID)
-                        {
-                            error.SetErrorStringWithFormat("invalid process ID '%s'", option_arg);
-                        }
-                        else
-                        {
-                            attach_info.SetProcessID (pid);
-                        }
-                    }
-                    break;
-
-                case 'P':
-                    attach_info.SetProcessPluginName (option_arg);
-                    break;
-
-                case 'n': 
-                    attach_info.GetExecutableFile().SetFile(option_arg, false);
-                    break;
-
-                case 'w':   
-                    attach_info.SetWaitForLaunch(true);
-                    break;
-                    
-                case 'i':
-                    attach_info.SetIgnoreExisting(false);
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            attach_info.Clear();
-        }
-
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        bool
-        HandleOptionArgumentCompletion (Args &input,
-                                        int cursor_index,
-                                        int char_pos,
-                                        OptionElementVector &opt_element_vector,
-                                        int opt_element_index,
-                                        int match_start_point,
-                                        int max_return_elements,
-                                        CommandInterpreter &interpreter,
-                                        bool &word_complete,
-                                        StringList &matches) override
-        {
-            int opt_arg_pos = opt_element_vector[opt_element_index].opt_arg_pos;
-            int opt_defs_index = opt_element_vector[opt_element_index].opt_defs_index;
-    
-            // We are only completing the name option for now...
-            
-            const OptionDefinition *opt_defs = GetDefinitions();
-            if (opt_defs[opt_defs_index].short_option == 'n')
-            {
-                // Are we in the name?
-                
-                // Look to see if there is a -P argument provided, and if so use that plugin, otherwise
-                // use the default plugin.
-                
-                const char *partial_name = nullptr;
-                partial_name = input.GetArgumentAtIndex(opt_arg_pos);
-
-                PlatformSP platform_sp(interpreter.GetPlatform(true));
-                if (platform_sp)
-                {
-                    ProcessInstanceInfoList process_infos;
-                    ProcessInstanceInfoMatch match_info;
-                    if (partial_name)
-                    {
-                        match_info.GetProcessInfo().GetExecutableFile().SetFile(partial_name, false);
-                        match_info.SetNameMatchType(eNameMatchStartsWith);
-                    }
-                    platform_sp->FindProcesses (match_info, process_infos);
-                    const size_t num_matches = process_infos.GetSize();
-                    if (num_matches > 0)
-                    {
-                        for (size_t i = 0; i < num_matches; ++i)
-                        {
-                            matches.AppendString (process_infos.GetProcessNameAtIndex(i), 
-                                                  process_infos.GetProcessNameLengthAtIndex(i));
-                        }
-                    }
-                }
-            }
-            
-            return false;
-        }
-
-        // Options table: Required for subclasses of Options.
+  ~CommandObjectProcessAttach() override = default;
 
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-
-        ProcessAttachInfo attach_info;
-    };
-
-    CommandObjectProcessAttach (CommandInterpreter &interpreter) :
-        CommandObjectProcessLaunchOrAttach (interpreter,
-                                            "process attach",
-                                            "Attach to a process.",
-                                            "process attach <cmd-options>",
-                                            0,
-                                            "attach"),
-        m_options()
-    {
-    }
-
-    ~CommandObjectProcessAttach() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        PlatformSP platform_sp (m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
-
-        Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
-        // N.B. The attach should be synchronous.  It doesn't help much to get the prompt back between initiating the attach
-        // and the target actually stopping.  So even if the interpreter is set to be asynchronous, we wait for the stop
-        // ourselves here.
-        
-        StateType state = eStateInvalid;
-        Process *process = m_exe_ctx.GetProcessPtr();
-        
-        if (!StopProcessIfNecessary (process, state, result))
-            return false;
-        
-        if (target == nullptr)
-        {
-            // If there isn't a current target create one.
-            TargetSP new_target_sp;
-            Error error;
-            
-            error = m_interpreter.GetDebugger().GetTargetList().CreateTarget(m_interpreter.GetDebugger(),
-                                                                             nullptr,
-                                                                             nullptr,
-                                                                             false,
-                                                                             nullptr, // No platform options
-                                                                             new_target_sp);
-            target = new_target_sp.get();
-            if (target == nullptr || error.Fail())
-            {
-                result.AppendError(error.AsCString("Error creating target"));
-                return false;
-            }
-            m_interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target);
-        }
-        
-        // Record the old executable module, we want to issue a warning if the process of attaching changed the
-        // current executable (like somebody said "file foo" then attached to a PID whose executable was bar.)
-         
-        ModuleSP old_exec_module_sp = target->GetExecutableModule();
-        ArchSpec old_arch_spec = target->GetArchitecture();
-
-        if (command.GetArgumentCount())
-        {
-            result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: %s\n", m_cmd_name.c_str(), m_cmd_syntax.c_str());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        m_interpreter.UpdateExecutionContext(nullptr);
-        StreamString stream;
-        const auto error = target->Attach(m_options.attach_info, &stream);
-        if (error.Success())
-        {
-            ProcessSP process_sp (target->GetProcessSP());
-            if (process_sp)
-            {
-                if (stream.GetData())
-                    result.AppendMessage(stream.GetData());
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                result.SetDidChangeProcessState (true);
-                result.SetAbnormalStopWasExpected(true);
-            }
-            else
-            {
-                result.AppendError("no error returned from Target::Attach, and target has no process");
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat ("attach failed: %s\n", error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-        }
-
-        if (!result.Succeeded())
-            return false;
-
-        // Okay, we're done.  Last step is to warn if the executable module has changed:
-        char new_path[PATH_MAX];
-        ModuleSP new_exec_module_sp (target->GetExecutableModule());
-        if (!old_exec_module_sp)
-        {
-            // We might not have a module if we attached to a raw pid...
-            if (new_exec_module_sp)
-            {
-                new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
-                result.AppendMessageWithFormat("Executable module set to \"%s\".\n", new_path);
-            }
-        }
-        else if (old_exec_module_sp->GetFileSpec() != new_exec_module_sp->GetFileSpec())
-        {
-            char old_path[PATH_MAX];
-
-            old_exec_module_sp->GetFileSpec().GetPath (old_path, PATH_MAX);
-            new_exec_module_sp->GetFileSpec().GetPath (new_path, PATH_MAX);
-
-            result.AppendWarningWithFormat("Executable module changed from \"%s\" to \"%s\".\n",
-                                                old_path, new_path);
-        }
-
-        if (!old_arch_spec.IsValid())
-        {
-            result.AppendMessageWithFormat ("Architecture set to: %s.\n", target->GetArchitecture().GetTriple().getTriple().c_str());
-        }
-        else if (!old_arch_spec.IsExactMatch(target->GetArchitecture()))
-        {
-            result.AppendWarningWithFormat("Architecture changed from %s to %s.\n",
-                                           old_arch_spec.GetTriple().getTriple().c_str(),
-                                           target->GetArchitecture().GetTriple().getTriple().c_str());
-        }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    PlatformSP platform_sp(
+        m_interpreter.GetDebugger().GetPlatformList().GetSelectedPlatform());
+
+    Target *target = m_interpreter.GetDebugger().GetSelectedTarget().get();
+    // N.B. The attach should be synchronous.  It doesn't help much to get the
+    // prompt back between initiating the attach
+    // and the target actually stopping.  So even if the interpreter is set to
+    // be asynchronous, we wait for the stop
+    // ourselves here.
+
+    StateType state = eStateInvalid;
+    Process *process = m_exe_ctx.GetProcessPtr();
+
+    if (!StopProcessIfNecessary(process, state, result))
+      return false;
+
+    if (target == nullptr) {
+      // If there isn't a current target create one.
+      TargetSP new_target_sp;
+      Error error;
+
+      error = m_interpreter.GetDebugger().GetTargetList().CreateTarget(
+          m_interpreter.GetDebugger(), nullptr, nullptr, false,
+          nullptr, // No platform options
+          new_target_sp);
+      target = new_target_sp.get();
+      if (target == nullptr || error.Fail()) {
+        result.AppendError(error.AsCString("Error creating target"));
+        return false;
+      }
+      m_interpreter.GetDebugger().GetTargetList().SetSelectedTarget(target);
+    }
+
+    // Record the old executable module, we want to issue a warning if the
+    // process of attaching changed the
+    // current executable (like somebody said "file foo" then attached to a PID
+    // whose executable was bar.)
+
+    ModuleSP old_exec_module_sp = target->GetExecutableModule();
+    ArchSpec old_arch_spec = target->GetArchitecture();
+
+    if (command.GetArgumentCount()) {
+      result.AppendErrorWithFormat("Invalid arguments for '%s'.\nUsage: %s\n",
+                                   m_cmd_name.c_str(), m_cmd_syntax.c_str());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    m_interpreter.UpdateExecutionContext(nullptr);
+    StreamString stream;
+    const auto error = target->Attach(m_options.attach_info, &stream);
+    if (error.Success()) {
+      ProcessSP process_sp(target->GetProcessSP());
+      if (process_sp) {
+        if (stream.GetData())
+          result.AppendMessage(stream.GetData());
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        result.SetDidChangeProcessState(true);
+        result.SetAbnormalStopWasExpected(true);
+      } else {
+        result.AppendError(
+            "no error returned from Target::Attach, and target has no process");
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendErrorWithFormat("attach failed: %s\n", error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+    }
+
+    if (!result.Succeeded())
+      return false;
+
+    // Okay, we're done.  Last step is to warn if the executable module has
+    // changed:
+    char new_path[PATH_MAX];
+    ModuleSP new_exec_module_sp(target->GetExecutableModule());
+    if (!old_exec_module_sp) {
+      // We might not have a module if we attached to a raw pid...
+      if (new_exec_module_sp) {
+        new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
+        result.AppendMessageWithFormat("Executable module set to \"%s\".\n",
+                                       new_path);
+      }
+    } else if (old_exec_module_sp->GetFileSpec() !=
+               new_exec_module_sp->GetFileSpec()) {
+      char old_path[PATH_MAX];
+
+      old_exec_module_sp->GetFileSpec().GetPath(old_path, PATH_MAX);
+      new_exec_module_sp->GetFileSpec().GetPath(new_path, PATH_MAX);
+
+      result.AppendWarningWithFormat(
+          "Executable module changed from \"%s\" to \"%s\".\n", old_path,
+          new_path);
+    }
+
+    if (!old_arch_spec.IsValid()) {
+      result.AppendMessageWithFormat(
+          "Architecture set to: %s.\n",
+          target->GetArchitecture().GetTriple().getTriple().c_str());
+    } else if (!old_arch_spec.IsExactMatch(target->GetArchitecture())) {
+      result.AppendWarningWithFormat(
+          "Architecture changed from %s to %s.\n",
+          old_arch_spec.GetTriple().getTriple().c_str(),
+          target->GetArchitecture().GetTriple().getTriple().c_str());
+    }
+
+    // This supports the use-case scenario of immediately continuing the process
+    // once attached.
+    if (m_options.attach_info.GetContinueOnceAttached())
+      m_interpreter.HandleCommand("process continue", eLazyBoolNo, result);
+
+    return result.Succeeded();
+  }
 
-        // This supports the use-case scenario of immediately continuing the process once attached.
-        if (m_options.attach_info.GetContinueOnceAttached())
-            m_interpreter.HandleCommand("process continue", eLazyBoolNo, result);
-
-        return result.Succeeded();
-    }
-    
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectProcessAttach::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectProcessAttach::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "continue",         'c', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,         "Immediately continue the process once attached."},
   {LLDB_OPT_SET_ALL, false, "plugin",           'P', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin,       "Name of the process plugin you want to use."},
   {LLDB_OPT_SET_1,   false, "pid",              'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePid,          "The process ID of an existing process to attach to."},
@@ -618,7 +569,7 @@ CommandObjectProcessAttach::CommandOptio
   {LLDB_OPT_SET_2,   false, "include-existing", 'i', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,         "Include existing processes when doing attach -w."},
   {LLDB_OPT_SET_2,   false, "waitfor",          'w', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,         "Wait for the process with <process-name> to launch."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -626,193 +577,170 @@ CommandObjectProcessAttach::CommandOptio
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessContinue
 
-class CommandObjectProcessContinue : public CommandObjectParsed
-{
+class CommandObjectProcessContinue : public CommandObjectParsed {
 public:
-    CommandObjectProcessContinue (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "process continue",
-                             "Continue execution of all threads in the current process.",
-                             "process continue",
-                             eCommandRequiresProcess       |
-                             eCommandTryTargetAPILock      |
-                             eCommandProcessMustBeLaunched |
-                             eCommandProcessMustBePaused   ),
-        m_options()
-    {
-    }
+  CommandObjectProcessContinue(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "process continue",
+            "Continue execution of all threads in the current process.",
+            "process continue",
+            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
+        m_options() {}
 
-    ~CommandObjectProcessContinue() override = default;
+  ~CommandObjectProcessContinue() override = default;
 
 protected:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options()
-        {
-            // Keep default values of all options in one place: OptionParsingStarting ()
-            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;
-            bool success = false;
-            switch (short_option)
-            {
-                case 'i':
-                    m_ignore = StringConvert::ToUInt32 (option_arg, 0, 0, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat ("invalid value for ignore option: \"%s\", should be a number.", option_arg);
-                    break;
-
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_ignore = 0;
-        }
-
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
-
-        uint32_t m_ignore;
-    };
-    
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
-        bool synchronous_execution = m_interpreter.GetSynchronous ();
-        StateType state = process->GetState();
-        if (state == eStateStopped)
-        {
-            if (command.GetArgumentCount() != 0)
-            {
-                result.AppendErrorWithFormat ("The '%s' command does not take any arguments.\n", m_cmd_name.c_str());
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
-
-            if (m_options.m_ignore > 0)
-            {
-                ThreadSP sel_thread_sp(GetDefaultThread()->shared_from_this());
-                if (sel_thread_sp)
-                {
-                    StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
-                    if (stop_info_sp && stop_info_sp->GetStopReason() == eStopReasonBreakpoint)
-                    {
-                        lldb::break_id_t bp_site_id = (lldb::break_id_t)stop_info_sp->GetValue();
-                        BreakpointSiteSP bp_site_sp(process->GetBreakpointSiteList().FindByID(bp_site_id));
-                        if (bp_site_sp)
-                        {
-                            const size_t num_owners = bp_site_sp->GetNumberOfOwners();
-                            for (size_t i = 0; i < num_owners; i++)
-                            {
-                                Breakpoint &bp_ref = bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
-                                if (!bp_ref.IsInternal())
-                                {
-                                    bp_ref.SetIgnoreCount(m_options.m_ignore);
-                                }
-                            }
-                        }
-                    }
-                }
-            }
-            
-            {  // Scope for thread list mutex:
-                std::lock_guard<std::recursive_mutex> guard(process->GetThreadList().GetMutex());
-                const uint32_t num_threads = process->GetThreadList().GetSize();
-
-                // Set the actions that the threads should each take when resuming
-                for (uint32_t idx=0; idx<num_threads; ++idx)
-                {
-                    const bool override_suspend = false;
-                    process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState (eStateRunning, override_suspend);
-                }
-            }
-
-            const uint32_t iohandler_id = process->GetIOHandlerID();
-
-            StreamString stream;
-            Error error;
-            if (synchronous_execution)
-                error = process->ResumeSynchronous (&stream);
-            else
-                error = process->Resume ();
-
-            if (error.Success())
-            {
-                // There is a race condition where this thread will return up the call stack to the main command
-                 // handler and show an (lldb) prompt before HandlePrivateEvent (from PrivateStateThread) has
-                 // a chance to call PushProcessIOHandler().
-                process->SyncIOHandler(iohandler_id, 2000);
-
-                result.AppendMessageWithFormat ("Process %" PRIu64 " resuming\n", process->GetID());
-                if (synchronous_execution)
-                {
-                    // If any state changed events had anything to say, add that to the result
-                    if (stream.GetData())
-                        result.AppendMessage(stream.GetData());
-
-                    result.SetDidChangeProcessState (true);
-                    result.SetStatus (eReturnStatusSuccessFinishNoResult);
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {
+      // Keep default values of all options in one place: OptionParsingStarting
+      // ()
+      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;
+      bool success = false;
+      switch (short_option) {
+      case 'i':
+        m_ignore = StringConvert::ToUInt32(option_arg, 0, 0, &success);
+        if (!success)
+          error.SetErrorStringWithFormat(
+              "invalid value for ignore option: \"%s\", should be a number.",
+              option_arg);
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_ignore = 0;
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    // Options table: Required for subclasses of Options.
+
+    static OptionDefinition g_option_table[];
+
+    uint32_t m_ignore;
+  };
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
+    bool synchronous_execution = m_interpreter.GetSynchronous();
+    StateType state = process->GetState();
+    if (state == eStateStopped) {
+      if (command.GetArgumentCount() != 0) {
+        result.AppendErrorWithFormat(
+            "The '%s' command does not take any arguments.\n",
+            m_cmd_name.c_str());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      if (m_options.m_ignore > 0) {
+        ThreadSP sel_thread_sp(GetDefaultThread()->shared_from_this());
+        if (sel_thread_sp) {
+          StopInfoSP stop_info_sp = sel_thread_sp->GetStopInfo();
+          if (stop_info_sp &&
+              stop_info_sp->GetStopReason() == eStopReasonBreakpoint) {
+            lldb::break_id_t bp_site_id =
+                (lldb::break_id_t)stop_info_sp->GetValue();
+            BreakpointSiteSP bp_site_sp(
+                process->GetBreakpointSiteList().FindByID(bp_site_id));
+            if (bp_site_sp) {
+              const size_t num_owners = bp_site_sp->GetNumberOfOwners();
+              for (size_t i = 0; i < num_owners; i++) {
+                Breakpoint &bp_ref =
+                    bp_site_sp->GetOwnerAtIndex(i)->GetBreakpoint();
+                if (!bp_ref.IsInternal()) {
+                  bp_ref.SetIgnoreCount(m_options.m_ignore);
                 }
-                else
-                {
-                    result.SetStatus (eReturnStatusSuccessContinuingNoResult);
-                }
-            }
-            else
-            {
-                result.AppendErrorWithFormat("Failed to resume process: %s.\n", error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
+              }
             }
+          }
         }
-        else
-        {
-            result.AppendErrorWithFormat ("Process cannot be continued from its current state (%s).\n",
-                                         StateAsCString(state));
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
-    }
+      }
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
+      { // Scope for thread list mutex:
+        std::lock_guard<std::recursive_mutex> guard(
+            process->GetThreadList().GetMutex());
+        const uint32_t num_threads = process->GetThreadList().GetSize();
+
+        // Set the actions that the threads should each take when resuming
+        for (uint32_t idx = 0; idx < num_threads; ++idx) {
+          const bool override_suspend = false;
+          process->GetThreadList().GetThreadAtIndex(idx)->SetResumeState(
+              eStateRunning, override_suspend);
+        }
+      }
+
+      const uint32_t iohandler_id = process->GetIOHandlerID();
+
+      StreamString stream;
+      Error error;
+      if (synchronous_execution)
+        error = process->ResumeSynchronous(&stream);
+      else
+        error = process->Resume();
+
+      if (error.Success()) {
+        // There is a race condition where this thread will return up the call
+        // stack to the main command
+        // handler and show an (lldb) prompt before HandlePrivateEvent (from
+        // PrivateStateThread) has
+        // a chance to call PushProcessIOHandler().
+        process->SyncIOHandler(iohandler_id, 2000);
+
+        result.AppendMessageWithFormat("Process %" PRIu64 " resuming\n",
+                                       process->GetID());
+        if (synchronous_execution) {
+          // If any state changed events had anything to say, add that to the
+          // result
+          if (stream.GetData())
+            result.AppendMessage(stream.GetData());
+
+          result.SetDidChangeProcessState(true);
+          result.SetStatus(eReturnStatusSuccessFinishNoResult);
+        } else {
+          result.SetStatus(eReturnStatusSuccessContinuingNoResult);
+        }
+      } else {
+        result.AppendErrorWithFormat("Failed to resume process: %s.\n",
+                                     error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendErrorWithFormat(
+          "Process cannot be continued from its current state (%s).\n",
+          StateAsCString(state));
+      result.SetStatus(eReturnStatusFailed);
     }
-    
-    CommandOptions m_options;
+    return result.Succeeded();
+  }
+
+  Options *GetOptions() override { return &m_options; }
+
+  CommandOptions m_options;
 };
 
 OptionDefinition
-CommandObjectProcessContinue::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectProcessContinue::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "ignore-count",'i', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeUnsignedInteger, "Ignore <N> crossings of the breakpoint (if it exists) for the currently selected thread."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -820,127 +748,101 @@ CommandObjectProcessContinue::CommandOpt
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessDetach
 
-class CommandObjectProcessDetach : public CommandObjectParsed
-{
+class CommandObjectProcessDetach : 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 's':
-                    bool tmp_result;
-                    bool success;
-                    tmp_result = Args::StringToBoolean(option_arg, false, &success);
-                    if (!success)
-                        error.SetErrorStringWithFormat("invalid boolean option: \"%s\"", option_arg);
-                    else
-                    {
-                        if (tmp_result)
-                            m_keep_stopped = eLazyBoolYes;
-                        else
-                            m_keep_stopped = eLazyBoolNo;
-                    }
-                    break;
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_keep_stopped = eLazyBoolCalculate;
-        }
-
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
+  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 's':
+        bool tmp_result;
+        bool success;
+        tmp_result = Args::StringToBoolean(option_arg, false, &success);
+        if (!success)
+          error.SetErrorStringWithFormat("invalid boolean option: \"%s\"",
+                                         option_arg);
+        else {
+          if (tmp_result)
+            m_keep_stopped = eLazyBoolYes;
+          else
+            m_keep_stopped = eLazyBoolNo;
+        }
+        break;
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_keep_stopped = eLazyBoolCalculate;
+    }
+
+    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.
+    LazyBool m_keep_stopped;
+  };
+
+  CommandObjectProcessDetach(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process detach",
+                            "Detach from the current target process.",
+                            "process detach",
+                            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched),
+        m_options() {}
 
-        // Options table: Required for subclasses of Options.
+  ~CommandObjectProcessDetach() override = default;
 
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-        LazyBool m_keep_stopped;
-    };
-
-    CommandObjectProcessDetach(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "process detach", "Detach from the current target process.",
-                              "process detach",
-                              eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched),
-          m_options()
-    {
-    }
-
-    ~CommandObjectProcessDetach() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
-        // FIXME: This will be a Command Option:
-        bool keep_stopped;
-        if (m_options.m_keep_stopped == eLazyBoolCalculate)
-        {
-            // Check the process default:
-            keep_stopped = process->GetDetachKeepsStopped();
-        }
-        else if (m_options.m_keep_stopped == eLazyBoolYes)
-            keep_stopped = true;
-        else
-            keep_stopped = false;
-        
-        Error error (process->Detach(keep_stopped));
-        if (error.Success())
-        {
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
-        else
-        {
-            result.AppendErrorWithFormat ("Detach failed: %s\n", error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        return result.Succeeded();
-    }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
+    // FIXME: This will be a Command Option:
+    bool keep_stopped;
+    if (m_options.m_keep_stopped == eLazyBoolCalculate) {
+      // Check the process default:
+      keep_stopped = process->GetDetachKeepsStopped();
+    } else if (m_options.m_keep_stopped == eLazyBoolYes)
+      keep_stopped = true;
+    else
+      keep_stopped = false;
+
+    Error error(process->Detach(keep_stopped));
+    if (error.Success()) {
+      result.SetStatus(eReturnStatusSuccessFinishResult);
+    } else {
+      result.AppendErrorWithFormat("Detach failed: %s\n", error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+    return result.Succeeded();
+  }
 
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectProcessDetach::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectProcessDetach::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "keep-stopped", 's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be kept stopped on detach (if possible)."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -948,133 +850,108 @@ CommandObjectProcessDetach::CommandOptio
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessConnect
 
-class CommandObjectProcessConnect : public CommandObjectParsed
-{
+class CommandObjectProcessConnect : public CommandObjectParsed {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options()
-        {
-            // Keep default values of all options in one place: OptionParsingStarting ()
-            OptionParsingStarting(nullptr);
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {
+      // Keep default values of all options in one place: OptionParsingStarting
+      // ()
+      OptionParsingStarting(nullptr);
+    }
 
-        ~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 'p':   
-                plugin_name.assign (option_arg);    
-                break;
-
-            default:
-                error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                break;
-            }
-            return error;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            plugin_name.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 plugin_name;        
-    };
-
-    CommandObjectProcessConnect (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "process connect",
-                             "Connect to a remote debug service.",
-                             "process connect <remote-url>",
-                             0),
-        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;
 
-    ~CommandObjectProcessConnect() override = default;
+      switch (short_option) {
+      case 'p':
+        plugin_name.assign(option_arg);
+        break;
 
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
     }
-    
-protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        if (command.GetArgumentCount() != 1)
-        {
-            result.AppendErrorWithFormat ("'%s' takes exactly one argument:\nUsage: %s\n",
-                                          m_cmd_name.c_str(),
-                                          m_cmd_syntax.c_str());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        Process *process = m_exe_ctx.GetProcessPtr();
-        if (process && process->IsAlive())
-        {
-            result.AppendErrorWithFormat ("Process %" PRIu64 " is currently being debugged, kill the process before connecting.\n",
-                                          process->GetID());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
 
-        const char *plugin_name = nullptr;
-        if (!m_options.plugin_name.empty())
-            plugin_name = m_options.plugin_name.c_str();
-
-        Error error;
-        Debugger& debugger = m_interpreter.GetDebugger();
-        PlatformSP platform_sp = m_interpreter.GetPlatform(true);
-        ProcessSP process_sp = platform_sp->ConnectProcess(command.GetArgumentAtIndex(0),
-                                                           plugin_name,
-                                                           debugger,
-                                                           debugger.GetSelectedTarget().get(),
-                                                           error);
-        if (error.Fail() || process_sp == nullptr)
-        {
-            result.AppendError(error.AsCString("Error connecting to the process"));
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        return true;
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      plugin_name.clear();
     }
 
-    CommandOptions m_options;
+    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 plugin_name;
+  };
+
+  CommandObjectProcessConnect(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process connect",
+                            "Connect to a remote debug service.",
+                            "process connect <remote-url>", 0),
+        m_options() {}
+
+  ~CommandObjectProcessConnect() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+protected:
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    if (command.GetArgumentCount() != 1) {
+      result.AppendErrorWithFormat(
+          "'%s' takes exactly one argument:\nUsage: %s\n", m_cmd_name.c_str(),
+          m_cmd_syntax.c_str());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    Process *process = m_exe_ctx.GetProcessPtr();
+    if (process && process->IsAlive()) {
+      result.AppendErrorWithFormat(
+          "Process %" PRIu64
+          " is currently being debugged, kill the process before connecting.\n",
+          process->GetID());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *plugin_name = nullptr;
+    if (!m_options.plugin_name.empty())
+      plugin_name = m_options.plugin_name.c_str();
+
+    Error error;
+    Debugger &debugger = m_interpreter.GetDebugger();
+    PlatformSP platform_sp = m_interpreter.GetPlatform(true);
+    ProcessSP process_sp = platform_sp->ConnectProcess(
+        command.GetArgumentAtIndex(0), plugin_name, debugger,
+        debugger.GetSelectedTarget().get(), error);
+    if (error.Fail() || process_sp == nullptr) {
+      result.AppendError(error.AsCString("Error connecting to the process"));
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+    return true;
+  }
+
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectProcessConnect::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectProcessConnect::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "plugin", 'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypePlugin, "Name of the process plugin you want to use."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -1082,25 +959,22 @@ CommandObjectProcessConnect::CommandOpti
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessPlugin
 
-class CommandObjectProcessPlugin : public CommandObjectProxy
-{
+class CommandObjectProcessPlugin : public CommandObjectProxy {
 public:
-    CommandObjectProcessPlugin(CommandInterpreter &interpreter)
-        : CommandObjectProxy(interpreter, "process plugin",
-                             "Send a custom command to the current target process plug-in.", "process plugin <args>", 0)
-    {
-    }
-
-    ~CommandObjectProcessPlugin() override = default;
-
-    CommandObject *
-    GetProxyCommandObject() override
-    {
-        Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
-        if (process)
-            return process->GetPluginCommandObject();
-        return nullptr;
-    }
+  CommandObjectProcessPlugin(CommandInterpreter &interpreter)
+      : CommandObjectProxy(
+            interpreter, "process plugin",
+            "Send a custom command to the current target process plug-in.",
+            "process plugin <args>", 0) {}
+
+  ~CommandObjectProcessPlugin() override = default;
+
+  CommandObject *GetProxyCommandObject() override {
+    Process *process = m_interpreter.GetExecutionContext().GetProcessPtr();
+    if (process)
+      return process->GetPluginCommandObject();
+    return nullptr;
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1108,139 +982,113 @@ public:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessLoad
 
-class CommandObjectProcessLoad : public CommandObjectParsed
-{
+class CommandObjectProcessLoad : public CommandObjectParsed {
 public:
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options()
-        {
-            // Keep default values of all options in one place: OptionParsingStarting ()
-            OptionParsingStarting(nullptr);
-        }
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options() {
+      // Keep default values of all options in one place: OptionParsingStarting
+      // ()
+      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 'i':
+        do_install = true;
+        if (option_arg && option_arg[0])
+          install_path.SetFile(option_arg, false);
+        break;
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      do_install = false;
+      install_path.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.
+    bool do_install;
+    FileSpec install_path;
+  };
+
+  CommandObjectProcessLoad(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process load",
+                            "Load a shared library into the current process.",
+                            "process load <filename> [<filename> ...]",
+                            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched |
+                                eCommandProcessMustBePaused),
+        m_options() {}
 
-        ~CommandOptions() override = default;
+  ~CommandObjectProcessLoad() 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 'i':
-                do_install = true;
-                if (option_arg && option_arg[0])
-                    install_path.SetFile(option_arg, false);
-                break;
-            default:
-                error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                break;
-            }
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            do_install = false;
-            install_path.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.
-        bool do_install;
-        FileSpec install_path;
-    };
-
-    CommandObjectProcessLoad (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "process load",
-                             "Load a shared library into the current process.",
-                             "process load <filename> [<filename> ...]",
-                             eCommandRequiresProcess       |
-                             eCommandTryTargetAPILock      |
-                             eCommandProcessMustBeLaunched |
-                             eCommandProcessMustBePaused   ),
-        m_options()
-    {
-    }
-
-    ~CommandObjectProcessLoad() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
+  Options *GetOptions() override { return &m_options; }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
-
-        const size_t argc = command.GetArgumentCount();
-        for (uint32_t i = 0; i < argc; ++i)
-        {
-            Error error;
-            PlatformSP platform = process->GetTarget().GetPlatform();
-            const char *image_path = command.GetArgumentAtIndex(i);
-            uint32_t image_token = LLDB_INVALID_IMAGE_TOKEN;
-
-            if (!m_options.do_install)
-            {
-                FileSpec image_spec (image_path, false);
-                platform->ResolveRemotePath(image_spec, image_spec);
-                image_token = platform->LoadImage(process, FileSpec(), image_spec, error);
-            }
-            else if (m_options.install_path)
-            {
-                FileSpec image_spec (image_path, true);
-                platform->ResolveRemotePath(m_options.install_path, m_options.install_path);
-                image_token = platform->LoadImage(process, image_spec, m_options.install_path, error);
-            }
-            else
-            {
-                FileSpec image_spec (image_path, true);
-                image_token = platform->LoadImage(process, image_spec, FileSpec(), error);
-            }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
 
-            if (image_token != LLDB_INVALID_IMAGE_TOKEN)
-            {
-                result.AppendMessageWithFormat ("Loading \"%s\"...ok\nImage %u loaded.\n", image_path, image_token);
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("failed to load '%s': %s", image_path, error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        return result.Succeeded();
+    const size_t argc = command.GetArgumentCount();
+    for (uint32_t i = 0; i < argc; ++i) {
+      Error error;
+      PlatformSP platform = process->GetTarget().GetPlatform();
+      const char *image_path = command.GetArgumentAtIndex(i);
+      uint32_t image_token = LLDB_INVALID_IMAGE_TOKEN;
+
+      if (!m_options.do_install) {
+        FileSpec image_spec(image_path, false);
+        platform->ResolveRemotePath(image_spec, image_spec);
+        image_token =
+            platform->LoadImage(process, FileSpec(), image_spec, error);
+      } else if (m_options.install_path) {
+        FileSpec image_spec(image_path, true);
+        platform->ResolveRemotePath(m_options.install_path,
+                                    m_options.install_path);
+        image_token = platform->LoadImage(process, image_spec,
+                                          m_options.install_path, error);
+      } else {
+        FileSpec image_spec(image_path, true);
+        image_token =
+            platform->LoadImage(process, image_spec, FileSpec(), error);
+      }
+
+      if (image_token != LLDB_INVALID_IMAGE_TOKEN) {
+        result.AppendMessageWithFormat(
+            "Loading \"%s\"...ok\nImage %u loaded.\n", image_path, image_token);
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendErrorWithFormat("failed to load '%s': %s", image_path,
+                                     error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
     }
-    
-    CommandOptions m_options;
+    return result.Succeeded();
+  }
+
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectProcessLoad::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectProcessLoad::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_ALL, false, "install", 'i', OptionParser::eOptionalArgument, nullptr, nullptr, 0, eArgTypePath, "Install the shared library to the target. If specified without an argument then the library will installed in the current working directory."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
 //-------------------------------------------------------------------------
@@ -1248,60 +1096,51 @@ CommandObjectProcessLoad::CommandOptions
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessUnload
 
-class CommandObjectProcessUnload : public CommandObjectParsed
-{
+class CommandObjectProcessUnload : public CommandObjectParsed {
 public:
+  CommandObjectProcessUnload(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "process unload",
+            "Unload a shared library from the current process using the index "
+            "returned by a previous call to \"process load\".",
+            "process unload <index>",
+            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                eCommandProcessMustBeLaunched | eCommandProcessMustBePaused) {}
 
-    CommandObjectProcessUnload (CommandInterpreter &interpreter) :
-        CommandObjectParsed (interpreter,
-                             "process unload",
-                             "Unload a shared library from the current process using the index returned by a previous call to \"process load\".",
-                             "process unload <index>",
-                             eCommandRequiresProcess       |
-                             eCommandTryTargetAPILock      |
-                             eCommandProcessMustBeLaunched |
-                             eCommandProcessMustBePaused   )
-    {
-    }
-
-    ~CommandObjectProcessUnload() override = default;
+  ~CommandObjectProcessUnload() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
 
-        const size_t argc = command.GetArgumentCount();
-        
-        for (uint32_t i = 0; i < argc; ++i)
-        {
-            const char *image_token_cstr = command.GetArgumentAtIndex(i);
-            uint32_t image_token = StringConvert::ToUInt32(image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0);
-            if (image_token == LLDB_INVALID_IMAGE_TOKEN)
-            {
-                result.AppendErrorWithFormat ("invalid image index argument '%s'", image_token_cstr);
-                result.SetStatus (eReturnStatusFailed);
-                break;
-            }
-            else
-            {
-                Error error (process->GetTarget().GetPlatform()->UnloadImage(process, image_token));
-                if (error.Success())
-                {
-                    result.AppendMessageWithFormat ("Unloading shared library with index %u...ok\n", image_token);  
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("failed to unload image: %s", error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                    break;
-                }
-            }
+    const size_t argc = command.GetArgumentCount();
+
+    for (uint32_t i = 0; i < argc; ++i) {
+      const char *image_token_cstr = command.GetArgumentAtIndex(i);
+      uint32_t image_token = StringConvert::ToUInt32(
+          image_token_cstr, LLDB_INVALID_IMAGE_TOKEN, 0);
+      if (image_token == LLDB_INVALID_IMAGE_TOKEN) {
+        result.AppendErrorWithFormat("invalid image index argument '%s'",
+                                     image_token_cstr);
+        result.SetStatus(eReturnStatusFailed);
+        break;
+      } else {
+        Error error(process->GetTarget().GetPlatform()->UnloadImage(
+            process, image_token));
+        if (error.Success()) {
+          result.AppendMessageWithFormat(
+              "Unloading shared library with index %u...ok\n", image_token);
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.AppendErrorWithFormat("failed to unload image: %s",
+                                       error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+          break;
         }
-        return result.Succeeded();
+      }
     }
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1309,72 +1148,66 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessSignal
 
-class CommandObjectProcessSignal : public CommandObjectParsed
-{
+class CommandObjectProcessSignal : public CommandObjectParsed {
 public:
-    CommandObjectProcessSignal(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "process signal", "Send a UNIX signal to the current target process.",
-                              nullptr, eCommandRequiresProcess | eCommandTryTargetAPILock)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData signal_arg;
-        
-        // Define the first (and only) variant of this arg.
-        signal_arg.arg_type = eArgTypeUnixSignal;
-        signal_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (signal_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
+  CommandObjectProcessSignal(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process signal",
+                            "Send a UNIX signal to the current target process.",
+                            nullptr, eCommandRequiresProcess |
+                                         eCommandTryTargetAPILock) {
+    CommandArgumentEntry arg;
+    CommandArgumentData signal_arg;
+
+    // Define the first (and only) variant of this arg.
+    signal_arg.arg_type = eArgTypeUnixSignal;
+    signal_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(signal_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
 
-    ~CommandObjectProcessSignal() override = default;
+  ~CommandObjectProcessSignal() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
 
-        if (command.GetArgumentCount() == 1)
-        {
-            int signo = LLDB_INVALID_SIGNAL_NUMBER;
-            
-            const char *signal_name = command.GetArgumentAtIndex(0);
-            if (::isxdigit (signal_name[0]))
-                signo = StringConvert::ToSInt32(signal_name, LLDB_INVALID_SIGNAL_NUMBER, 0);
-            else
-                signo = process->GetUnixSignals()->GetSignalNumberFromName(signal_name);
-            
-            if (signo == LLDB_INVALID_SIGNAL_NUMBER)
-            {
-                result.AppendErrorWithFormat ("Invalid signal argument '%s'.\n", command.GetArgumentAtIndex(0));
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else
-            {
-                Error error (process->Signal (signo));
-                if (error.Success())
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("Failed to send signal %i: %s\n", signo, error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat("'%s' takes exactly one signal number argument:\nUsage: %s\n", m_cmd_name.c_str(),
-                                        m_cmd_syntax.c_str());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+    if (command.GetArgumentCount() == 1) {
+      int signo = LLDB_INVALID_SIGNAL_NUMBER;
+
+      const char *signal_name = command.GetArgumentAtIndex(0);
+      if (::isxdigit(signal_name[0]))
+        signo =
+            StringConvert::ToSInt32(signal_name, LLDB_INVALID_SIGNAL_NUMBER, 0);
+      else
+        signo = process->GetUnixSignals()->GetSignalNumberFromName(signal_name);
+
+      if (signo == LLDB_INVALID_SIGNAL_NUMBER) {
+        result.AppendErrorWithFormat("Invalid signal argument '%s'.\n",
+                                     command.GetArgumentAtIndex(0));
+        result.SetStatus(eReturnStatusFailed);
+      } else {
+        Error error(process->Signal(signo));
+        if (error.Success()) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.AppendErrorWithFormat("Failed to send signal %i: %s\n", signo,
+                                       error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      }
+    } else {
+      result.AppendErrorWithFormat(
+          "'%s' takes exactly one signal number argument:\nUsage: %s\n",
+          m_cmd_name.c_str(), m_cmd_syntax.c_str());
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1382,53 +1215,43 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessInterrupt
 
-class CommandObjectProcessInterrupt : public CommandObjectParsed
-{
+class CommandObjectProcessInterrupt : public CommandObjectParsed {
 public:
-    CommandObjectProcessInterrupt(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "process interrupt", "Interrupt the current target process.",
-                              "process interrupt",
-                              eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched)
-    {
-    }
+  CommandObjectProcessInterrupt(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process interrupt",
+                            "Interrupt the current target process.",
+                            "process interrupt",
+                            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched) {}
 
-    ~CommandObjectProcessInterrupt() override = default;
+  ~CommandObjectProcessInterrupt() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
-        if (process == nullptr)
-        {
-            result.AppendError ("no process to halt");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (command.GetArgumentCount() == 0)
-        {
-            bool clear_thread_plans = true;
-            Error error(process->Halt (clear_thread_plans));
-            if (error.Success())
-            {
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("Failed to halt process: %s\n", error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
-                                        m_cmd_name.c_str(),
-                                        m_cmd_syntax.c_str());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
+    if (process == nullptr) {
+      result.AppendError("no process to halt");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      bool clear_thread_plans = true;
+      Error error(process->Halt(clear_thread_plans));
+      if (error.Success()) {
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendErrorWithFormat("Failed to halt process: %s\n",
+                                     error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
+                                   m_cmd_name.c_str(), m_cmd_syntax.c_str());
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1436,51 +1259,42 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessKill
 
-class CommandObjectProcessKill : public CommandObjectParsed
-{
+class CommandObjectProcessKill : public CommandObjectParsed {
 public:
-    CommandObjectProcessKill(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "process kill", "Terminate the current target process.", "process kill",
-                              eCommandRequiresProcess | eCommandTryTargetAPILock | eCommandProcessMustBeLaunched)
-    {
-    }
+  CommandObjectProcessKill(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process kill",
+                            "Terminate the current target process.",
+                            "process kill",
+                            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched) {}
 
-    ~CommandObjectProcessKill() override = default;
+  ~CommandObjectProcessKill() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Process *process = m_exe_ctx.GetProcessPtr();
-        if (process == nullptr)
-        {
-            result.AppendError ("no process to kill");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (command.GetArgumentCount() == 0)
-        {
-            Error error (process->Destroy(true));
-            if (error.Success())
-            {
-                result.SetStatus (eReturnStatusSuccessFinishResult);
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("Failed to kill process: %s\n", error.AsCString());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
-                                        m_cmd_name.c_str(),
-                                        m_cmd_syntax.c_str());
-            result.SetStatus (eReturnStatusFailed);
-        }
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Process *process = m_exe_ctx.GetProcessPtr();
+    if (process == nullptr) {
+      result.AppendError("no process to kill");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (command.GetArgumentCount() == 0) {
+      Error error(process->Destroy(true));
+      if (error.Success()) {
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      } else {
+        result.AppendErrorWithFormat("Failed to kill process: %s\n",
+                                     error.AsCString());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendErrorWithFormat("'%s' takes no arguments:\nUsage: %s\n",
+                                   m_cmd_name.c_str(), m_cmd_syntax.c_str());
+      result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1488,61 +1302,45 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessSaveCore
 
-class CommandObjectProcessSaveCore : public CommandObjectParsed
-{
+class CommandObjectProcessSaveCore : public CommandObjectParsed {
 public:
-    CommandObjectProcessSaveCore (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "process save-core",
-                         "Save the current process as a core file using an appropriate file type.",
-                         "process save-core FILE",
-                         eCommandRequiresProcess      |
-                         eCommandTryTargetAPILock     |
-                         eCommandProcessMustBeLaunched)
-    {
-    }
+  CommandObjectProcessSaveCore(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process save-core",
+                            "Save the current process as a core file using an "
+                            "appropriate file type.",
+                            "process save-core FILE",
+                            eCommandRequiresProcess | eCommandTryTargetAPILock |
+                                eCommandProcessMustBeLaunched) {}
 
-    ~CommandObjectProcessSaveCore() override = default;
+  ~CommandObjectProcessSaveCore() override = default;
 
 protected:
-    bool
-    DoExecute (Args& command,
-               CommandReturnObject &result) override
-    {
-        ProcessSP process_sp = m_exe_ctx.GetProcessSP();
-        if (process_sp)
-        {
-            if (command.GetArgumentCount() == 1)
-            {
-                FileSpec output_file(command.GetArgumentAtIndex(0), false);
-                Error error = PluginManager::SaveCore(process_sp, output_file);
-                if (error.Success())
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("Failed to save core file for process: %s\n", error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("'%s' takes one arguments:\nUsage: %s\n",
-                                              m_cmd_name.c_str(),
-                                              m_cmd_syntax.c_str());
-                result.SetStatus (eReturnStatusFailed);
-            }
-        }
-        else
-        {
-            result.AppendError ("invalid process");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    ProcessSP process_sp = m_exe_ctx.GetProcessSP();
+    if (process_sp) {
+      if (command.GetArgumentCount() == 1) {
+        FileSpec output_file(command.GetArgumentAtIndex(0), false);
+        Error error = PluginManager::SaveCore(process_sp, output_file);
+        if (error.Success()) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.AppendErrorWithFormat(
+              "Failed to save core file for process: %s\n", error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      } else {
+        result.AppendErrorWithFormat("'%s' takes one arguments:\nUsage: %s\n",
+                                     m_cmd_name.c_str(), m_cmd_syntax.c_str());
+        result.SetStatus(eReturnStatusFailed);
+      }
+    } else {
+      result.AppendError("invalid process");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1550,37 +1348,32 @@ protected:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessStatus
 
-class CommandObjectProcessStatus : public CommandObjectParsed
-{
+class CommandObjectProcessStatus : public CommandObjectParsed {
 public:
-    CommandObjectProcessStatus(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "process status",
-                              "Show status and stop location for the current target process.", "process status",
-                              eCommandRequiresProcess | eCommandTryTargetAPILock)
-    {
-    }
-
-    ~CommandObjectProcessStatus() override = default;
-
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Stream &strm = result.GetOutputStream();
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        // No need to check "process" for validity as eCommandRequiresProcess ensures it is valid        
-        Process *process = m_exe_ctx.GetProcessPtr();
-        const bool only_threads_with_stop_reason = true;
-        const uint32_t start_frame = 0;
-        const uint32_t num_frames = 1;
-        const uint32_t num_frames_with_source = 1;
-        process->GetStatus(strm);
-        process->GetThreadStatus (strm, 
-                                  only_threads_with_stop_reason, 
-                                  start_frame,
-                                  num_frames,
-                                  num_frames_with_source);
-        return result.Succeeded();
-    }
+  CommandObjectProcessStatus(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "process status",
+            "Show status and stop location for the current target process.",
+            "process status",
+            eCommandRequiresProcess | eCommandTryTargetAPILock) {}
+
+  ~CommandObjectProcessStatus() override = default;
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Stream &strm = result.GetOutputStream();
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    // No need to check "process" for validity as eCommandRequiresProcess
+    // ensures it is valid
+    Process *process = m_exe_ctx.GetProcessPtr();
+    const bool only_threads_with_stop_reason = true;
+    const uint32_t start_frame = 0;
+    const uint32_t num_frames = 1;
+    const uint32_t num_frames_with_source = 1;
+    process->GetStatus(strm);
+    process->GetThreadStatus(strm, only_threads_with_stop_reason, start_frame,
+                             num_frames, num_frames_with_source);
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
@@ -1588,324 +1381,303 @@ public:
 //-------------------------------------------------------------------------
 #pragma mark CommandObjectProcessHandle
 
-class CommandObjectProcessHandle : public CommandObjectParsed
-{
+class CommandObjectProcessHandle : 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 's':
-                    stop = option_arg;
-                    break;
-                case 'n':
-                    notify = option_arg;
-                    break;
-                case 'p':
-                    pass = option_arg;
-                    break;
-                default:
-                    error.SetErrorStringWithFormat("invalid short option character '%c'", short_option);
-                    break;
-            }
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            stop.clear();
-            notify.clear();
-            pass.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 stop;
-        std::string notify;
-        std::string pass;
-    };
-
-    CommandObjectProcessHandle(CommandInterpreter &interpreter)
-        : CommandObjectParsed(
-              interpreter, "process handle",
-              "Manage LLDB handling of OS signals for the current target process.  Defaults to showing current policy.",
-              nullptr),
-          m_options()
-    {
-        SetHelpLong ("\nIf no signals are specified, update them all.  If no update "
-                     "option is specified, list the current values.");
-        CommandArgumentEntry arg;
-        CommandArgumentData signal_arg;
-
-        signal_arg.arg_type = eArgTypeUnixSignal;
-        signal_arg.arg_repetition = eArgRepeatStar;
-
-        arg.push_back (signal_arg);
-        
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectProcessHandle() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-
-    bool
-    VerifyCommandOptionValue (const std::string &option, int &real_value)
-    {
-        bool okay = true;
-        bool success = false;
-        bool tmp_value = Args::StringToBoolean (option.c_str(), false, &success);
-
-        if (success && tmp_value)
-            real_value = 1;
-        else if (success && !tmp_value)
-            real_value = 0;
-        else
-        {
-            // If the value isn't 'true' or 'false', it had better be 0 or 1.
-            real_value = StringConvert::ToUInt32 (option.c_str(), 3);
-            if (real_value != 0 && real_value != 1)
-                okay = false;
-        }
-        
-        return okay;
-    }
-
-    void
-    PrintSignalHeader (Stream &str)
-    {
-        str.Printf ("NAME         PASS   STOP   NOTIFY\n");
-        str.Printf ("===========  =====  =====  ======\n");
-    }  
-
-    void
-    PrintSignal(Stream &str, int32_t signo, const char *sig_name, const UnixSignalsSP &signals_sp)
-    {
-        bool stop;
-        bool suppress;
-        bool notify;
-
-        str.Printf ("%-11s  ", sig_name);
-        if (signals_sp->GetSignalInfo(signo, suppress, stop, notify))
-        {
-            bool pass = !suppress;
-            str.Printf ("%s  %s  %s", 
-                        (pass ? "true " : "false"), 
-                        (stop ? "true " : "false"), 
-                        (notify ? "true " : "false"));
-        }
-        str.Printf ("\n");
-    }
-
-    void
-    PrintSignalInformation(Stream &str, Args &signal_args, int num_valid_signals, const UnixSignalsSP &signals_sp)
-    {
-        PrintSignalHeader (str);
-
-        if (num_valid_signals > 0)
-        {
-            size_t num_args = signal_args.GetArgumentCount();
-            for (size_t i = 0; i < num_args; ++i)
-            {
-                int32_t signo = signals_sp->GetSignalNumberFromName(signal_args.GetArgumentAtIndex(i));
-                if (signo != LLDB_INVALID_SIGNAL_NUMBER)
-                    PrintSignal (str, signo, signal_args.GetArgumentAtIndex (i), signals_sp);
-            }
-        }
-        else // Print info for ALL signals
-        {
-            int32_t signo = signals_sp->GetFirstSignalNumber();
-            while (signo != LLDB_INVALID_SIGNAL_NUMBER)
-            {
-                PrintSignal(str, signo, signals_sp->GetSignalAsCString(signo), signals_sp);
-                signo = signals_sp->GetNextSignalNumber(signo);
-            }
-        }
+  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 's':
+        stop = option_arg;
+        break;
+      case 'n':
+        notify = option_arg;
+        break;
+      case 'p':
+        pass = option_arg;
+        break;
+      default:
+        error.SetErrorStringWithFormat("invalid short option character '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      stop.clear();
+      notify.clear();
+      pass.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 stop;
+    std::string notify;
+    std::string pass;
+  };
+
+  CommandObjectProcessHandle(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "process handle",
+                            "Manage LLDB handling of OS signals for the "
+                            "current target process.  Defaults to showing "
+                            "current policy.",
+                            nullptr),
+        m_options() {
+    SetHelpLong("\nIf no signals are specified, update them all.  If no update "
+                "option is specified, list the current values.");
+    CommandArgumentEntry arg;
+    CommandArgumentData signal_arg;
+
+    signal_arg.arg_type = eArgTypeUnixSignal;
+    signal_arg.arg_repetition = eArgRepeatStar;
+
+    arg.push_back(signal_arg);
+
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectProcessHandle() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  bool VerifyCommandOptionValue(const std::string &option, int &real_value) {
+    bool okay = true;
+    bool success = false;
+    bool tmp_value = Args::StringToBoolean(option.c_str(), false, &success);
+
+    if (success && tmp_value)
+      real_value = 1;
+    else if (success && !tmp_value)
+      real_value = 0;
+    else {
+      // If the value isn't 'true' or 'false', it had better be 0 or 1.
+      real_value = StringConvert::ToUInt32(option.c_str(), 3);
+      if (real_value != 0 && real_value != 1)
+        okay = false;
+    }
+
+    return okay;
+  }
+
+  void PrintSignalHeader(Stream &str) {
+    str.Printf("NAME         PASS   STOP   NOTIFY\n");
+    str.Printf("===========  =====  =====  ======\n");
+  }
+
+  void PrintSignal(Stream &str, int32_t signo, const char *sig_name,
+                   const UnixSignalsSP &signals_sp) {
+    bool stop;
+    bool suppress;
+    bool notify;
+
+    str.Printf("%-11s  ", sig_name);
+    if (signals_sp->GetSignalInfo(signo, suppress, stop, notify)) {
+      bool pass = !suppress;
+      str.Printf("%s  %s  %s", (pass ? "true " : "false"),
+                 (stop ? "true " : "false"), (notify ? "true " : "false"));
+    }
+    str.Printf("\n");
+  }
+
+  void PrintSignalInformation(Stream &str, Args &signal_args,
+                              int num_valid_signals,
+                              const UnixSignalsSP &signals_sp) {
+    PrintSignalHeader(str);
+
+    if (num_valid_signals > 0) {
+      size_t num_args = signal_args.GetArgumentCount();
+      for (size_t i = 0; i < num_args; ++i) {
+        int32_t signo = signals_sp->GetSignalNumberFromName(
+            signal_args.GetArgumentAtIndex(i));
+        if (signo != LLDB_INVALID_SIGNAL_NUMBER)
+          PrintSignal(str, signo, signal_args.GetArgumentAtIndex(i),
+                      signals_sp);
+      }
+    } else // Print info for ALL signals
+    {
+      int32_t signo = signals_sp->GetFirstSignalNumber();
+      while (signo != LLDB_INVALID_SIGNAL_NUMBER) {
+        PrintSignal(str, signo, signals_sp->GetSignalAsCString(signo),
+                    signals_sp);
+        signo = signals_sp->GetNextSignalNumber(signo);
+      }
     }
+  }
 
 protected:
-    bool
-    DoExecute (Args &signal_args, CommandReturnObject &result) override
-    {
-        TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
-        
-        if (!target_sp)
-        {
-            result.AppendError ("No current target;"
-                                " cannot handle signals until you have a valid target and process.\n");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        ProcessSP process_sp = target_sp->GetProcessSP();
-
-        if (!process_sp)
-        {
-            result.AppendError ("No current process; cannot handle signals until you have a valid process.\n");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        int stop_action = -1;   // -1 means leave the current setting alone
-        int pass_action = -1;   // -1 means leave the current setting alone
-        int notify_action = -1; // -1 means leave the current setting alone
-
-        if (! m_options.stop.empty()
-            && ! VerifyCommandOptionValue (m_options.stop, stop_action))
-        {
-            result.AppendError ("Invalid argument for command option --stop; must be true or false.\n");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (! m_options.notify.empty()
-            && ! VerifyCommandOptionValue (m_options.notify, notify_action))
-        {
-            result.AppendError ("Invalid argument for command option --notify; must be true or false.\n");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        if (! m_options.pass.empty()
-            && ! VerifyCommandOptionValue (m_options.pass, pass_action))
-        {
-            result.AppendError ("Invalid argument for command option --pass; must be true or false.\n");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        size_t num_args = signal_args.GetArgumentCount();
-        UnixSignalsSP signals_sp = process_sp->GetUnixSignals();
-        int num_signals_set = 0;
-
-        if (num_args > 0)
-        {
-            for (size_t i = 0; i < num_args; ++i)
-            {
-                int32_t signo = signals_sp->GetSignalNumberFromName(signal_args.GetArgumentAtIndex(i));
-                if (signo != LLDB_INVALID_SIGNAL_NUMBER)
-                {
-                    // Casting the actions as bools here should be okay, because VerifyCommandOptionValue guarantees
-                    // the value is either 0 or 1.
-                    if (stop_action != -1)
-                        signals_sp->SetShouldStop(signo, stop_action);
-                    if (pass_action != -1)
-                    {
-                        bool suppress = !pass_action;
-                        signals_sp->SetShouldSuppress(signo, suppress);
-                    }
-                    if (notify_action != -1)
-                        signals_sp->SetShouldNotify(signo, notify_action);
-                    ++num_signals_set;
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("Invalid signal name '%s'\n", signal_args.GetArgumentAtIndex (i));
-                }
-            }
-        }
-        else
-        {
-            // No signal specified, if any command options were specified, update ALL signals.
-            if ((notify_action != -1) || (stop_action != -1) || (pass_action != -1))
-            {
-                if (m_interpreter.Confirm ("Do you really want to update all the signals?", false))
-                {
-                    int32_t signo = signals_sp->GetFirstSignalNumber();
-                    while (signo != LLDB_INVALID_SIGNAL_NUMBER)
-                    {
-                        if (notify_action != -1)
-                            signals_sp->SetShouldNotify(signo, notify_action);
-                        if (stop_action != -1)
-                            signals_sp->SetShouldStop(signo, stop_action);
-                        if (pass_action != -1)
-                        {
-                            bool suppress = !pass_action;
-                            signals_sp->SetShouldSuppress(signo, suppress);
-                        }
-                        signo = signals_sp->GetNextSignalNumber(signo);
-                    }
-                }
-            }
-        }
-
-        PrintSignalInformation (result.GetOutputStream(), signal_args, num_signals_set, signals_sp);
+  bool DoExecute(Args &signal_args, CommandReturnObject &result) override {
+    TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
 
-        if (num_signals_set > 0)
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        else
-            result.SetStatus (eReturnStatusFailed);
-
-        return result.Succeeded();
-    }
+    if (!target_sp) {
+      result.AppendError("No current target;"
+                         " cannot handle signals until you have a valid target "
+                         "and process.\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    ProcessSP process_sp = target_sp->GetProcessSP();
+
+    if (!process_sp) {
+      result.AppendError("No current process; cannot handle signals until you "
+                         "have a valid process.\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    int stop_action = -1;   // -1 means leave the current setting alone
+    int pass_action = -1;   // -1 means leave the current setting alone
+    int notify_action = -1; // -1 means leave the current setting alone
+
+    if (!m_options.stop.empty() &&
+        !VerifyCommandOptionValue(m_options.stop, stop_action)) {
+      result.AppendError("Invalid argument for command option --stop; must be "
+                         "true or false.\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (!m_options.notify.empty() &&
+        !VerifyCommandOptionValue(m_options.notify, notify_action)) {
+      result.AppendError("Invalid argument for command option --notify; must "
+                         "be true or false.\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    if (!m_options.pass.empty() &&
+        !VerifyCommandOptionValue(m_options.pass, pass_action)) {
+      result.AppendError("Invalid argument for command option --pass; must be "
+                         "true or false.\n");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    size_t num_args = signal_args.GetArgumentCount();
+    UnixSignalsSP signals_sp = process_sp->GetUnixSignals();
+    int num_signals_set = 0;
+
+    if (num_args > 0) {
+      for (size_t i = 0; i < num_args; ++i) {
+        int32_t signo = signals_sp->GetSignalNumberFromName(
+            signal_args.GetArgumentAtIndex(i));
+        if (signo != LLDB_INVALID_SIGNAL_NUMBER) {
+          // Casting the actions as bools here should be okay, because
+          // VerifyCommandOptionValue guarantees
+          // the value is either 0 or 1.
+          if (stop_action != -1)
+            signals_sp->SetShouldStop(signo, stop_action);
+          if (pass_action != -1) {
+            bool suppress = !pass_action;
+            signals_sp->SetShouldSuppress(signo, suppress);
+          }
+          if (notify_action != -1)
+            signals_sp->SetShouldNotify(signo, notify_action);
+          ++num_signals_set;
+        } else {
+          result.AppendErrorWithFormat("Invalid signal name '%s'\n",
+                                       signal_args.GetArgumentAtIndex(i));
+        }
+      }
+    } else {
+      // No signal specified, if any command options were specified, update ALL
+      // signals.
+      if ((notify_action != -1) || (stop_action != -1) || (pass_action != -1)) {
+        if (m_interpreter.Confirm(
+                "Do you really want to update all the signals?", false)) {
+          int32_t signo = signals_sp->GetFirstSignalNumber();
+          while (signo != LLDB_INVALID_SIGNAL_NUMBER) {
+            if (notify_action != -1)
+              signals_sp->SetShouldNotify(signo, notify_action);
+            if (stop_action != -1)
+              signals_sp->SetShouldStop(signo, stop_action);
+            if (pass_action != -1) {
+              bool suppress = !pass_action;
+              signals_sp->SetShouldSuppress(signo, suppress);
+            }
+            signo = signals_sp->GetNextSignalNumber(signo);
+          }
+        }
+      }
+    }
+
+    PrintSignalInformation(result.GetOutputStream(), signal_args,
+                           num_signals_set, signals_sp);
+
+    if (num_signals_set > 0)
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    else
+      result.SetStatus(eReturnStatusFailed);
+
+    return result.Succeeded();
+  }
 
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectProcessHandle::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectProcessHandle::CommandOptions::g_option_table[] =
+    {
+        // clang-format off
   {LLDB_OPT_SET_1, false, "stop",   's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the process should be stopped if the signal is received."},
   {LLDB_OPT_SET_1, false, "notify", 'n', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the debugger should notify the user if the signal is received."},
   {LLDB_OPT_SET_1, false, "pass",   'p', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeBoolean, "Whether or not the signal should be passed to the process."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+        // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectMultiwordProcess
 //-------------------------------------------------------------------------
 
-CommandObjectMultiwordProcess::CommandObjectMultiwordProcess(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "process", "Commands for interacting with processes on the current platform.",
-                             "process <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand ("attach",      CommandObjectSP (new CommandObjectProcessAttach    (interpreter)));
-    LoadSubCommand ("launch",      CommandObjectSP (new CommandObjectProcessLaunch    (interpreter)));
-    LoadSubCommand ("continue",    CommandObjectSP (new CommandObjectProcessContinue  (interpreter)));
-    LoadSubCommand ("connect",     CommandObjectSP (new CommandObjectProcessConnect   (interpreter)));
-    LoadSubCommand ("detach",      CommandObjectSP (new CommandObjectProcessDetach    (interpreter)));
-    LoadSubCommand ("load",        CommandObjectSP (new CommandObjectProcessLoad      (interpreter)));
-    LoadSubCommand ("unload",      CommandObjectSP (new CommandObjectProcessUnload    (interpreter)));
-    LoadSubCommand ("signal",      CommandObjectSP (new CommandObjectProcessSignal    (interpreter)));
-    LoadSubCommand ("handle",      CommandObjectSP (new CommandObjectProcessHandle    (interpreter)));
-    LoadSubCommand ("status",      CommandObjectSP (new CommandObjectProcessStatus    (interpreter)));
-    LoadSubCommand ("interrupt",   CommandObjectSP (new CommandObjectProcessInterrupt (interpreter)));
-    LoadSubCommand ("kill",        CommandObjectSP (new CommandObjectProcessKill      (interpreter)));
-    LoadSubCommand ("plugin",      CommandObjectSP (new CommandObjectProcessPlugin    (interpreter)));
-    LoadSubCommand ("save-core",   CommandObjectSP (new CommandObjectProcessSaveCore  (interpreter)));
+CommandObjectMultiwordProcess::CommandObjectMultiwordProcess(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(
+          interpreter, "process",
+          "Commands for interacting with processes on the current platform.",
+          "process <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("attach",
+                 CommandObjectSP(new CommandObjectProcessAttach(interpreter)));
+  LoadSubCommand("launch",
+                 CommandObjectSP(new CommandObjectProcessLaunch(interpreter)));
+  LoadSubCommand("continue", CommandObjectSP(new CommandObjectProcessContinue(
+                                 interpreter)));
+  LoadSubCommand("connect",
+                 CommandObjectSP(new CommandObjectProcessConnect(interpreter)));
+  LoadSubCommand("detach",
+                 CommandObjectSP(new CommandObjectProcessDetach(interpreter)));
+  LoadSubCommand("load",
+                 CommandObjectSP(new CommandObjectProcessLoad(interpreter)));
+  LoadSubCommand("unload",
+                 CommandObjectSP(new CommandObjectProcessUnload(interpreter)));
+  LoadSubCommand("signal",
+                 CommandObjectSP(new CommandObjectProcessSignal(interpreter)));
+  LoadSubCommand("handle",
+                 CommandObjectSP(new CommandObjectProcessHandle(interpreter)));
+  LoadSubCommand("status",
+                 CommandObjectSP(new CommandObjectProcessStatus(interpreter)));
+  LoadSubCommand("interrupt", CommandObjectSP(new CommandObjectProcessInterrupt(
+                                  interpreter)));
+  LoadSubCommand("kill",
+                 CommandObjectSP(new CommandObjectProcessKill(interpreter)));
+  LoadSubCommand("plugin",
+                 CommandObjectSP(new CommandObjectProcessPlugin(interpreter)));
+  LoadSubCommand("save-core", CommandObjectSP(new CommandObjectProcessSaveCore(
+                                  interpreter)));
 }
 
 CommandObjectMultiwordProcess::~CommandObjectMultiwordProcess() = default;

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

Modified: lldb/trunk/source/Commands/CommandObjectQuit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectQuit.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectQuit.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectQuit.cpp Tue Sep  6 15:57:50 2016
@@ -25,75 +25,62 @@ using namespace lldb_private;
 //-------------------------------------------------------------------------
 
 CommandObjectQuit::CommandObjectQuit(CommandInterpreter &interpreter)
-    : CommandObjectParsed(interpreter, "quit", "Quit the LLDB debugger.", "quit")
-{
-}
+    : CommandObjectParsed(interpreter, "quit", "Quit the LLDB debugger.",
+                          "quit") {}
 
-CommandObjectQuit::~CommandObjectQuit ()
-{
-}
+CommandObjectQuit::~CommandObjectQuit() {}
 
 // returns true if there is at least one alive process
-// is_a_detach will be true if all alive processes will be detached when you quit
+// is_a_detach will be true if all alive processes will be detached when you
+// quit
 // and false if at least one process will be killed instead
-bool
-CommandObjectQuit::ShouldAskForConfirmation (bool& is_a_detach)
-{
-    if (m_interpreter.GetPromptOnQuit() == false)
-        return false;
-    bool should_prompt = false;
-    is_a_detach = true;
-    for (uint32_t debugger_idx = 0;
-         debugger_idx < Debugger::GetNumDebuggers();
-         debugger_idx++)
-    {
-        DebuggerSP debugger_sp(Debugger::GetDebuggerAtIndex(debugger_idx));
-        if (!debugger_sp)
-            continue;
-        const TargetList& target_list(debugger_sp->GetTargetList());
-        for (uint32_t target_idx = 0;
-             target_idx < static_cast<uint32_t>(target_list.GetNumTargets());
-             target_idx++)
-        {
-            TargetSP target_sp(target_list.GetTargetAtIndex(target_idx));
-            if (!target_sp)
-                continue;
-            ProcessSP process_sp(target_sp->GetProcessSP());
-            if (process_sp
-                && process_sp->IsValid()
-                && process_sp->IsAlive()
-                && process_sp->WarnBeforeDetach())
-            {
-                should_prompt = true;
-                if (process_sp->GetShouldDetach() == false)
-                {
-                    // if we need to kill at least one process, just say so and return
-                    is_a_detach = false;
-                    return should_prompt;
-                }
-            }
+bool CommandObjectQuit::ShouldAskForConfirmation(bool &is_a_detach) {
+  if (m_interpreter.GetPromptOnQuit() == false)
+    return false;
+  bool should_prompt = false;
+  is_a_detach = true;
+  for (uint32_t debugger_idx = 0; debugger_idx < Debugger::GetNumDebuggers();
+       debugger_idx++) {
+    DebuggerSP debugger_sp(Debugger::GetDebuggerAtIndex(debugger_idx));
+    if (!debugger_sp)
+      continue;
+    const TargetList &target_list(debugger_sp->GetTargetList());
+    for (uint32_t target_idx = 0;
+         target_idx < static_cast<uint32_t>(target_list.GetNumTargets());
+         target_idx++) {
+      TargetSP target_sp(target_list.GetTargetAtIndex(target_idx));
+      if (!target_sp)
+        continue;
+      ProcessSP process_sp(target_sp->GetProcessSP());
+      if (process_sp && process_sp->IsValid() && process_sp->IsAlive() &&
+          process_sp->WarnBeforeDetach()) {
+        should_prompt = true;
+        if (process_sp->GetShouldDetach() == false) {
+          // if we need to kill at least one process, just say so and return
+          is_a_detach = false;
+          return should_prompt;
         }
+      }
     }
-    return should_prompt;
+  }
+  return should_prompt;
 }
 
-bool
-CommandObjectQuit::DoExecute (Args& command, CommandReturnObject &result)
-{
-    bool is_a_detach = true;
-    if (ShouldAskForConfirmation (is_a_detach))
-    {
-        StreamString message;
-        message.Printf("Quitting LLDB will %s one or more processes. Do you really want to proceed", (is_a_detach ? "detach from" : "kill"));
-        if (!m_interpreter.Confirm(message.GetData(), true))
-        {
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
+bool CommandObjectQuit::DoExecute(Args &command, CommandReturnObject &result) {
+  bool is_a_detach = true;
+  if (ShouldAskForConfirmation(is_a_detach)) {
+    StreamString message;
+    message.Printf("Quitting LLDB will %s one or more processes. Do you really "
+                   "want to proceed",
+                   (is_a_detach ? "detach from" : "kill"));
+    if (!m_interpreter.Confirm(message.GetData(), true)) {
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
-    const uint32_t event_type = CommandInterpreter::eBroadcastBitQuitCommandReceived;
-    m_interpreter.BroadcastEvent (event_type);
-    result.SetStatus (eReturnStatusQuit);
-    return true;
+  }
+  const uint32_t event_type =
+      CommandInterpreter::eBroadcastBitQuitCommandReceived;
+  m_interpreter.BroadcastEvent(event_type);
+  result.SetStatus(eReturnStatusQuit);
+  return true;
 }
-

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

Modified: lldb/trunk/source/Commands/CommandObjectRegister.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectRegister.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectRegister.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectRegister.cpp Tue Sep  6 15:57:50 2016
@@ -15,17 +15,17 @@
 // Project includes
 #include "CommandObjectRegister.h"
 #include "lldb/Core/DataExtractor.h"
+#include "lldb/Core/Debugger.h"
 #include "lldb/Core/RegisterValue.h"
 #include "lldb/Core/Scalar.h"
-#include "lldb/Core/Debugger.h"
 #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/OptionValueArray.h"
 #include "lldb/Interpreter/OptionValueBoolean.h"
 #include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/RegisterContext.h"
@@ -38,432 +38,377 @@ using namespace lldb_private;
 //----------------------------------------------------------------------
 // "register read"
 //----------------------------------------------------------------------
-class CommandObjectRegisterRead : public CommandObjectParsed
-{
+class CommandObjectRegisterRead : public CommandObjectParsed {
 public:
-    CommandObjectRegisterRead (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter, 
-                            "register read",
-                            "Dump the contents of one or more register values from the current frame.  If no register is specified, dumps them all.",
-                            nullptr,
-                            eCommandRequiresFrame         |
-                            eCommandRequiresRegContext    |
-                            eCommandProcessMustBeLaunched |
-                            eCommandProcessMustBePaused   ),
-        m_option_group(),
-        m_format_options (eFormatDefault),
-        m_command_options ()
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData register_arg;
-        
-        // Define the first (and only) variant of this arg.
-        register_arg.arg_type = eArgTypeRegisterName;
-        register_arg.arg_repetition = eArgRepeatStar;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg.push_back (register_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-
-        // Add the "--format"
-        m_option_group.Append (&m_format_options, OptionGroupFormat::OPTION_GROUP_FORMAT | OptionGroupFormat::OPTION_GROUP_GDB_FMT, LLDB_OPT_SET_ALL);
-        m_option_group.Append (&m_command_options);
-        m_option_group.Finalize();
-    }
-
-    ~CommandObjectRegisterRead() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_option_group;
-    }
-
-    bool
-    DumpRegister (const ExecutionContext &exe_ctx,
-                  Stream &strm,
-                  RegisterContext *reg_ctx,
-                  const RegisterInfo *reg_info)
-    {
-        if (reg_info)
-        {
-            RegisterValue reg_value;
-
-            if (reg_ctx->ReadRegister (reg_info, reg_value))
-            {
-                strm.Indent ();
-
-                bool prefix_with_altname = (bool)m_command_options.alternate_name;
-                bool prefix_with_name = !prefix_with_altname;
-                reg_value.Dump(&strm, reg_info, prefix_with_name, prefix_with_altname, m_format_options.GetFormat(), 8);
-                if ((reg_info->encoding == eEncodingUint) || (reg_info->encoding == eEncodingSint))
-                {
-                    Process *process = exe_ctx.GetProcessPtr();
-                    if (process && reg_info->byte_size == process->GetAddressByteSize())
-                    {
-                        addr_t reg_addr = reg_value.GetAsUInt64(LLDB_INVALID_ADDRESS);
-                        if (reg_addr != LLDB_INVALID_ADDRESS)
-                        {
-                            Address so_reg_addr;
-                            if (exe_ctx.GetTargetRef().GetSectionLoadList().ResolveLoadAddress(reg_addr, so_reg_addr))
-                            {
-                                strm.PutCString ("  ");
-                                so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(), Address::DumpStyleResolvedDescription);
-                            }
-                        }
-                    }
-                }
-                strm.EOL();
-                return true;
+  CommandObjectRegisterRead(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "register read",
+            "Dump the contents of one or more register values from the current "
+            "frame.  If no register is specified, dumps them all.",
+            nullptr,
+            eCommandRequiresFrame | eCommandRequiresRegContext |
+                eCommandProcessMustBeLaunched | eCommandProcessMustBePaused),
+        m_option_group(), m_format_options(eFormatDefault),
+        m_command_options() {
+    CommandArgumentEntry arg;
+    CommandArgumentData register_arg;
+
+    // Define the first (and only) variant of this arg.
+    register_arg.arg_type = eArgTypeRegisterName;
+    register_arg.arg_repetition = eArgRepeatStar;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg.push_back(register_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+
+    // Add the "--format"
+    m_option_group.Append(&m_format_options,
+                          OptionGroupFormat::OPTION_GROUP_FORMAT |
+                              OptionGroupFormat::OPTION_GROUP_GDB_FMT,
+                          LLDB_OPT_SET_ALL);
+    m_option_group.Append(&m_command_options);
+    m_option_group.Finalize();
+  }
+
+  ~CommandObjectRegisterRead() override = default;
+
+  Options *GetOptions() override { return &m_option_group; }
+
+  bool DumpRegister(const ExecutionContext &exe_ctx, Stream &strm,
+                    RegisterContext *reg_ctx, const RegisterInfo *reg_info) {
+    if (reg_info) {
+      RegisterValue reg_value;
+
+      if (reg_ctx->ReadRegister(reg_info, reg_value)) {
+        strm.Indent();
+
+        bool prefix_with_altname = (bool)m_command_options.alternate_name;
+        bool prefix_with_name = !prefix_with_altname;
+        reg_value.Dump(&strm, reg_info, prefix_with_name, prefix_with_altname,
+                       m_format_options.GetFormat(), 8);
+        if ((reg_info->encoding == eEncodingUint) ||
+            (reg_info->encoding == eEncodingSint)) {
+          Process *process = exe_ctx.GetProcessPtr();
+          if (process && reg_info->byte_size == process->GetAddressByteSize()) {
+            addr_t reg_addr = reg_value.GetAsUInt64(LLDB_INVALID_ADDRESS);
+            if (reg_addr != LLDB_INVALID_ADDRESS) {
+              Address so_reg_addr;
+              if (exe_ctx.GetTargetRef()
+                      .GetSectionLoadList()
+                      .ResolveLoadAddress(reg_addr, so_reg_addr)) {
+                strm.PutCString("  ");
+                so_reg_addr.Dump(&strm, exe_ctx.GetBestExecutionContextScope(),
+                                 Address::DumpStyleResolvedDescription);
+              }
             }
+          }
         }
-        return false;
+        strm.EOL();
+        return true;
+      }
     }
+    return false;
+  }
 
-    bool
-    DumpRegisterSet (const ExecutionContext &exe_ctx,
-                     Stream &strm,
-                     RegisterContext *reg_ctx,
-                     size_t set_idx,
-                     bool primitive_only=false)
-    {
-        uint32_t unavailable_count = 0;
-        uint32_t available_count = 0;
-
-        if (!reg_ctx)
-            return false; // thread has no registers (i.e. core files are corrupt, incomplete crash logs...)
-
-        const RegisterSet * const reg_set = reg_ctx->GetRegisterSet(set_idx);
-        if (reg_set)
-        {
-            strm.Printf ("%s:\n", (reg_set->name ? reg_set->name : "unknown") );
-            strm.IndentMore ();
-            const size_t num_registers = reg_set->num_registers;
-            for (size_t reg_idx = 0; reg_idx < num_registers; ++reg_idx)
-            {
-                const uint32_t reg = reg_set->registers[reg_idx];
-                const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg);
-                // Skip the dumping of derived register if primitive_only is true.
-                if (primitive_only && reg_info && reg_info->value_regs)
-                    continue;
-
-                if (DumpRegister (exe_ctx, strm, reg_ctx, reg_info))
-                    ++available_count;
-                else
-                    ++unavailable_count;
-            }
-            strm.IndentLess ();
-            if (unavailable_count)
-            {
-                strm.Indent ();
-                strm.Printf("%u registers were unavailable.\n", unavailable_count);
-            }
-            strm.EOL();
-        }
-        return available_count > 0;
+  bool DumpRegisterSet(const ExecutionContext &exe_ctx, Stream &strm,
+                       RegisterContext *reg_ctx, size_t set_idx,
+                       bool primitive_only = false) {
+    uint32_t unavailable_count = 0;
+    uint32_t available_count = 0;
+
+    if (!reg_ctx)
+      return false; // thread has no registers (i.e. core files are corrupt,
+                    // incomplete crash logs...)
+
+    const RegisterSet *const reg_set = reg_ctx->GetRegisterSet(set_idx);
+    if (reg_set) {
+      strm.Printf("%s:\n", (reg_set->name ? reg_set->name : "unknown"));
+      strm.IndentMore();
+      const size_t num_registers = reg_set->num_registers;
+      for (size_t reg_idx = 0; reg_idx < num_registers; ++reg_idx) {
+        const uint32_t reg = reg_set->registers[reg_idx];
+        const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoAtIndex(reg);
+        // Skip the dumping of derived register if primitive_only is true.
+        if (primitive_only && reg_info && reg_info->value_regs)
+          continue;
+
+        if (DumpRegister(exe_ctx, strm, reg_ctx, reg_info))
+          ++available_count;
+        else
+          ++unavailable_count;
+      }
+      strm.IndentLess();
+      if (unavailable_count) {
+        strm.Indent();
+        strm.Printf("%u registers were unavailable.\n", unavailable_count);
+      }
+      strm.EOL();
     }
+    return available_count > 0;
+  }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        Stream &strm = result.GetOutputStream();
-        RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext ();
-
-        const RegisterInfo *reg_info = nullptr;
-        if (command.GetArgumentCount() == 0)
-        {
-            size_t set_idx;
-            
-            size_t num_register_sets = 1;
-            const size_t set_array_size = m_command_options.set_indexes.GetSize();
-            if (set_array_size > 0)
-            {
-                for (size_t i = 0; i < set_array_size; ++i)
-                {
-                    set_idx = m_command_options.set_indexes[i]->GetUInt64Value(UINT32_MAX, nullptr);
-                    if (set_idx < reg_ctx->GetRegisterSetCount())
-                    {
-                        if (!DumpRegisterSet (m_exe_ctx, strm, reg_ctx, set_idx))
-                        {
-                            if (errno)
-                                result.AppendErrorWithFormat ("register read failed: %s\n", strerror(errno));
-                            else
-                                result.AppendError ("unknown error while reading registers.\n");
-                            result.SetStatus (eReturnStatusFailed);
-                            break;
-                        }
-                    }
-                    else
-                    {
-                        result.AppendErrorWithFormat("invalid register set index: %" PRIu64 "\n", (uint64_t)set_idx);
-                        result.SetStatus (eReturnStatusFailed);
-                        break;
-                    }
-                }
-            }
-            else
-            {
-                if (m_command_options.dump_all_sets)
-                    num_register_sets = reg_ctx->GetRegisterSetCount();
-
-                for (set_idx = 0; set_idx < num_register_sets; ++set_idx)
-                {
-                    // When dump_all_sets option is set, dump primitive as well as derived registers.
-                    DumpRegisterSet (m_exe_ctx, strm, reg_ctx, set_idx, !m_command_options.dump_all_sets.GetCurrentValue());
-                }
-            }
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    Stream &strm = result.GetOutputStream();
+    RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext();
+
+    const RegisterInfo *reg_info = nullptr;
+    if (command.GetArgumentCount() == 0) {
+      size_t set_idx;
+
+      size_t num_register_sets = 1;
+      const size_t set_array_size = m_command_options.set_indexes.GetSize();
+      if (set_array_size > 0) {
+        for (size_t i = 0; i < set_array_size; ++i) {
+          set_idx = m_command_options.set_indexes[i]->GetUInt64Value(UINT32_MAX,
+                                                                     nullptr);
+          if (set_idx < reg_ctx->GetRegisterSetCount()) {
+            if (!DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx)) {
+              if (errno)
+                result.AppendErrorWithFormat("register read failed: %s\n",
+                                             strerror(errno));
+              else
+                result.AppendError("unknown error while reading registers.\n");
+              result.SetStatus(eReturnStatusFailed);
+              break;
+            }
+          } else {
+            result.AppendErrorWithFormat(
+                "invalid register set index: %" PRIu64 "\n", (uint64_t)set_idx);
+            result.SetStatus(eReturnStatusFailed);
+            break;
+          }
         }
-        else
-        {
-            if (m_command_options.dump_all_sets)
-            {
-                result.AppendError ("the --all option can't be used when registers names are supplied as arguments\n");
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else if (m_command_options.set_indexes.GetSize() > 0)
-            {
-                result.AppendError ("the --set <set> option can't be used when registers names are supplied as arguments\n");
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else
-            {
-                const char *arg_cstr;
-                for (int arg_idx = 0; (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr; ++arg_idx)
-                {
-                    // in most LLDB commands we accept $rbx as the name for register RBX - and here we would
-                    // reject it and non-existant. we should be more consistent towards the user and allow them
-                    // to say reg read $rbx - internally, however, we should be strict and not allow ourselves
-                    // to call our registers $rbx in our own API
-                    if (*arg_cstr == '$')
-                        arg_cstr = arg_cstr+1;
-                    reg_info = reg_ctx->GetRegisterInfoByName(arg_cstr);
-
-                    if (reg_info)
-                    {
-                        if (!DumpRegister (m_exe_ctx, strm, reg_ctx, reg_info))
-                            strm.Printf("%-12s = error: unavailable\n", reg_info->name);
-                    }
-                    else
-                    {
-                        result.AppendErrorWithFormat ("Invalid register name '%s'.\n", arg_cstr);
-                    }
-                }
-            }
+      } else {
+        if (m_command_options.dump_all_sets)
+          num_register_sets = reg_ctx->GetRegisterSetCount();
+
+        for (set_idx = 0; set_idx < num_register_sets; ++set_idx) {
+          // When dump_all_sets option is set, dump primitive as well as derived
+          // registers.
+          DumpRegisterSet(m_exe_ctx, strm, reg_ctx, set_idx,
+                          !m_command_options.dump_all_sets.GetCurrentValue());
         }
-        return result.Succeeded();
+      }
+    } else {
+      if (m_command_options.dump_all_sets) {
+        result.AppendError("the --all option can't be used when registers "
+                           "names are supplied as arguments\n");
+        result.SetStatus(eReturnStatusFailed);
+      } else if (m_command_options.set_indexes.GetSize() > 0) {
+        result.AppendError("the --set <set> option can't be used when "
+                           "registers names are supplied as arguments\n");
+        result.SetStatus(eReturnStatusFailed);
+      } else {
+        const char *arg_cstr;
+        for (int arg_idx = 0;
+             (arg_cstr = command.GetArgumentAtIndex(arg_idx)) != nullptr;
+             ++arg_idx) {
+          // in most LLDB commands we accept $rbx as the name for register RBX -
+          // and here we would
+          // reject it and non-existant. we should be more consistent towards
+          // the user and allow them
+          // to say reg read $rbx - internally, however, we should be strict and
+          // not allow ourselves
+          // to call our registers $rbx in our own API
+          if (*arg_cstr == '$')
+            arg_cstr = arg_cstr + 1;
+          reg_info = reg_ctx->GetRegisterInfoByName(arg_cstr);
+
+          if (reg_info) {
+            if (!DumpRegister(m_exe_ctx, strm, reg_ctx, reg_info))
+              strm.Printf("%-12s = error: unavailable\n", reg_info->name);
+          } else {
+            result.AppendErrorWithFormat("Invalid register name '%s'.\n",
+                                         arg_cstr);
+          }
+        }
+      }
     }
+    return result.Succeeded();
+  }
 
-    class CommandOptions : public OptionGroup
-    {
-    public:
-        CommandOptions () :
-            OptionGroup(),
-            set_indexes (OptionValue::ConvertTypeToMask (OptionValue::eTypeUInt64)),
-            dump_all_sets (false, false), // Initial and default values are false
-            alternate_name (false, false)
-        {
-        }
+  class CommandOptions : public OptionGroup {
+  public:
+    CommandOptions()
+        : OptionGroup(),
+          set_indexes(OptionValue::ConvertTypeToMask(OptionValue::eTypeUInt64)),
+          dump_all_sets(false, false), // Initial and default values are false
+          alternate_name(false, false) {}
+
+    ~CommandOptions() override = default;
+
+    uint32_t GetNumDefinitions() override;
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      set_indexes.Clear();
+      dump_all_sets.Clear();
+      alternate_name.Clear();
+    }
 
-        ~CommandOptions() override = default;
+    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 's': {
+        OptionValueSP value_sp(OptionValueUInt64::Create(option_value, error));
+        if (value_sp)
+          set_indexes.AppendValue(value_sp);
+      } break;
+
+      case 'a':
+        // When we don't use OptionValue::SetValueFromCString(const char *) to
+        // set an option value, it won't be marked as being set in the options
+        // so we make a call to let users know the value was set via option
+        dump_all_sets.SetCurrentValue(true);
+        dump_all_sets.SetOptionWasSet();
+        break;
+
+      case 'A':
+        // When we don't use OptionValue::SetValueFromCString(const char *) to
+        // set an option value, it won't be marked as being set in the options
+        // so we make a call to let users know the value was set via option
+        alternate_name.SetCurrentValue(true);
+        dump_all_sets.SetOptionWasSet();
+        break;
+
+      default:
+        error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                       short_option);
+        break;
+      }
+      return error;
+    }
 
-        uint32_t
-        GetNumDefinitions () override;
+    // Options table: Required for subclasses of Options.
 
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-        
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            set_indexes.Clear();
-            dump_all_sets.Clear();
-            alternate_name.Clear();
-        }
+    static const OptionDefinition 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 's':
-                    {
-                        OptionValueSP value_sp (OptionValueUInt64::Create (option_value, error));
-                        if (value_sp)
-                            set_indexes.AppendValue (value_sp);
-                    }
-                    break;
-
-                case 'a':
-                    // When we don't use OptionValue::SetValueFromCString(const char *) to 
-                    // set an option value, it won't be marked as being set in the options
-                    // so we make a call to let users know the value was set via option
-                    dump_all_sets.SetCurrentValue (true);
-                    dump_all_sets.SetOptionWasSet ();
-                    break;
-
-                case 'A':
-                    // When we don't use OptionValue::SetValueFromCString(const char *) to 
-                    // set an option value, it won't be marked as being set in the options
-                    // so we make a call to let users know the value was set via option
-                    alternate_name.SetCurrentValue (true);
-                    dump_all_sets.SetOptionWasSet ();
-                    break;
-                    
-                default:
-                    error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-                    break;
-            }
-            return error;
-        }
-        
-        // Options table: Required for subclasses of Options.
-        
-        static const OptionDefinition g_option_table[];
-        
-        // Instance variables to hold the values for command options.
-        OptionValueArray set_indexes;
-        OptionValueBoolean dump_all_sets;
-        OptionValueBoolean alternate_name;
-    };
-
-    OptionGroupOptions m_option_group;
-    OptionGroupFormat m_format_options;
-    CommandOptions m_command_options;
+    // Instance variables to hold the values for command options.
+    OptionValueArray set_indexes;
+    OptionValueBoolean dump_all_sets;
+    OptionValueBoolean alternate_name;
+  };
+
+  OptionGroupOptions m_option_group;
+  OptionGroupFormat m_format_options;
+  CommandOptions m_command_options;
 };
 
 const OptionDefinition
-CommandObjectRegisterRead::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+    CommandObjectRegisterRead::CommandOptions::g_option_table[] = {
+        // clang-format off
   {LLDB_OPT_SET_ALL, false, "alternate", 'A', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,  "Display register names using the alternate register name if there is one."},
   {LLDB_OPT_SET_1,   false, "set",       's', OptionParser::eRequiredArgument, nullptr, nullptr, 0, eArgTypeIndex, "Specify which register sets to dump by index."},
   {LLDB_OPT_SET_2,   false, "all",       'a', OptionParser::eNoArgument,       nullptr, nullptr, 0, eArgTypeNone,  "Show all register sets."},
-  // clang-format on
+        // clang-format on
 };
 
-uint32_t
-CommandObjectRegisterRead::CommandOptions::GetNumDefinitions ()
-{
-    return llvm::array_lengthof(g_option_table);
+uint32_t CommandObjectRegisterRead::CommandOptions::GetNumDefinitions() {
+  return llvm::array_lengthof(g_option_table);
 }
 
 //----------------------------------------------------------------------
 // "register write"
 //----------------------------------------------------------------------
-class CommandObjectRegisterWrite : public CommandObjectParsed
-{
+class CommandObjectRegisterWrite : public CommandObjectParsed {
 public:
-    CommandObjectRegisterWrite (CommandInterpreter &interpreter) :
-        CommandObjectParsed(interpreter,
-                            "register write",
-                            "Modify a single register value.",
-                            nullptr,
-                            eCommandRequiresFrame         |
-                            eCommandRequiresRegContext    |
-                            eCommandProcessMustBeLaunched |
-                            eCommandProcessMustBePaused)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData register_arg;
-        CommandArgumentData value_arg;
-        
-        // Define the first (and only) variant of this arg.
-        register_arg.arg_type = eArgTypeRegisterName;
-        register_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (register_arg);
-        
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlain;
-        
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (value_arg);
-        
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-    }
+  CommandObjectRegisterWrite(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "register write",
+                            "Modify a single register value.", nullptr,
+                            eCommandRequiresFrame | eCommandRequiresRegContext |
+                                eCommandProcessMustBeLaunched |
+                                eCommandProcessMustBePaused) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData register_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    register_arg.arg_type = eArgTypeRegisterName;
+    register_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(register_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(value_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+  }
 
-    ~CommandObjectRegisterWrite() override = default;
+  ~CommandObjectRegisterWrite() override = default;
 
 protected:
-    bool
-    DoExecute(Args& command, CommandReturnObject &result) override
-    {
-        DataExtractor reg_data;
-        RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext ();
-
-        if (command.GetArgumentCount() != 2)
-        {
-            result.AppendError ("register write takes exactly 2 arguments: <reg-name> <value>");
-            result.SetStatus (eReturnStatusFailed);
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    DataExtractor reg_data;
+    RegisterContext *reg_ctx = m_exe_ctx.GetRegisterContext();
+
+    if (command.GetArgumentCount() != 2) {
+      result.AppendError(
+          "register write takes exactly 2 arguments: <reg-name> <value>");
+      result.SetStatus(eReturnStatusFailed);
+    } else {
+      const char *reg_name = command.GetArgumentAtIndex(0);
+      const char *value_str = command.GetArgumentAtIndex(1);
+
+      // in most LLDB commands we accept $rbx as the name for register RBX - and
+      // here we would
+      // reject it and non-existant. we should be more consistent towards the
+      // user and allow them
+      // to say reg write $rbx - internally, however, we should be strict and
+      // not allow ourselves
+      // to call our registers $rbx in our own API
+      if (reg_name && *reg_name == '$')
+        reg_name = reg_name + 1;
+
+      const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(reg_name);
+
+      if (reg_info) {
+        RegisterValue reg_value;
+
+        Error error(reg_value.SetValueFromCString(reg_info, value_str));
+        if (error.Success()) {
+          if (reg_ctx->WriteRegister(reg_info, reg_value)) {
+            // Toss all frames and anything else in the thread
+            // after a register has been written.
+            m_exe_ctx.GetThreadRef().Flush();
+            result.SetStatus(eReturnStatusSuccessFinishNoResult);
+            return true;
+          }
         }
-        else
-        {
-            const char *reg_name = command.GetArgumentAtIndex(0);
-            const char *value_str = command.GetArgumentAtIndex(1);
-
-            // in most LLDB commands we accept $rbx as the name for register RBX - and here we would
-            // reject it and non-existant. we should be more consistent towards the user and allow them
-            // to say reg write $rbx - internally, however, we should be strict and not allow ourselves
-            // to call our registers $rbx in our own API
-            if (reg_name && *reg_name == '$')
-                reg_name = reg_name+1;
-            
-            const RegisterInfo *reg_info = reg_ctx->GetRegisterInfoByName(reg_name);
-
-            if (reg_info)
-            {
-                RegisterValue reg_value;
-                
-                Error error (reg_value.SetValueFromCString (reg_info, value_str));
-                if (error.Success())
-                {
-                    if (reg_ctx->WriteRegister (reg_info, reg_value))
-                    {
-                        // Toss all frames and anything else in the thread
-                        // after a register has been written.
-                        m_exe_ctx.GetThreadRef().Flush();
-                        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-                        return true;
-                    }
-                }
-                if (error.AsCString())
-                {
-                    result.AppendErrorWithFormat ("Failed to write register '%s' with value '%s': %s\n",
-                                                 reg_name,
-                                                 value_str,
-                                                 error.AsCString());
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("Failed to write register '%s' with value '%s'",
-                                                 reg_name,
-                                                 value_str);
-                }
-                result.SetStatus (eReturnStatusFailed);
-            }
-            else
-            {
-                result.AppendErrorWithFormat ("Register not found for '%s'.\n", reg_name);
-                result.SetStatus (eReturnStatusFailed);
-            }
+        if (error.AsCString()) {
+          result.AppendErrorWithFormat(
+              "Failed to write register '%s' with value '%s': %s\n", reg_name,
+              value_str, error.AsCString());
+        } else {
+          result.AppendErrorWithFormat(
+              "Failed to write register '%s' with value '%s'", reg_name,
+              value_str);
         }
-        return result.Succeeded();
+        result.SetStatus(eReturnStatusFailed);
+      } else {
+        result.AppendErrorWithFormat("Register not found for '%s'.\n",
+                                     reg_name);
+        result.SetStatus(eReturnStatusFailed);
+      }
     }
+    return result.Succeeded();
+  }
 };
 
 //----------------------------------------------------------------------
@@ -471,11 +416,13 @@ protected:
 //----------------------------------------------------------------------
 CommandObjectRegister::CommandObjectRegister(CommandInterpreter &interpreter)
     : CommandObjectMultiword(interpreter, "register",
-                             "Commands to access registers for the current thread and stack frame.",
-                             "register [read|write] ...")
-{
-    LoadSubCommand ("read",  CommandObjectSP (new CommandObjectRegisterRead (interpreter)));
-    LoadSubCommand ("write", CommandObjectSP (new CommandObjectRegisterWrite (interpreter)));
+                             "Commands to access registers for the current "
+                             "thread and stack frame.",
+                             "register [read|write] ...") {
+  LoadSubCommand("read",
+                 CommandObjectSP(new CommandObjectRegisterRead(interpreter)));
+  LoadSubCommand("write",
+                 CommandObjectSP(new CommandObjectRegisterWrite(interpreter)));
 }
 
 CommandObjectRegister::~CommandObjectRegister() = default;

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

Modified: lldb/trunk/source/Commands/CommandObjectSettings.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.cpp Tue Sep  6 15:57:50 2016
@@ -15,9 +15,9 @@
 #include "llvm/ADT/StringRef.h"
 
 // Project includes
+#include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
 #include "lldb/Interpreter/CommandReturnObject.h"
-#include "lldb/Interpreter/CommandCompletions.h"
 #include "lldb/Interpreter/OptionValueProperties.h"
 
 using namespace lldb;
@@ -27,39 +27,42 @@ using namespace lldb_private;
 // CommandObjectSettingsSet
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsSet : public CommandObjectRaw
-{
+class CommandObjectSettingsSet : public CommandObjectRaw {
 public:
-    CommandObjectSettingsSet(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "settings set", "Set the value of the specified debugger setting.", nullptr),
-          m_options()
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData value_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (value_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-        
-        SetHelpLong (
-"\nWhen setting a dictionary or array variable, you can set multiple entries \
-at once by giving the values to the set command.  For example:" R"(
+  CommandObjectSettingsSet(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "settings set",
+                         "Set the value of the specified debugger setting.",
+                         nullptr),
+        m_options() {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(value_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+
+    SetHelpLong(
+        "\nWhen setting a dictionary or array variable, you can set multiple entries \
+at once by giving the values to the set command.  For example:"
+        R"(
 
 (lldb) settings set target.run-args value1 value2 value3
 (lldb) settings set target.env-vars MYPATH=~/.:/usr/bin  SOME_ENV_VAR=12345
@@ -72,1108 +75,987 @@ at once by giving the values to the set
   'MYPATH=~/.:/usr/bin'
   'SOME_ENV_VAR=12345'
 
-)" "Warning:  The 'set' command re-sets the entire array or dictionary.  If you \
+)"
+        "Warning:  The 'set' command re-sets the entire array or dictionary.  If you \
 just want to add, remove or update individual values (or add something to \
 the end), use one of the other settings sub-commands: append, replace, \
-insert-before or insert-after."
-        );
-
-    }
-
-    ~CommandObjectSettingsSet() override = default;
+insert-before or insert-after.");
+  }
 
-    // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
-    bool
-    WantsCompletion() override { return true; }
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-    
-    class CommandOptions : public Options
-    {
-    public:
-        CommandOptions() :
-            Options(),
-            m_global(false)
-        {
-        }
+  ~CommandObjectSettingsSet() 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 'g':
-                    m_global = true;
-                    break;
-                default:
-                    error.SetErrorStringWithFormat ("unrecognized options '%c'", short_option);
-                    break;
-            }
-
-            return error;
-        }
-
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            m_global = false;
-        }
-        
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
+  // Overrides base class's behavior where WantsCompletion =
+  // !WantsRawCommandString.
+  bool WantsCompletion() override { return true; }
+
+  Options *GetOptions() override { return &m_options; }
+
+  class CommandOptions : public Options {
+  public:
+    CommandOptions() : Options(), m_global(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 'g':
+        m_global = true;
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized options '%c'",
+                                       short_option);
+        break;
+      }
+
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      m_global = 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_global;
+  };
+
+  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),
+                               cursor_char_position);
+
+    const size_t argc = input.GetArgumentCount();
+    const char *arg = nullptr;
+    int setting_var_idx;
+    for (setting_var_idx = 1; setting_var_idx < static_cast<int>(argc);
+         ++setting_var_idx) {
+      arg = input.GetArgumentAtIndex(setting_var_idx);
+      if (arg && arg[0] != '-')
+        break; // We found our setting variable name index
+    }
+    if (cursor_index == setting_var_idx) {
+      // Attempting to complete setting variable name
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
+    } else {
+      arg = input.GetArgumentAtIndex(cursor_index);
+
+      if (arg) {
+        if (arg[0] == '-') {
+          // Complete option name
+        } else {
+          // Complete setting value
+          const char *setting_var_name =
+              input.GetArgumentAtIndex(setting_var_idx);
+          Error error;
+          lldb::OptionValueSP value_sp(
+              m_interpreter.GetDebugger().GetPropertyValue(
+                  &m_exe_ctx, setting_var_name, false, error));
+          if (value_sp) {
+            value_sp->AutoComplete(m_interpreter, completion_str.c_str(),
+                                   match_start_point, max_return_elements,
+                                   word_complete, matches);
+          }
         }
-
-        // Options table: Required for subclasses of Options.
-
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-
-        bool m_global;
-    };
-
-    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), cursor_char_position);
-
-        const size_t argc = input.GetArgumentCount();
-        const char *arg = nullptr;
-        int setting_var_idx;
-        for (setting_var_idx = 1; setting_var_idx < static_cast<int>(argc);
-             ++setting_var_idx)
-        {
-            arg = input.GetArgumentAtIndex(setting_var_idx);
-            if (arg && arg[0] != '-')
-                break; // We found our setting variable name index
-        }
-        if (cursor_index == setting_var_idx)
-        {
-            // Attempting to complete setting variable name
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
-        }
-        else
-        {
-            arg = input.GetArgumentAtIndex(cursor_index);
-            
-            if (arg)
-            {
-                if (arg[0] == '-')
-                {
-                    // Complete option name
-                }
-                else
-                {
-                    // Complete setting value
-                    const char *setting_var_name = input.GetArgumentAtIndex(setting_var_idx);
-                    Error error;
-                    lldb::OptionValueSP value_sp (m_interpreter.GetDebugger().GetPropertyValue(&m_exe_ctx, setting_var_name, false, error));
-                    if (value_sp)
-                    {
-                        value_sp->AutoComplete (m_interpreter,
-                                                completion_str.c_str(),
-                                                match_start_point,
-                                                max_return_elements,
-                                                word_complete,
-                                                matches);
-                    }
-                }
-            }
-        }
-        return matches.GetSize();
+      }
     }
-    
-protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override
-    {
-        Args cmd_args(command);
-
-        // Process possible options.
-        if (!ParseOptions (cmd_args, result))
-            return false;
-
-        const size_t argc = cmd_args.GetArgumentCount ();
-        if ((argc < 2) && (!m_options.m_global))
-        {
-            result.AppendError ("'settings set' takes more arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    return matches.GetSize();
+  }
 
-        const char *var_name = cmd_args.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings set' command requires a valid variable name");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        // Split the raw command into var_name and value pair.
-        llvm::StringRef raw_str(command);
-        std::string var_value_string = raw_str.split(var_name).second.str();
-        const char *var_value_cstr = Args::StripSpaces(var_value_string, true, false, false);
-
-        Error error;
-        if (m_options.m_global)
-        {
-            error = m_interpreter.GetDebugger().SetPropertyValue(nullptr,
-                                                                 eVarSetOperationAssign,
-                                                                 var_name,
-                                                                 var_value_cstr);
-        }
-        
-        if (error.Success())
-        {
-            // FIXME this is the same issue as the one in commands script import
-            // we could be setting target.load-script-from-symbol-file which would cause
-            // Python scripts to be loaded, which could run LLDB commands
-            // (e.g. settings set target.process.python-os-plugin-path) and cause a crash
-            // if we did not clear the command's exe_ctx first
-            ExecutionContext exe_ctx(m_exe_ctx);
-            m_exe_ctx.Clear();
-            error = m_interpreter.GetDebugger().SetPropertyValue (&exe_ctx,
-                                                                  eVarSetOperationAssign,
-                                                                  var_name,
-                                                                  var_value_cstr);
-        }
-
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        else
-        {
-            result.SetStatus (eReturnStatusSuccessFinishResult);
-        }
+protected:
+  bool DoExecute(const char *command, CommandReturnObject &result) override {
+    Args cmd_args(command);
 
-        return result.Succeeded();
+    // Process possible options.
+    if (!ParseOptions(cmd_args, result))
+      return false;
+
+    const size_t argc = cmd_args.GetArgumentCount();
+    if ((argc < 2) && (!m_options.m_global)) {
+      result.AppendError("'settings set' takes more arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *var_name = cmd_args.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError(
+          "'settings set' command requires a valid variable name");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Split the raw command into var_name and value pair.
+    llvm::StringRef raw_str(command);
+    std::string var_value_string = raw_str.split(var_name).second.str();
+    const char *var_value_cstr =
+        Args::StripSpaces(var_value_string, true, false, false);
+
+    Error error;
+    if (m_options.m_global) {
+      error = m_interpreter.GetDebugger().SetPropertyValue(
+          nullptr, eVarSetOperationAssign, var_name, var_value_cstr);
+    }
+
+    if (error.Success()) {
+      // FIXME this is the same issue as the one in commands script import
+      // we could be setting target.load-script-from-symbol-file which would
+      // cause
+      // Python scripts to be loaded, which could run LLDB commands
+      // (e.g. settings set target.process.python-os-plugin-path) and cause a
+      // crash
+      // if we did not clear the command's exe_ctx first
+      ExecutionContext exe_ctx(m_exe_ctx);
+      m_exe_ctx.Clear();
+      error = m_interpreter.GetDebugger().SetPropertyValue(
+          &exe_ctx, eVarSetOperationAssign, var_name, var_value_cstr);
+    }
+
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    } else {
+      result.SetStatus(eReturnStatusSuccessFinishResult);
     }
 
+    return result.Succeeded();
+  }
+
 private:
-    CommandOptions m_options;
+  CommandOptions m_options;
 };
 
-OptionDefinition
-CommandObjectSettingsSet::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectSettingsSet::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_2, false, "global", 'g', OptionParser::eNoArgument, nullptr, nullptr, 0, eArgTypeNone, "Apply the new value to the global default value."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsShow -- Show current values
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsShow : public CommandObjectParsed
-{
+class CommandObjectSettingsShow : public CommandObjectParsed {
 public:
-    CommandObjectSettingsShow(CommandInterpreter &interpreter)
-        : CommandObjectParsed(
-              interpreter, "settings show",
-              "Show matching debugger settings and their current values.  Defaults to showing all settings.", nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentData var_name_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatOptional;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-    }
-
-    ~CommandObjectSettingsShow() 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), cursor_char_position);
-
-        CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                            CommandCompletions::eSettingsNameCompletion,
-                                                            completion_str.c_str(),
-                                                            match_start_point,
-                                                            max_return_elements,
-                                                            nullptr,
-                                                            word_complete,
-                                                            matches);
-        return matches.GetSize();
-    }
+  CommandObjectSettingsShow(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "settings show",
+                            "Show matching debugger settings and their current "
+                            "values.  Defaults to showing all settings.",
+                            nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentData var_name_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatOptional;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+  }
+
+  ~CommandObjectSettingsShow() 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),
+                               cursor_char_position);
+
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+        completion_str.c_str(), match_start_point, max_return_elements, nullptr,
+        word_complete, matches);
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishResult);
-
-        const size_t argc = args.GetArgumentCount ();
-        if (argc > 0)
-        {
-            for (size_t i = 0; i < argc; ++i)
-            {
-                const char *property_path = args.GetArgumentAtIndex (i);
-
-                Error error(m_interpreter.GetDebugger().DumpPropertyValue (&m_exe_ctx, result.GetOutputStream(), property_path, OptionValue::eDumpGroupValue));
-                if (error.Success())
-                {
-                    result.GetOutputStream().EOL();
-                }
-                else
-                {
-                    result.AppendError (error.AsCString());
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-        }
-        else
-        {
-            m_interpreter.GetDebugger().DumpAllPropertyValues (&m_exe_ctx, result.GetOutputStream(), OptionValue::eDumpGroupValue);
-        }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishResult);
 
-        return result.Succeeded();
+    const size_t argc = args.GetArgumentCount();
+    if (argc > 0) {
+      for (size_t i = 0; i < argc; ++i) {
+        const char *property_path = args.GetArgumentAtIndex(i);
+
+        Error error(m_interpreter.GetDebugger().DumpPropertyValue(
+            &m_exe_ctx, result.GetOutputStream(), property_path,
+            OptionValue::eDumpGroupValue));
+        if (error.Success()) {
+          result.GetOutputStream().EOL();
+        } else {
+          result.AppendError(error.AsCString());
+          result.SetStatus(eReturnStatusFailed);
+        }
+      }
+    } else {
+      m_interpreter.GetDebugger().DumpAllPropertyValues(
+          &m_exe_ctx, result.GetOutputStream(), OptionValue::eDumpGroupValue);
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsList -- List settable variables
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsList : public CommandObjectParsed
-{
+class CommandObjectSettingsList : public CommandObjectParsed {
 public:
-    CommandObjectSettingsList(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "settings list",
-                              "List and describe matching debugger settings.  Defaults to all listing all settings.",
-                              nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData prefix_name_arg;
-
-        // Define the first variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatOptional;
-
-        // Define the second variant of this arg.
-        prefix_name_arg.arg_type = eArgTypeSettingPrefix;
-        prefix_name_arg.arg_repetition = eArgRepeatOptional;
-
-        arg.push_back (var_name_arg);
-        arg.push_back (prefix_name_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg);
-    }
-
-    ~CommandObjectSettingsList() 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), cursor_char_position);
-
-        CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                            CommandCompletions::eSettingsNameCompletion,
-                                                            completion_str.c_str(),
-                                                            match_start_point,
-                                                            max_return_elements,
-                                                            nullptr,
-                                                            word_complete,
-                                                            matches);
-        return matches.GetSize();
-    }
+  CommandObjectSettingsList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "settings list",
+                            "List and describe matching debugger settings.  "
+                            "Defaults to all listing all settings.",
+                            nullptr) {
+    CommandArgumentEntry arg;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData prefix_name_arg;
+
+    // Define the first variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatOptional;
+
+    // Define the second variant of this arg.
+    prefix_name_arg.arg_type = eArgTypeSettingPrefix;
+    prefix_name_arg.arg_repetition = eArgRepeatOptional;
+
+    arg.push_back(var_name_arg);
+    arg.push_back(prefix_name_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg);
+  }
+
+  ~CommandObjectSettingsList() 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),
+                               cursor_char_position);
+
+    CommandCompletions::InvokeCommonCompletionCallbacks(
+        GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+        completion_str.c_str(), match_start_point, max_return_elements, nullptr,
+        word_complete, matches);
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (Args& args, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishResult);
-
-        const bool will_modify = false;
-        const size_t argc = args.GetArgumentCount ();
-        if (argc > 0)
-        {
-            const bool dump_qualified_name = true;
-
-            for (size_t i = 0; i < argc; ++i)
-            {
-                const char *property_path = args.GetArgumentAtIndex (i);
-                
-                const Property *property = m_interpreter.GetDebugger().GetValueProperties()->GetPropertyAtPath (&m_exe_ctx, will_modify, property_path);
-
-                if (property)
-                {
-                    property->DumpDescription (m_interpreter, result.GetOutputStream(), 0, dump_qualified_name);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat ("invalid property path '%s'", property_path);
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-        }
-        else
-        {
-            m_interpreter.GetDebugger().DumpAllDescriptions (m_interpreter, result.GetOutputStream());
-        }
+  bool DoExecute(Args &args, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishResult);
 
-        return result.Succeeded();
+    const bool will_modify = false;
+    const size_t argc = args.GetArgumentCount();
+    if (argc > 0) {
+      const bool dump_qualified_name = true;
+
+      for (size_t i = 0; i < argc; ++i) {
+        const char *property_path = args.GetArgumentAtIndex(i);
+
+        const Property *property =
+            m_interpreter.GetDebugger().GetValueProperties()->GetPropertyAtPath(
+                &m_exe_ctx, will_modify, property_path);
+
+        if (property) {
+          property->DumpDescription(m_interpreter, result.GetOutputStream(), 0,
+                                    dump_qualified_name);
+        } else {
+          result.AppendErrorWithFormat("invalid property path '%s'",
+                                       property_path);
+          result.SetStatus(eReturnStatusFailed);
+        }
+      }
+    } else {
+      m_interpreter.GetDebugger().DumpAllDescriptions(m_interpreter,
+                                                      result.GetOutputStream());
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsRemove
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsRemove : public CommandObjectRaw
-{
+class CommandObjectSettingsRemove : public CommandObjectRaw {
 public:
-    CommandObjectSettingsRemove(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "settings remove",
-                           "Remove a value from a setting, specified by array index or dictionary key.", nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData index_arg;
-        CommandArgumentData key_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Define the first variant of this arg.
-        index_arg.arg_type = eArgTypeSettingIndex;
-        index_arg.arg_repetition = eArgRepeatPlain;
-
-        // Define the second variant of this arg.
-        key_arg.arg_type = eArgTypeSettingKey;
-        key_arg.arg_repetition = eArgRepeatPlain;
-
-        // Push both variants into this arg
-        arg2.push_back (index_arg);
-        arg2.push_back (key_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-    }
-
-    ~CommandObjectSettingsRemove() 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), cursor_char_position);
-
-        // Attempting to complete variable name
-        if (cursor_index < 2)
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
-        return matches.GetSize();
-    }
+  CommandObjectSettingsRemove(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "settings remove",
+                         "Remove a value from a setting, specified by array "
+                         "index or dictionary key.",
+                         nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData index_arg;
+    CommandArgumentData key_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Define the first variant of this arg.
+    index_arg.arg_type = eArgTypeSettingIndex;
+    index_arg.arg_repetition = eArgRepeatPlain;
+
+    // Define the second variant of this arg.
+    key_arg.arg_type = eArgTypeSettingKey;
+    key_arg.arg_repetition = eArgRepeatPlain;
+
+    // Push both variants into this arg
+    arg2.push_back(index_arg);
+    arg2.push_back(key_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+  }
+
+  ~CommandObjectSettingsRemove() 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),
+                               cursor_char_position);
+
+    // Attempting to complete variable name
+    if (cursor_index < 2)
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-     
-        Args cmd_args(command);
-        
-        // Process possible options.
-        if (!ParseOptions (cmd_args, result))
-            return false;
-        
-        const size_t argc = cmd_args.GetArgumentCount ();
-        if (argc == 0)
-        {
-            result.AppendError ("'settings set' takes an array or dictionary item, or an array followed by one or more indexes, or a dictionary followed by one or more key names to remove");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        const char *var_name = cmd_args.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings set' command requires a valid variable name");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        // Split the raw command into var_name and value pair.
-        llvm::StringRef raw_str(command);
-        std::string var_value_string = raw_str.split(var_name).second.str();
-        const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false);
-        
-        Error error (m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx,
-                                                                   eVarSetOperationRemove,
-                                                                   var_name,
-                                                                   var_value_cstr));
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        return result.Succeeded();
+  bool DoExecute(const char *command, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
+
+    Args cmd_args(command);
+
+    // Process possible options.
+    if (!ParseOptions(cmd_args, result))
+      return false;
+
+    const size_t argc = cmd_args.GetArgumentCount();
+    if (argc == 0) {
+      result.AppendError("'settings set' takes an array or dictionary item, or "
+                         "an array followed by one or more indexes, or a "
+                         "dictionary followed by one or more key names to "
+                         "remove");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *var_name = cmd_args.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError(
+          "'settings set' command requires a valid variable name");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Split the raw command into var_name and value pair.
+    llvm::StringRef raw_str(command);
+    std::string var_value_string = raw_str.split(var_name).second.str();
+    const char *var_value_cstr =
+        Args::StripSpaces(var_value_string, true, true, false);
+
+    Error error(m_interpreter.GetDebugger().SetPropertyValue(
+        &m_exe_ctx, eVarSetOperationRemove, var_name, var_value_cstr));
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsReplace
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsReplace : public CommandObjectRaw
-{
+class CommandObjectSettingsReplace : public CommandObjectRaw {
 public:
-    CommandObjectSettingsReplace(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "settings replace",
-                           "Replace the debugger setting value specified by array index or dictionary key.", nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentEntry arg3;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData index_arg;
-        CommandArgumentData key_arg;
-        CommandArgumentData value_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Define the first (variant of this arg.
-        index_arg.arg_type = eArgTypeSettingIndex;
-        index_arg.arg_repetition = eArgRepeatPlain;
-
-        // Define the second (variant of this arg.
-        key_arg.arg_type = eArgTypeSettingKey;
-        key_arg.arg_repetition = eArgRepeatPlain;
-
-        // Put both variants into this arg
-        arg2.push_back (index_arg);
-        arg2.push_back (key_arg);
-
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg3.push_back (value_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);
-    }
-
-    ~CommandObjectSettingsReplace() override = default;
-
-    // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
-    bool
-    WantsCompletion() override { return true; }
-
-    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), cursor_char_position);
-
-        // Attempting to complete variable name
-        if (cursor_index < 2)
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
+  CommandObjectSettingsReplace(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "settings replace",
+                         "Replace the debugger setting value specified by "
+                         "array index or dictionary key.",
+                         nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentEntry arg3;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData index_arg;
+    CommandArgumentData key_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Define the first (variant of this arg.
+    index_arg.arg_type = eArgTypeSettingIndex;
+    index_arg.arg_repetition = eArgRepeatPlain;
+
+    // Define the second (variant of this arg.
+    key_arg.arg_type = eArgTypeSettingKey;
+    key_arg.arg_repetition = eArgRepeatPlain;
+
+    // Put both variants into this arg
+    arg2.push_back(index_arg);
+    arg2.push_back(key_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg3.push_back(value_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);
+  }
+
+  ~CommandObjectSettingsReplace() override = default;
+
+  // Overrides base class's behavior where WantsCompletion =
+  // !WantsRawCommandString.
+  bool WantsCompletion() override { return true; }
+
+  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),
+                               cursor_char_position);
+
+    // Attempting to complete variable name
+    if (cursor_index < 2)
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
 
-        return matches.GetSize();
-    }
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-
-        Args cmd_args(command);
-        const char *var_name = cmd_args.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings replace' command requires a valid variable name; No value supplied");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        // Split the raw command into var_name, index_value, and value triple.
-        llvm::StringRef raw_str(command);
-        std::string var_value_string = raw_str.split(var_name).second.str();
-        const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false);
-
-        Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx,
-                                                                  eVarSetOperationReplace,
-                                                                  var_name,
-                                                                  var_value_cstr));
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        else
-        {
-            result.SetStatus (eReturnStatusSuccessFinishNoResult);
-
-        }
+  bool DoExecute(const char *command, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
 
-        return result.Succeeded();
+    Args cmd_args(command);
+    const char *var_name = cmd_args.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError("'settings replace' command requires a valid variable "
+                         "name; No value supplied");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Split the raw command into var_name, index_value, and value triple.
+    llvm::StringRef raw_str(command);
+    std::string var_value_string = raw_str.split(var_name).second.str();
+    const char *var_value_cstr =
+        Args::StripSpaces(var_value_string, true, true, false);
+
+    Error error(m_interpreter.GetDebugger().SetPropertyValue(
+        &m_exe_ctx, eVarSetOperationReplace, var_name, var_value_cstr));
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    } else {
+      result.SetStatus(eReturnStatusSuccessFinishNoResult);
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsInsertBefore
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsInsertBefore : public CommandObjectRaw
-{
+class CommandObjectSettingsInsertBefore : public CommandObjectRaw {
 public:
-    CommandObjectSettingsInsertBefore(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "settings insert-before", "Insert one or more values into an debugger array "
-                                                                  "setting immediately before the specified element "
-                                                                  "index.",
-                           nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentEntry arg3;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData index_arg;
-        CommandArgumentData value_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Define the first (variant of this arg.
-        index_arg.arg_type = eArgTypeSettingIndex;
-        index_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (index_arg);
-
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg3.push_back (value_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);
-    }
-
-    ~CommandObjectSettingsInsertBefore() override = default;
-
-    // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
-    bool
-    WantsCompletion() override { return true; }
-
-    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), cursor_char_position);
-
-        // Attempting to complete variable name
-        if (cursor_index < 2)
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
+  CommandObjectSettingsInsertBefore(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "settings insert-before",
+                         "Insert one or more values into an debugger array "
+                         "setting immediately before the specified element "
+                         "index.",
+                         nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentEntry arg3;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData index_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Define the first (variant of this arg.
+    index_arg.arg_type = eArgTypeSettingIndex;
+    index_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(index_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg3.push_back(value_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);
+  }
+
+  ~CommandObjectSettingsInsertBefore() override = default;
+
+  // Overrides base class's behavior where WantsCompletion =
+  // !WantsRawCommandString.
+  bool WantsCompletion() override { return true; }
+
+  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),
+                               cursor_char_position);
+
+    // Attempting to complete variable name
+    if (cursor_index < 2)
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
 
-        return matches.GetSize();
-    }
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-
-        Args cmd_args(command);
-        const size_t argc = cmd_args.GetArgumentCount ();
-
-        if (argc < 3)
-        {
-            result.AppendError ("'settings insert-before' takes more arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        const char *var_name = cmd_args.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings insert-before' command requires a valid variable name; No value supplied");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+  bool DoExecute(const char *command, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
 
-        // Split the raw command into var_name, index_value, and value triple.
-        llvm::StringRef raw_str(command);
-        std::string var_value_string = raw_str.split(var_name).second.str();
-        const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false);
-
-        Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx,
-                                                                  eVarSetOperationInsertBefore,
-                                                                  var_name,
-                                                                  var_value_cstr));
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    Args cmd_args(command);
+    const size_t argc = cmd_args.GetArgumentCount();
 
-        return result.Succeeded();
+    if (argc < 3) {
+      result.AppendError("'settings insert-before' takes more arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *var_name = cmd_args.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError("'settings insert-before' command requires a valid "
+                         "variable name; No value supplied");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Split the raw command into var_name, index_value, and value triple.
+    llvm::StringRef raw_str(command);
+    std::string var_value_string = raw_str.split(var_name).second.str();
+    const char *var_value_cstr =
+        Args::StripSpaces(var_value_string, true, true, false);
+
+    Error error(m_interpreter.GetDebugger().SetPropertyValue(
+        &m_exe_ctx, eVarSetOperationInsertBefore, var_name, var_value_cstr));
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingInsertAfter
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsInsertAfter : public CommandObjectRaw
-{
+class CommandObjectSettingsInsertAfter : public CommandObjectRaw {
 public:
-    CommandObjectSettingsInsertAfter(CommandInterpreter &interpreter)
-        : CommandObjectRaw(
-              interpreter, "settings insert-after",
-              "Insert one or more values into a debugger array settings after the specified element index.", nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentEntry arg3;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData index_arg;
-        CommandArgumentData value_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Define the first (variant of this arg.
-        index_arg.arg_type = eArgTypeSettingIndex;
-        index_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (index_arg);
-
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg3.push_back (value_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);
-    }
-
-    ~CommandObjectSettingsInsertAfter() override = default;
-
-    // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
-    bool
-    WantsCompletion() override { return true; }
-
-    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), cursor_char_position);
-
-        // Attempting to complete variable name
-        if (cursor_index < 2)
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
+  CommandObjectSettingsInsertAfter(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "settings insert-after",
+                         "Insert one or more values into a debugger array "
+                         "settings after the specified element index.",
+                         nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentEntry arg3;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData index_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Define the first (variant of this arg.
+    index_arg.arg_type = eArgTypeSettingIndex;
+    index_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(index_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg3.push_back(value_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);
+  }
+
+  ~CommandObjectSettingsInsertAfter() override = default;
+
+  // Overrides base class's behavior where WantsCompletion =
+  // !WantsRawCommandString.
+  bool WantsCompletion() override { return true; }
+
+  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),
+                               cursor_char_position);
+
+    // Attempting to complete variable name
+    if (cursor_index < 2)
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
 
-        return matches.GetSize();
-    }
-    
-protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-
-        Args cmd_args(command);
-        const size_t argc = cmd_args.GetArgumentCount ();
-
-        if (argc < 3)
-        {
-            result.AppendError ("'settings insert-after' takes more arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    return matches.GetSize();
+  }
 
-        const char *var_name = cmd_args.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings insert-after' command requires a valid variable name; No value supplied");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+protected:
+  bool DoExecute(const char *command, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
 
-        // Split the raw command into var_name, index_value, and value triple.
-        llvm::StringRef raw_str(command);
-        std::string var_value_string = raw_str.split(var_name).second.str();
-        const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false);
-
-        Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx,
-                                                                  eVarSetOperationInsertAfter,
-                                                                  var_name,
-                                                                  var_value_cstr));
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
+    Args cmd_args(command);
+    const size_t argc = cmd_args.GetArgumentCount();
 
-        return result.Succeeded();
+    if (argc < 3) {
+      result.AppendError("'settings insert-after' takes more arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *var_name = cmd_args.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError("'settings insert-after' command requires a valid "
+                         "variable name; No value supplied");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Split the raw command into var_name, index_value, and value triple.
+    llvm::StringRef raw_str(command);
+    std::string var_value_string = raw_str.split(var_name).second.str();
+    const char *var_value_cstr =
+        Args::StripSpaces(var_value_string, true, true, false);
+
+    Error error(m_interpreter.GetDebugger().SetPropertyValue(
+        &m_exe_ctx, eVarSetOperationInsertAfter, var_name, var_value_cstr));
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsAppend
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsAppend : public CommandObjectRaw
-{
+class CommandObjectSettingsAppend : public CommandObjectRaw {
 public:
-    CommandObjectSettingsAppend(CommandInterpreter &interpreter)
-        : CommandObjectRaw(interpreter, "settings append",
-                           "Append one or more values to a debugger array, dictionary, or string setting.", nullptr)
-    {
-        CommandArgumentEntry arg1;
-        CommandArgumentEntry arg2;
-        CommandArgumentData var_name_arg;
-        CommandArgumentData value_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg1.push_back (var_name_arg);
-
-        // Define the first (and only) variant of this arg.
-        value_arg.arg_type = eArgTypeValue;
-        value_arg.arg_repetition = eArgRepeatPlain;
-
-        // There is only one variant this argument could be; put it into the argument entry.
-        arg2.push_back (value_arg);
-
-        // Push the data for the first argument into the m_arguments vector.
-        m_arguments.push_back (arg1);
-        m_arguments.push_back (arg2);
-    }
-
-    ~CommandObjectSettingsAppend() override = default;
-
-    // Overrides base class's behavior where WantsCompletion = !WantsRawCommandString.
-    bool
-    WantsCompletion() override { return true; }
-
-    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), cursor_char_position);
-
-        // Attempting to complete variable name
-        if (cursor_index < 2)
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
+  CommandObjectSettingsAppend(CommandInterpreter &interpreter)
+      : CommandObjectRaw(interpreter, "settings append",
+                         "Append one or more values to a debugger array, "
+                         "dictionary, or string setting.",
+                         nullptr) {
+    CommandArgumentEntry arg1;
+    CommandArgumentEntry arg2;
+    CommandArgumentData var_name_arg;
+    CommandArgumentData value_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg1.push_back(var_name_arg);
+
+    // Define the first (and only) variant of this arg.
+    value_arg.arg_type = eArgTypeValue;
+    value_arg.arg_repetition = eArgRepeatPlain;
+
+    // There is only one variant this argument could be; put it into the
+    // argument entry.
+    arg2.push_back(value_arg);
+
+    // Push the data for the first argument into the m_arguments vector.
+    m_arguments.push_back(arg1);
+    m_arguments.push_back(arg2);
+  }
+
+  ~CommandObjectSettingsAppend() override = default;
+
+  // Overrides base class's behavior where WantsCompletion =
+  // !WantsRawCommandString.
+  bool WantsCompletion() override { return true; }
+
+  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),
+                               cursor_char_position);
+
+    // Attempting to complete variable name
+    if (cursor_index < 2)
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
 
-        return matches.GetSize();
-    }
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (const char *command, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        Args cmd_args(command);
-        const size_t argc = cmd_args.GetArgumentCount ();
-
-        if (argc < 2)
-        {
-            result.AppendError ("'settings append' takes more arguments");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        const char *var_name = cmd_args.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings append' command requires a valid variable name; No value supplied");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        // Do not perform cmd_args.Shift() since StringRef is manipulating the
-        // raw character string later on.
-
-        // Split the raw command into var_name and value pair.
-        llvm::StringRef raw_str(command);
-        std::string var_value_string = raw_str.split(var_name).second.str();
-        const char *var_value_cstr = Args::StripSpaces(var_value_string, true, true, false);
-
-        Error error(m_interpreter.GetDebugger().SetPropertyValue (&m_exe_ctx,
-                                                                  eVarSetOperationAppend,
-                                                                  var_name,
-                                                                  var_value_cstr));
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        return result.Succeeded();
+  bool DoExecute(const char *command, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    Args cmd_args(command);
+    const size_t argc = cmd_args.GetArgumentCount();
+
+    if (argc < 2) {
+      result.AppendError("'settings append' takes more arguments");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *var_name = cmd_args.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError("'settings append' command requires a valid variable "
+                         "name; No value supplied");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    // Do not perform cmd_args.Shift() since StringRef is manipulating the
+    // raw character string later on.
+
+    // Split the raw command into var_name and value pair.
+    llvm::StringRef raw_str(command);
+    std::string var_value_string = raw_str.split(var_name).second.str();
+    const char *var_value_cstr =
+        Args::StripSpaces(var_value_string, true, true, false);
+
+    Error error(m_interpreter.GetDebugger().SetPropertyValue(
+        &m_exe_ctx, eVarSetOperationAppend, var_name, var_value_cstr));
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectSettingsClear
 //-------------------------------------------------------------------------
 
-class CommandObjectSettingsClear : public CommandObjectParsed
-{
+class CommandObjectSettingsClear : public CommandObjectParsed {
 public:
-    CommandObjectSettingsClear(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "settings clear", "Clear a debugger setting array, dictionary, or string.",
-                              nullptr)
-    {
-        CommandArgumentEntry arg;
-        CommandArgumentData var_name_arg;
-
-        // Define the first (and only) variant of this arg.
-        var_name_arg.arg_type = eArgTypeSettingVariableName;
-        var_name_arg.arg_repetition = eArgRepeatPlain;
-
-        // 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);
-    }
-
-    ~CommandObjectSettingsClear() 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), cursor_char_position);
-
-        // Attempting to complete variable name
-        if (cursor_index < 2)
-            CommandCompletions::InvokeCommonCompletionCallbacks(GetCommandInterpreter(),
-                                                                CommandCompletions::eSettingsNameCompletion,
-                                                                completion_str.c_str(),
-                                                                match_start_point,
-                                                                max_return_elements,
-                                                                nullptr,
-                                                                word_complete,
-                                                                matches);
+  CommandObjectSettingsClear(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "settings clear",
+            "Clear a debugger setting array, dictionary, or string.", nullptr) {
+    CommandArgumentEntry arg;
+    CommandArgumentData var_name_arg;
+
+    // Define the first (and only) variant of this arg.
+    var_name_arg.arg_type = eArgTypeSettingVariableName;
+    var_name_arg.arg_repetition = eArgRepeatPlain;
+
+    // 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);
+  }
+
+  ~CommandObjectSettingsClear() 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),
+                               cursor_char_position);
+
+    // Attempting to complete variable name
+    if (cursor_index < 2)
+      CommandCompletions::InvokeCommonCompletionCallbacks(
+          GetCommandInterpreter(), CommandCompletions::eSettingsNameCompletion,
+          completion_str.c_str(), match_start_point, max_return_elements,
+          nullptr, word_complete, matches);
 
-        return matches.GetSize();
-    }
+    return matches.GetSize();
+  }
 
 protected:
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        result.SetStatus (eReturnStatusSuccessFinishNoResult);
-        const size_t argc = command.GetArgumentCount ();
-
-        if (argc != 1)
-        {
-            result.AppendError ("'settings clear' takes exactly one argument");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        const char *var_name = command.GetArgumentAtIndex (0);
-        if ((var_name == nullptr) || (var_name[0] == '\0'))
-        {
-            result.AppendError ("'settings clear' command requires a valid variable name; No value supplied");
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-        
-        Error error(m_interpreter.GetDebugger().SetPropertyValue(&m_exe_ctx,
-                                                                 eVarSetOperationClear,
-                                                                 var_name,
-                                                                 nullptr));
-        if (error.Fail())
-        {
-            result.AppendError (error.AsCString());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        return result.Succeeded();
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    result.SetStatus(eReturnStatusSuccessFinishNoResult);
+    const size_t argc = command.GetArgumentCount();
+
+    if (argc != 1) {
+      result.AppendError("'settings clear' takes exactly one argument");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    const char *var_name = command.GetArgumentAtIndex(0);
+    if ((var_name == nullptr) || (var_name[0] == '\0')) {
+      result.AppendError("'settings clear' command requires a valid variable "
+                         "name; No value supplied");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    Error error(m_interpreter.GetDebugger().SetPropertyValue(
+        &m_exe_ctx, eVarSetOperationClear, var_name, nullptr));
+    if (error.Fail()) {
+      result.AppendError(error.AsCString());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
+
+    return result.Succeeded();
+  }
 };
 
 //-------------------------------------------------------------------------
 // CommandObjectMultiwordSettings
 //-------------------------------------------------------------------------
 
-CommandObjectMultiwordSettings::CommandObjectMultiwordSettings(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(interpreter, "settings", "Commands for managing LLDB settings.",
-                             "settings <subcommand> [<command-options>]")
-{
-    LoadSubCommand ("set",           CommandObjectSP (new CommandObjectSettingsSet (interpreter)));
-    LoadSubCommand ("show",          CommandObjectSP (new CommandObjectSettingsShow (interpreter)));
-    LoadSubCommand ("list",          CommandObjectSP (new CommandObjectSettingsList (interpreter)));
-    LoadSubCommand ("remove",        CommandObjectSP (new CommandObjectSettingsRemove (interpreter)));
-    LoadSubCommand ("replace",       CommandObjectSP (new CommandObjectSettingsReplace (interpreter)));
-    LoadSubCommand ("insert-before", CommandObjectSP (new CommandObjectSettingsInsertBefore (interpreter)));
-    LoadSubCommand ("insert-after",  CommandObjectSP (new CommandObjectSettingsInsertAfter (interpreter)));
-    LoadSubCommand ("append",        CommandObjectSP (new CommandObjectSettingsAppend (interpreter)));
-    LoadSubCommand ("clear",         CommandObjectSP (new CommandObjectSettingsClear (interpreter)));
+CommandObjectMultiwordSettings::CommandObjectMultiwordSettings(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(interpreter, "settings",
+                             "Commands for managing LLDB settings.",
+                             "settings <subcommand> [<command-options>]") {
+  LoadSubCommand("set",
+                 CommandObjectSP(new CommandObjectSettingsSet(interpreter)));
+  LoadSubCommand("show",
+                 CommandObjectSP(new CommandObjectSettingsShow(interpreter)));
+  LoadSubCommand("list",
+                 CommandObjectSP(new CommandObjectSettingsList(interpreter)));
+  LoadSubCommand("remove",
+                 CommandObjectSP(new CommandObjectSettingsRemove(interpreter)));
+  LoadSubCommand("replace", CommandObjectSP(
+                                new CommandObjectSettingsReplace(interpreter)));
+  LoadSubCommand(
+      "insert-before",
+      CommandObjectSP(new CommandObjectSettingsInsertBefore(interpreter)));
+  LoadSubCommand(
+      "insert-after",
+      CommandObjectSP(new CommandObjectSettingsInsertAfter(interpreter)));
+  LoadSubCommand("append",
+                 CommandObjectSP(new CommandObjectSettingsAppend(interpreter)));
+  LoadSubCommand("clear",
+                 CommandObjectSP(new CommandObjectSettingsClear(interpreter)));
 }
 
 CommandObjectMultiwordSettings::~CommandObjectMultiwordSettings() = default;

Modified: lldb/trunk/source/Commands/CommandObjectSettings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSettings.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSettings.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSettings.h Tue Sep  6 15:57:50 2016
@@ -18,20 +18,17 @@
 #include "lldb/Interpreter/CommandObjectMultiword.h"
 #include "lldb/Interpreter/Options.h"
 
-
 namespace lldb_private {
 
 //-------------------------------------------------------------------------
 // CommandObjectMultiwordSettings
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordSettings : public CommandObjectMultiword
-{
+class CommandObjectMultiwordSettings : public CommandObjectMultiword {
 public:
+  CommandObjectMultiwordSettings(CommandInterpreter &interpreter);
 
-    CommandObjectMultiwordSettings (CommandInterpreter &interpreter);
-
-    ~CommandObjectMultiwordSettings() override;
+  ~CommandObjectMultiwordSettings() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Tue Sep  6 15:57:50 2016
@@ -18,10 +18,12 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Core/ModuleSpec.h"
 #include "lldb/Core/SourceManager.h"
-#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Host/FileSpec.h"
 #include "lldb/Host/StringConvert.h"
+#include "lldb/Interpreter/CommandCompletions.h"
+#include "lldb/Interpreter/CommandInterpreter.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 #include "lldb/Symbol/CompileUnit.h"
 #include "lldb/Symbol/Function.h"
 #include "lldb/Symbol/Symbol.h"
@@ -29,8 +31,6 @@
 #include "lldb/Target/SectionLoadList.h"
 #include "lldb/Target/StackFrame.h"
 #include "lldb/Target/TargetList.h"
-#include "lldb/Interpreter/CommandCompletions.h"
-#include "lldb/Interpreter/Options.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -40,668 +40,617 @@ using namespace lldb_private;
 // CommandObjectSourceInfo - debug line entries dumping command
 //----------------------------------------------------------------------
 
-class CommandObjectSourceInfo : public CommandObjectParsed
-{
-    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 = g_option_table[option_idx].short_option;
-            switch (short_option)
-            {
-                case 'l':
-                    start_line = StringConvert::ToUInt32(option_arg, 0);
-                    if (start_line == 0)
-                        error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
-                    break;
-
-                case 'e':
-                    end_line = StringConvert::ToUInt32(option_arg, 0);
-                    if (end_line == 0)
-                        error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
-                    break;
-
-                case 'c':
-                    num_lines = StringConvert::ToUInt32(option_arg, 0);
-                    if (num_lines == 0)
-                        error.SetErrorStringWithFormat("invalid line count: '%s'", option_arg);
-                    break;
-
-                case 'f':
-                    file_name = option_arg;
-                    break;
-
-                case 'n':
-                    symbol_name = option_arg;
-                    break;
-
-                case 'a':
-                {
-                    address = Args::StringToAddress(execution_context,
-                                                    option_arg,
-                                                    LLDB_INVALID_ADDRESS,
-                                                    &error);
-                }
-                break;
-                case 's':
-                    modules.push_back(std::string(option_arg));
-                    break;
-                default:
-                    error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-                    break;
-            }
+class CommandObjectSourceInfo : public CommandObjectParsed {
+  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 = g_option_table[option_idx].short_option;
+      switch (short_option) {
+      case 'l':
+        start_line = StringConvert::ToUInt32(option_arg, 0);
+        if (start_line == 0)
+          error.SetErrorStringWithFormat("invalid line number: '%s'",
+                                         option_arg);
+        break;
+
+      case 'e':
+        end_line = StringConvert::ToUInt32(option_arg, 0);
+        if (end_line == 0)
+          error.SetErrorStringWithFormat("invalid line number: '%s'",
+                                         option_arg);
+        break;
+
+      case 'c':
+        num_lines = StringConvert::ToUInt32(option_arg, 0);
+        if (num_lines == 0)
+          error.SetErrorStringWithFormat("invalid line count: '%s'",
+                                         option_arg);
+        break;
+
+      case 'f':
+        file_name = option_arg;
+        break;
+
+      case 'n':
+        symbol_name = option_arg;
+        break;
+
+      case 'a': {
+        address = Args::StringToAddress(execution_context, option_arg,
+                                        LLDB_INVALID_ADDRESS, &error);
+      } break;
+      case 's':
+        modules.push_back(std::string(option_arg));
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                       short_option);
+        break;
+      }
 
-            return error;
-        }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      file_spec.Clear();
+      file_name.clear();
+      symbol_name.clear();
+      address = LLDB_INVALID_ADDRESS;
+      start_line = 0;
+      end_line = 0;
+      num_lines = 0;
+      modules.clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
+
+    static OptionDefinition g_option_table[];
 
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            file_spec.Clear();
-            file_name.clear();
-            symbol_name.clear();
-            address = LLDB_INVALID_ADDRESS;
-            start_line = 0;
-            end_line = 0;
-            num_lines = 0;
-            modules.clear();
-        }
-
-        const OptionDefinition *
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-        FileSpec file_spec;
-        std::string file_name;
-        std::string symbol_name;
-        lldb::addr_t address;
-        uint32_t start_line;
-        uint32_t end_line;
-        uint32_t num_lines;
-        STLStringArray modules;
-    };
+    // Instance variables to hold the values for command options.
+    FileSpec file_spec;
+    std::string file_name;
+    std::string symbol_name;
+    lldb::addr_t address;
+    uint32_t start_line;
+    uint32_t end_line;
+    uint32_t num_lines;
+    STLStringArray modules;
+  };
 
 public:
-    CommandObjectSourceInfo(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "source info", "Display source line information for the current target "
-                                                          "process.  Defaults to instruction pointer in current stack "
-                                                          "frame.",
-                              nullptr, eCommandRequiresTarget),
-          m_options()
-    {
+  CommandObjectSourceInfo(CommandInterpreter &interpreter)
+      : CommandObjectParsed(
+            interpreter, "source info",
+            "Display source line information for the current target "
+            "process.  Defaults to instruction pointer in current stack "
+            "frame.",
+            nullptr, eCommandRequiresTarget),
+        m_options() {}
+
+  ~CommandObjectSourceInfo() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+protected:
+  // Dump the line entries in each symbol context.
+  // Return the number of entries found.
+  // If module_list is set, only dump lines contained in one of the modules.
+  // If file_spec is set, only dump lines in the file.
+  // If the start_line option was specified, don't print lines less than
+  // start_line.
+  // If the end_line option was specified, don't print lines greater than
+  // end_line.
+  // If the num_lines option was specified, dont print more than num_lines
+  // entries.
+  uint32_t DumpLinesInSymbolContexts(Stream &strm,
+                                     const SymbolContextList &sc_list,
+                                     const ModuleList &module_list,
+                                     const FileSpec &file_spec) {
+    uint32_t start_line = m_options.start_line;
+    uint32_t end_line = m_options.end_line;
+    uint32_t num_lines = m_options.num_lines;
+    Target *target = m_exe_ctx.GetTargetPtr();
+
+    uint32_t num_matches = 0;
+    bool has_path = false;
+    if (file_spec) {
+      assert(file_spec.GetFilename().AsCString());
+      has_path = (file_spec.GetDirectory().AsCString() != nullptr);
     }
 
-    ~CommandObjectSourceInfo() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
+    // Dump all the line entries for the file in the list.
+    ConstString last_module_file_name;
+    uint32_t num_scs = sc_list.GetSize();
+    for (uint32_t i = 0; i < num_scs; ++i) {
+      SymbolContext sc;
+      sc_list.GetContextAtIndex(i, sc);
+      if (sc.comp_unit) {
+        Module *module = sc.module_sp.get();
+        CompileUnit *cu = sc.comp_unit;
+        const LineEntry &line_entry = sc.line_entry;
+        assert(module && cu);
+
+        // Are we looking for specific modules, files or lines?
+        if (module_list.GetSize() &&
+            module_list.GetIndexForModule(module) == LLDB_INVALID_INDEX32)
+          continue;
+        if (file_spec &&
+            !lldb_private::FileSpec::Equal(file_spec, line_entry.file,
+                                           has_path))
+          continue;
+        if (start_line > 0 && line_entry.line < start_line)
+          continue;
+        if (end_line > 0 && line_entry.line > end_line)
+          continue;
+        if (num_lines > 0 && num_matches > num_lines)
+          continue;
+
+        // Print a new header if the module changed.
+        const ConstString &module_file_name =
+            module->GetFileSpec().GetFilename();
+        assert(module_file_name);
+        if (module_file_name != last_module_file_name) {
+          if (num_matches > 0)
+            strm << "\n\n";
+          strm << "Lines found in module `" << module_file_name << "\n";
+        }
+        // Dump the line entry.
+        line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
+                                  target, /*show_address_only=*/false);
+        strm << "\n";
+        last_module_file_name = module_file_name;
+        num_matches++;
+      }
     }
+    return num_matches;
+  }
 
-protected:
-    // Dump the line entries in each symbol context.
-    // Return the number of entries found.
-    // If module_list is set, only dump lines contained in one of the modules.
-    // If file_spec is set, only dump lines in the file.
-    // If the start_line option was specified, don't print lines less than start_line.
-    // If the end_line option was specified, don't print lines greater than end_line.
-    // If the num_lines option was specified, dont print more than num_lines entries.
-    uint32_t
-    DumpLinesInSymbolContexts (Stream &strm, const SymbolContextList &sc_list,
-                               const ModuleList &module_list, const FileSpec &file_spec)
-    {
-        uint32_t start_line = m_options.start_line;
-        uint32_t end_line = m_options.end_line;
-        uint32_t num_lines = m_options.num_lines;
-        Target *target = m_exe_ctx.GetTargetPtr();
-
-        uint32_t num_matches = 0;
-        bool has_path = false;
-        if (file_spec)
-        {
-            assert(file_spec.GetFilename().AsCString());
-            has_path = (file_spec.GetDirectory().AsCString() != nullptr);
-        }
-    
-        // Dump all the line entries for the file in the list.
-        ConstString last_module_file_name;
-        uint32_t num_scs = sc_list.GetSize();
-        for (uint32_t i = 0; i < num_scs; ++i)
-        {
-            SymbolContext sc;
-            sc_list.GetContextAtIndex(i, sc);
-            if (sc.comp_unit)
-            {
-                Module *module = sc.module_sp.get();
-                CompileUnit *cu = sc.comp_unit;
-                const LineEntry &line_entry = sc.line_entry;
-                assert(module && cu);
-    
-                // Are we looking for specific modules, files or lines?
-                if (module_list.GetSize() && module_list.GetIndexForModule(module) == LLDB_INVALID_INDEX32)
-                    continue;
-                if (file_spec && !lldb_private::FileSpec::Equal(file_spec, line_entry.file, has_path))
-                    continue;
-                if (start_line > 0 && line_entry.line < start_line)
-                    continue;
-                if (end_line > 0 && line_entry.line > end_line)
-                    continue;
-                if (num_lines > 0 && num_matches > num_lines)
-                    continue;
-    
-                // Print a new header if the module changed.
-                const ConstString &module_file_name = module->GetFileSpec().GetFilename();
-                assert(module_file_name);
-                if (module_file_name != last_module_file_name)
-                {
-                    if (num_matches > 0)
-                        strm << "\n\n";
-                    strm << "Lines found in module `" << module_file_name << "\n";
-                }
-                // Dump the line entry.
-                line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
-                                          target, /*show_address_only=*/false);
-                strm << "\n";
-                last_module_file_name = module_file_name;
-                num_matches++;
-            }
+  // Dump the requested line entries for the file in the compilation unit.
+  // Return the number of entries found.
+  // If module_list is set, only dump lines contained in one of the modules.
+  // If the start_line option was specified, don't print lines less than
+  // start_line.
+  // If the end_line option was specified, don't print lines greater than
+  // end_line.
+  // If the num_lines option was specified, dont print more than num_lines
+  // entries.
+  uint32_t DumpFileLinesInCompUnit(Stream &strm, Module *module,
+                                   CompileUnit *cu, const FileSpec &file_spec) {
+    uint32_t start_line = m_options.start_line;
+    uint32_t end_line = m_options.end_line;
+    uint32_t num_lines = m_options.num_lines;
+    Target *target = m_exe_ctx.GetTargetPtr();
+
+    uint32_t num_matches = 0;
+    assert(module);
+    if (cu) {
+      assert(file_spec.GetFilename().AsCString());
+      bool has_path = (file_spec.GetDirectory().AsCString() != nullptr);
+      const FileSpecList &cu_file_list = cu->GetSupportFiles();
+      size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path);
+      if (file_idx != UINT32_MAX) {
+        // Update the file to how it appears in the CU.
+        const FileSpec &cu_file_spec =
+            cu_file_list.GetFileSpecAtIndex(file_idx);
+
+        // Dump all matching lines at or above start_line for the file in the
+        // CU.
+        const ConstString &file_spec_name = file_spec.GetFilename();
+        const ConstString &module_file_name =
+            module->GetFileSpec().GetFilename();
+        bool cu_header_printed = false;
+        uint32_t line = start_line;
+        while (true) {
+          LineEntry line_entry;
+
+          // Find the lowest index of a line entry with a line equal to
+          // or higher than 'line'.
+          uint32_t start_idx = 0;
+          start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec,
+                                        /*exact=*/false, &line_entry);
+          if (start_idx == UINT32_MAX)
+            // No more line entries for our file in this CU.
+            break;
+
+          if (end_line > 0 && line_entry.line > end_line)
+            break;
+
+          // Loop through to find any other entries for this line, dumping each.
+          line = line_entry.line;
+          do {
+            num_matches++;
+            if (num_lines > 0 && num_matches > num_lines)
+              break;
+            assert(lldb_private::FileSpec::Equal(cu_file_spec, line_entry.file,
+                                                 has_path));
+            if (!cu_header_printed) {
+              if (num_matches > 0)
+                strm << "\n\n";
+              strm << "Lines found for file " << file_spec_name
+                   << " in compilation unit " << cu->GetFilename() << " in `"
+                   << module_file_name << "\n";
+              cu_header_printed = true;
+            }
+            line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
+                                      target, /*show_address_only=*/false);
+            strm << "\n";
+
+            // Anymore after this one?
+            start_idx++;
+            start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec,
+                                          /*exact=*/true, &line_entry);
+          } while (start_idx != UINT32_MAX);
+
+          // Try the next higher line, starting over at start_idx 0.
+          line++;
         }
-        return num_matches;
+      }
     }
-    
-    // Dump the requested line entries for the file in the compilation unit.
-    // Return the number of entries found.
-    // If module_list is set, only dump lines contained in one of the modules.
-    // If the start_line option was specified, don't print lines less than start_line.
-    // If the end_line option was specified, don't print lines greater than end_line.
-    // If the num_lines option was specified, dont print more than num_lines entries.
-    uint32_t
-    DumpFileLinesInCompUnit (Stream &strm, Module *module, CompileUnit *cu, const FileSpec &file_spec)
-    {
-        uint32_t start_line = m_options.start_line;
-        uint32_t end_line = m_options.end_line;
-        uint32_t num_lines = m_options.num_lines;
-        Target *target = m_exe_ctx.GetTargetPtr();
-
-        uint32_t num_matches = 0;
-        assert(module);
-        if (cu)
-        {
-            assert(file_spec.GetFilename().AsCString());
-            bool has_path = (file_spec.GetDirectory().AsCString() != nullptr);
-            const FileSpecList &cu_file_list = cu->GetSupportFiles();
-            size_t file_idx = cu_file_list.FindFileIndex(0, file_spec, has_path);
-            if (file_idx != UINT32_MAX)
-            {
-                // Update the file to how it appears in the CU.
-                const FileSpec &cu_file_spec = cu_file_list.GetFileSpecAtIndex(file_idx);
-    
-                // Dump all matching lines at or above start_line for the file in the CU.
-                const ConstString &file_spec_name = file_spec.GetFilename();
-                const ConstString &module_file_name = module->GetFileSpec().GetFilename();
-                bool cu_header_printed = false;
-                uint32_t line = start_line;
-                while (true)
-                {
-                    LineEntry line_entry;
-    
-                    // Find the lowest index of a line entry with a line equal to
-                    // or higher than 'line'.
-                    uint32_t start_idx = 0;
-                    start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec,
-                                                  /*exact=*/false, &line_entry);
-                    if (start_idx == UINT32_MAX)
-                        // No more line entries for our file in this CU.
-                        break;
-    
-                    if (end_line > 0 && line_entry.line > end_line)
-                        break;
-    
-                    // Loop through to find any other entries for this line, dumping each.
-                    line = line_entry.line;
-                    do
-                    {
-                        num_matches++;
-                        if (num_lines > 0 && num_matches > num_lines)
-                            break;
-                        assert(lldb_private::FileSpec::Equal(cu_file_spec, line_entry.file, has_path));
-                        if (!cu_header_printed)
-                        {
-                            if (num_matches > 0)
-                                strm << "\n\n";
-                            strm << "Lines found for file " << file_spec_name
-                                 << " in compilation unit " << cu->GetFilename()
-                                 << " in `" << module_file_name << "\n";
-                            cu_header_printed = true;
-                        }
-                        line_entry.GetDescription(&strm, lldb::eDescriptionLevelBrief, cu,
-                                                  target, /*show_address_only=*/false);
-                        strm << "\n";
-    
-                        // Anymore after this one?
-                        start_idx++;
-                        start_idx = cu->FindLineEntry(start_idx, line, &cu_file_spec,
-                                                      /*exact=*/true, &line_entry);
-                    } while (start_idx != UINT32_MAX);
-    
-                    // Try the next higher line, starting over at start_idx 0.
-                    line++;
-                }
-            }
+    return num_matches;
+  }
+
+  // Dump the requested line entries for the file in the module.
+  // Return the number of entries found.
+  // If module_list is set, only dump lines contained in one of the modules.
+  // If the start_line option was specified, don't print lines less than
+  // start_line.
+  // If the end_line option was specified, don't print lines greater than
+  // end_line.
+  // If the num_lines option was specified, dont print more than num_lines
+  // entries.
+  uint32_t DumpFileLinesInModule(Stream &strm, Module *module,
+                                 const FileSpec &file_spec) {
+    uint32_t num_matches = 0;
+    if (module) {
+      // Look through all the compilation units (CUs) in this module for ones
+      // that
+      // contain lines of code from this source file.
+      for (size_t i = 0; i < module->GetNumCompileUnits(); i++) {
+        // Look for a matching source file in this CU.
+        CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i));
+        if (cu_sp) {
+          num_matches +=
+              DumpFileLinesInCompUnit(strm, module, cu_sp.get(), file_spec);
         }
-        return num_matches;
+      }
     }
-    
-    // Dump the requested line entries for the file in the module.
-    // Return the number of entries found.
-    // If module_list is set, only dump lines contained in one of the modules.
-    // If the start_line option was specified, don't print lines less than start_line.
-    // If the end_line option was specified, don't print lines greater than end_line.
-    // If the num_lines option was specified, dont print more than num_lines entries.
-    uint32_t
-    DumpFileLinesInModule (Stream &strm, Module *module, const FileSpec &file_spec)
-    {
-        uint32_t num_matches = 0;
-        if (module)
-        {
-            // Look through all the compilation units (CUs) in this module for ones that
-            // contain lines of code from this source file.
-            for (size_t i = 0; i < module->GetNumCompileUnits(); i++)
-            {
-                // Look for a matching source file in this CU.
-                CompUnitSP cu_sp(module->GetCompileUnitAtIndex(i));
-                if (cu_sp)
-                {
-                    num_matches += DumpFileLinesInCompUnit(strm, module, cu_sp.get(), file_spec);
-                }
-            }
+    return num_matches;
+  }
+
+  // Given an address and a list of modules, append the symbol contexts of all
+  // line entries
+  // containing the address found in the modules and return the count of
+  // matches.  If none
+  // is found, return an error in 'error_strm'.
+  size_t GetSymbolContextsForAddress(const ModuleList &module_list,
+                                     lldb::addr_t addr,
+                                     SymbolContextList &sc_list,
+                                     StreamString &error_strm) {
+    Address so_addr;
+    size_t num_matches = 0;
+    assert(module_list.GetSize() > 0);
+    Target *target = m_exe_ctx.GetTargetPtr();
+    if (target->GetSectionLoadList().IsEmpty()) {
+      // The target isn't loaded yet, we need to lookup the file address in
+      // all modules.  Note: the module list option does not apply to addresses.
+      const size_t num_modules = module_list.GetSize();
+      for (size_t i = 0; i < num_modules; ++i) {
+        ModuleSP module_sp(module_list.GetModuleAtIndex(i));
+        if (!module_sp)
+          continue;
+        if (module_sp->ResolveFileAddress(addr, so_addr)) {
+          SymbolContext sc;
+          sc.Clear(true);
+          if (module_sp->ResolveSymbolContextForAddress(
+                  so_addr, eSymbolContextEverything, sc) &
+              eSymbolContextLineEntry) {
+            sc_list.AppendIfUnique(sc, /*merge_symbol_into_function=*/false);
+            ++num_matches;
+          }
+        }
+      }
+      if (num_matches == 0)
+        error_strm.Printf("Source information for file address 0x%" PRIx64
+                          " not found in any modules.\n",
+                          addr);
+    } else {
+      // The target has some things loaded, resolve this address to a
+      // compile unit + file + line and display
+      if (target->GetSectionLoadList().ResolveLoadAddress(addr, so_addr)) {
+        ModuleSP module_sp(so_addr.GetModule());
+        // Check to make sure this module is in our list.
+        if (module_sp &&
+            module_list.GetIndexForModule(module_sp.get()) !=
+                LLDB_INVALID_INDEX32) {
+          SymbolContext sc;
+          sc.Clear(true);
+          if (module_sp->ResolveSymbolContextForAddress(
+                  so_addr, eSymbolContextEverything, sc) &
+              eSymbolContextLineEntry) {
+            sc_list.AppendIfUnique(sc, /*merge_symbol_into_function=*/false);
+            ++num_matches;
+          } else {
+            StreamString addr_strm;
+            so_addr.Dump(&addr_strm, nullptr,
+                         Address::DumpStyleModuleWithFileAddress);
+            error_strm.Printf(
+                "Address 0x%" PRIx64 " resolves to %s, but there is"
+                " no source information available for this address.\n",
+                addr, addr_strm.GetData());
+          }
+        } else {
+          StreamString addr_strm;
+          so_addr.Dump(&addr_strm, nullptr,
+                       Address::DumpStyleModuleWithFileAddress);
+          error_strm.Printf("Address 0x%" PRIx64
+                            " resolves to %s, but it cannot"
+                            " be found in any modules.\n",
+                            addr, addr_strm.GetData());
         }
-        return num_matches;
+      } else
+        error_strm.Printf("Unable to resolve address 0x%" PRIx64 ".\n", addr);
     }
-    
-    // Given an address and a list of modules, append the symbol contexts of all line entries
-    // containing the address found in the modules and return the count of matches.  If none
-    // is found, return an error in 'error_strm'.
-    size_t
-    GetSymbolContextsForAddress (const ModuleList &module_list, lldb::addr_t addr,
-                                 SymbolContextList &sc_list, StreamString &error_strm)
-    {
-        Address so_addr;
-        size_t num_matches = 0;
-        assert(module_list.GetSize() > 0);
-        Target *target = m_exe_ctx.GetTargetPtr();
-        if (target->GetSectionLoadList().IsEmpty())
-        {
-            // The target isn't loaded yet, we need to lookup the file address in
-            // all modules.  Note: the module list option does not apply to addresses.
-            const size_t num_modules = module_list.GetSize();
-            for (size_t i = 0; i < num_modules; ++i)
-            {
-                ModuleSP module_sp(module_list.GetModuleAtIndex(i));
-                if (!module_sp)
-                    continue;
-                if (module_sp->ResolveFileAddress(addr, so_addr))
-                {
-                    SymbolContext sc;
-                    sc.Clear(true);
-                    if (module_sp->ResolveSymbolContextForAddress(so_addr, eSymbolContextEverything, sc) &
-                        eSymbolContextLineEntry)
-                    {
-                        sc_list.AppendIfUnique(sc, /*merge_symbol_into_function=*/false);
-                        ++num_matches;
-                    }
-                }
-            }
-            if (num_matches == 0)
-                error_strm.Printf("Source information for file address 0x%" PRIx64
-                                  " not found in any modules.\n", addr);
-        }
-        else
-        {
-            // The target has some things loaded, resolve this address to a
-            // compile unit + file + line and display
-            if (target->GetSectionLoadList().ResolveLoadAddress(addr, so_addr))
-            {
-                ModuleSP module_sp(so_addr.GetModule());
-                // Check to make sure this module is in our list.
-                if (module_sp &&
-                    module_list.GetIndexForModule(module_sp.get()) != LLDB_INVALID_INDEX32)
-                {
-                    SymbolContext sc;
-                    sc.Clear(true);
-                    if (module_sp->ResolveSymbolContextForAddress(so_addr, eSymbolContextEverything, sc) &
-                        eSymbolContextLineEntry)
-                    {
-                        sc_list.AppendIfUnique(sc, /*merge_symbol_into_function=*/false);
-                        ++num_matches;
-                    }
-                    else
-                    {
-                        StreamString addr_strm;
-                        so_addr.Dump(&addr_strm, nullptr, Address::DumpStyleModuleWithFileAddress);
-                        error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but there is"
-                                          " no source information available for this address.\n",
-                                          addr, addr_strm.GetData());
-                    }
-                }
-                else
-                {
-                    StreamString addr_strm;
-                    so_addr.Dump(&addr_strm, nullptr, Address::DumpStyleModuleWithFileAddress);
-                    error_strm.Printf("Address 0x%" PRIx64 " resolves to %s, but it cannot"
-                                      " be found in any modules.\n",
-                                      addr, addr_strm.GetData());
-                }
-            }
-            else
-                error_strm.Printf("Unable to resolve address 0x%" PRIx64 ".\n", addr);
+    return num_matches;
+  }
+
+  // Dump the line entries found in functions matching the name specified in the
+  // option.
+  bool DumpLinesInFunctions(CommandReturnObject &result) {
+    SymbolContextList sc_list_funcs;
+    ConstString name(m_options.symbol_name.c_str());
+    SymbolContextList sc_list_lines;
+    Target *target = m_exe_ctx.GetTargetPtr();
+    uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+
+    // Note: module_list can't be const& because FindFunctionSymbols isn't
+    // const.
+    ModuleList module_list =
+        (m_module_list.GetSize() > 0) ? m_module_list : target->GetImages();
+    size_t num_matches =
+        module_list.FindFunctions(name, eFunctionNameTypeAuto,
+                                  /*include_symbols=*/false,
+                                  /*include_inlines=*/true,
+                                  /*append=*/true, sc_list_funcs);
+    if (!num_matches) {
+      // If we didn't find any functions with that name, try searching for
+      // symbols that line up exactly with function addresses.
+      SymbolContextList sc_list_symbols;
+      size_t num_symbol_matches = module_list.FindFunctionSymbols(
+          name, eFunctionNameTypeAuto, sc_list_symbols);
+      for (size_t i = 0; i < num_symbol_matches; i++) {
+        SymbolContext sc;
+        sc_list_symbols.GetContextAtIndex(i, sc);
+        if (sc.symbol && sc.symbol->ValueIsAddress()) {
+          const Address &base_address = sc.symbol->GetAddressRef();
+          Function *function = base_address.CalculateSymbolContextFunction();
+          if (function) {
+            sc_list_funcs.Append(SymbolContext(function));
+            num_matches++;
+          }
         }
-        return num_matches;
+      }
+    }
+    if (num_matches == 0) {
+      result.AppendErrorWithFormat("Could not find function named \'%s\'.\n",
+                                   m_options.symbol_name.c_str());
+      return false;
+    }
+    for (size_t i = 0; i < num_matches; i++) {
+      SymbolContext sc;
+      sc_list_funcs.GetContextAtIndex(i, sc);
+      bool context_found_for_symbol = false;
+      // Loop through all the ranges in the function.
+      AddressRange range;
+      for (uint32_t r = 0;
+           sc.GetAddressRange(eSymbolContextEverything, r,
+                              /*use_inline_block_range=*/true, range);
+           ++r) {
+        // Append the symbol contexts for each address in the range to
+        // sc_list_lines.
+        const Address &base_address = range.GetBaseAddress();
+        const addr_t size = range.GetByteSize();
+        lldb::addr_t start_addr = base_address.GetLoadAddress(target);
+        if (start_addr == LLDB_INVALID_ADDRESS)
+          start_addr = base_address.GetFileAddress();
+        lldb::addr_t end_addr = start_addr + size;
+        for (lldb::addr_t addr = start_addr; addr < end_addr;
+             addr += addr_byte_size) {
+          StreamString error_strm;
+          if (!GetSymbolContextsForAddress(module_list, addr, sc_list_lines,
+                                           error_strm))
+            result.AppendWarningWithFormat("in symbol '%s': %s",
+                                           sc.GetFunctionName().AsCString(),
+                                           error_strm.GetData());
+          else
+            context_found_for_symbol = true;
+        }
+      }
+      if (!context_found_for_symbol)
+        result.AppendWarningWithFormat("Unable to find line information"
+                                       " for matching symbol '%s'.\n",
+                                       sc.GetFunctionName().AsCString());
     }
+    if (sc_list_lines.GetSize() == 0) {
+      result.AppendErrorWithFormat("No line information could be found"
+                                   " for any symbols matching '%s'.\n",
+                                   name.AsCString());
+      return false;
+    }
+    FileSpec file_spec;
+    if (!DumpLinesInSymbolContexts(result.GetOutputStream(), sc_list_lines,
+                                   module_list, file_spec)) {
+      result.AppendErrorWithFormat(
+          "Unable to dump line information for symbol '%s'.\n",
+          name.AsCString());
+      return false;
+    }
+    return true;
+  }
 
-    // Dump the line entries found in functions matching the name specified in the option. 
-    bool
-    DumpLinesInFunctions (CommandReturnObject &result)
-    {
-        SymbolContextList sc_list_funcs;
-        ConstString name(m_options.symbol_name.c_str());
-        SymbolContextList sc_list_lines;
-        Target *target = m_exe_ctx.GetTargetPtr();
-        uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
-
-        // Note: module_list can't be const& because FindFunctionSymbols isn't const.
-        ModuleList module_list = (m_module_list.GetSize() > 0) ?
-                                 m_module_list : target->GetImages();
-        size_t num_matches = module_list.FindFunctions(name,
-                                                       eFunctionNameTypeAuto,
-                                                       /*include_symbols=*/false,
-                                                       /*include_inlines=*/true,
-                                                       /*append=*/true,
-                                                       sc_list_funcs);
-        if (!num_matches)
-        {
-            // If we didn't find any functions with that name, try searching for
-            // symbols that line up exactly with function addresses.
-            SymbolContextList sc_list_symbols;
-            size_t num_symbol_matches = module_list.FindFunctionSymbols(name,
-                                                                        eFunctionNameTypeAuto,
-                                                                        sc_list_symbols);
-            for (size_t i = 0; i < num_symbol_matches; i++)
-            {
-                SymbolContext sc;
-                sc_list_symbols.GetContextAtIndex(i, sc);
-                if (sc.symbol && sc.symbol->ValueIsAddress())
-                {
-                    const Address &base_address = sc.symbol->GetAddressRef();
-                    Function *function = base_address.CalculateSymbolContextFunction();
-                    if (function)
-                    {
-                        sc_list_funcs.Append(SymbolContext(function));
-                        num_matches++;
-                    }
-                }
-            }
-        }
-        if (num_matches == 0)
-        {
-            result.AppendErrorWithFormat("Could not find function named \'%s\'.\n",
-                                         m_options.symbol_name.c_str());
-            return false;
-        }
-        for (size_t i = 0; i < num_matches; i++)
-        {
-            SymbolContext sc;
-            sc_list_funcs.GetContextAtIndex(i, sc);
-            bool context_found_for_symbol = false;
-            // Loop through all the ranges in the function.
-            AddressRange range;
-            for (uint32_t r = 0;
-                 sc.GetAddressRange(eSymbolContextEverything,
-                                    r,
-                                    /*use_inline_block_range=*/true,
-                                    range);
-                 ++r)
-            {
-                // Append the symbol contexts for each address in the range to sc_list_lines.
-                const Address &base_address = range.GetBaseAddress();
-                const addr_t size = range.GetByteSize();
-                lldb::addr_t start_addr = base_address.GetLoadAddress(target);
-                if (start_addr == LLDB_INVALID_ADDRESS)
-                    start_addr = base_address.GetFileAddress();
-                lldb::addr_t end_addr = start_addr + size;
-                for (lldb::addr_t addr = start_addr; addr < end_addr; addr += addr_byte_size)
-                {
-                    StreamString error_strm;
-                    if (!GetSymbolContextsForAddress(module_list, addr, sc_list_lines, error_strm))
-                        result.AppendWarningWithFormat("in symbol '%s': %s",
-                                                       sc.GetFunctionName().AsCString(),
-                                                       error_strm.GetData());
-                    else
-                        context_found_for_symbol = true;
-                }
-            }
-            if (!context_found_for_symbol)
-                result.AppendWarningWithFormat("Unable to find line information"
-                                               " for matching symbol '%s'.\n",
-                                               sc.GetFunctionName().AsCString());
-        }
-        if (sc_list_lines.GetSize() == 0)
-        {
-            result.AppendErrorWithFormat("No line information could be found"
-                                         " for any symbols matching '%s'.\n",
-                                         name.AsCString());
-            return false;
-        }
-        FileSpec file_spec;
-        if (!DumpLinesInSymbolContexts(result.GetOutputStream(),
-                                       sc_list_lines, module_list, file_spec))
-        {
-            result.AppendErrorWithFormat("Unable to dump line information for symbol '%s'.\n",
-                                         name.AsCString());
-            return false;
-        }
-        return true;
+  // Dump the line entries found for the address specified in the option.
+  bool DumpLinesForAddress(CommandReturnObject &result) {
+    Target *target = m_exe_ctx.GetTargetPtr();
+    SymbolContextList sc_list;
+
+    StreamString error_strm;
+    if (!GetSymbolContextsForAddress(target->GetImages(), m_options.address,
+                                     sc_list, error_strm)) {
+      result.AppendErrorWithFormat("%s.\n", error_strm.GetData());
+      return false;
     }
+    ModuleList module_list;
+    FileSpec file_spec;
+    if (!DumpLinesInSymbolContexts(result.GetOutputStream(), sc_list,
+                                   module_list, file_spec)) {
+      result.AppendErrorWithFormat("No modules contain load address 0x%" PRIx64
+                                   ".\n",
+                                   m_options.address);
+      return false;
+    }
+    return true;
+  }
 
-    // Dump the line entries found for the address specified in the option. 
-    bool
-    DumpLinesForAddress (CommandReturnObject &result)
-    {
-        Target *target = m_exe_ctx.GetTargetPtr();
-        SymbolContextList sc_list;
-
-        StreamString error_strm;
-        if (!GetSymbolContextsForAddress(target->GetImages(), m_options.address, sc_list, error_strm))
-        {
-            result.AppendErrorWithFormat("%s.\n", error_strm.GetData());
-            return false;
-        }
-        ModuleList module_list;
-        FileSpec file_spec;
-        if (!DumpLinesInSymbolContexts(result.GetOutputStream(),
-                                       sc_list, module_list, file_spec))
-        {
-            result.AppendErrorWithFormat("No modules contain load address 0x%" PRIx64 ".\n",
-                                         m_options.address);
-            return false;
-        }
-        return true;
+  // Dump the line entries found in the file specified in the option.
+  bool DumpLinesForFile(CommandReturnObject &result) {
+    FileSpec file_spec(m_options.file_name, false);
+    const char *filename = m_options.file_name.c_str();
+    Target *target = m_exe_ctx.GetTargetPtr();
+    const ModuleList &module_list =
+        (m_module_list.GetSize() > 0) ? m_module_list : target->GetImages();
+
+    bool displayed_something = false;
+    const size_t num_modules = module_list.GetSize();
+    for (uint32_t i = 0; i < num_modules; ++i) {
+      // Dump lines for this module.
+      Module *module = module_list.GetModulePointerAtIndex(i);
+      assert(module);
+      if (DumpFileLinesInModule(result.GetOutputStream(), module, file_spec))
+        displayed_something = true;
     }
+    if (!displayed_something) {
+      result.AppendErrorWithFormat("No source filenames matched '%s'.\n",
+                                   filename);
+      return false;
+    }
+    return true;
+  }
 
-    // Dump the line entries found in the file specified in the option. 
-    bool
-    DumpLinesForFile (CommandReturnObject &result)
-    {
-        FileSpec file_spec(m_options.file_name, false);
-        const char *filename = m_options.file_name.c_str();
-        Target *target = m_exe_ctx.GetTargetPtr();
-        const ModuleList &module_list = (m_module_list.GetSize() > 0) ?
-                                        m_module_list : target->GetImages();
+  // Dump the line entries for the current frame.
+  bool DumpLinesForFrame(CommandReturnObject &result) {
+    StackFrame *cur_frame = m_exe_ctx.GetFramePtr();
+    if (cur_frame == nullptr) {
+      result.AppendError(
+          "No selected frame to use to find the default source.");
+      return false;
+    } else if (!cur_frame->HasDebugInformation()) {
+      result.AppendError("No debug info for the selected frame.");
+      return false;
+    } else {
+      const SymbolContext &sc =
+          cur_frame->GetSymbolContext(eSymbolContextLineEntry);
+      SymbolContextList sc_list;
+      sc_list.Append(sc);
+      ModuleList module_list;
+      FileSpec file_spec;
+      if (!DumpLinesInSymbolContexts(result.GetOutputStream(), sc_list,
+                                     module_list, file_spec)) {
+        result.AppendError(
+            "No source line info available for the selected frame.");
+        return false;
+      }
+    }
+    return true;
+  }
 
-        bool displayed_something = false;
-        const size_t num_modules = module_list.GetSize();
-        for (uint32_t i = 0; i < num_modules; ++i)
-        {
-            // Dump lines for this module.
-            Module *module = module_list.GetModulePointerAtIndex(i);
-            assert(module);
-            if (DumpFileLinesInModule(result.GetOutputStream(), module, file_spec))
-                displayed_something = true;
-        }
-        if (!displayed_something)
-        {
-            result.AppendErrorWithFormat("No source filenames matched '%s'.\n", filename);
-            return false;
-        }
-        return true;
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    const size_t argc = command.GetArgumentCount();
+
+    if (argc != 0) {
+      result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n",
+                                   GetCommandName());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
     }
 
-    // Dump the line entries for the current frame.
-    bool
-    DumpLinesForFrame (CommandReturnObject &result)
-    {
-        StackFrame *cur_frame = m_exe_ctx.GetFramePtr();
-        if (cur_frame == nullptr)
-        {
-            result.AppendError("No selected frame to use to find the default source.");
-            return false;
-        }
-        else if (!cur_frame->HasDebugInformation())
-        {
-            result.AppendError("No debug info for the selected frame.");
-            return false;
-        }
-        else
-        {
-            const SymbolContext &sc = cur_frame->GetSymbolContext(eSymbolContextLineEntry);
-            SymbolContextList sc_list;
-            sc_list.Append(sc);
-            ModuleList module_list;
-            FileSpec file_spec;
-            if (!DumpLinesInSymbolContexts(result.GetOutputStream(), sc_list, module_list, file_spec))
-            {
-                result.AppendError("No source line info available for the selected frame.");
-                return false;
-            }
-        }
-        return true;
+    Target *target = m_exe_ctx.GetTargetPtr();
+    if (target == nullptr) {
+      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
-    DoExecute (Args &command, CommandReturnObject &result) override
-    {
-        const size_t argc = command.GetArgumentCount();
-
-        if (argc != 0)
-        {
-            result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n",
-                                         GetCommandName());
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-
-        Target *target = m_exe_ctx.GetTargetPtr();
-        if (target == nullptr)
-        {
-            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;
-            }
-        }
+    uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
+    result.GetOutputStream().SetAddressByteSize(addr_byte_size);
+    result.GetErrorStream().SetAddressByteSize(addr_byte_size);
+
+    // Collect the list of modules to search.
+    m_module_list.Clear();
+    if (!m_options.modules.empty()) {
+      for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) {
+        FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+        if (module_file_spec) {
+          ModuleSpec module_spec(module_file_spec);
+          if (target->GetImages().FindModules(module_spec, m_module_list) == 0)
+            result.AppendWarningWithFormat("No module found for '%s'.\n",
+                                           m_options.modules[i].c_str());
+        }
+      }
+      if (!m_module_list.GetSize()) {
+        result.AppendError("No modules match the input.");
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+    } else if (target->GetImages().GetSize() == 0) {
+      result.AppendError("The target has no associated executable images.");
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
 
-        uint32_t addr_byte_size = target->GetArchitecture().GetAddressByteSize();
-        result.GetOutputStream().SetAddressByteSize(addr_byte_size);
-        result.GetErrorStream().SetAddressByteSize(addr_byte_size);
-
-        // Collect the list of modules to search.
-        m_module_list.Clear();
-        if (!m_options.modules.empty())
-        {
-            for (size_t i = 0, e = m_options.modules.size(); i < e; ++i)
-            {
-                FileSpec module_file_spec(m_options.modules[i].c_str(), false);
-                if (module_file_spec)
-                {
-                    ModuleSpec module_spec(module_file_spec);
-                    if (target->GetImages().FindModules(module_spec, m_module_list) == 0)
-                        result.AppendWarningWithFormat("No module found for '%s'.\n",
-                                                       m_options.modules[i].c_str());
-                }
-            }
-            if (!m_module_list.GetSize())
-            {
-                result.AppendError("No modules match the input.");
-                result.SetStatus(eReturnStatusFailed);
-                return false;
-            }
-        }
-        else if (target->GetImages().GetSize() == 0)
-        {
-            result.AppendError("The target has no associated executable images.");
-            result.SetStatus(eReturnStatusFailed);
-            return false;
-        }
-
-        // Check the arguments to see what lines we should dump.
-        if (!m_options.symbol_name.empty())
-        {
-            // Print lines for symbol.
-            if (DumpLinesInFunctions(result))
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            else
-                result.SetStatus(eReturnStatusFailed);
-        }
-        else if (m_options.address != LLDB_INVALID_ADDRESS)
-        {
-            // Print lines for an address.
-            if (DumpLinesForAddress(result))
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            else
-                result.SetStatus(eReturnStatusFailed);
-        }
-        else if (!m_options.file_name.empty())
-        {
-            // Dump lines for a file.
-            if (DumpLinesForFile(result))
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            else
-                result.SetStatus(eReturnStatusFailed);
-        }
-        else
-        {
-            // Dump the line for the current frame.
-            if (DumpLinesForFrame(result))
-                result.SetStatus(eReturnStatusSuccessFinishResult);
-            else
-                result.SetStatus(eReturnStatusFailed);
-        }
-        return result.Succeeded();
+    // Check the arguments to see what lines we should dump.
+    if (!m_options.symbol_name.empty()) {
+      // Print lines for symbol.
+      if (DumpLinesInFunctions(result))
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      else
+        result.SetStatus(eReturnStatusFailed);
+    } else if (m_options.address != LLDB_INVALID_ADDRESS) {
+      // Print lines for an address.
+      if (DumpLinesForAddress(result))
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      else
+        result.SetStatus(eReturnStatusFailed);
+    } else if (!m_options.file_name.empty()) {
+      // Dump lines for a file.
+      if (DumpLinesForFile(result))
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      else
+        result.SetStatus(eReturnStatusFailed);
+    } else {
+      // Dump the line for the current frame.
+      if (DumpLinesForFrame(result))
+        result.SetStatus(eReturnStatusSuccessFinishResult);
+      else
+        result.SetStatus(eReturnStatusFailed);
     }
+    return result.Succeeded();
+  }
 
-    CommandOptions m_options;
-    ModuleList m_module_list;
+  CommandOptions m_options;
+  ModuleList m_module_list;
 };
 
 OptionDefinition CommandObjectSourceInfo::CommandOptions::g_option_table[] = {
-  // clang-format off
+    // clang-format off
   {LLDB_OPT_SET_ALL,                false, "count",    'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                         eArgTypeCount,               "The number of line entries to display."},
   {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib",    's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion,     eArgTypeShlibName,           "Look up the source in the given module or shared library (can be specified more than once)."},
   {LLDB_OPT_SET_1,                  false, "file",     'f', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSourceFileCompletion, eArgTypeFilename,            "The file from which to display source."},
@@ -710,7 +659,7 @@ OptionDefinition CommandObjectSourceInfo
   {LLDB_OPT_SET_2,                  false, "name",     'n', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eSymbolCompletion,     eArgTypeSymbol,              "The name of a function whose source to display."},
   {LLDB_OPT_SET_3,                  false, "address",  'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                         eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
 #pragma mark CommandObjectSourceList
@@ -718,748 +667,638 @@ OptionDefinition CommandObjectSourceInfo
 // CommandObjectSourceList
 //-------------------------------------------------------------------------
 
-class CommandObjectSourceList : public CommandObjectParsed
-{
-    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 = g_option_table[option_idx].short_option;
-            switch (short_option)
-            {
-            case 'l':
-                start_line = StringConvert::ToUInt32 (option_arg, 0);
-                if (start_line == 0)
-                    error.SetErrorStringWithFormat("invalid line number: '%s'", option_arg);
-                break;
-
-            case 'c':
-                num_lines = StringConvert::ToUInt32 (option_arg, 0);
-                if (num_lines == 0)
-                    error.SetErrorStringWithFormat("invalid line count: '%s'", option_arg);
-                break;
-
-            case 'f':
-                file_name = option_arg;
-                break;
-                
-            case 'n':
-                symbol_name = option_arg;
-                break;
-
-            case 'a':
-                {
-                    address = Args::StringToAddress(execution_context,
-                                                    option_arg,
-                                                    LLDB_INVALID_ADDRESS,
-                                                    &error);
-                }
-                break;
-            case 's':
-                modules.push_back (std::string (option_arg));
-                break;
-            
-            case 'b':
-                show_bp_locs = true;
-                break;
-            case 'r':
-                reverse = true;
-                break;
-           default:
-                error.SetErrorStringWithFormat("unrecognized short option '%c'", short_option);
-                break;
-            }
+class CommandObjectSourceList : public CommandObjectParsed {
+  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 = g_option_table[option_idx].short_option;
+      switch (short_option) {
+      case 'l':
+        start_line = StringConvert::ToUInt32(option_arg, 0);
+        if (start_line == 0)
+          error.SetErrorStringWithFormat("invalid line number: '%s'",
+                                         option_arg);
+        break;
+
+      case 'c':
+        num_lines = StringConvert::ToUInt32(option_arg, 0);
+        if (num_lines == 0)
+          error.SetErrorStringWithFormat("invalid line count: '%s'",
+                                         option_arg);
+        break;
+
+      case 'f':
+        file_name = option_arg;
+        break;
+
+      case 'n':
+        symbol_name = option_arg;
+        break;
+
+      case 'a': {
+        address = Args::StringToAddress(execution_context, option_arg,
+                                        LLDB_INVALID_ADDRESS, &error);
+      } break;
+      case 's':
+        modules.push_back(std::string(option_arg));
+        break;
+
+      case 'b':
+        show_bp_locs = true;
+        break;
+      case 'r':
+        reverse = true;
+        break;
+      default:
+        error.SetErrorStringWithFormat("unrecognized short option '%c'",
+                                       short_option);
+        break;
+      }
 
-            return error;
-        }
+      return error;
+    }
+
+    void OptionParsingStarting(ExecutionContext *execution_context) override {
+      file_spec.Clear();
+      file_name.clear();
+      symbol_name.clear();
+      address = LLDB_INVALID_ADDRESS;
+      start_line = 0;
+      num_lines = 0;
+      show_bp_locs = false;
+      reverse = false;
+      modules.clear();
+    }
+
+    const OptionDefinition *GetDefinitions() override { return g_option_table; }
 
-        void
-        OptionParsingStarting(ExecutionContext *execution_context) override
-        {
-            file_spec.Clear();
-            file_name.clear();
-            symbol_name.clear();
-            address = LLDB_INVALID_ADDRESS;
-            start_line = 0;
-            num_lines = 0;
-            show_bp_locs = false;
-            reverse = false;
-            modules.clear();
-        }
-
-        const OptionDefinition*
-        GetDefinitions () override
-        {
-            return g_option_table;
-        }
-
-        static OptionDefinition g_option_table[];
-
-        // Instance variables to hold the values for command options.
-        FileSpec file_spec;
-        std::string file_name;
-        std::string symbol_name;
-        lldb::addr_t address;
-        uint32_t start_line;
-        uint32_t num_lines;
-        STLStringArray modules;        
-        bool show_bp_locs;
-        bool reverse;
-    };
+    static OptionDefinition g_option_table[];
+
+    // Instance variables to hold the values for command options.
+    FileSpec file_spec;
+    std::string file_name;
+    std::string symbol_name;
+    lldb::addr_t address;
+    uint32_t start_line;
+    uint32_t num_lines;
+    STLStringArray modules;
+    bool show_bp_locs;
+    bool reverse;
+  };
 
 public:
-    CommandObjectSourceList(CommandInterpreter &interpreter)
-        : CommandObjectParsed(interpreter, "source list",
-                              "Display source code for the current target process as specified by options.", nullptr,
-                              eCommandRequiresTarget),
-          m_options()
-    {
-    }
-
-    ~CommandObjectSourceList() override = default;
-
-    Options *
-    GetOptions () override
-    {
-        return &m_options;
-    }
-
-    const char *
-    GetRepeatCommand (Args &current_command_args, uint32_t index) override
-    {
-        // This is kind of gross, but the command hasn't been parsed yet so we can't look at the option
-        // values for this invocation...  I have to scan the arguments directly.
-        size_t num_args = current_command_args.GetArgumentCount();
-        bool is_reverse = false;
-        for (size_t i = 0; i < num_args; i++)
-        {
-            const char *arg = current_command_args.GetArgumentAtIndex(i);
-            if (arg && (strcmp(arg, "-r") == 0 || strcmp(arg, "--reverse") == 0))
-            {
-                is_reverse = true;
-            }
-        }
-        if (is_reverse)
-        {
-            if (m_reverse_name.empty())
-            {
-                m_reverse_name = m_cmd_name;
-                m_reverse_name.append (" -r");
-            }
-            return m_reverse_name.c_str();
-        }
-        else
-            return m_cmd_name.c_str();
+  CommandObjectSourceList(CommandInterpreter &interpreter)
+      : CommandObjectParsed(interpreter, "source list",
+                            "Display source code for the current target "
+                            "process as specified by options.",
+                            nullptr, eCommandRequiresTarget),
+        m_options() {}
+
+  ~CommandObjectSourceList() override = default;
+
+  Options *GetOptions() override { return &m_options; }
+
+  const char *GetRepeatCommand(Args &current_command_args,
+                               uint32_t index) override {
+    // This is kind of gross, but the command hasn't been parsed yet so we can't
+    // look at the option
+    // values for this invocation...  I have to scan the arguments directly.
+    size_t num_args = current_command_args.GetArgumentCount();
+    bool is_reverse = false;
+    for (size_t i = 0; i < num_args; i++) {
+      const char *arg = current_command_args.GetArgumentAtIndex(i);
+      if (arg && (strcmp(arg, "-r") == 0 || strcmp(arg, "--reverse") == 0)) {
+        is_reverse = true;
+      }
     }
+    if (is_reverse) {
+      if (m_reverse_name.empty()) {
+        m_reverse_name = m_cmd_name;
+        m_reverse_name.append(" -r");
+      }
+      return m_reverse_name.c_str();
+    } else
+      return m_cmd_name.c_str();
+  }
 
 protected:
-    struct SourceInfo
-    {
-        ConstString function;
-        LineEntry line_entry;
-        
-        SourceInfo (const ConstString &name, const LineEntry &line_entry) :
-            function(name),
-            line_entry(line_entry)
-        {
-        }
-        
-        SourceInfo () :
-            function(),
-            line_entry()
-        {
-        }
-        
-        bool
-        IsValid () const
-        {
-            return (bool)function && line_entry.IsValid();
-        }
-        
-        bool
-        operator == (const SourceInfo &rhs) const
-        {
-            return function == rhs.function &&
-            line_entry.original_file == rhs.line_entry.original_file &&
-            line_entry.line == rhs.line_entry.line;
-        }
-        
-        bool
-        operator != (const SourceInfo &rhs) const
-        {
-            return function != rhs.function ||
-            line_entry.original_file != rhs.line_entry.original_file ||
-            line_entry.line != rhs.line_entry.line;
-        }
-        
-        bool
-        operator < (const SourceInfo &rhs) const
-        {
-            if (function.GetCString() < rhs.function.GetCString())
-                return true;
-            if (line_entry.file.GetDirectory().GetCString() < rhs.line_entry.file.GetDirectory().GetCString())
-                return true;
-            if (line_entry.file.GetFilename().GetCString() < rhs.line_entry.file.GetFilename().GetCString())
-                return true;
-            if (line_entry.line < rhs.line_entry.line)
-                return true;
-            return false;
-        }
-    };
-
-    size_t
-    DisplayFunctionSource (const SymbolContext &sc,
-                           SourceInfo &source_info,
-                           CommandReturnObject &result)
-    {
-        if (!source_info.IsValid())
-        {
-            source_info.function = sc.GetFunctionName();
-            source_info.line_entry = sc.GetFunctionStartLineEntry();
-        }
-    
-        if (sc.function)
-        {
-            Target *target = m_exe_ctx.GetTargetPtr();
-
-            FileSpec start_file;
-            uint32_t start_line;
-            uint32_t end_line;
-            FileSpec end_file;
-            
-            if (sc.block == nullptr)
-            {
-                // Not an inlined function
-                sc.function->GetStartLineSourceInfo (start_file, start_line);
-                if (start_line == 0)
-                {
-                    result.AppendErrorWithFormat("Could not find line information for start of function: \"%s\".\n", source_info.function.GetCString());
-                    result.SetStatus (eReturnStatusFailed);
-                    return 0;
-                }
-                sc.function->GetEndLineSourceInfo (end_file, end_line);
-            }
-            else
-            {
-                // We have an inlined function
-                start_file = source_info.line_entry.file;
-                start_line = source_info.line_entry.line;
-                end_line = start_line + m_options.num_lines;
-            }
+  struct SourceInfo {
+    ConstString function;
+    LineEntry line_entry;
 
-            // This is a little hacky, but the first line table entry for a function points to the "{" that
-            // starts the function block.  It would be nice to actually get the function
-            // declaration in there too.  So back up a bit, but not further than what you're going to display.
-            uint32_t extra_lines;
-            if (m_options.num_lines >= 10)
-                extra_lines = 5;
-            else
-                extra_lines = m_options.num_lines/2;
-            uint32_t line_no;
-            if (start_line <= extra_lines)
-                line_no = 1;
-            else
-                line_no = start_line - extra_lines;
-            
-            // For fun, if the function is shorter than the number of lines we're supposed to display,
-            // only display the function...
-            if (end_line != 0)
-            {
-                if (m_options.num_lines > end_line - line_no)
-                    m_options.num_lines = end_line - line_no + extra_lines;
-            }
-            
-            m_breakpoint_locations.Clear();
+    SourceInfo(const ConstString &name, const LineEntry &line_entry)
+        : function(name), line_entry(line_entry) {}
 
-            if (m_options.show_bp_locs)
-            {
-                const bool show_inlines = true;
-                m_breakpoint_locations.Reset (start_file, 0, show_inlines);
-                SearchFilterForUnconstrainedSearches target_search_filter (m_exe_ctx.GetTargetSP());
-                target_search_filter.Search (m_breakpoint_locations);
-            }
-            
-            result.AppendMessageWithFormat("File: %s\n", start_file.GetPath().c_str());
-            return target->GetSourceManager().DisplaySourceLinesWithLineNumbers (start_file,
-                                                                                 line_no,
-                                                                                 0,
-                                                                                 m_options.num_lines,
-                                                                                 "",
-                                                                                 &result.GetOutputStream(),
-                                                                                 GetBreakpointLocations ());
-        }
-        else
-        {
-            result.AppendErrorWithFormat("Could not find function info for: \"%s\".\n", m_options.symbol_name.c_str());
-        }
-        return 0;
+    SourceInfo() : function(), line_entry() {}
+
+    bool IsValid() const { return (bool)function && line_entry.IsValid(); }
+
+    bool operator==(const SourceInfo &rhs) const {
+      return function == rhs.function &&
+             line_entry.original_file == rhs.line_entry.original_file &&
+             line_entry.line == rhs.line_entry.line;
     }
 
-    // From Jim: The FindMatchingFunctions / FindMatchingFunctionSymbols functions 
-    // "take a possibly empty vector of strings which are names of modules, and
-    // run the two search functions on the subset of the full module list that
-    // matches the strings in the input vector". If we wanted to put these somewhere,
-    // there should probably be a module-filter-list that can be passed to the
-    // various ModuleList::Find* calls, which would either be a vector of string
-    // names or a ModuleSpecList.
-    size_t FindMatchingFunctions (Target *target, const ConstString &name, SymbolContextList& sc_list)
-    {
-        // Displaying the source for a symbol:
-        bool include_inlines = true;
-        bool append = true;
-        bool include_symbols = false;
-        size_t num_matches = 0;
-        
-        if (m_options.num_lines == 0)
-            m_options.num_lines = 10;
+    bool operator!=(const SourceInfo &rhs) const {
+      return function != rhs.function ||
+             line_entry.original_file != rhs.line_entry.original_file ||
+             line_entry.line != rhs.line_entry.line;
+    }
 
-        const size_t num_modules = m_options.modules.size();
-        if (num_modules > 0)
-        {
-            ModuleList matching_modules;
-            for (size_t i = 0; i < num_modules; ++i)
-            {
-                FileSpec module_file_spec(m_options.modules[i].c_str(), false);
-                if (module_file_spec)
-                {
-                    ModuleSpec module_spec (module_file_spec);
-                    matching_modules.Clear();
-                    target->GetImages().FindModules (module_spec, matching_modules);
-                    num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-                }
-            }
-        }
-        else
-        {
-            num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
-        }
-        return num_matches;
+    bool operator<(const SourceInfo &rhs) const {
+      if (function.GetCString() < rhs.function.GetCString())
+        return true;
+      if (line_entry.file.GetDirectory().GetCString() <
+          rhs.line_entry.file.GetDirectory().GetCString())
+        return true;
+      if (line_entry.file.GetFilename().GetCString() <
+          rhs.line_entry.file.GetFilename().GetCString())
+        return true;
+      if (line_entry.line < rhs.line_entry.line)
+        return true;
+      return false;
     }
+  };
 
-    size_t FindMatchingFunctionSymbols (Target *target, const ConstString &name, SymbolContextList& sc_list)
-    {
-        size_t num_matches = 0;
-        const size_t num_modules = m_options.modules.size();
-        if (num_modules > 0)
-        {
-            ModuleList matching_modules;
-            for (size_t i = 0; i < num_modules; ++i)
-            {
-                FileSpec module_file_spec(m_options.modules[i].c_str(), false);
-                if (module_file_spec)
-                {
-                    ModuleSpec module_spec (module_file_spec);
-                    matching_modules.Clear();
-                    target->GetImages().FindModules (module_spec, matching_modules);
-                    num_matches += matching_modules.FindFunctionSymbols (name, eFunctionNameTypeAuto, sc_list);
-                }
-            }
-        }
-        else
-        {
-            num_matches = target->GetImages().FindFunctionSymbols (name, eFunctionNameTypeAuto, sc_list);
-        }
-        return num_matches;
+  size_t DisplayFunctionSource(const SymbolContext &sc, SourceInfo &source_info,
+                               CommandReturnObject &result) {
+    if (!source_info.IsValid()) {
+      source_info.function = sc.GetFunctionName();
+      source_info.line_entry = sc.GetFunctionStartLineEntry();
     }
 
-    bool
-    DoExecute (Args& command, CommandReturnObject &result) override
-    {
-        const size_t argc = command.GetArgumentCount();
-
-        if (argc != 0)
-        {
-            result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n", GetCommandName());
-            result.SetStatus (eReturnStatusFailed);
-            return false;
-        }
-
-        Target *target = m_exe_ctx.GetTargetPtr();
-
-        if (!m_options.symbol_name.empty())
-        {
-            SymbolContextList sc_list;
-            ConstString name(m_options.symbol_name.c_str());
-
-            // Displaying the source for a symbol. Search for function named name.
-            size_t num_matches = FindMatchingFunctions (target, name, sc_list);
-            if (!num_matches)
-            {
-                // If we didn't find any functions with that name, try searching for symbols
-                // that line up exactly with function addresses.
-                SymbolContextList sc_list_symbols;
-                size_t num_symbol_matches = FindMatchingFunctionSymbols (target, name, sc_list_symbols);
-                for (size_t i = 0; i < num_symbol_matches; i++)
-                {
-                    SymbolContext sc;
-                    sc_list_symbols.GetContextAtIndex (i, sc);
-                    if (sc.symbol && sc.symbol->ValueIsAddress())
-                    {
-                        const Address &base_address = sc.symbol->GetAddressRef();
-                        Function *function = base_address.CalculateSymbolContextFunction();
-                        if (function)
-                        {
-                            sc_list.Append (SymbolContext(function));
-                            num_matches++;
-                            break;
-                        }
-                    }
-                }
-            }
+    if (sc.function) {
+      Target *target = m_exe_ctx.GetTargetPtr();
 
-            if (num_matches == 0)
-            {
-                result.AppendErrorWithFormat("Could not find function named: \"%s\".\n", m_options.symbol_name.c_str());
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
+      FileSpec start_file;
+      uint32_t start_line;
+      uint32_t end_line;
+      FileSpec end_file;
+
+      if (sc.block == nullptr) {
+        // Not an inlined function
+        sc.function->GetStartLineSourceInfo(start_file, start_line);
+        if (start_line == 0) {
+          result.AppendErrorWithFormat("Could not find line information for "
+                                       "start of function: \"%s\".\n",
+                                       source_info.function.GetCString());
+          result.SetStatus(eReturnStatusFailed);
+          return 0;
+        }
+        sc.function->GetEndLineSourceInfo(end_file, end_line);
+      } else {
+        // We have an inlined function
+        start_file = source_info.line_entry.file;
+        start_line = source_info.line_entry.line;
+        end_line = start_line + m_options.num_lines;
+      }
+
+      // This is a little hacky, but the first line table entry for a function
+      // points to the "{" that
+      // starts the function block.  It would be nice to actually get the
+      // function
+      // declaration in there too.  So back up a bit, but not further than what
+      // you're going to display.
+      uint32_t extra_lines;
+      if (m_options.num_lines >= 10)
+        extra_lines = 5;
+      else
+        extra_lines = m_options.num_lines / 2;
+      uint32_t line_no;
+      if (start_line <= extra_lines)
+        line_no = 1;
+      else
+        line_no = start_line - extra_lines;
+
+      // For fun, if the function is shorter than the number of lines we're
+      // supposed to display,
+      // only display the function...
+      if (end_line != 0) {
+        if (m_options.num_lines > end_line - line_no)
+          m_options.num_lines = end_line - line_no + extra_lines;
+      }
+
+      m_breakpoint_locations.Clear();
+
+      if (m_options.show_bp_locs) {
+        const bool show_inlines = true;
+        m_breakpoint_locations.Reset(start_file, 0, show_inlines);
+        SearchFilterForUnconstrainedSearches target_search_filter(
+            m_exe_ctx.GetTargetSP());
+        target_search_filter.Search(m_breakpoint_locations);
+      }
+
+      result.AppendMessageWithFormat("File: %s\n",
+                                     start_file.GetPath().c_str());
+      return target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
+          start_file, line_no, 0, m_options.num_lines, "",
+          &result.GetOutputStream(), GetBreakpointLocations());
+    } else {
+      result.AppendErrorWithFormat(
+          "Could not find function info for: \"%s\".\n",
+          m_options.symbol_name.c_str());
+    }
+    return 0;
+  }
 
-            if (num_matches > 1)
-            {
-                std::set<SourceInfo> source_match_set;
-                
-                bool displayed_something = false;
-                for (size_t i = 0; i < num_matches; i++)
-                {
-                    SymbolContext sc;
-                    sc_list.GetContextAtIndex (i, sc);
-                    SourceInfo source_info (sc.GetFunctionName(),
-                                            sc.GetFunctionStartLineEntry());
-                    
-                    if (source_info.IsValid())
-                    {
-                        if (source_match_set.find(source_info) == source_match_set.end())
-                        {
-                            source_match_set.insert(source_info);
-                            if (DisplayFunctionSource (sc, source_info, result))
-                                displayed_something = true;
-                        }
-                    }
-                }
-                
-                if (displayed_something)
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                else
-                    result.SetStatus (eReturnStatusFailed);
-            }
-            else
-            {
-                SymbolContext sc;
-                sc_list.GetContextAtIndex (0, sc);
-                SourceInfo source_info;
-                
-                if (DisplayFunctionSource (sc, source_info, result))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.SetStatus (eReturnStatusFailed);
-                }
-            }
-            return result.Succeeded();
-        }
-        else if (m_options.address != LLDB_INVALID_ADDRESS)
-        {
-            Address so_addr;
-            StreamString error_strm;
-            SymbolContextList sc_list;
-
-            if (target->GetSectionLoadList().IsEmpty())
-            {
-                // The target isn't loaded yet, we need to lookup the file address
-                // in all modules
-                const ModuleList &module_list = target->GetImages();
-                const size_t num_modules = module_list.GetSize();
-                for (size_t i = 0; i < num_modules; ++i)
-                {
-                    ModuleSP module_sp (module_list.GetModuleAtIndex(i));
-                    if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr))
-                    {
-                        SymbolContext sc;
-                        sc.Clear(true);
-                        if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry)
-                            sc_list.Append(sc);
-                    }
-                }
-                
-                if (sc_list.GetSize() == 0)
-                {
-                    result.AppendErrorWithFormat("no modules have source information for file address 0x%" PRIx64 ".\n",
-                                                 m_options.address);
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
-            else
-            {
-                // The target has some things loaded, resolve this address to a
-                // compile unit + file + line and display
-                if (target->GetSectionLoadList().ResolveLoadAddress (m_options.address, so_addr))
-                {
-                    ModuleSP module_sp (so_addr.GetModule());
-                    if (module_sp)
-                    {
-                        SymbolContext sc;
-                        sc.Clear(true);
-                        if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry)
-                        {
-                            sc_list.Append(sc);
-                        }
-                        else
-                        {
-                            so_addr.Dump(&error_strm, nullptr, Address::DumpStyleModuleWithFileAddress);
-                            result.AppendErrorWithFormat("address resolves to %s, but there is no line table information available for this address.\n",
-                                                         error_strm.GetData());
-                            result.SetStatus (eReturnStatusFailed);
-                            return false;
-                        }
-                    }
-                }
-
-                if (sc_list.GetSize() == 0)
-                {
-                    result.AppendErrorWithFormat("no modules contain load address 0x%" PRIx64 ".\n", m_options.address);
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
-            uint32_t num_matches = sc_list.GetSize();
-            for (uint32_t i = 0; i < num_matches; ++i)
-            {
-                SymbolContext sc;
-                sc_list.GetContextAtIndex(i, sc);
-                if (sc.comp_unit)
-                {
-                    if (m_options.show_bp_locs)
-                    {
-                        m_breakpoint_locations.Clear();
-                        const bool show_inlines = true;
-                        m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines);
-                        SearchFilterForUnconstrainedSearches target_search_filter (target->shared_from_this());
-                        target_search_filter.Search (m_breakpoint_locations);
-                    }
-                    
-                    bool show_fullpaths = true;
-                    bool show_module = true;
-                    bool show_inlined_frames = true;
-                    const bool show_function_arguments = true;
-                    const bool show_function_name = true;
-                    sc.DumpStopContext(&result.GetOutputStream(),
-                                       m_exe_ctx.GetBestExecutionContextScope(),
-                                       sc.line_entry.range.GetBaseAddress(),
-                                       show_fullpaths,
-                                       show_module,
-                                       show_inlined_frames,
-                                       show_function_arguments,
-                                       show_function_name);
-                    result.GetOutputStream().EOL();
-
-                    if (m_options.num_lines == 0)
-                        m_options.num_lines = 10;
-                    
-                    size_t lines_to_back_up = m_options.num_lines >= 10 ? 5 : m_options.num_lines/2;
-
-                    target->GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
-                                                                                  sc.line_entry.line,
-                                                                                  lines_to_back_up,
-                                                                                  m_options.num_lines - lines_to_back_up,
-                                                                                  "->",
-                                                                                  &result.GetOutputStream(),
-                                                                                  GetBreakpointLocations ());
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-            }
-        }
-        else if (m_options.file_name.empty())
-        {
-            // Last valid source manager context, or the current frame if no
-            // valid last context in source manager.
-            // One little trick here, if you type the exact same list command twice in a row, it is
-            // more likely because you typed it once, then typed it again
-            if (m_options.start_line == 0)
-            {
-                if (target->GetSourceManager().DisplayMoreWithLineNumbers (&result.GetOutputStream(),
-                                                                           m_options.num_lines,
-                                                                           m_options.reverse,
-                                                                           GetBreakpointLocations ()))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-            }
-            else
-            {
-                if (m_options.num_lines == 0)
-                    m_options.num_lines = 10;
-
-                if (m_options.show_bp_locs)
-                {
-                    SourceManager::FileSP last_file_sp (target->GetSourceManager().GetLastFile ());
-                    if (last_file_sp)
-                    {
-                        const bool show_inlines = true;
-                        m_breakpoint_locations.Reset (last_file_sp->GetFileSpec(), 0, show_inlines);
-                        SearchFilterForUnconstrainedSearches target_search_filter (target->shared_from_this());
-                        target_search_filter.Search (m_breakpoint_locations);
-                    }
-                }
-                else
-                    m_breakpoint_locations.Clear();
-
-                if (target->GetSourceManager().DisplaySourceLinesWithLineNumbersUsingLastFile(
-                            m_options.start_line,   // Line to display
-                            m_options.num_lines,    // Lines after line to
-                            UINT32_MAX,             // Don't mark "line"
-                            "",                     // Don't mark "line"
-                            &result.GetOutputStream(),
-                            GetBreakpointLocations ()))
-                {
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
+  // From Jim: The FindMatchingFunctions / FindMatchingFunctionSymbols functions
+  // "take a possibly empty vector of strings which are names of modules, and
+  // run the two search functions on the subset of the full module list that
+  // matches the strings in the input vector". If we wanted to put these
+  // somewhere,
+  // there should probably be a module-filter-list that can be passed to the
+  // various ModuleList::Find* calls, which would either be a vector of string
+  // names or a ModuleSpecList.
+  size_t FindMatchingFunctions(Target *target, const ConstString &name,
+                               SymbolContextList &sc_list) {
+    // Displaying the source for a symbol:
+    bool include_inlines = true;
+    bool append = true;
+    bool include_symbols = false;
+    size_t num_matches = 0;
+
+    if (m_options.num_lines == 0)
+      m_options.num_lines = 10;
+
+    const size_t num_modules = m_options.modules.size();
+    if (num_modules > 0) {
+      ModuleList matching_modules;
+      for (size_t i = 0; i < num_modules; ++i) {
+        FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+        if (module_file_spec) {
+          ModuleSpec module_spec(module_file_spec);
+          matching_modules.Clear();
+          target->GetImages().FindModules(module_spec, matching_modules);
+          num_matches += matching_modules.FindFunctions(
+              name, eFunctionNameTypeAuto, include_symbols, include_inlines,
+              append, sc_list);
+        }
+      }
+    } else {
+      num_matches = target->GetImages().FindFunctions(
+          name, eFunctionNameTypeAuto, include_symbols, include_inlines, append,
+          sc_list);
+    }
+    return num_matches;
+  }
+
+  size_t FindMatchingFunctionSymbols(Target *target, const ConstString &name,
+                                     SymbolContextList &sc_list) {
+    size_t num_matches = 0;
+    const size_t num_modules = m_options.modules.size();
+    if (num_modules > 0) {
+      ModuleList matching_modules;
+      for (size_t i = 0; i < num_modules; ++i) {
+        FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+        if (module_file_spec) {
+          ModuleSpec module_spec(module_file_spec);
+          matching_modules.Clear();
+          target->GetImages().FindModules(module_spec, matching_modules);
+          num_matches += matching_modules.FindFunctionSymbols(
+              name, eFunctionNameTypeAuto, sc_list);
+        }
+      }
+    } else {
+      num_matches = target->GetImages().FindFunctionSymbols(
+          name, eFunctionNameTypeAuto, sc_list);
+    }
+    return num_matches;
+  }
+
+  bool DoExecute(Args &command, CommandReturnObject &result) override {
+    const size_t argc = command.GetArgumentCount();
+
+    if (argc != 0) {
+      result.AppendErrorWithFormat("'%s' takes no arguments, only flags.\n",
+                                   GetCommandName());
+      result.SetStatus(eReturnStatusFailed);
+      return false;
+    }
+
+    Target *target = m_exe_ctx.GetTargetPtr();
+
+    if (!m_options.symbol_name.empty()) {
+      SymbolContextList sc_list;
+      ConstString name(m_options.symbol_name.c_str());
+
+      // Displaying the source for a symbol. Search for function named name.
+      size_t num_matches = FindMatchingFunctions(target, name, sc_list);
+      if (!num_matches) {
+        // If we didn't find any functions with that name, try searching for
+        // symbols
+        // that line up exactly with function addresses.
+        SymbolContextList sc_list_symbols;
+        size_t num_symbol_matches =
+            FindMatchingFunctionSymbols(target, name, sc_list_symbols);
+        for (size_t i = 0; i < num_symbol_matches; i++) {
+          SymbolContext sc;
+          sc_list_symbols.GetContextAtIndex(i, sc);
+          if (sc.symbol && sc.symbol->ValueIsAddress()) {
+            const Address &base_address = sc.symbol->GetAddressRef();
+            Function *function = base_address.CalculateSymbolContextFunction();
+            if (function) {
+              sc_list.Append(SymbolContext(function));
+              num_matches++;
+              break;
+            }
+          }
+        }
+      }
+
+      if (num_matches == 0) {
+        result.AppendErrorWithFormat("Could not find function named: \"%s\".\n",
+                                     m_options.symbol_name.c_str());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      if (num_matches > 1) {
+        std::set<SourceInfo> source_match_set;
+
+        bool displayed_something = false;
+        for (size_t i = 0; i < num_matches; i++) {
+          SymbolContext sc;
+          sc_list.GetContextAtIndex(i, sc);
+          SourceInfo source_info(sc.GetFunctionName(),
+                                 sc.GetFunctionStartLineEntry());
+
+          if (source_info.IsValid()) {
+            if (source_match_set.find(source_info) == source_match_set.end()) {
+              source_match_set.insert(source_info);
+              if (DisplayFunctionSource(sc, source_info, result))
+                displayed_something = true;
             }
+          }
         }
+
+        if (displayed_something)
+          result.SetStatus(eReturnStatusSuccessFinishResult);
         else
-        {
-            const char *filename = m_options.file_name.c_str();
+          result.SetStatus(eReturnStatusFailed);
+      } else {
+        SymbolContext sc;
+        sc_list.GetContextAtIndex(0, sc);
+        SourceInfo source_info;
+
+        if (DisplayFunctionSource(sc, source_info, result)) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.SetStatus(eReturnStatusFailed);
+        }
+      }
+      return result.Succeeded();
+    } else if (m_options.address != LLDB_INVALID_ADDRESS) {
+      Address so_addr;
+      StreamString error_strm;
+      SymbolContextList sc_list;
+
+      if (target->GetSectionLoadList().IsEmpty()) {
+        // The target isn't loaded yet, we need to lookup the file address
+        // in all modules
+        const ModuleList &module_list = target->GetImages();
+        const size_t num_modules = module_list.GetSize();
+        for (size_t i = 0; i < num_modules; ++i) {
+          ModuleSP module_sp(module_list.GetModuleAtIndex(i));
+          if (module_sp &&
+              module_sp->ResolveFileAddress(m_options.address, so_addr)) {
+            SymbolContext sc;
+            sc.Clear(true);
+            if (module_sp->ResolveSymbolContextForAddress(
+                    so_addr, eSymbolContextEverything, sc) &
+                eSymbolContextLineEntry)
+              sc_list.Append(sc);
+          }
+        }
+
+        if (sc_list.GetSize() == 0) {
+          result.AppendErrorWithFormat(
+              "no modules have source information for file address 0x%" PRIx64
+              ".\n",
+              m_options.address);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      } else {
+        // The target has some things loaded, resolve this address to a
+        // compile unit + file + line and display
+        if (target->GetSectionLoadList().ResolveLoadAddress(m_options.address,
+                                                            so_addr)) {
+          ModuleSP module_sp(so_addr.GetModule());
+          if (module_sp) {
+            SymbolContext sc;
+            sc.Clear(true);
+            if (module_sp->ResolveSymbolContextForAddress(
+                    so_addr, eSymbolContextEverything, sc) &
+                eSymbolContextLineEntry) {
+              sc_list.Append(sc);
+            } else {
+              so_addr.Dump(&error_strm, nullptr,
+                           Address::DumpStyleModuleWithFileAddress);
+              result.AppendErrorWithFormat("address resolves to %s, but there "
+                                           "is no line table information "
+                                           "available for this address.\n",
+                                           error_strm.GetData());
+              result.SetStatus(eReturnStatusFailed);
+              return false;
+            }
+          }
+        }
+
+        if (sc_list.GetSize() == 0) {
+          result.AppendErrorWithFormat(
+              "no modules contain load address 0x%" PRIx64 ".\n",
+              m_options.address);
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      }
+      uint32_t num_matches = sc_list.GetSize();
+      for (uint32_t i = 0; i < num_matches; ++i) {
+        SymbolContext sc;
+        sc_list.GetContextAtIndex(i, sc);
+        if (sc.comp_unit) {
+          if (m_options.show_bp_locs) {
+            m_breakpoint_locations.Clear();
+            const bool show_inlines = true;
+            m_breakpoint_locations.Reset(*sc.comp_unit, 0, show_inlines);
+            SearchFilterForUnconstrainedSearches target_search_filter(
+                target->shared_from_this());
+            target_search_filter.Search(m_breakpoint_locations);
+          }
+
+          bool show_fullpaths = true;
+          bool show_module = true;
+          bool show_inlined_frames = true;
+          const bool show_function_arguments = true;
+          const bool show_function_name = true;
+          sc.DumpStopContext(&result.GetOutputStream(),
+                             m_exe_ctx.GetBestExecutionContextScope(),
+                             sc.line_entry.range.GetBaseAddress(),
+                             show_fullpaths, show_module, show_inlined_frames,
+                             show_function_arguments, show_function_name);
+          result.GetOutputStream().EOL();
 
-            bool check_inlines = false;
-            SymbolContextList sc_list;
-            size_t num_matches = 0;
-            
-            if (!m_options.modules.empty())
-            {
-                ModuleList matching_modules;
-                for (size_t i = 0, e = m_options.modules.size(); i < e; ++i)
-                {
-                    FileSpec module_file_spec(m_options.modules[i].c_str(), false);
-                    if (module_file_spec)
-                    {
-                        ModuleSpec module_spec (module_file_spec);
-                        matching_modules.Clear();
-                        target->GetImages().FindModules (module_spec, matching_modules);
-                        num_matches += matching_modules.ResolveSymbolContextForFilePath (filename,
-                                                                                         0,
-                                                                                         check_inlines,
-                                                                                         eSymbolContextModule | eSymbolContextCompUnit,
-                                                                                         sc_list);
-                    }
-                }
-            }
-            else
-            {
-                num_matches = target->GetImages().ResolveSymbolContextForFilePath (filename,
-                                                                                   0,
-                                                                                   check_inlines,
-                                                                                   eSymbolContextModule | eSymbolContextCompUnit,
-                                                                                   sc_list);
-            }
-            
-            if (num_matches == 0)
-            {
-                result.AppendErrorWithFormat("Could not find source file \"%s\".\n", 
-                                             m_options.file_name.c_str());
-                result.SetStatus (eReturnStatusFailed);
-                return false;
-            }
+          if (m_options.num_lines == 0)
+            m_options.num_lines = 10;
 
-            if (num_matches > 1)
-            {
-                bool got_multiple = false;
-                FileSpec *test_cu_spec = nullptr;
-
-                for (unsigned i = 0; i < num_matches; i++)
-                {
-                    SymbolContext sc;
-                    sc_list.GetContextAtIndex(i, sc);
-                    if (sc.comp_unit)
-                    {
-                        if (test_cu_spec)
-                        {
-                            if (test_cu_spec != static_cast<FileSpec *> (sc.comp_unit))
-                                got_multiple = true;
-                            break;
-                        }
-                        else
-                            test_cu_spec = sc.comp_unit;
-                    }
-                }
-                if (got_multiple)
-                {
-                    result.AppendErrorWithFormat("Multiple source files found matching: \"%s.\"\n",
-                                                 m_options.file_name.c_str());
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
-            
-            SymbolContext sc;
-            if (sc_list.GetContextAtIndex(0, sc))
-            {
-                if (sc.comp_unit)
-                {
-                    if (m_options.show_bp_locs)
-                    {
-                        const bool show_inlines = true;
-                        m_breakpoint_locations.Reset (*sc.comp_unit, 0, show_inlines);
-                        SearchFilterForUnconstrainedSearches target_search_filter (target->shared_from_this());
-                        target_search_filter.Search (m_breakpoint_locations);
-                    }
-                    else
-                        m_breakpoint_locations.Clear();
-
-                    if (m_options.num_lines == 0)
-                        m_options.num_lines = 10;
-                    
-                    target->GetSourceManager().DisplaySourceLinesWithLineNumbers (sc.comp_unit,
-                                                                                  m_options.start_line,
-                                                                                  0,
-                                                                                  m_options.num_lines,
-                                                                                  "",
-                                                                                  &result.GetOutputStream(),
-                                                                                  GetBreakpointLocations ());
-
-                    result.SetStatus (eReturnStatusSuccessFinishResult);
-                }
-                else
-                {
-                    result.AppendErrorWithFormat("No comp unit found for: \"%s.\"\n", 
-                                                 m_options.file_name.c_str());
-                    result.SetStatus (eReturnStatusFailed);
-                    return false;
-                }
-            }
+          size_t lines_to_back_up =
+              m_options.num_lines >= 10 ? 5 : m_options.num_lines / 2;
+
+          target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
+              sc.comp_unit, sc.line_entry.line, lines_to_back_up,
+              m_options.num_lines - lines_to_back_up, "->",
+              &result.GetOutputStream(), GetBreakpointLocations());
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        }
+      }
+    } else if (m_options.file_name.empty()) {
+      // Last valid source manager context, or the current frame if no
+      // valid last context in source manager.
+      // One little trick here, if you type the exact same list command twice in
+      // a row, it is
+      // more likely because you typed it once, then typed it again
+      if (m_options.start_line == 0) {
+        if (target->GetSourceManager().DisplayMoreWithLineNumbers(
+                &result.GetOutputStream(), m_options.num_lines,
+                m_options.reverse, GetBreakpointLocations())) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
         }
-        return result.Succeeded();
-    }
-    
-    const SymbolContextList *
-    GetBreakpointLocations ()
-    {
-        if (m_breakpoint_locations.GetFileLineMatches().GetSize() > 0)
-            return &m_breakpoint_locations.GetFileLineMatches();
-        return nullptr;
+      } else {
+        if (m_options.num_lines == 0)
+          m_options.num_lines = 10;
+
+        if (m_options.show_bp_locs) {
+          SourceManager::FileSP last_file_sp(
+              target->GetSourceManager().GetLastFile());
+          if (last_file_sp) {
+            const bool show_inlines = true;
+            m_breakpoint_locations.Reset(last_file_sp->GetFileSpec(), 0,
+                                         show_inlines);
+            SearchFilterForUnconstrainedSearches target_search_filter(
+                target->shared_from_this());
+            target_search_filter.Search(m_breakpoint_locations);
+          }
+        } else
+          m_breakpoint_locations.Clear();
+
+        if (target->GetSourceManager()
+                .DisplaySourceLinesWithLineNumbersUsingLastFile(
+                    m_options.start_line, // Line to display
+                    m_options.num_lines,  // Lines after line to
+                    UINT32_MAX,           // Don't mark "line"
+                    "",                   // Don't mark "line"
+                    &result.GetOutputStream(), GetBreakpointLocations())) {
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        }
+      }
+    } else {
+      const char *filename = m_options.file_name.c_str();
+
+      bool check_inlines = false;
+      SymbolContextList sc_list;
+      size_t num_matches = 0;
+
+      if (!m_options.modules.empty()) {
+        ModuleList matching_modules;
+        for (size_t i = 0, e = m_options.modules.size(); i < e; ++i) {
+          FileSpec module_file_spec(m_options.modules[i].c_str(), false);
+          if (module_file_spec) {
+            ModuleSpec module_spec(module_file_spec);
+            matching_modules.Clear();
+            target->GetImages().FindModules(module_spec, matching_modules);
+            num_matches += matching_modules.ResolveSymbolContextForFilePath(
+                filename, 0, check_inlines,
+                eSymbolContextModule | eSymbolContextCompUnit, sc_list);
+          }
+        }
+      } else {
+        num_matches = target->GetImages().ResolveSymbolContextForFilePath(
+            filename, 0, check_inlines,
+            eSymbolContextModule | eSymbolContextCompUnit, sc_list);
+      }
+
+      if (num_matches == 0) {
+        result.AppendErrorWithFormat("Could not find source file \"%s\".\n",
+                                     m_options.file_name.c_str());
+        result.SetStatus(eReturnStatusFailed);
+        return false;
+      }
+
+      if (num_matches > 1) {
+        bool got_multiple = false;
+        FileSpec *test_cu_spec = nullptr;
+
+        for (unsigned i = 0; i < num_matches; i++) {
+          SymbolContext sc;
+          sc_list.GetContextAtIndex(i, sc);
+          if (sc.comp_unit) {
+            if (test_cu_spec) {
+              if (test_cu_spec != static_cast<FileSpec *>(sc.comp_unit))
+                got_multiple = true;
+              break;
+            } else
+              test_cu_spec = sc.comp_unit;
+          }
+        }
+        if (got_multiple) {
+          result.AppendErrorWithFormat(
+              "Multiple source files found matching: \"%s.\"\n",
+              m_options.file_name.c_str());
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      }
+
+      SymbolContext sc;
+      if (sc_list.GetContextAtIndex(0, sc)) {
+        if (sc.comp_unit) {
+          if (m_options.show_bp_locs) {
+            const bool show_inlines = true;
+            m_breakpoint_locations.Reset(*sc.comp_unit, 0, show_inlines);
+            SearchFilterForUnconstrainedSearches target_search_filter(
+                target->shared_from_this());
+            target_search_filter.Search(m_breakpoint_locations);
+          } else
+            m_breakpoint_locations.Clear();
+
+          if (m_options.num_lines == 0)
+            m_options.num_lines = 10;
+
+          target->GetSourceManager().DisplaySourceLinesWithLineNumbers(
+              sc.comp_unit, m_options.start_line, 0, m_options.num_lines, "",
+              &result.GetOutputStream(), GetBreakpointLocations());
+
+          result.SetStatus(eReturnStatusSuccessFinishResult);
+        } else {
+          result.AppendErrorWithFormat("No comp unit found for: \"%s.\"\n",
+                                       m_options.file_name.c_str());
+          result.SetStatus(eReturnStatusFailed);
+          return false;
+        }
+      }
     }
+    return result.Succeeded();
+  }
 
-    CommandOptions m_options;
-    FileLineResolver m_breakpoint_locations;
-    std::string    m_reverse_name;
+  const SymbolContextList *GetBreakpointLocations() {
+    if (m_breakpoint_locations.GetFileLineMatches().GetSize() > 0)
+      return &m_breakpoint_locations.GetFileLineMatches();
+    return nullptr;
+  }
+
+  CommandOptions m_options;
+  FileLineResolver m_breakpoint_locations;
+  std::string m_reverse_name;
 };
 
-OptionDefinition
-CommandObjectSourceList::CommandOptions::g_option_table[] =
-{
-  // clang-format off
+OptionDefinition CommandObjectSourceList::CommandOptions::g_option_table[] = {
+    // clang-format off
   {LLDB_OPT_SET_ALL,                false, "count",            'c', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                         eArgTypeCount,               "The number of source lines to display."},
   {LLDB_OPT_SET_1 | LLDB_OPT_SET_2, false, "shlib",            's', OptionParser::eRequiredArgument, nullptr, nullptr, CommandCompletions::eModuleCompletion,     eArgTypeShlibName,           "Look up the source file in the given shared library."},
   {LLDB_OPT_SET_ALL,                false, "show-breakpoints", 'b', OptionParser::eNoArgument,       nullptr, nullptr, 0,                                         eArgTypeNone,                "Show the line table locations from the debug information that indicate valid places to set source level breakpoints."},
@@ -1469,7 +1308,7 @@ CommandObjectSourceList::CommandOptions:
   {LLDB_OPT_SET_3,                  false, "address",          'a', OptionParser::eRequiredArgument, nullptr, nullptr, 0,                                         eArgTypeAddressOrExpression, "Lookup the address and display the source information for the corresponding file and line."},
   {LLDB_OPT_SET_4,                  false, "reverse",          'r', OptionParser::eNoArgument,       nullptr, nullptr, 0,                                         eArgTypeNone,                "Reverse the listing to look backwards from the last displayed block of source."},
   {0, false, nullptr, 0, 0, nullptr, nullptr, 0, eArgTypeNone, nullptr}
-  // clang-format on
+    // clang-format on
 };
 
 #pragma mark CommandObjectMultiwordSource
@@ -1477,14 +1316,17 @@ CommandObjectSourceList::CommandOptions:
 // CommandObjectMultiwordSource
 //-------------------------------------------------------------------------
 
-CommandObjectMultiwordSource::CommandObjectMultiwordSource(CommandInterpreter &interpreter)
-    : CommandObjectMultiword(
-          interpreter, "source",
-          "Commands for examining source code described by debug information for the current target process.",
-          "source <subcommand> [<subcommand-options>]")
-{
-    LoadSubCommand ("info",   CommandObjectSP (new CommandObjectSourceInfo (interpreter)));
-    LoadSubCommand ("list",   CommandObjectSP (new CommandObjectSourceList (interpreter)));
+CommandObjectMultiwordSource::CommandObjectMultiwordSource(
+    CommandInterpreter &interpreter)
+    : CommandObjectMultiword(interpreter, "source", "Commands for examining "
+                                                    "source code described by "
+                                                    "debug information for the "
+                                                    "current target process.",
+                             "source <subcommand> [<subcommand-options>]") {
+  LoadSubCommand("info",
+                 CommandObjectSP(new CommandObjectSourceInfo(interpreter)));
+  LoadSubCommand("list",
+                 CommandObjectSP(new CommandObjectSourceList(interpreter)));
 }
 
 CommandObjectMultiwordSource::~CommandObjectMultiwordSource() = default;

Modified: lldb/trunk/source/Commands/CommandObjectSource.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.h (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.h Tue Sep  6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- CommandObjectSource.h.h -----------------------------------*- C++ -*-===//
+//===-- CommandObjectSource.h.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 {
 // CommandObjectMultiwordSource
 //-------------------------------------------------------------------------
 
-class CommandObjectMultiwordSource : public CommandObjectMultiword
-{
+class CommandObjectMultiwordSource : public CommandObjectMultiword {
 public:
+  CommandObjectMultiwordSource(CommandInterpreter &interpreter);
 
-    CommandObjectMultiwordSource (CommandInterpreter &interpreter);
-
-    ~CommandObjectMultiwordSource() override;
+  ~CommandObjectMultiwordSource() override;
 };
 
 } // namespace lldb_private

Modified: lldb/trunk/source/Commands/CommandObjectSyntax.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSyntax.cpp?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSyntax.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSyntax.cpp Tue Sep  6 15:57:50 2016
@@ -14,10 +14,10 @@
 #include "CommandObjectSyntax.h"
 #include "CommandObjectHelp.h"
 #include "lldb/Interpreter/Args.h"
-#include "lldb/Interpreter/Options.h"
 #include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Interpreter/CommandReturnObject.h"
 #include "lldb/Interpreter/CommandObjectMultiword.h"
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Interpreter/Options.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -26,97 +26,80 @@ using namespace lldb_private;
 // CommandObjectSyntax
 //-------------------------------------------------------------------------
 
-CommandObjectSyntax::CommandObjectSyntax (CommandInterpreter &interpreter) :
-    CommandObjectParsed (interpreter,
-                         "syntax",
-                         "Shows the correct syntax for a given debugger command.",
-                         "syntax <command>")
-{
-    CommandArgumentEntry arg;
-    CommandArgumentData command_arg;
-
-    // Define the first (and only) variant of this arg.
-    command_arg.arg_type = eArgTypeCommandName;
-    command_arg.arg_repetition = eArgRepeatPlain;
+CommandObjectSyntax::CommandObjectSyntax(CommandInterpreter &interpreter)
+    : CommandObjectParsed(
+          interpreter, "syntax",
+          "Shows the correct syntax for a given debugger command.",
+          "syntax <command>") {
+  CommandArgumentEntry arg;
+  CommandArgumentData command_arg;
+
+  // Define the first (and only) variant of this arg.
+  command_arg.arg_type = eArgTypeCommandName;
+  command_arg.arg_repetition = eArgRepeatPlain;
+
+  // 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);
 }
 
 CommandObjectSyntax::~CommandObjectSyntax() = default;
 
-bool
-CommandObjectSyntax::DoExecute (Args& command, CommandReturnObject &result)
-{
-    CommandObject::CommandMap::iterator pos;
-    CommandObject *cmd_obj;
-    const size_t argc = command.GetArgumentCount();
-
-    if (argc > 0)
-    {
-        cmd_obj = m_interpreter.GetCommandObject (command.GetArgumentAtIndex(0));
-        bool all_okay = true;
-        for (size_t i = 1; i < argc; ++i)
-        {
-            std::string sub_command = command.GetArgumentAtIndex (i);
-            if (!cmd_obj->IsMultiwordObject())
-            {
-                all_okay = false;
-                break;
-            }
-            else
-            {
-                cmd_obj = cmd_obj->GetSubcommandObject(sub_command.c_str());
-                if (!cmd_obj)
-                {
-                    all_okay = false;
-                    break;
-                }
-            }
-        }
-        
-        if (all_okay && (cmd_obj != nullptr))
-        {
-            Stream &output_strm = result.GetOutputStream();
-            if (cmd_obj->GetOptions() != nullptr)
-            {
-                output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax());
-                output_strm.Printf ("(Try 'help %s' for more information on command options syntax.)\n",
-                                    cmd_obj->GetCommandName());
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-            else
-            {
-                output_strm.Printf ("\nSyntax: %s\n", cmd_obj->GetSyntax());
-                result.SetStatus (eReturnStatusSuccessFinishNoResult);
-            }
-        }
-        else
-        {
-            std::string cmd_string;
-            command.GetCommandString (cmd_string);
-
-            StreamString error_msg_stream;
-            const bool generate_apropos = true;
-            const bool generate_type_lookup = false;
-            CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(&error_msg_stream,
-                                                                    cmd_string.c_str(),
-                                                                    nullptr,
-                                                                    nullptr,
-                                                                    generate_apropos,
-                                                                    generate_type_lookup);
-            result.AppendErrorWithFormat ("%s", error_msg_stream.GetData());
-            result.SetStatus (eReturnStatusFailed);
+bool CommandObjectSyntax::DoExecute(Args &command,
+                                    CommandReturnObject &result) {
+  CommandObject::CommandMap::iterator pos;
+  CommandObject *cmd_obj;
+  const size_t argc = command.GetArgumentCount();
+
+  if (argc > 0) {
+    cmd_obj = m_interpreter.GetCommandObject(command.GetArgumentAtIndex(0));
+    bool all_okay = true;
+    for (size_t i = 1; i < argc; ++i) {
+      std::string sub_command = command.GetArgumentAtIndex(i);
+      if (!cmd_obj->IsMultiwordObject()) {
+        all_okay = false;
+        break;
+      } else {
+        cmd_obj = cmd_obj->GetSubcommandObject(sub_command.c_str());
+        if (!cmd_obj) {
+          all_okay = false;
+          break;
         }
+      }
     }
-    else
-    {
-        result.AppendError ("Must call 'syntax' with a valid command.");
-        result.SetStatus (eReturnStatusFailed);
+
+    if (all_okay && (cmd_obj != nullptr)) {
+      Stream &output_strm = result.GetOutputStream();
+      if (cmd_obj->GetOptions() != nullptr) {
+        output_strm.Printf("\nSyntax: %s\n", cmd_obj->GetSyntax());
+        output_strm.Printf(
+            "(Try 'help %s' for more information on command options syntax.)\n",
+            cmd_obj->GetCommandName());
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      } else {
+        output_strm.Printf("\nSyntax: %s\n", cmd_obj->GetSyntax());
+        result.SetStatus(eReturnStatusSuccessFinishNoResult);
+      }
+    } else {
+      std::string cmd_string;
+      command.GetCommandString(cmd_string);
+
+      StreamString error_msg_stream;
+      const bool generate_apropos = true;
+      const bool generate_type_lookup = false;
+      CommandObjectHelp::GenerateAdditionalHelpAvenuesMessage(
+          &error_msg_stream, cmd_string.c_str(), nullptr, nullptr,
+          generate_apropos, generate_type_lookup);
+      result.AppendErrorWithFormat("%s", error_msg_stream.GetData());
+      result.SetStatus(eReturnStatusFailed);
     }
+  } else {
+    result.AppendError("Must call 'syntax' with a valid command.");
+    result.SetStatus(eReturnStatusFailed);
+  }
 
-    return result.Succeeded();
+  return result.Succeeded();
 }

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




More information about the lldb-commits mailing list