Page MenuHomePhabricator

[lldb] Fix that LLDB doesn't print NaN's sign on Darwin
ClosedPublic

Authored by teemperor on Thu, May 20, 7:50 AM.

Details

Summary

It seems std::ostringstream ignores NaN signs on Darwin while it prints them on Linux. This causes
that LLDB behaves differently on those platforms which is both confusing for users and it also
means we have to deal with that in our tests.

This patch manually implements the NaN/Inf printing (which are apparently implementation defined)
to make LLDB print the same thing on all platforms. The only output difference in practice seems to
be that we now print negative NaNs as -nan, but this potentially also changes the output on other
systems I haven't tested this on.

Diff Detail

Event Timeline

teemperor requested review of this revision.Thu, May 20, 7:50 AM
teemperor planned changes to this revision.
teemperor created this revision.

That's the wrong set of tests...

teemperor updated this revision to Diff 346744.Thu, May 20, 8:08 AM
  • Now uploaded the right tests.
JDevlieghere accepted this revision.Thu, May 20, 8:16 PM

LGTM

lldb/source/Core/DumpDataExtractor.cpp
238–240

Seems like this could be part of the doxygen comment above?

This revision is now accepted and ready to land.Thu, May 20, 8:16 PM

LGTM besides my minor comment on headers. Thanks for fixing this!

lldb/source/Core/DumpDataExtractor.cpp
241

We are not explicitly including <cmath> for std::isnan we should replace math.h include. We should replace all the C header includes for C++ ones but that feels out of scope for this change.

LGTM besides my minor comment on headers. Thanks for fixing this!

lldb/unittests/Core/DumpDataExtractorTest.cpp
212

We should explicitly include <limits>

This revision was landed with ongoing or failed builds.Tue, May 25, 4:33 AM
This revision was automatically updated to reflect the committed changes.