Make SBBreakpointLocation::GetDescription() API to be consistent with SBTarget,
i.e., with 'SBStream &description' first, followed by 'DescriptionLevel level'.
Modify lldbutil.py so that get_description() for a target or breakpoint location
can just take the lldb object itself without specifying an option to mean option
lldb.eDescriptionLevelBrief. Modify TestTargetAPI.py to exercise this logic path.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@130147 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/lldbutil.py b/test/lldbutil.py
index 9cc4370..89c9d8f 100644
--- a/test/lldbutil.py
+++ b/test/lldbutil.py
@@ -171,11 +171,22 @@
# ==============================================================
# Get the description of an lldb object or None if not available
# ==============================================================
-def get_description(lldb_obj, option=None):
- """Calls lldb_obj.GetDescription() and returns a string, or None."""
- method = getattr(lldb_obj, 'GetDescription')
+def get_description(obj, option=None):
+ """Calls lldb_obj.GetDescription() and returns a string, or None.
+
+ For SBTarget and SBBreakpointLocation lldb objects, an extra option can be
+ passed in to describe the detailed level of description desired:
+ o lldb.eDescriptionLevelBrief
+ o lldb.eDescriptionLevelFull
+ o lldb.eDescriptionLevelVerbose
+ """
+ method = getattr(obj, 'GetDescription')
if not method:
return None
+ if isinstance(obj, lldb.SBTarget) or isinstance(obj, lldb.SBBreakpointLocation):
+ if option is None:
+ option = lldb.eDescriptionLevelBrief
+
stream = lldb.SBStream()
if option is None:
success = method(stream)