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. llvm-svn: 130147
This commit is contained in:
parent
743dda49d9
commit
fc87e2dd5c
|
@ -82,7 +82,7 @@ public:
|
|||
IsResolved ();
|
||||
|
||||
bool
|
||||
GetDescription (DescriptionLevel level, lldb::SBStream &description);
|
||||
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
||||
|
||||
SBBreakpoint
|
||||
GetBreakpoint ();
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
%extend lldb::SBBreakpointLocation {
|
||||
PyObject *lldb::SBBreakpointLocation::__repr__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (lldb::eDescriptionLevelFull, description);
|
||||
$self->GetDescription (description, lldb::eDescriptionLevelFull);
|
||||
return PyString_FromString (description.GetData());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ SBBreakpointLocation::SBBreakpointLocation (const lldb::BreakpointLocationSP &br
|
|||
if (log)
|
||||
{
|
||||
SBStream sstr;
|
||||
GetDescription (lldb::eDescriptionLevelBrief, sstr);
|
||||
GetDescription (sstr, lldb::eDescriptionLevelBrief);
|
||||
log->Printf ("SBBreakpointLocation::SBBreakpointLocaiton (const lldb::BreakpointLocationsSP &break_loc_sp"
|
||||
"=%p) => this.sp = %p (%s)", break_loc_sp.get(), m_opaque_sp.get(), sstr.GetData());
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ SBBreakpointLocation::SetLocation (const lldb::BreakpointLocationSP &break_loc_s
|
|||
}
|
||||
|
||||
bool
|
||||
SBBreakpointLocation::GetDescription (DescriptionLevel level, SBStream &description)
|
||||
SBBreakpointLocation::GetDescription (SBStream &description, DescriptionLevel level)
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue