[all-commits] [llvm/llvm-project] 5033f0: [lldb] Avoid unhandled Error in TypeSystemMap::Get...

Dimitry Andric via All-commits all-commits at lists.llvm.org
Mon Aug 16 08:38:17 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 5033f0793fe6e8b36990e6ce9f9ec2bf2ff79923
      https://github.com/llvm/llvm-project/commit/5033f0793fe6e8b36990e6ce9f9ec2bf2ff79923
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2021-08-16 (Mon, 16 Aug 2021)

  Changed paths:
    M lldb/source/Symbol/TypeSystem.cpp

  Log Message:
  -----------
  [lldb] Avoid unhandled Error in TypeSystemMap::GetTypeSystemForLanguage

When assertions are turned off, the `llvm::Error` value created at the
start of this function is overwritten using the move-assignment
operator, but the success value is never checked. Whenever a TypeSystem
cannot be found or created, this can lead to lldb core dumping with:

    Program aborted due to an unhandled Error:
    Error value was Success. (Note: Success values must still be checked prior to being destroyed).

Fix this by not creating a `llvm::Error` value in advance, and directly
returning the result of `llvm::make_error` instead, whenever an error is
encountered.

See also: <https://bugs.freebsd.org/253881> and
<https://bugs.freebsd.org/257829>.

Reviewed By: teemperor

Differential Revision: https://reviews.llvm.org/D108088




More information about the All-commits mailing list