[Lldb-commits] [lldb] [lldb] Add ReadCStrings API to Process (PR #172026)

Felipe de Azevedo Piovezan via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 18 01:25:46 PST 2025


felipepiovezan wrote:

> I think it would be better to change `Process::ReadMemoryRanges` to return `llvm::SmallVector<llvm::Expected<llvm::MutableArrayRef<uint8_t>>>` and then we could change `lldb_private::StringList` to hold a `std::vector<llvm::Expected<std::string>>`, add a `HasError` method to check if it contains any error, as well as a `GetErrorAtIndex()` method to surface the error appropriately. 

This was discussed during the RFC, and the conclusion was that if a memory read did not return the number of bytes requested, a user could call the single-address variant if they really wanted more details. Even then, it was felt that _what_ the error was was not relevant, only the fact that _some_ error occurred, which is already expressed by the read length.

> That way you could keep your SBStringString api, but in the even where there was a memory read failure for one of the addresses, the user could get the error from the same SBStringList object.

This would be akin to changing the behavior of an SB object, which I don't think we are allowed to do


https://github.com/llvm/llvm-project/pull/172026


More information about the lldb-commits mailing list