summaryrefslogtreecommitdiffstats
path: root/lldb/source/Target
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-09-04 11:41:23 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-09-04 11:41:23 +0000
commite5814d78ce51a072901573e6f86df6b9a79153ce (patch)
treedef3c1a3c1d138530e4d1abd3645d099a378dd81 /lldb/source/Target
parente36fd9ed7602b8c78c6c0ba9103bba59b65b4556 (diff)
downloadbcm5719-llvm-e5814d78ce51a072901573e6f86df6b9a79153ce.tar.gz
bcm5719-llvm-e5814d78ce51a072901573e6f86df6b9a79153ce.zip
[lldb] Limit the amount of zeroes we use for padding when printing small floats
Summary: We got a radar that printing small floats is not very user-friendly in LLDB as we print them with up to 100 leading zeroes before starting to use scientific notation. This patch changes this by already using scientific notation when we hit 6 padding zeroes by default and moves this value into a target setting so that users can just set this number back to 100 if they for some reason preferred the old behaviour. This new setting is influencing how we format data, so that's why we have to reset the data visualisation cache when it is changed. Note that we have always been using scientific notation for large numbers because it seems that the LLVM implementation doesn't support printing out the padding zeroes for them. I would have fixed that if it was trivial, but looking at the LLVM implementation for this it seems that this is not as trivial as it sounds. I would say we look into this if we ever get a bug report about someone wanting to have a large amount of trailing zeroes in their numbers instead of using scientific notation. Fixes rdar://39744137 Reviewers: #lldb, clayborg Reviewed By: clayborg Subscribers: JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D67001 llvm-svn: 370880
Diffstat (limited to 'lldb/source/Target')
-rw-r--r--lldb/source/Target/Target.cpp6
-rw-r--r--lldb/source/Target/TargetProperties.td3
2 files changed, 9 insertions, 0 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index 5675e788a21..c92d63882c0 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -3789,6 +3789,12 @@ bool TargetProperties::GetEnableSyntheticValue() const {
nullptr, idx, g_target_properties[idx].default_uint_value != 0);
}
+uint32_t TargetProperties::GetMaxZeroPaddingInFloatFormat() const {
+ const uint32_t idx = ePropertyMaxZeroPaddingInFloatFormat;
+ return m_collection_sp->GetPropertyAtIndexAsUInt64(
+ nullptr, idx, g_target_properties[idx].default_uint_value);
+}
+
uint32_t TargetProperties::GetMaximumNumberOfChildrenToDisplay() const {
const uint32_t idx = ePropertyMaxChildrenCount;
return m_collection_sp->GetPropertyAtIndexAsSInt64(
diff --git a/lldb/source/Target/TargetProperties.td b/lldb/source/Target/TargetProperties.td
index 7fa8f1cdd8d..9079c3cf427 100644
--- a/lldb/source/Target/TargetProperties.td
+++ b/lldb/source/Target/TargetProperties.td
@@ -60,6 +60,9 @@ let Definition = "target" in {
def SaveObjects: Property<"save-jit-objects", "Boolean">,
DefaultFalse,
Desc<"Save intermediate object files generated by the LLVM JIT">;
+ def MaxZeroPaddingInFloatFormat: Property<"max-zero-padding-in-float-format", "UInt64">,
+ DefaultUnsignedValue<6>,
+ Desc<"The maximum number of zeroes to insert when displaying a very small float before falling back to scientific notation.">;
def MaxChildrenCount: Property<"max-children-count", "SInt64">,
DefaultUnsignedValue<256>,
Desc<"Maximum number of children to expand in any level of depth.">;
OpenPOWER on IntegriCloud