[all-commits] [llvm/llvm-project] 1400a3: [lldb] Always use APFloat for FP dumping

Pavel Labath via All-commits all-commits at lists.llvm.org
Wed Jul 27 05:30:50 PDT 2022

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 1400a3cb8d53c8c10e23ecdd4f241ea9cff404b5
  Author: Pavel Labath <pavel at labath.sk>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M lldb/include/lldb/Core/DumpRegisterValue.h
    M lldb/source/Commands/CommandObjectRegister.cpp
    M lldb/source/Core/DumpDataExtractor.cpp
    M lldb/source/Core/DumpRegisterValue.cpp
    M lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
    M lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
    M lldb/unittests/Core/DumpDataExtractorTest.cpp

  Log Message:
  [lldb] Always use APFloat for FP dumping

The DumpDataExtractor function had two branches for printing floating
point values. One branch (APFloat) was used if we had a Target object
around and could query it for the appropriate semantics. If we didn't
have a Target, we used host operations to read and format the value.

This patch changes second path to use APFloat as well. To make it work,
I pick reasonable defaults for different byte size. Notably, I did not
include x87 long double in that list (as it is ambibuous and
architecture-specific). This exposed a bug where we were printing
register values using the target-less branch, even though the registers
definitely belong to a target, and we had it available. Fixing this
prompted the update of several tests for register values due to slightly
different floating point outputs.

The most dubious aspect of this patch is the change in
TypeSystemClang::GetFloatTypeSemantics to recognize `10` as a valid size
for x87 long double. This was necessary because because sizeof(long
double) on x86_64 is 16 even though it only holds 10 bytes of useful
data. This generalizes the hackaround present in the target-free branch
of the dumping function.

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

More information about the All-commits mailing list