[lldb-dev] "Correctly use GetLoadedModuleList to take advantage of libraries-svr4" can cause LLDB to abort

Ted Woodward via lldb-dev lldb-dev at lists.llvm.org
Tue Aug 13 11:19:55 PDT 2019


Hi Antonio,

This is in regards to https://reviews.llvm.org/D64013 , specifically this code in ProcessGDBRemote::GetImageInfoAddress:

  if (addr == LLDB_INVALID_ADDRESS) {
    llvm::Expected<LoadedModuleInfoList> list = GetLoadedModuleList();
    if (!list) {
      Log *log(ProcessGDBRemoteLog::GetLogIfAllCategoriesSet(GDBR_LOG_PROCESS));
      LLDB_LOG_ERROR(log, list.takeError(), "Failed to read module list: {0}");
    } else {
      addr = list->m_link_map;
    }
  }

If LLVM_ENABLE_ABI_BREAKING_CHECKS is set to 1 (which is true when asserts are enabled), llvm::Expected will call abort() if there is an error.
GetLoadedModuleList() has many reasons to set an error, including when XML is not available, or when the stub doesn't support remote modules.

I don't think we ever want to crash LLDB if the remote stub doesn't support something. I don't think llvm::Expected is the right solution here, and I think it should be removed.

Ted
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190813/9248f1e2/attachment-0001.html>


More information about the lldb-dev mailing list