Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve MSVC debug info for f16 and f128 #121837

Open
Labels
A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.E-needs-investigationCall for partcipation: This issues needs some investigation to determine current statusF-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]`O-windows-msvcToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-debuggingWorking group: Bad Rust debugging experiences
@tgross35

Description

@tgross35

The code at

implMsvcBasicNamefor ty::FloatTy{
fnmsvc_basic_name(self) ->&'staticstr{
// FIXME: f16 and f128 have no MSVE representation. We could improve the debuginfo.
// See: <https://github.com/rust-lang/rust/pull/114607/files#r1454683264>
matchself{
ty::FloatTy::F16 =>"half",
ty::FloatTy::F32 =>"float",
ty::FloatTy::F64 =>"double",
ty::FloatTy::F128 =>"fp128",
}
}
}
produces a debug representation for MSVC, which could be improved. Quoting from@MaulingMonkey inhttps://github.com/rust-lang/rust/pull/114607/files#r1454683264:

Not sure if proper support is possible here without bugging Microsoft. Even if it is possible, Microsoft hasn't bothered for their own SDK types (e.g._FLOAT128 can be found in the windows SDK, but it's just a struct around a couple of u64s and has no useful debug visualizers.)

If itwere possible:

* Emit debug info for a `u16`/`u128`-wrapping structure (I'm fuzzy on the details here, I've only wrapped existing emitted types rather than emitting my own.  Merely defining an unused std type might not be enough as such types will get culled IME?)* Write/extend a `*.natvis` file (probably [rust/src/etc/natvis/intrinsics.natvis](https://github.com/rust-lang/rust/blob/6bf600bc98879bf1bf2ab0f3b3b37c965f5bdff6/src/etc/natvis/intrinsic.natvis)?) that unpacks the bits and reconstitutes them as an approximate double or float in it's `<DisplayString>`.    * How do you transmute/type-pun from `u64` → `f64` in the subset of C++ allowed by the debugger (no pointer-to-temporary shenannigans)?  _Maybe_ abuse a union somehow...?  * See [`natvis-pdbs` Recommended Reading](https://crates.io/crates/natvis-pdbs#recommended-reading)  * If you added a new `*.nativs` file for some reason, make sure it's referenced properly (see e.g. [rust/src/bootstrap/src/core/build_steps/dist.rs](https://github.com/rust-lang/rust/blob/master/src/bootstrap/src/core/build_steps/dist.rs#L535-L538)  * Consider unit tests like [tests/debuginfo/pretty-std-collections-hash.rs](https://github.com/rust-lang/rust/blob/6bf600bc98879bf1bf2ab0f3b3b37c965f5bdff6/tests/debuginfo/pretty-std-collections-hash.rs#L1)

(It'spossible to call_CrtCheckMemory() from a watch window. I forget if this works in a*.natvis visualizer. If so, you could theoretically authorF128toApproxF64(high: u64, low: u64) and stuff it in a DLL? Or better yet, let someone more foolish take the time to go downthat rabbit hole and shave that yak...)

@rustbot label +F-f16_and_f128

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)E-hardCall for participation: Hard difficulty. Experience needed to fix: A lot.E-needs-investigationCall for partcipation: This issues needs some investigation to determine current statusF-f16_and_f128`#![feature(f16)]`, `#![feature(f128)]`O-windows-msvcToolchain: MSVC, Operating system: WindowsT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.WG-debuggingWorking group: Bad Rust debugging experiences

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp