[lldb-dev] Possible bug in the LLDB Python Scripting Example (And the API itself)

Spundun Bhatt spundun at gmail.com
Sun Feb 15 23:23:36 PST 2015


(Using OSX 10.10.1, XCode 6.1.1 6A2008a, lldb-320.4.156, Apple LLVM version
6.0 (clang-600.0.56) (based on LLVM 3.5svn) )

Hi all,
I have just started using LLDB and its Python scripting interface.

I may have stumbled upon a deep bug related to null pointer treatment.

http://lldb.llvm.org/scripting.html I tried to follow this scripting
tutorial.

http://pastebin.com/S0RhVG3s This is the output of my interaction with the
lldb and the python script. (I haven't modified any part of the example
code there)

It seems like `if left_child_ptr.GetValue() == None:` expression (and other
similar expressions) doesn't evaluate to true for null pointers

I was able to cook up a python check for null pointer:

def IsNullPtr(ptr):

  ptr_string = str(ptr.GetValue())

  if re.search('[1-9a-fA-F]', ptr_string):

    return False;

  else:

    return True;

I discussed this on the irc channel and zturner thought it looked like a
bug and that I should post it here.

Hope this helps.
Please let me know if there is a standard way to do null pointer check
through the python API. Especially a check for nullptr shared_ptrs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150215/e04d1366/attachment.html>


More information about the lldb-dev mailing list