[all-commits] [llvm/llvm-project] 177dd6: Data formatters: fix detection of C strings

Raphael Isemann via All-commits all-commits at lists.llvm.org
Tue Mar 24 06:26:18 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 177dd63c8d742250dac6ea365e7c30f0fbab3257
      https://github.com/llvm/llvm-project/commit/177dd63c8d742250dac6ea365e7c30f0fbab3257
  Author: Jaroslav Sevcik <jarin at google.com>
  Date:   2020-03-24 (Tue, 24 Mar 2020)

  Changed paths:
    M lldb/source/Core/ValueObject.cpp
    A lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/Makefile
    A lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/TestCstringUnicode.py
    A lldb/test/API/functionalities/data-formatter/cstring-utf8-summary/main.cpp

  Log Message:
  -----------
  Data formatters: fix detection of C strings

Summary:
Detection of C strings does not work well for pointers. If the value object holding a (char*) pointer does not have an address (e.g., if it is a temp), the value is not considered a C string and its formatting is left to DumpDataExtractor rather than the special handling in  ValueObject::DumpPrintableRepresentation. This leads to inconsistent outputs, e.g., in escaping non-ASCII characters. See the test for an example; the second test expectation is not met (without this patch). With this patch, the C string detection only insists that the pointer value is valid. The patch makes the code consistent with how the pointer is obtained in ValueObject::ReadPointedString.

Reviewers: teemperor

Reviewed By: teemperor

Subscribers: lldb-commits

Tags: #lldb

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




More information about the All-commits mailing list