Change the new breakpoint creation output (primarily from "break set") to something more useful.
<rdar://problem/11333623>
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@164432 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Breakpoint/Breakpoint.cpp b/source/Breakpoint/Breakpoint.cpp
index e158258..e90a827 100644
--- a/source/Breakpoint/Breakpoint.cpp
+++ b/source/Breakpoint/Breakpoint.cpp
@@ -511,14 +511,22 @@
void
Breakpoint::GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_locations)
{
- assert (s != NULL);
- s->Printf("%i: ", GetID());
- GetResolverDescription (s);
- GetFilterDescription (s);
-
const size_t num_locations = GetNumLocations ();
const size_t num_resolved_locations = GetNumResolvedLocations ();
+ assert (s != NULL);
+
+
+
+ // They just made the breakpoint, they don't need to be told HOW they made it...
+ // Also, we'll print the breakpoint number differently depending on whether there is 1 or more locations.
+ if (level != eDescriptionLevelInitial)
+ {
+ s->Printf("%i: ", GetID());
+ GetResolverDescription (s);
+ GetFilterDescription (s);
+ }
+
switch (level)
{
case lldb::eDescriptionLevelBrief:
@@ -545,7 +553,32 @@
s->EOL();
}
break;
-
+
+ case lldb::eDescriptionLevelInitial:
+ s->Printf ("Breakpoint %i: ", GetID());
+ if (num_locations == 0)
+ {
+ s->Printf ("no locations (pending).");
+ }
+ else if (num_locations == 1)
+ {
+ // If there is one location only, we'll just print that location information. But don't do this if
+ // show locations is true, then that will be handled below.
+ if (show_locations == false)
+ {
+ GetLocationAtIndex(0)->GetDescription(s, level);
+ }
+ else
+ {
+ s->Printf ("%zd locations.", num_locations);
+ }
+ }
+ else
+ {
+ s->Printf ("%zd locations.", num_locations);
+ }
+ s->EOL();
+ break;
case lldb::eDescriptionLevelVerbose:
// Verbose mode does a debug dump of the breakpoint
Dump (s);
diff --git a/source/Breakpoint/BreakpointLocation.cpp b/source/Breakpoint/BreakpointLocation.cpp
index 96ccce3..202898c 100644
--- a/source/Breakpoint/BreakpointLocation.cpp
+++ b/source/Breakpoint/BreakpointLocation.cpp
@@ -410,13 +410,20 @@
BreakpointLocation::GetDescription (Stream *s, lldb::DescriptionLevel level)
{
SymbolContext sc;
- s->Indent();
- BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
-
+
+ // If the description level is "initial" then the breakpoint is printing out our initial state,
+ // and we should let it decide how it wants to print our label.
+ if (level != eDescriptionLevelInitial)
+ {
+ s->Indent();
+ BreakpointID::GetCanonicalReference(s, m_owner.GetID(), GetID());
+ }
+
if (level == lldb::eDescriptionLevelBrief)
return;
- s->PutCString(": ");
+ if (level != eDescriptionLevelInitial)
+ s->PutCString(": ");
if (level == lldb::eDescriptionLevelVerbose)
s->IndentMore();
@@ -425,7 +432,7 @@
{
m_address.CalculateSymbolContext(&sc);
- if (level == lldb::eDescriptionLevelFull)
+ if (level == lldb::eDescriptionLevelFull || level == eDescriptionLevelInitial)
{
s->PutCString("where = ");
sc.DumpStopContext (s, m_owner.GetTarget().GetProcessSP().get(), m_address, false, true, false);
@@ -478,7 +485,11 @@
s->EOL();
s->Indent();
}
- s->Printf ("%saddress = ", (level == lldb::eDescriptionLevelFull && m_address.IsSectionOffset()) ? ", " : "");
+
+ if (m_address.IsSectionOffset() && (level == eDescriptionLevelFull || level == eDescriptionLevelInitial))
+ s->Printf (", ");
+ s->Printf ("address = ");
+
ExecutionContextScope *exe_scope = NULL;
Target *target = &m_owner.GetTarget();
if (target)
@@ -486,7 +497,10 @@
if (exe_scope == NULL)
exe_scope = target;
- m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
+ if (eDescriptionLevelInitial)
+ m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleFileAddress);
+ else
+ m_address.Dump(s, exe_scope, Address::DumpStyleLoadAddress, Address::DumpStyleModuleWithFileAddress);
if (level == lldb::eDescriptionLevelVerbose)
{
@@ -505,7 +519,7 @@
}
s->IndentLess();
}
- else
+ else if (level != eDescriptionLevelInitial)
{
s->Printf(", %sresolved, hit count = %u ",
(IsResolved() ? "" : "un"),
diff --git a/source/Commands/CommandObjectBreakpoint.cpp b/source/Commands/CommandObjectBreakpoint.cpp
index 95d533d..0bc02d8 100644
--- a/source/Commands/CommandObjectBreakpoint.cpp
+++ b/source/Commands/CommandObjectBreakpoint.cpp
@@ -516,9 +516,8 @@
if (bp)
{
Stream &output_stream = result.GetOutputStream();
- output_stream.Printf ("Breakpoint created: ");
- bp->GetDescription(&output_stream, lldb::eDescriptionLevelBrief);
- output_stream.EOL();
+ const bool show_locations = false;
+ bp->GetDescription(&output_stream, lldb::eDescriptionLevelInitial, show_locations);
// Don't print out this warning for exception breakpoints. They can get set before the target
// is set, but we won't know how to actually set the breakpoint till we run.
if (bp->GetNumLocations() == 0 && break_type != eSetTypeException)