[Lldb-commits] [PATCH] D68691: [lldb] Add MemorySource abstraction, unit test StringPrinter and document found bugs

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 04:27:54 PDT 2019


teemperor created this revision.
teemperor added a reviewer: labath.
Herald added subscribers: lldb-commits, JDevlieghere, abidh, mgorny.
Herald added a project: LLDB.
teemperor added a comment.

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.


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.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D68691

Files:
  lldb/include/lldb/DataFormatters/StringPrinter.h
  lldb/include/lldb/Target/Process.h
  lldb/source/DataFormatters/StringPrinter.cpp
  lldb/unittests/CMakeLists.txt
  lldb/unittests/DataFormatters/CMakeLists.txt
  lldb/unittests/DataFormatters/StringPrinterTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68691.224015.patch
Type: text/x-patch
Size: 42967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191009/96f3ba2f/attachment-0001.bin>


More information about the lldb-commits mailing list