summaryrefslogtreecommitdiffstats
path: root/lldb/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/lldbutil.py17
-rw-r--r--lldb/test/python_api/target/TestTargetAPI.py5
2 files changed, 18 insertions, 4 deletions
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py
index 9cc4370e604..89c9d8f3bc8 100644
--- a/lldb/test/lldbutil.py
+++ b/lldb/test/lldbutil.py
@@ -171,11 +171,22 @@ def get_stopped_thread(process, reason):
# ==============================================================
# 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)
diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py
index a112de5de28..e72d2e70daa 100644
--- a/lldb/test/python_api/target/TestTargetAPI.py
+++ b/lldb/test/python_api/target/TestTargetAPI.py
@@ -67,7 +67,10 @@ class TargetAPITestCase(TestBase):
self.assertTrue(target.IsValid(), VALID_TARGET)
from lldbutil import get_description
- desc = get_description(target, option=lldb.eDescriptionLevelBrief)
+
+ # get_description() allows no option to mean lldb.eDescriptionLevelBrief.
+ desc = get_description(target)
+ #desc = get_description(target, option=lldb.eDescriptionLevelBrief)
if not desc:
self.fail("SBTarget.GetDescription() failed")
self.expect(desc, exe=False,
OpenPOWER on IntegriCloud