about summary refs log tree commit diff
path: root/src/test/debuginfo
AgeCommit message (Collapse)AuthorLines
2021-09-26Remove box syntax from most places in src/test outside of the issues direst31-100/+83
2021-09-22Rollup merge of #89127 - wesleywiser:reenable_mutex_debuginfo_test, r=ehussthe8472-7/+5
Re-enable the `src/test/debuginfo/mutex.rs` test on Windows This test required a newer version of cdb than was previously enabled in CI thus leading to some bitrot in the test since the time it was originally created. With the update to the `windows-latest` image last week, we're now running this test in CI and thus uncovered the regression. I've updated the test and it now passes. r? `@ehuss`
2021-09-22Auto merge of #88629 - wesleywiser:fix_debuginfo_for_scalarpair_params, ↵bors-0/+101
r=oli-obk Fix debuginfo for parameters passed via the ScalarPair abi on Windows Mark all of these as locals so the debugger does not try to interpret them as being a pointer to the value. This extends the approach used in #81898. Fixes #88625
2021-09-20Re-enable the `src/test/debuginfo/mutex.rs` test on WindowsWesley Wiser-7/+5
This test required a newer version of cdb than was previously enabled in CI thus leading to some bitrot in the test since the time it was originally created. With the update to the `windows-latest` image last week, we're now running this test in CI and thus uncovered the regression. I've updated the test and it now passes.
2021-09-20Auto merge of #88842 - wesleywiser:fix_dbg_tests_windows_sdk, r=michaelwoeristerbors-89/+58
Fix debuginfo tests for the latest version of the Windows SDK. Re-enable the tests that were disabled to fix CI. Changes: - Cdb now correctly visualizes enums. - Cdb doesn't render emoji characters in `OSStr` anymore. - Cdb doesn't always render `str` correctly (#88840)
2021-09-15Disable debuginfo test on Windows that fails in new cdb version.Eric Huss-0/+2
2021-09-13Fix debuginfo for ScalarPair abi parametersWesley Wiser-9/+10
Mark all of these as locals so the debugger does not try to interpret them as being a pointer to the value. This extends the approach used in PR #81898.
2021-09-13Add test to show issue with ScalarPair parametersWesley Wiser-0/+100
2021-09-10Fix debuginfo tests for the latest version of the Windows SDK.Wesley Wiser-77/+58
- Cdb now correctly visualizes enums. - Cdb doesn't render emoji characters in `OSStr` anymore. - Cdb doesn't always render `str` correctly (#88840)
2021-09-10Revert "Temporarily ignore some debuginfo tests on windows."Wesley Wiser-12/+0
This reverts commit 8059bc1069b88a51ec2dfc2483854b9a854b1994.
2021-09-10Temporarily ignore some debuginfo tests on windows.Mara Bos-0/+12
2021-08-30`feature(const_param_types)` -> `feature(adt_const_params)`lcnr-1/+1
2021-08-30`feature(const_generics)` -> `feature(const_param_types)`lcnr-2/+2
2021-08-27Auto merge of #88371 - Manishearth:rollup-pkkjsme, r=Manishearthbors-0/+383
Rollup of 11 pull requests Successful merges: - #87832 (Fix debugger stepping behavior with `match` expressions) - #88123 (Make spans for tuple patterns in E0023 more precise) - #88215 (Reland #83738: "rustdoc: Don't load all extern crates unconditionally") - #88216 (Don't stabilize creation of TryReserveError instances) - #88270 (Handle type ascription type ops in NLL HRTB diagnostics) - #88289 (Fixes for LLVM change 0f45c16f2caa7c035e5c3edd40af9e0d51ad6ba7) - #88320 (type_implements_trait consider obligation failure on overflow) - #88332 (Add argument types tait tests) - #88340 (Add `c_size_t` and `c_ssize_t` to `std::os::raw`.) - #88346 (Revert "Add type of a let tait test impl trait straight in let") - #88348 (Add field types tait tests) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2021-08-26Add test for stepping though `match` expressionsWesley Wiser-0/+383
2021-08-24tests: support -Zsymbol-mangling-version=v0 being the default.Eduard-Mihai Burtescu-2/+2
2021-08-16Fix a debuginfo testCameron Steffen-1/+3
2021-08-14Auto merge of #85020 - lrh2000:named-upvars, r=tmandrybors-7/+161
Name the captured upvars for closures/generators in debuginfo Previously, debuggers print closures as something like ``` y::main::closure-0 (0x7fffffffdd34) ``` The pointer actually references to an upvar. It is not very obvious, especially for beginners. It's because upvars don't have names before, as they are packed into a tuple. This PR names the upvars, so we can expect to see something like ``` y::main::closure-0 {_captured_ref__b: 0x[...]} ``` r? `@tmandry` Discussed at https://github.com/rust-lang/rust/pull/84752#issuecomment-831639489 .
2021-07-25Fix failing testBenoît du Garreau-2/+2
2021-07-19Auto merge of #87153 - ↵bors-37/+41
michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser [debuginfo] Emit associated type bindings in trait object type names. This PR updates debuginfo type name generation for trait objects to include associated type bindings and auto trait bounds -- so that, for example, the debuginfo type name of `&dyn Iterator<Item=Foo>` and `&dyn Iterator<Item=Bar>` don't both map to just `&dyn Iterator` anymore. The following table shows examples of debuginfo type names before and after the PR: | type | before | after | |------|---------|-------| | `&dyn Iterator<Item=u32>>` | `&dyn Iterator` | `&dyn Iterator<Item=u32>` | | `&(dyn Iterator<Item=u32>> + Sync)` | `&dyn Iterator` | `&(dyn Iterator<Item=u32> + Sync)` | | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `&dyn SomeTrait<bool, i8>` | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | For targets that need C++-like type names, we use `assoc$<Item,u32>` instead of `Item=u32`: | type | before | after | |------|---------|-------| | `&dyn Iterator<Item=u32>>` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> > > >` | | `&(dyn Iterator<Item=u32>> + Sync)` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> >,Sync> >` | | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `ref$<dyn$<SomeTrait<bool, i8> > >` | `ref$<dyn$<SomeTrait<bool,i8,assoc$<Bar,u32> > >,Send> >` | The PR also adds self-profiling measurements for debuginfo type name generation (re. https://github.com/rust-lang/rust/issues/86431). It looks like the compiler spends up to 0.5% of its time in that task, so the potential for optimizing it via caching seems limited. However, the perf run also shows [the biggest regression](https://perf.rust-lang.org/detailed-query.html?commit=585e91c718b0b2c5319e1fffd0ff1e62aaf7ccc2&base_commit=b9197978a90be6f7570741eabe2da175fec75375&benchmark=tokio-webpush-simple-debug&run_name=incr-unchanged) in a test case that does not even invoke the code in question. This suggests that the length of the names we generate here can affect performance by influencing how much data the linker has to copy around. Fixes https://github.com/rust-lang/rust/issues/86134.
2021-07-19[debuginfo] Adapt CDB tests after changes to whitespace usage in debuginfo ↵Michael Woerister-12/+12
type names.
2021-07-16Rollup merge of #86983 - wesleywiser:natvis_std_types, r=michaelwoeristerGuillaume Gomez-37/+411
Add or improve natvis definitions for common standard library types Natvis definitions are used by Windows debuggers to provide a better experience when inspecting a value for types with natvis definitions. Many of our standard library types and intrinsic Rust types like slices and `str` already have natvis definitions. This PR adds natvis definitions for missing types (like all of the `Atomic*` types) and improves some of the existing ones (such as showing the ref count on `Arc<T>` and `Rc<T>` and showing the borrow state of `RefCell<T>`). I've also added cdb tests to cover these definitions and updated existing tests with the new visualizations. With this PR, the following types now visualize in a much more intuitive way: ### Type: `NonZero{I,U}{8,16,32,64,128,size}`, `Atomic{I,U}{8,16,32,64,size}`, `AtomicBool` and `Wrapping<T>` <details><summary>Example:</summary> ```rust let a_u32 = AtomicU32::new(32i32); ``` ``` 0:000> dx a_u32 a_u32 : 32 [Type: core::sync::atomic::AtomicU32] [<Raw View>] [Type: core::sync::atomic::AtomicU32] ``` </details> ### Type: `Cell<T>` and `UnsafeCell<T>` <details><summary>Example:</summary> ```rust let cell = Cell::new(123u8); let unsafecell = UnsafeCell::new((42u16, 30u16)); ``` ``` 0:000> dx cell cell : 123 [Type: core::cell::Cell<u8>] [<Raw View>] [Type: core::cell::Cell<u8>] 0:000> dx unsafecell unsafecell : (42, 30) [Type: core::cell::UnsafeCell<tuple<u16, u16>>] [<Raw View>] [Type: core::cell::UnsafeCell<tuple<u16, u16>>] [0] : 42 [Type: unsigned short] [1] : 30 [Type: unsigned short] ``` </details> ### Type: `RefCell<T>` <details><summary>Example:</summary> ```rust let refcell = RefCell::new((123u16, 456u32)); ``` ``` 0:000> dx refcell refcell : (123, 456) [Type: core::cell::RefCell<tuple<u16, u32>>] [<Raw View>] [Type: core::cell::RefCell<tuple<u16, u32>>] [Borrow state] : Unborrowed [0] : 123 [Type: unsigned short] [1] : 456 [Type: unsigned int] ``` </details> ### Type: `NonNull<T>` and `Unique<T>` <details><summary>Example:</summary> ```rust let nonnull: NonNull<_> = (&(10, 20)).into(); ``` ``` 0:000> dx nonnull nonnull : NonNull(0x7ff6a5d9c390: (10, 20)) [Type: core::ptr::non_null::NonNull<tuple<i32, i32>>] [<Raw View>] [Type: core::ptr::non_null::NonNull<tuple<i32, i32>>] [0] : 10 [Type: int] [1] : 20 [Type: int] ``` </details> ### Type: `Range<T>`, `RangeFrom<T>`, `RangeInclusive<T>`, `RangeTo<T>` and `RangeToInclusive<T>` <details><summary>Example:</summary> ```rust let range = (1..12); let rangefrom = (9..); let rangeinclusive = (32..=80); let rangeto = (..42); let rangetoinclusive = (..=120); ``` ``` 0:000> dx range range : (1..12) [Type: core::ops::range::Range<i32>] [<Raw View>] [Type: core::ops::range::Range<i32>] 0:000> dx rangefrom rangefrom : (9..) [Type: core::ops::range::RangeFrom<i32>] [<Raw View>] [Type: core::ops::range::RangeFrom<i32>] 0:000> dx rangeinclusive rangeinclusive : (32..=80) [Type: core::ops::range::RangeInclusive<i32>] [<Raw View>] [Type: core::ops::range::RangeInclusive<i32>] 0:000> dx rangeto rangeto : (..42) [Type: core::ops::range::RangeTo<i32>] [<Raw View>] [Type: core::ops::range::RangeTo<i32>] 0:000> dx rangetoinclusive rangetoinclusive : (..=120) [Type: core::ops::range::RangeToInclusive<i32>] [<Raw View>] [Type: core::ops::range::RangeToInclusive<i32>] ``` </details> ### Type: `Duration` <details><summary>Example:</summary> ```rust let duration = Duration::new(5, 12); ``` ``` 0:000> dx duration duration : 5s 12ns [Type: core::time::Duration] [<Raw View>] [Type: core::time::Duration] seconds : 5 [Type: unsigned __int64] nanoseconds : 12 [Type: unsigned int] ``` </details> ### Type: `ManuallyDrop<T>` <details><summary>Example:</summary> ```rust let manuallydrop = ManuallyDrop::new((123, 456)); ``` ``` 0:000> dx manuallydrop manuallydrop : (123, 456) [Type: core::mem::manually_drop::ManuallyDrop<tuple<i32, i32>>] [<Raw View>] [Type: core::mem::manually_drop::ManuallyDrop<tuple<i32, i32>>] [0] : 123 [Type: int] [1] : 456 [Type: int] ``` </details> ### Type: `Pin<T>` <details><summary>Example:</summary> ```rust let mut s = "this".to_string(); let pin = Pin::new(&mut s); ``` ``` 0:000> dx pin pin : Pin(0x11a0ff6f0: "this") [Type: core::pin::Pin<mut alloc::string::String*>] [<Raw View>] [Type: core::pin::Pin<mut alloc::string::String*>] [len] : 4 [Type: unsigned __int64] [capacity] : 4 [Type: unsigned __int64] [chars] ``` </details> ### Type: `Rc<T>` and `Arc<T>` <details><summary>Example:</summary> ```rust let rc = Rc::new(42i8); let rc_weak = Rc::downgrade(&rc); ``` ``` 0:000> dx rc rc : 42 [Type: alloc::rc::Rc<i8>] [<Raw View>] [Type: alloc::rc::Rc<i8>] [Reference count] : 1 [Type: core::cell::Cell<usize>] 0:000> dx rc_weak rc_weak : 42 [Type: alloc::rc::Weak<i8>] [<Raw View>] [Type: alloc::rc::Weak<i8>] ``` </details> r? ```@michaelwoerister``` cc ```@nanguye2496```
2021-07-15[debuginfo] Make use of spaces and separators in debuginfo names more uniform.Michael Woerister-19/+19
2021-07-15[debuginfo] Emit associated type bindings in trait object type names.Michael Woerister-7/+11
2021-07-14Fix tests for i686Wesley Wiser-3/+3
2021-07-14Handle non-integer const generic parameters in debuginfo type names.Michael Woerister-2/+28
2021-07-12Add test for `Unique<T>`, weak ref counts and ref counts for `Weak<T>`Wesley Wiser-1/+19
2021-07-09Respond to review feedbackWesley Wiser-5/+5
2021-07-09Store names of captured variables in `optimized_mir`lrh2000-17/+84
- Closures in external crates may get compiled in because of monomorphization. We should store names of captured variables in `optimized_mir`, so that they are written into the metadata file and we can use them to generate debuginfo. - If there are breakpoints inside closures, the names of captured variables stored in `optimized_mir` can be used to print them. Now the name is more precise when disjoint fields are captured.
2021-07-09Name the captured upvars for closures/generators in debuginfolrh2000-7/+94
Previously, debuggers print closures as something like ``` y::main::closure-0 (0x7fffffffdd34) ``` The pointer actually references to an upvar. It is not very obvious, especially for beginners. It's because upvars don't have names before, as they are packed into a tuple. This commit names the upvars, so we can expect to see something like ``` y::main::closure-0 {_captured_ref__b: 0x[...]} ```
2021-07-08Add visualizer for OsString and fixup other string visualizersWesley Wiser-2/+3
2021-07-08Add/improve visualizations for liballoc typesWesley Wiser-3/+36
2021-07-08Add natvis for Duration, ManuallyDrop and Pin typesWesley Wiser-0/+40
2021-07-08Add natvis for Range typesWesley Wiser-17/+19
2021-07-08Fixup natvis for NonNull and Unique typesWesley Wiser-0/+21
Remove the Shared type natvis since it no longer exists
2021-07-08Add natvis for cell typesWesley Wiser-15/+68
2021-07-08Add natvis for Atomic typesWesley Wiser-2/+66
2021-07-08Add natvis for NonZero and Wrapping typesWesley Wiser-0/+142
2021-07-08Auto merge of #85363 - EFanZh:gdb-pretty-print-slices, r=michaelwoeristerbors-1/+47
Support pretty printing slices using GDB Support pretty printing `&[T]`, `&mut [T]` and `&mut str` types using GDB. Support pretty printing `&mut [T]` and `&mut str` types using LLDB. Fixes #85219.
2021-07-08Ignore Windows debugger pretty-printing testsEFanZh-0/+1
2021-07-07Ignore Android debugger pretty-printing testsEFanZh-1/+1
2021-07-06Fix failing test on i686-pc-windows-msvcWesley Wiser-1/+1
2021-07-03Support pretty printing slices using GDBEFanZh-1/+46
2021-07-02Respond to review feedbackWesley Wiser-1/+5
2021-07-02Show the variant name for univariant enumsWesley Wiser-0/+8
Previously, only the fields would be displayed with no indication of the variant name. If you already knew the enum was univariant, this was ok but if the enum was univariant because of layout, for example, a `Result<T, !>` then it could be very confusing which variant was the active one.
2021-07-02Update directly tagged enums to visualize the same as niche-layout enumsWesley Wiser-5/+23
Previously, directly tagged enums had a `variant$` field which would show the name of the active variant. We now show the variant using a `[variant]` synthetic item just like we do for niche-layout enums.
2021-07-02Fix type name difference between i686 and x86_64 for testWesley Wiser-1/+1
2021-07-01Update cdb tests for expected outputWesley Wiser-66/+70
Also an fix issue with tuple type names where we can't cast to them in natvis (required by the visualizer for `HashMap`) because of peculiarities with the natvis expression evaluator.
2021-06-30Improve debug symbol names to avoid ambiguity and work better with MSVC's ↵Daniel Paoliello-185/+504
debugger There are several cases where names of types and functions in the debug info are either ambiguous, or not helpful, such as including ambiguous placeholders (e.g., `{{impl}}`, `{{closure}}` or `dyn _'`) or dropping qualifications (e.g., for dynamic types). Instead, each debug symbol name should be unique and useful: * Include disambiguators for anonymous `DefPathDataName` (closures and generators), and unify their formatting when used as a path-qualifier vs item being qualified. * Qualify the principal trait for dynamic types. * If there is no principal trait for a dynamic type, emit all other traits instead. * Respect the `qualified` argument when emitting ref and pointer types. * For implementations, emit the disambiguator. * Print const generics when emitting generic parameters or arguments. Additionally, when targeting MSVC, its debugger treats many command arguments as C++ expressions, even when the argument is defined to be a symbol name. As such names in the debug info need to be more C++-like to be parsed correctly: * Avoid characters with special meaning (`#`, `[`, `"`, `+`). * Never start a name with `<` or `{` as this is treated as an operator. * `>>` is always treated as a right-shift, even when parsing generic arguments (so add a space to avoid this). * Emit function declarations using C/C++ style syntax (e.g., leading return type). * Emit arrays as a synthetic `array$<type, size>` type. * Include a `$` in all synthetic types as this is a legal character for C++, but not Rust (thus we avoid collisions with user types).
2021-06-25Add debug info tests for range, fix-sized array, and cell types.Nam Nguyen-5/+337