[Lldb-commits] [PATCH] D129750: [lldb] Always use APFloat for FP dumping

Pavel Labath via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 14 04:12:12 PDT 2022


labath created this revision.
labath added reviewers: JDevlieghere, jingham, DavidSpickett, Emmmer.
Herald added subscribers: jsji, pengfei.
Herald added a project: All.
labath requested review of this revision.
Herald added a project: LLDB.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129750

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129750.444586.patch
Type: text/x-patch
Size: 16833 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220714/492fb9df/attachment.bin>


More information about the lldb-commits mailing list