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

Kuba (Brecka) Mracek via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 1 10:34:55 PST 2018


kubamracek added a comment.

> This seems like it is two patches, one fixing the NSCallStackArray data formatter, and one extracting fields from NSException.  Is that right.  I'm more asking to make sure I'm not missing something about this patch.

I'll split the patch. There's actually probably 3 more-or-less independent parts: 1) NFC refactoring of NSException.cpp, 2) extracting fields from NSException, 3) NSCallStackArray data formatter.



================
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);
----------------
jingham wrote:
> davide wrote:
> > 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).
> It looks like we generally have a type for NSException - it's an ObjC class so we'll read it out of the runtime if we can't get it from debug information.  You should be able to get the offsets from that rather than having to hand code them here.
Does reading the offsets need to run the target or is it just inspecting memory?


https://reviews.llvm.org/D43884





More information about the lldb-commits mailing list