[Lldb-commits] [PATCH] D43884: [lldb] Extract more fields from NSException values

Davide Italiano via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 28 20:04:39 PST 2018


davide added a comment.

LG modulo the test. Update that, I'll take another look and approve it. Thanks for your contribution!



================
Comment at: packages/Python/lldbsuite/test/lang/objc/exceptions/TestObjCExceptions.py:1-4
+# encoding: utf-8
+"""
+Test lldb Obj-C exception support.
+"""
----------------
kubamracek wrote:
> davide wrote:
> > This looks like it doesn't need any interactivity whatsoever, so you can probably convert this to a lit test. See the examples in `lit/` (and please let me know if you have any questions.
> Will do! I didn't realize we already have the lit infrastructure ready. Quick question: Can I test the SB layer from a lit test?
No not really. The `lit` tests are a super recent addition :)


================
Comment at: source/Plugins/Language/ObjC/NSArray.cpp:221-228
+namespace CallStackArray {
+  struct DataDescriptor_32 {
+    uint32_t _data;
+    uint32_t _used;
+    uint32_t _offset;
+    const uint32_t _size = 0;
+  };
----------------
kubamracek wrote:
> davide wrote:
> > Do you mind to add comments to explain what the structure fields represent (or what this structure is for)?
> There's many definitions of array layout throughout this file, so I don't see a comment to be necessary here. Basically, this just defines another layout of an array, see above for other instances.
Fair enough.


================
Comment at: source/Plugins/Language/ObjC/NSException.cpp:57-64
+  auto name = process_sp->ReadPointerFromMemory(ptr + 1 * ptr_size, error);
+  if (error.Fail() || name == LLDB_INVALID_ADDRESS) return false;
+  auto reason = process_sp->ReadPointerFromMemory(ptr + 2 * ptr_size, error);
+  if (error.Fail() || reason == LLDB_INVALID_ADDRESS) return false;
+  auto userinfo = process_sp->ReadPointerFromMemory(ptr + 3 * ptr_size, error);
+  if (error.Fail() || reason == LLDB_INVALID_ADDRESS) return false;
+  auto reserved = process_sp->ReadPointerFromMemory(ptr + 4 * ptr_size, error);
----------------
kubamracek wrote:
> davide wrote:
> > The fact we have to calculate this by hand is slightly annoying, but I guess that's a bug to fix another day.
> I'll be happy to send follow-up patches. Do you have suggestions how to avoid these manual pointer calculations?
The way we do that in swift (or well, we're trying to do) is that of using remote mirrors. I'm not really aware of an equivalent mechanism in Obj-C, FWIW, but we should definitely think about it and have a chat (if you want, I don't think you should be signed up for cleaning up this).


https://reviews.llvm.org/D43884





More information about the lldb-commits mailing list