[Lldb-commits] [PATCH] D68010: [lldb] Fix string summary of an empty NSPathStore2
Raphael Isemann via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Sep 25 01:02:14 PDT 2019
teemperor created this revision.
teemperor added reviewers: aprantl, JDevlieghere, shafik.
Herald added subscribers: lldb-commits, abidh, christof.
Herald added a project: LLDB.
Printing a summary for an empty NSPathStore2 string currently prints random bytes behind the empty string pointer from memory (rdar://55575888).
It seems the reason for this is that the SourceSize parameter in the `ReadStringAndDumpToStreamOptions` - which is supposed to contain the string
length - actually uses the length 0 as a magic value for saying "read as much as possible from the buffer" which is clearly wrong for empty strings.
This patch adds another flag that indicates if we have know the string length or not and makes this behaviour dependent on that (which seemingly
was the original purpose of this magic value). As this code is shared between all string reading, this patch also adds tests for printing empty strings
to all string type tests that seem to use this code path.
Note that I'm aware that some of the surrounding code that I touch here is spaghetti which should be refactored. However, I would prefer if we could
backport this patch without also having to backport a series of refactoring patches, so let's just add sauce to that pasta for now and I'll do the refactoring
once this has landed.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 17899 bytes
Desc: not available
More information about the lldb-commits