diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h --- a/lldb/include/lldb/Target/Target.h +++ b/lldb/include/lldb/Target/Target.h @@ -1310,8 +1310,8 @@ bool GetAutoContinue() const { return m_auto_continue; } - void GetDescription(Stream *s, lldb::DescriptionLevel level) const; - virtual void GetSubclassDescription(Stream *s, + void GetDescription(Stream &s, lldb::DescriptionLevel level) const; + virtual void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const = 0; protected: @@ -1334,7 +1334,7 @@ StopHookResult HandleStop(ExecutionContext &exc_ctx, lldb::StreamSP output_sp) override; - void GetSubclassDescription(Stream *s, + void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override; private: @@ -1356,7 +1356,7 @@ Status SetScriptCallback(std::string class_name, StructuredData::ObjectSP extra_args_sp); - void GetSubclassDescription(Stream *s, + void GetSubclassDescription(Stream &s, lldb::DescriptionLevel level) const override; private: diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp --- a/lldb/source/Commands/CommandCompletions.cpp +++ b/lldb/source/Commands/CommandCompletions.cpp @@ -754,7 +754,7 @@ // neater. strm.SetIndentLevel(11); const Target::StopHookSP stophook_sp = target_sp->GetStopHookAtIndex(idx); - stophook_sp->GetDescription(&strm, lldb::eDescriptionLevelInitial); + stophook_sp->GetDescription(strm, lldb::eDescriptionLevelInitial); request.TryCompleteCurrentArg(std::to_string(stophook_sp->GetID()), strm.GetString()); } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -5057,7 +5057,7 @@ Target::StopHookSP this_hook = target.GetStopHookAtIndex(i); if (i > 0) result.GetOutputStream().PutCString("\n"); - this_hook->GetDescription(&(result.GetOutputStream()), + this_hook->GetDescription(result.GetOutputStream(), eDescriptionLevelFull); } } diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2892,7 +2892,7 @@ if (print_hook_header && !any_thread_matched) { StreamString s; - cur_hook_sp->GetDescription(&s, eDescriptionLevelBrief); + cur_hook_sp->GetDescription(s, eDescriptionLevelBrief); if (s.GetSize() != 0) output_sp->Printf("\n- Hook %" PRIu64 " (%s)\n", cur_hook_sp->GetID(), s.GetData()); @@ -3651,7 +3651,7 @@ return will_run; } -void Target::StopHook::GetDescription(Stream *s, +void Target::StopHook::GetDescription(Stream &s, lldb::DescriptionLevel level) const { // For brief descriptions, only print the subclass description: @@ -3660,55 +3660,55 @@ return; } - unsigned indent_level = s->GetIndentLevel(); + unsigned indent_level = s.GetIndentLevel(); - s->SetIndentLevel(indent_level + 2); + s.SetIndentLevel(indent_level + 2); - s->Printf("Hook: %" PRIu64 "\n", GetID()); + s.Printf("Hook: %" PRIu64 "\n", GetID()); if (m_active) - s->Indent("State: enabled\n"); + s.Indent("State: enabled\n"); else - s->Indent("State: disabled\n"); + s.Indent("State: disabled\n"); if (m_auto_continue) - s->Indent("AutoContinue on\n"); + s.Indent("AutoContinue on\n"); if (m_specifier_sp) { - s->Indent(); - s->PutCString("Specifier:\n"); - s->SetIndentLevel(indent_level + 4); - m_specifier_sp->GetDescription(s, level); - s->SetIndentLevel(indent_level + 2); + s.Indent(); + s.PutCString("Specifier:\n"); + s.SetIndentLevel(indent_level + 4); + m_specifier_sp->GetDescription(&s, level); + s.SetIndentLevel(indent_level + 2); } if (m_thread_spec_up) { StreamString tmp; - s->Indent("Thread:\n"); + s.Indent("Thread:\n"); m_thread_spec_up->GetDescription(&tmp, level); - s->SetIndentLevel(indent_level + 4); - s->Indent(tmp.GetString()); - s->PutCString("\n"); - s->SetIndentLevel(indent_level + 2); + s.SetIndentLevel(indent_level + 4); + s.Indent(tmp.GetString()); + s.PutCString("\n"); + s.SetIndentLevel(indent_level + 2); } GetSubclassDescription(s, level); } void Target::StopHookCommandLine::GetSubclassDescription( - Stream *s, lldb::DescriptionLevel level) const { + Stream &s, lldb::DescriptionLevel level) const { // The brief description just prints the first command. if (level == eDescriptionLevelBrief) { if (m_commands.GetSize() == 1) - s->PutCString(m_commands.GetStringAtIndex(0)); + s.PutCString(m_commands.GetStringAtIndex(0)); return; } - s->Indent("Commands: \n"); - s->SetIndentLevel(s->GetIndentLevel() + 4); + s.Indent("Commands: \n"); + s.SetIndentLevel(s.GetIndentLevel() + 4); uint32_t num_commands = m_commands.GetSize(); for (uint32_t i = 0; i < num_commands; i++) { - s->Indent(m_commands.GetStringAtIndex(i)); - s->PutCString("\n"); + s.Indent(m_commands.GetStringAtIndex(i)); + s.PutCString("\n"); } - s->SetIndentLevel(s->GetIndentLevel() - 4); + s.SetIndentLevel(s.GetIndentLevel() - 4); } // Target::StopHookCommandLine @@ -3796,13 +3796,13 @@ } void Target::StopHookScripted::GetSubclassDescription( - Stream *s, lldb::DescriptionLevel level) const { + Stream &s, lldb::DescriptionLevel level) const { if (level == eDescriptionLevelBrief) { - s->PutCString(m_class_name); + s.PutCString(m_class_name); return; } - s->Indent("Class:"); - s->Printf("%s\n", m_class_name.c_str()); + s.Indent("Class:"); + s.Printf("%s\n", m_class_name.c_str()); // Now print the extra args: // FIXME: We should use StructuredData.GetDescription on the m_extra_args @@ -3821,20 +3821,20 @@ if (num_keys == 0) return; - s->Indent("Args:\n"); - s->SetIndentLevel(s->GetIndentLevel() + 4); + s.Indent("Args:\n"); + s.SetIndentLevel(s.GetIndentLevel() + 4); auto print_one_element = [&s](ConstString key, StructuredData::Object *object) { - s->Indent(); - s->Printf("%s : %s\n", key.GetCString(), + s.Indent(); + s.Printf("%s : %s\n", key.GetCString(), object->GetStringValue().str().c_str()); return true; }; as_dict->ForEach(print_one_element); - s->SetIndentLevel(s->GetIndentLevel() - 4); + s.SetIndentLevel(s.GetIndentLevel() - 4); } static constexpr OptionEnumValueElement g_dynamic_value_types[] = {