2023-04-25 16:01:54 +00:00
|
|
|
// Testing the display of JoinHandle and Thread in cdb.
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
// cdb-only
|
|
|
|
// min-cdb-version: 10.0.18317.1001
|
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// === CDB TESTS ==================================================================================
|
|
|
|
//
|
|
|
|
// cdb-command:g
|
|
|
|
//
|
|
|
|
// cdb-command:dx join_handle,d
|
Improve debug symbol names to avoid ambiguity and work better with MSVC's 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-24 17:36:28 +00:00
|
|
|
// cdb-check:join_handle,d [Type: std::thread::JoinHandle<tuple$<> >]
|
|
|
|
// cdb-check: [...] __0 [Type: std::thread::JoinInner<tuple$<> >]
|
2021-03-30 17:43:39 +00:00
|
|
|
//
|
|
|
|
// cdb-command:dx t,d
|
|
|
|
// cdb-check:t,d : [...] [Type: std::thread::Thread *]
|
2022-04-28 13:34:43 +00:00
|
|
|
// cdb-check:[...] inner [...][Type: core::pin::Pin<alloc::sync::Arc<std::thread::Inner> >]
|
2021-03-30 17:43:39 +00:00
|
|
|
|
|
|
|
use std::thread;
|
|
|
|
|
|
|
|
#[allow(unused_variables)]
|
|
|
|
fn main()
|
|
|
|
{
|
|
|
|
let join_handle = thread::spawn(|| {
|
|
|
|
println!("Initialize a thread");
|
|
|
|
});
|
|
|
|
let t = join_handle.thread();
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn zzz() {}
|