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

Raphael Isemann via All-commits all-commits at lists.llvm.org
Thu Aug 19 21:49:43 PDT 2021


  Branch: refs/heads/release/13.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 535b7fb2201ab2025594de7e476179e37546d73f
      https://github.com/llvm/llvm-project/commit/535b7fb2201ab2025594de7e476179e37546d73f
  Author: Dimitry Andric <dimitry at andric.com>
  Date:   2021-08-19 (Thu, 19 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

(cherry picked from commit 5033f0793fe6e8b36990e6ce9f9ec2bf2ff79923)


  Commit: 10a4a861837dc97dc4c75f1b9e33213b547dc24b
      https://github.com/llvm/llvm-project/commit/10a4a861837dc97dc4c75f1b9e33213b547dc24b
  Author: Raphael Isemann <teemperor at gmail.com>
  Date:   2021-08-19 (Thu, 19 Aug 2021)

  Changed paths:
    M lldb/unittests/Symbol/CMakeLists.txt
    A lldb/unittests/Symbol/TestTypeSystem.cpp

  Log Message:
  -----------
  [lldb] Add tests for TypeSystemMap::GetTypeSystemForLanguage

Regression tests for D108088 .

Reviewed By: mib

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

(cherry picked from commit cf521e78dfd2a418970358e5d55dcc9a862664e5)


Compare: https://github.com/llvm/llvm-project/compare/ddc49d0f1f2b...10a4a861837d


More information about the All-commits mailing list