[all-commits] [llvm/llvm-project] 7afd25: Fix the std::string formatter to report errors in ...

jimingham via All-commits all-commits at lists.llvm.org
Tue May 17 08:22:46 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 7afd257ff8a45a348767b4432abc6f4f105fc376
      https://github.com/llvm/llvm-project/commit/7afd257ff8a45a348767b4432abc6f4f105fc376
  Author: Jim Ingham <jingham at apple.com>
  Date:   2022-05-17 (Tue, 17 May 2022)

  Changed paths:
    M lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp
    M lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/TestDataFormatterLibcxxString.py
    M lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/string/main.cpp

  Log Message:
  -----------
  Fix the std::string formatter to report errors in the case where the
string points to unaccessible memory.

The formatter tries to get the data field of the std::string, and to
check whether that fails it just checks that the ValueObjectSP
returned is not empty. But we never return empty ValueObjectSP's to
indicate failure, since doing so would lose the Error object that
tells you why fetching the ValueObject failed.

This patch adds a check for ValueObject::GetError().Success().

I also added a test case for this failure, and reworked the test case
a bit (to use run_to_source_breakpoint). I also renamed a couple of
single letter locals which don't follow the lldb coding conventions.

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




More information about the All-commits mailing list