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

Med Ismail Bennani via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 17 11:41:27 PST 2025


medismailben wrote:

I'm not a big fan of using the StringList as the return type since it's make `ReadCStrings` a lossy API.  Having such critical API be lossy seems wrong to me. If you don't think SBValueList is the right thing to use, we should come up with something else.

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. 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.

I'd recommend doing this in a separate PR, that'd land before this one, so we can make use of it here.

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


More information about the lldb-commits mailing list