This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Add MemorySource abstraction, unit test StringPrinter and document found bugs
Needs ReviewPublic

Authored by teemperor on Oct 9 2019, 4:24 AM.

Details

Reviewers
labath
Summary

As we found out already, StringPrinter has some surprising behaviour and bugs. This patch adds a (hopefully) exhaustive
test of all the StringPrinter functionality for all supported encodings and API variants. Also adds a bunch of
FIXME's into the test for all the unexpected behaviour I found. This patch is not fully NFC as it changes that
the StringPrinter now treats both 0 and LLDB_INVALID_ADDRESS as invalid addresses (this
seems like a really safe fix to me and it makes the test a bit simpler).

Also adds the MemorySource abstraction class that allows us to mock a process in this unit test. It essentially has
the minimal interface so that StringPrinter can do all the calls it currently does, but obviously the implementation
could be more minimal. We can reduce that interface more in the future once StringPrinter doesn't use all of these
functions to do its job.

Diff Detail

Event Timeline

teemperor created this revision.Oct 9 2019, 4:24 AM

Btw, the current declaration of MemorySource is just what I came up with on the fly. Not sure where the documentation should go or if that class deserves its own header.