about summary refs log tree commit diff
path: root/src/test/debuginfo
AgeCommit message (Collapse)AuthorLines
2023-01-11Move /src/test to /testsAlbert Larsan-16671/+0
2022-11-27Fix `pretty-std` testMarkus Everling-2/+2
2022-11-19Auto merge of #104470 - ehuss:cdb-dupe-last-command, r=jyn514bors-1/+1
Don't duplicate last cdb debuginfo test command cdb scripts interpret a blank line to mean "repeat the last command", similar to what happens when running the debugger from a console. The code for compiletest that constructs the debugger script was inserting a blank line between the last command and the "quit" command. This caused the last command to be executed twice. This can cause some confusion since the `-check` lines are expecting the output in a certain order. But printing the last command twice causes that order-assumption to fail, and that can cause confusion. This fixes it by removing the blank line. AFAICT, gdb and lldb scripts don't have the same behavior with blank lines (and the gdb code doesn't add any blank lines anyways).
2022-11-16Merge basic blocks where possible when generating LLVM IR.Nicholas Nethercote-4/+4
In `codegen_assert_terminator` we decide if a BB's successor is a candidate for merging, which requires that it be the only successor, and that it only have one predecessor. That result then gets passed down, and if it reaches `funclet_br` with the appropriate BB characteristics, then no `br` instruction is issued, a `MergingSucc::True` result is passed back, and the merging proceeds in `codegen_block`. The commit also adds `CachedLlbb`, a new type to help keep track of each BB that has been merged into its predecessor.
2022-11-15Don't duplicate last cdb debuginfo test commandEric Huss-1/+1
2022-11-10update debuginfo checkjoboet-2/+2
2022-10-31[debuginfo] Make debuginfo type names for slices and str consistent.Michael Woerister-29/+29
Before this PR, the compiler would emit the debuginfo name `slice$<T>` for all kinds of slices, regardless of whether they are behind a reference or not and regardless of the kind of reference. As a consequence, the types `Foo<&[T]>`, `Foo<[T]>`, and `Foo<&mut [T]>` would end up with the same type name `Foo<slice$<T> >` in debuginfo, making it impossible to disambiguate between them by name. Similarly, `&str` would get the name `str` in debuginfo, so the debuginfo name for `Foo<str>` and `Foo<&str>` would be the same. In contrast, `*const [bool]` and `*mut [bool]` would be `ptr_const$<slice$<bool> >` and `ptr_mut$<slice$<bool> >`, i.e. the encoding does not lose information about the type. This PR removes all special handling for slices and `str`. The types `&[bool]`, `&mut [bool]`, and `&str` thus get the names `ref$<slice2$<bool> >`, `ref_mut$<slice2$<bool> >`, and `ref$<str$>` respectively -- as one would expect.
2022-09-13Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiserbors-0/+243
ssa: implement `#[collapse_debuginfo]` cc #39153 rust-lang/compiler-team#386 Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. r? rust-lang/wg-debugging
2022-09-07Change name of "dataful" variant to "untagged"Michael Benfield-3/+3
This is in anticipation of a new enum layout, in which the niche optimization may be applied even when multiple variants have data.
2022-09-07ssa: implement `#[collapse_debuginfo]`David Wood-0/+243
Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour. When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed. Signed-off-by: David Wood <david.wood@huawei.com>
2022-08-28Rollup merge of #98301 - ortem:pretty-printers-nonzero, r=wesleywiserMatthias Krüger-1/+86
Add GDB/LLDB pretty-printers for NonZero types Add GDB/LLDB pretty-printers for `NonZero` types. These pretty-printers were originally implemented for IntelliJ Rust by ```@Kobzol``` in https://github.com/intellij-rust/intellij-rust/pull/5270. Part of #29392.
2022-08-24Add GDB/LLDB pretty-printers for NonZero typesArtem Mukhin-1/+86
2022-08-15[debuginfo] Fix msvc-pretty-enums debuginfo test for i686.Michael Woerister-2/+2
2022-08-12[debuginfo] Update src/test/debuginfo/mutex.rs for new cpp-like enum ↵Michael Woerister-5/+7
debuginfo encoding.
2022-08-12[debuginfo] Add more test cases cpp-like enum debuginfo.Michael Woerister-4/+39
2022-08-12Support wrapping 128-bit tag ranges for cpp-like enum debuginfo.Michael Woerister-0/+32
2022-08-12Use enum2<_> instead of enum<_> for Cpp-like debuginfo enum type names.Michael Woerister-63/+62
And add more comments about niche tag enum encoding.
2022-08-12debuginfo: Change C++-like encoding for enums.Michael Woerister-50/+119
The updated encoding should be able to handle niche layouts where more than one variant has fields.
2022-08-04Add min-gdb-versionRyan Levick-0/+1
2022-08-04Update FIXME commentRyan Levick-1/+1
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2022-08-04Add comment about issue caused with multiple staticsRyan Levick-0/+2
2022-08-04Fix linux testsRyan Levick-7/+7
2022-08-04Turn CDB test back on and all clarifying testRyan Levick-6/+18
2022-08-04Turn off cdb test for now, link to issueRyan Levick-6/+5
2022-08-04Add a test for issue #33172Ryan Levick-0/+26
2022-07-20Use revision support to remove near identical debuginfo test.Luqman Aden-81/+6
2022-07-18Fix debuginfo tests.Nicholas Nethercote-2/+2
This is needed for my Ubuntu 22.04 box due to a slight change in gdb output. The fix is similar to the fix in #95063.
2022-07-16Auto merge of #95685 - oxidecomputer:restore-static-dwarf, r=pnkfelixbors-7/+85
Revert "Work around invalid DWARF bugs for fat LTO" Since September, the toolchain has not been generating reliable DWARF information for static variables when LTO is on. This has affected projects in the embedded space where the use of LTO is typical. In our case, it has kept us from bumping past the 2021-09-22 nightly toolchain lest our debugger break. This has been a pretty dramatic regression for people using debuggers and static variables. See #90357 for more info and a repro case. This commit is a mechanical revert of d5de680e20def848751cb3c11e1182408112b1d3 from PR #89041, which caused the issue. (Note on that PR that the commit's author has requested it be reverted.) I have locally verified that this fixes #90357 by restoring the functionality of both the repro case I posted on that bug, and debugger behavior on real programs. There do not appear to be test cases for this in the toolchain; if I've missed them, point me at 'em and I'll update them.
2022-07-15Set minimum GDB version needed for basic-types-globals* tests.Luqman Aden-0/+2
2022-06-25Auto merge of #96820 - r-raymond:master, r=cuviperbors-5/+2
Make RwLockReadGuard covariant Hi, first time contributor here, if anything is not as expected, please let me know. `RwLockReadGoard`'s type constructor is invariant. Since it behaves like a smart pointer to an immutable reference, there is no reason that it should not be covariant. Take e.g. ``` fn test_read_guard_covariance() { fn do_stuff<'a>(_: RwLockReadGuard<'_, &'a i32>, _: &'a i32) {} let j: i32 = 5; let lock = RwLock::new(&j); { let i = 6; do_stuff(lock.read().unwrap(), &i); } drop(lock); } ``` where the compiler complains that &i doesn't live long enough. If `RwLockReadGuard` is covariant, then the above code is accepted because the lifetime can be shorter than `'a`. In order for `RwLockReadGuard` to be covariant, it can't contain a full reference to the `RwLock`, which can never be covariant (because it exposes a mutable reference to the underlying data structure). By reducing the data structure to the required pieces of `RwLock`, the rest falls in place. If there is a better way to do a test that tests successful compilation, please let me know. Fixes #80392
2022-06-22Fix debug info testRobin Raymond-5/+2
2022-06-20Auto merge of #97931 - xldenis:fix-if-let-source-scopes, r=nagisabors-0/+100
Fix `SourceScope` for `if let` bindings. Fixes #97799. I'm not sure how to test this properly, is there any way to observe the difference in behavior apart from `ui` tests? I'm worried that they would be overlooked in the case of a regression.
2022-06-15The type of the slice length field is architecture dependentWesley Wiser-4/+4
2022-06-15Add debuginfo test for if let lexical scopesWesley Wiser-0/+100
2022-06-15debuginfo: Fix NatVis for Rc and Arc with unsized pointees.Michael Woerister-40/+104
2022-06-14account for endianness in debuginfo for const argsb-naber-2/+2
2022-06-04Auto merge of #97191 - wesleywiser:main_thread_name, r=ChrisDentonbors-0/+51
Call the OS function to set the main thread's name on program init Normally, `Thread::spawn` takes care of setting the thread's name, if one was provided, but since the main thread wasn't created by calling `Thread::spawn`, we need to call that function in `std::rt::init`. This is mainly useful for system tools like debuggers and profilers which might show the thread name to a user. Prior to these changes, gdb and WinDbg would show all thread names except the main thread's name to a user. I've validated that this patch resolves the issue for both debuggers.
2022-06-04Update src/test/debuginfo/thread-names.rsWesley Wiser-0/+11
Co-authored-by: Chris Denton <ChrisDenton@users.noreply.github.com>
2022-05-27Call the OS function to set the main thread's name on program initWesley Wiser-0/+40
Normally, `Thread::spawn` takes care of setting the thread's name, if one was provided, but since the main thread wasn't created by calling `Thread::spawn`, we need to call that function in `std::rt::init`. This is mainly useful for system tools like debuggers and profilers which might show the thread name to a user. Prior to these changes, gdb and WinDbg would show all thread names except the main thread's name to a user. I've validated that this patch resolves the issue for both debuggers.
2022-05-24Add support for embedding pretty printers via the `#[debugger_visualizer]` ↵ridwanabdillahi-73/+221
attribute. Add tests for embedding pretty printers and update documentation. Ensure all error checking for `#[debugger_visualizer]` is done up front and not when the `debugger_visualizer` query is run. Clean up potential ODR violations when embedding pretty printers into the `__rustc_debug_gdb_scripts_section__` section. Respond to PR comments and update documentation.
2022-05-03Add support for a new attribute `#[debugger_visualizer]` to support ↵ridwanabdillahi-0/+82
embedding debugger visualizers into a generated PDB. Cleanup `DebuggerVisualizerFile` type and other minor cleanup of queries. Merge the queries for debugger visualizers into a single query. Revert move of `resolve_path` to `rustc_builtin_macros`. Update dependencies in Cargo.toml for `rustc_passes`. Respond to PR comments. Load visualizer files into opaque bytes `Vec<u8>`. Debugger visualizers for dynamically linked crates should not be embedded in the current crate. Update the unstable book with the new feature. Add the tracking issue for the debugger_visualizer feature. Respond to PR comments and minor cleanups.
2022-04-28std: update debuginfo check to match type definitionjoboet-1/+1
2022-04-22debuginfo: Emit ZST struct debuginfo for unit type when CPP-like debuginfo ↵Michael Woerister-0/+71
is enabled (instead of custom basic type).
2022-04-05Improve debuginfo test coverage for simple statics.Cliff L. Biffle-7/+83
- Re-enabled basic-types-globals which has been disabled since 2018 - Updated its now-rotted assertions about GDB's output to pass - Rewrote header comment describing some previous state of GDB behavior that didn't match either the checked-in assertions _or_ the current behavior, and so I assume has just been wrong for some time. - Copy-pasta'd the test into a version that uses LTO to check for regression on #90357, because I don't see a way to matrix the same test into several build configurations.
2022-03-24debuginfo: Fix debuginfo for Box<T> where T is unsized.Michael Woerister-4/+15
Before this fix, the debuginfo for the fields was generated from the struct defintion of Box<T>, but (at least at the moment) the compiler pretends that Box<T> is just a (fat) pointer, so the fields need to be `pointer` and `vtable` instead of `__0: Unique<T>` and `__1: Allocator`. This is meant as a temporary mitigation until we can make sure that simply treating Box as a regular struct in debuginfo does not cause too much breakage in the ecosystem.
2022-03-17Fix debuginfo tests with GDB 11.2Tom Tromey-8/+25
GDB 11.2 added support for DW_ATE_UTF, which caused some test failures. This fixes these tests by changing the format that is used, and adds a new test to verify that characters are emitted as something that GDB can print in a char-like way. Fixes #94458
2022-03-15Rollup merge of #94810 - michaelwoerister:fix-trait-pointer-debuginfo-names, ↵Matthias Krüger-0/+16
r=wesleywiser debuginfo: Fix bug in type name generation for dyn types with associated types but no other generic arguments. For types like `&dyn Future<Output=bool>` the compiler currently emits invalid types names in debuginfo. This PR fixes this. Before: ```txt // DWARF &dyn core::future::future::Future, Output=bool> // CodeView ref$<dyn$<core::future::future::Future,assoc$<Output,bool> > > > ``` After: ```txt // DWARF &dyn core::future::future::Future<Output=bool> // CodeView ref$<dyn$<core::future::future::Future<assoc$<Output,bool> > > > ``` These syntactically incorrect type names can cause downstream tools (e.g. debugger extensions) crash when trying to parse them. r? `@wesleywiser`
2022-03-15debuginfo: Refactor debuginfo generation for types -- Make generator-objects ↵Michael Woerister-8/+9
test case architecture independent.
2022-03-14debuginfo: change cpp-like naming for generator environments so that NatVis ↵Michael Woerister-0/+31
works for them
2022-03-14debuginfo: Refactor debuginfo generation for typesMichael Woerister-19/+20
This commit - changes names to use di_node instead of metadata - uniformly names all functions that build new debuginfo nodes build_xyz_di_node - renames CrateDebugContext to CodegenUnitDebugContext (which is more accurate) - moves TypeMap and functions that work directly work with it to a new type_map module - moves and reimplements enum related builder functions to a new enums module - splits enum debuginfo building for the native and cpp-like cases, since they are mostly separate - uses SmallVec instead of Vec in many places - removes the old infrastructure for dealing with recursion cycles (create_and_register_recursive_type_forward_declaration(), RecursiveTypeDescription, set_members_of_composite_type(), MemberDescription, MemberDescriptionFactory, prepare_xyz_metadata(), etc) - adds type_map::build_type_with_children() as a replacement for dealing with recursion cycles - adds many (doc-)comments explaining what's going on - changes cpp-like naming for C-Style enums so they don't get a enum$<...> name (because the NatVis visualizer does not apply to them) - fixes detection of what is a C-style enum because some enums where classified as C-style even though they have fields - changes the position of discriminant debuginfo node so it is consistently nested inside the top-level union instead of, sometimes, next to it