[Lldb-commits] [PATCH] D97165: [lldb] Add deref support and tests to shared_ptr synthetic

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 22 12:16:21 PST 2021


jingham added a comment.

This looks great.  It's a little weird to use "SBValue.value" to get a string version of something that's a pointer and then have to do regex compares.  It's more direct to use "unsigned" and compare against 0x0.



================
Comment at: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/shared_ptr/TestDataFormatterLibcxxSharedPtr.py:31
+        )
+        self.assertRegex(valobj.children[0].value, "^0x0{8,}$")
+
----------------
If you used "unsigned" instead of "value" you'd get a number back and you could check that directly against 0x0 rather than having to do a regex match.  If you want to be careful, use GetValueAsUnsigned(fail_value=lldb.LLDB_INVALID_ADDRESS) since the default fail value is 0...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97165/new/

https://reviews.llvm.org/D97165



More information about the lldb-commits mailing list