In order to write applications with the lldb C++ API which support non-8-bit bytes targets, it is necessary to extend the API somewhat.
To use lldb's ReadMemory interface, which accepts a buffer sized by the host's definition of a byte, I have added the following "discovery" functions:
SBSection::GetTargetByteSize
SBTarget::GetCodeByteSize
SBTarget::GetDataByteSize
additionally I have added SBTarget::ResolveFileAddress, which resolves a file address to a section. With the above discovery functions, my test C++ application, can correctly deduce the host buffer allocation necessary, and decode the read data, for an address read on the target.
I added SBTarget::ReadMemory too, so that my test application can read memory (straight from the object file) without a running process. This function merely being a wrapper on the existent Target::ReadMemory.
(As an aside I added SBTarget::GetPlatform, since I found this useful as a sanity check when using my test C++ application.)
For each C++ API routine I have added a test case. I've run these case on linux and FreeBSD to my satisfaction. I've assumed that these tests will work on MACH-O, so I did not decorate them with "@dwarf_test". Feel free to comment if this is considered to be a poor omission.