Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inaccurate debuginfo for pointer types in PDB #106679

Open
artemmukhin opened this issue Jan 10, 2023 · 0 comments
Open

Inaccurate debuginfo for pointer types in PDB #106679

artemmukhin opened this issue Jan 10, 2023 · 0 comments
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@artemmukhin
Copy link
Contributor

Consider the following code compiled using x86_64-pc-windows-msvc toolchain:

fn func(
    my_string: String,
    my_string_ref: &String,
    my_string_ref_mut: &mut String,
    my_string_ptr_const: *const String,
    my_string_ptr_mut: *mut String,
) {
    zzz(); // break
}

References and raw pointers are practically indistinguishable during debugging:

parameter_types

In the raw PDB dump, we can see that my_string_ref, my_string_ref_mut, my_string_ptr_const, and my_string_ptr_mut share the same type:

PDB dump

2848 | S_LOCAL [size = 20] `my_string`
  type=0x115A (alloc::string::String&), flags = param
2868 | S_DEFRANGE_FRAMEPOINTER_REL [size = 20]
  offset = -40, range = [0001:5606,+56)
  gaps = 2
2888 | S_DEFRANGE_REGISTER [size = 16]
  register = RCX, may have no name = false, range start = 0001:5606, length = 21
  gaps = []
2904 | S_LOCAL [size = 24] `my_string_ref`
  type=0x1071 (alloc::string::String*), flags = param
2928 | S_DEFRANGE_FRAMEPOINTER_REL [size = 16]
  offset = -32, range = [0001:5622,+56)
  gaps = 2
2944 | S_LOCAL [size = 28] `my_string_ref_mut`
  type=0x1071 (alloc::string::String*), flags = param
2972 | S_DEFRANGE_FRAMEPOINTER_REL [size = 16]
  offset = -24, range = [0001:5622,+56)
  gaps = 2
2988 | S_LOCAL [size = 32] `my_string_ptr_const`
  type=0x1071 (alloc::string::String*), flags = param
3020 | S_DEFRANGE_FRAMEPOINTER_REL [size = 16]
  offset = -16, range = [0001:5622,+56)
  gaps = 2
3036 | S_LOCAL [size = 28] `my_string_ptr_mut`
  type=0x1071 (alloc::string::String*), flags = param
3064 | S_DEFRANGE_FRAMEPOINTER_REL [size = 16]
  offset = 48, range = [0001:5622,+56)
  gaps = 2

Meta

rustc --version --verbose:

rustc 1.68.0-nightly (3020239de 2023-01-09)
binary: rustc
commit-hash: 3020239de947ec52677e9b4e853a6a9fc073d1f9
commit-date: 2023-01-09
host: x86_64-pc-windows-msvc
release: 1.68.0-nightly
LLVM version: 15.0.6
@artemmukhin artemmukhin added the C-bug Category: This is a bug. label Jan 10, 2023
@artemmukhin artemmukhin changed the title Inaccurate debuginfo for function parameters' types in PDB Inaccurate debuginfo for pointer types in PDB Jan 10, 2023
@wesleywiser wesleywiser added A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) O-windows-msvc Toolchain: MSVC, Operating system: Windows labels Jan 10, 2023
@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) C-bug Category: This is a bug. O-windows-msvc Toolchain: MSVC, Operating system: Windows T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants