Change the Breakpoint & BreakpointLocation GetDescription methods so they call the BreakpointOptions::GetDescription rather
than picking bits out of the breakpoint options. Added BreakpointOptions::GetDescription to do this job. Some more mucking
around to keep the breakpoint listing from getting too verbose.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@106262 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Breakpoint/BreakpointOptions.cpp b/source/Breakpoint/BreakpointOptions.cpp
index 695f4ee..c362514 100644
--- a/source/Breakpoint/BreakpointOptions.cpp
+++ b/source/Breakpoint/BreakpointOptions.cpp
@@ -71,6 +71,21 @@
return *this;
}
+BreakpointOptions *
+BreakpointOptions::CopyOptionsNoCallback (BreakpointOptions &orig)
+{
+ BreakpointHitCallback orig_callback = orig.m_callback;
+ lldb::BatonSP orig_callback_baton_sp = orig.m_callback_baton_sp;
+ bool orig_is_sync = orig.m_callback_is_synchronous;
+
+ orig.ClearCallback();
+ BreakpointOptions *ret_val = new BreakpointOptions(orig);
+
+ orig.SetCallback (orig_callback, orig_callback_baton_sp, orig_is_sync);
+
+ return ret_val;
+}
+
//----------------------------------------------------------------------
// Destructor
//----------------------------------------------------------------------
@@ -124,6 +139,12 @@
return true;
}
+bool
+BreakpointOptions::HasCallback ()
+{
+ return m_callback != BreakpointOptions::NullCallback;
+}
+
//------------------------------------------------------------------
// Enabled/Ignore Count
//------------------------------------------------------------------
@@ -173,10 +194,68 @@
}
void
+BreakpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) const
+{
+
+ // Figure out if there are any options not at their default value, and only print
+ // anything if there are:
+
+ if (m_ignore_count != 0 || !m_enabled || (GetThreadSpec() != NULL && GetThreadSpec()->HasSpecification ()))
+ {
+ if (level == lldb::eDescriptionLevelVerbose)
+ {
+ s->EOL ();
+ s->IndentMore();
+ s->Indent();
+ s->PutCString("Breakpoint Options:\n");
+ s->IndentMore();
+ s->Indent();
+ }
+ else
+ s->PutCString(" Options: ");
+
+ if (m_ignore_count > 0)
+ s->Printf("ignore: %d ", m_ignore_count);
+ s->Printf("%sabled ", m_enabled ? "en" : "dis");
+
+ if (m_thread_spec_ap.get())
+ m_thread_spec_ap->GetDescription (s, level);
+ else if (level == eDescriptionLevelBrief)
+ s->PutCString ("thread spec: no ");
+ if (level == lldb::eDescriptionLevelFull)
+ {
+ s->IndentLess();
+ s->IndentMore();
+ }
+ }
+
+ if (m_callback_baton_sp.get())
+ {
+ if (level != eDescriptionLevelBrief)
+ s->EOL();
+ m_callback_baton_sp->GetDescription (s, level);
+ }
+ else if (level == eDescriptionLevelBrief)
+ s->PutCString ("commands: no ");
+
+}
+
+void
BreakpointOptions::CommandBaton::GetDescription (Stream *s, lldb::DescriptionLevel level) const
{
- s->Indent("Breakpoint commands:\n");
CommandData *data = (CommandData *)m_data;
+
+ if (level == eDescriptionLevelBrief)
+ {
+ if (data && data->user_source.GetSize() > 0)
+ s->PutCString("commands: yes ");
+ else
+ s->PutCString("commands: no ");
+ return;
+ }
+
+ s->IndentMore ();
+ s->Indent("Breakpoint commands:\n");
s->IndentMore ();
if (data && data->user_source.GetSize() > 0)
@@ -193,5 +272,6 @@
s->PutCString ("No commands.\n");
}
s->IndentLess ();
+ s->IndentLess ();
}