Skip to content

Add Natvis visualiser and debuginfo tests for f128 - #161777

Open
beetrees wants to merge 1 commit into
rust-lang:mainfrom
beetrees:f128-debuginfo
Open

Add Natvis visualiser and debuginfo tests for f128#161777
beetrees wants to merge 1 commit into
rust-lang:mainfrom
beetrees:f128-debuginfo

Conversation

@beetrees

@beetrees beetrees commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

To render f128s in debuggers on MSVC targets, this PR changes the compiler to output f128s as struct f128 { low_bits: u64, high_bits: u64 }, and includes a Natvis visualiser that displays the float in hexdecimal format (similar to the LowerHex impl in #160626), as unlike f16 there's no larger supported float format to convert to and trying to write a float to decimal string converter in Natvis didn't seem practical. gdb, lldb and cdb tests are also included for f128, although gdb does not yet correctly identify the float format.

I did consider also displaying a double approximation of the f128 (as the debugger will convert that to a decimal string) but decided against it as f64 has a significantly smaller exponent range too (meaning very large or small f128s couldn't have an approximation anyway) and cdb and WinDbg both seem to round all floating-point numbers to 6 decimal places, meaning the displayed number is (double) rounded even further than f64 precision and is useless for tiny values.

Closes #121837
Tracking issue: #116909

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 25, 2026
@beetrees
beetrees marked this pull request as ready for review August 25, 2026 19:20
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 25, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Aug 25, 2026
@rustbot

rustbot commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

r? @JohnTitor

rustbot has assigned @JohnTitor.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 75 candidates
  • Random selection from 16 candidates

@beetrees

Copy link
Copy Markdown
Contributor Author

cc MSVC target maintainers: @ChrisDenton @dpaoliello @Fulgen301 @lambdageek @sivadeilra @wesleywiser

@beetrees

beetrees commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

(Given this touches debuginfo tests this should probably get a bors try x86_64-msvc-* i686-msvc-* aarch64-msvc-* aarch64-apple-*.)

@folkertdev

folkertdev commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

@bors try jobs=x86_64-msvc-,i686-msvc-,aarch64-msvc-,aarch64-apple-

1 similar comment
@folkertdev

Copy link
Copy Markdown
Contributor

@bors try jobs=x86_64-msvc-,i686-msvc-,aarch64-msvc-,aarch64-apple-

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 25, 2026
Add Natvis visualiser and debuginfo tests for `f128`


try-job: x86_64-msvc-*
try-job: i686-msvc-*
try-job: aarch64-msvc-*
try-job: aarch64-apple-*
@rust-log-analyzer

This comment has been minimized.

@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 25, 2026
@rust-bors

rust-bors Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 816a2f0 failed: CI. Failed jobs:

@beetrees

Copy link
Copy Markdown
Contributor Author

According to the table on Wikipedia, there isn't any Xcode versions yet with LLDB 22 or later, so I've ignored the f128 debuginfo tests on Apple for now and left a FIXME.

@folkertdev

Copy link
Copy Markdown
Contributor

@bors try jobs=x86_64-msvc-,i686-msvc-,aarch64-msvc-,aarch64-apple-

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 26, 2026
Add Natvis visualiser and debuginfo tests for `f128`


try-job: x86_64-msvc-*
try-job: i686-msvc-*
try-job: aarch64-msvc-*
try-job: aarch64-apple-*
@rust-bors

rust-bors Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d79cce8 (d79cce855e6f305d9b8796f97b79e09fb0a5c022)
Base parent: 3ffb26f (3ffb26fbf5bf232cf59e314e75ea325973f4f583)

@beetrees

Copy link
Copy Markdown
Contributor Author

@rustbot review

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 26, 2026

@JohnTitor JohnTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! I'm not going to r+ just in case you want to wait for another look from the target maintainers. Ohterwise r=me

View changes since this review

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@beetrees

Copy link
Copy Markdown
Contributor Author

I've updated the LLDB tests that this PR adds in basic-types-mut-globals.rs to match the changes made to the existing ones in basic-types-globals.rs in the rebase. Not sure if this counts as significant enough to require a review or if the r=me still stands, so I'll air on the side of caution.

@beetrees
beetrees requested a review from JohnTitor September 10, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve MSVC debug info for f16 and f128

5 participants