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

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

View all comments

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.

JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 18, 2026
Add Natvis visualiser and debuginfo tests for `f128`

To render f128s in debuggers on MSVC targets, this PR changes the compiler to output `f128`s 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 rust-lang#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 `f128`s 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 rust-lang#121837
Tracking issue: rust-lang#116909
rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #160401 (sparc: make ABI consistent with clang)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162423 (Rename the src install build step to rust-src.)
 - #162740 (stdarch subtree update)
 - #162824 (link Enzyme and the offload with in-tree lld if possible)
 - #162832 (add `Div` and `Mul` for `Complex<{float}>`)
 - #161005 (fix: unfulfilled nested dead code lint)
 - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase)
 - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch)
 - #162661 (simplify `Target::GenericParam`)
 - #162666 (Tidy footnote in `platform-support.md`)
 - #162803 (docs(num): add documentation for `NonZero::from_str`)
 - #162906 (Move more `rustdoc-html` tests in the right location)
 - #162922 (An assortment of polonius tweaks)
 - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 18, 2026
Add Natvis visualiser and debuginfo tests for `f128`

To render f128s in debuggers on MSVC targets, this PR changes the compiler to output `f128`s 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 rust-lang#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 `f128`s 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 rust-lang#121837
Tracking issue: rust-lang#116909
rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
…uwer

Rollup of 15 pull requests

Successful merges:

 - #160401 (sparc: make ABI consistent with clang)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162423 (Rename the src install build step to rust-src.)
 - #162740 (stdarch subtree update)
 - #162824 (link Enzyme and the offload with in-tree lld if possible)
 - #161005 (fix: unfulfilled nested dead code lint)
 - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase)
 - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch)
 - #162661 (simplify `Target::GenericParam`)
 - #162666 (Tidy footnote in `platform-support.md`)
 - #162803 (docs(num): add documentation for `NonZero::from_str`)
 - #162906 (Move more `rustdoc-html` tests in the right location)
 - #162922 (An assortment of polonius tweaks)
 - #162929 (Update unicode_data to Unicode version 18.0.0)
 - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Sep 18, 2026
Add Natvis visualiser and debuginfo tests for `f128`

To render f128s in debuggers on MSVC targets, this PR changes the compiler to output `f128`s 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 rust-lang#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 `f128`s 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 rust-lang#121837
Tracking issue: rust-lang#116909
rust-bors Bot pushed a commit that referenced this pull request Sep 18, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #160401 (sparc: make ABI consistent with clang)
 - #161777 (Add Natvis visualiser and debuginfo tests for `f128`)
 - #162740 (stdarch subtree update)
 - #162824 (link Enzyme and the offload with in-tree lld if possible)
 - #161005 (fix: unfulfilled nested dead code lint)
 - #161803 (Fix docs of make_ascii_lowercase/make_ascii_upercase)
 - #162256 (Add mentions to sync back `RELEASES.md` to the `main` branch)
 - #162661 (simplify `Target::GenericParam`)
 - #162666 (Tidy footnote in `platform-support.md`)
 - #162803 (docs(num): add documentation for `NonZero::from_str`)
 - #162906 (Move more `rustdoc-html` tests in the right location)
 - #162922 (An assortment of polonius tweaks)
 - #162929 (Update unicode_data to Unicode version 18.0.0)
 - #162930 (Use niche length type for strlen to guarantee `isize::MAX` bound)
@JonathanBrouwer

Copy link
Copy Markdown
Member

💔 I suspect this PR failed tests as part of a rollup
@bors r-

After fixing the problem, consider running a try job for the failed job before re-approving.

Link to failure: #162973 (comment)

@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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 18, 2026
@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved.

This PR was contained in a rollup (#162973), which was unapproved.

View changes since this unapproval

@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

⚠️ A new commit b7bad07da0564a861c8ffcbeb290d4409f5cb937 was pushed.

This PR was contained in a rollup (#162973), which was closed.

@beetrees

Copy link
Copy Markdown
Contributor Author

Test fails locally on i686-unknown-linux-gnu - I think GDB can't find any 16-byte float type to represent it internally so can't even display the DWARF type name. Since GDB doesn't have proper f128 support yet and the type names working is more of a coincidence, I've replaced the failing checks with FIXMEs.

@bors try jobs=test-i686-gnu-nopt-1

@rust-bors

This comment has been minimized.

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


try-job: test-i686-gnu-nopt-1
@rust-bors

rust-bors Bot commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: fd84d0d (fd84d0de4842e4d20e8d41134ffe0b41ef0060c6)
Base parent: 420ed2a (420ed2a0c3d7225b1744266fd884d431b4d8cfe0)

@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 Sep 18, 2026
@JohnTitor

Copy link
Copy Markdown
Member

@bors r+

@rust-bors

rust-bors Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

📌 Commit b7bad07 has been approved by JohnTitor

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 19, 2026
Zalathar added a commit to Zalathar/rust that referenced this pull request Sep 19, 2026
Add Natvis visualiser and debuginfo tests for `f128`

To render f128s in debuggers on MSVC targets, this PR changes the compiler to output `f128`s 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 rust-lang#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 `f128`s 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 rust-lang#121837
Tracking issue: rust-lang#116909
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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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

7 participants