[Lldb-commits] [PATCH] D80254: Prevent GetNumChildren from transitively walking pointer chains

Jaroslav Sevcik via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue May 19 16:00:15 PDT 2020

jarin created this revision.
jarin added reviewers: teemperor, jingham.
jarin added a project: LLDB.
Herald added a subscriber: lldb-commits.

This is an attempt to fix https://bugs.llvm.org/show_bug.cgi?id=45988, where SBValue::GetNumChildren returns 2, but SBValue::GetChildAtIndex(1) returns an invalid value sentinel.

The root cause of this seems to be that GetNumChildren can return the number of children of a wrong value. In particular, for pointers GetNumChildren just recursively calls itself on the pointee type, so it effectively walks chains of pointers. This is different from the logic of GetChildAtIndex, which only recurses if pointee.IsAggregateType() returns true (IsAggregateType is false for pointers and references), so it never follows chain of pointers.

This patch aims to make GetNumChildren (more) consistent with GetChildAtIndex by only recursively calling GetNumChildren for aggregate types.

Ideally, GetNumChildren and GetChildAtIndex would share the code that decides which pointers/references are followed, but that is a bit more invasive change.

  rG LLVM Github Monorepo



-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80254.265059.patch
Type: text/x-patch
Size: 4434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200519/d90785e3/attachment-0001.bin>

More information about the lldb-commits mailing list