I'm trying to add an lldb summary to my Xcode project for a class PlugDocument. I added a 'summaries.py' file, and created a ~/.lldbinit file which points to the py file... the first version of my summaries file, cribbed from the web / WWDC, looks like:
And that works fine, in the case where valueObj is a real ObjC object. But it "crashes" sorta kinda, when valueObj is zero, which can happen in the startup of the program. So I thought I would test for that case, and I tried changing the summary part to this:
But the true clause will not happen, no matter what. I don't know python from an earthworm, if it's not obvious. But "valueObj" is zero, yet the statement "if valueObj == None" never evaluates to true?? What does python want from me here? I've tried a gazillion things, like adding parens, changing "None" to "0"... nothing works. Plz help-- the debug loop is enormous: forget compiling, I need to relaunch Xcode to see changes to the summary file. yikes.
An example output:
Code:
def PlugDocument_summary( valueObj , dictionary ):
nameAsStr = valueObj.GetChildMemberWithName('_pluginName').GetSummary()
return 'pluginName: ' + nameAsStr
def __lldb_init_module( debugger , dictionary ):
debugger.HandleCommand( 'type summary add PlugDocument -F summaries.PlugDocument_summary')
And that works fine, in the case where valueObj is a real ObjC object. But it "crashes" sorta kinda, when valueObj is zero, which can happen in the startup of the program. So I thought I would test for that case, and I tried changing the summary part to this:
Code:
def PlugDocument_summary( valueObj , dictionary ):
print valueObj
if valueObj == None:
print "troo clause"
return 'this ' + 'never happens'
else:
print "else clause"
nameAsStr = valueObj.GetChildMemberWithName('_pluginName').GetSummary()
return 'pluginName: ' + nameAsStr
But the true clause will not happen, no matter what. I don't know python from an earthworm, if it's not obvious. But "valueObj" is zero, yet the statement "if valueObj == None" never evaluates to true?? What does python want from me here? I've tried a gazillion things, like adding parens, changing "None" to "0"... nothing works. Plz help-- the debug loop is enormous: forget compiling, I need to relaunch Xcode to see changes to the summary file. yikes.
An example output:
Code:
(PlugDocument *) _plugCandidateData = 0x0000000000000000
else clause
Traceback (most recent call last):
File "/Volumes/ [...] /summaries.py", line 11, in PlugDocument_summary
return 'pluginName: ' + nameAsStr
TypeError: cannot concatenate 'str' and 'NoneType' objects
Last edited: