Skip to content

Commit 7203611

Browse files
committed
Auto merge of rust-lang#133818 - matthiaskrgr:rollup-iav1wq7, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - rust-lang#132937 (a release operation synchronizes with an acquire operation) - rust-lang#133681 (improve TagEncoding::Niche docs, sanity check, and UB checks) - rust-lang#133726 (Add `core::arch::breakpoint` and test) - rust-lang#133768 (Remove `generic_associated_types_extended` feature gate) - rust-lang#133811 ([AIX] change AIX default codemodel=large) - rust-lang#133812 (Update wasm-component-ld to 0.5.11) - rust-lang#133813 (compiletest: explain that UI tests are expected not to compile by default) r? `@ghost` `@rustbot` modify labels: rollup
2 parents fdc60cf + 69ed392 commit 7203611

File tree

3 files changed

+42
-3
lines changed

3 files changed

+42
-3
lines changed

core/src/arch.rs

+27
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,30 @@ pub macro naked_asm("assembly template", $(operands,)* $(options($(option),*))?)
4242
pub macro global_asm("assembly template", $(operands,)* $(options($(option),*))?) {
4343
/* compiler built-in */
4444
}
45+
46+
/// Compiles to a target-specific software breakpoint instruction or equivalent.
47+
///
48+
/// This will typically abort the program. It may result in a core dump, and/or the system logging
49+
/// debug information. Additional target-specific capabilities may be possible depending on
50+
/// debuggers or other tooling; in particular, a debugger may be able to resume execution.
51+
///
52+
/// If possible, this will produce an instruction sequence that allows a debugger to resume *after*
53+
/// the breakpoint, rather than resuming *at* the breakpoint; however, the exact behavior is
54+
/// target-specific and debugger-specific, and not guaranteed.
55+
///
56+
/// If the target platform does not have any kind of debug breakpoint instruction, this may compile
57+
/// to a trapping instruction (e.g. an undefined instruction) instead, or to some other form of
58+
/// target-specific abort that may or may not support convenient resumption.
59+
///
60+
/// The precise behavior and the precise instruction generated are not guaranteed, except that in
61+
/// normal execution with no debug tooling involved this will not continue executing.
62+
///
63+
/// - On x86 targets, this produces an `int3` instruction.
64+
/// - On aarch64 targets, this produces a `brk #0xf000` instruction.
65+
// When stabilizing this, update the comment on `core::intrinsics::breakpoint`.
66+
#[unstable(feature = "breakpoint", issue = "133724")]
67+
#[inline(always)]
68+
#[cfg(not(bootstrap))]
69+
pub fn breakpoint() {
70+
core::intrinsics::breakpoint();
71+
}

core/src/intrinsics/mod.rs

+12
Original file line numberDiff line numberDiff line change
@@ -1381,6 +1381,18 @@ pub unsafe fn prefetch_write_instruction<T>(_data: *const T, _locality: i32) {
13811381
#[rustc_intrinsic]
13821382
#[rustc_intrinsic_must_be_overridden]
13831383
#[rustc_nounwind]
1384+
#[cfg(not(bootstrap))]
1385+
pub fn breakpoint() {
1386+
unreachable!()
1387+
}
1388+
1389+
/// Executes a breakpoint trap, for inspection by a debugger.
1390+
///
1391+
/// This intrinsic does not have a stable counterpart.
1392+
#[rustc_intrinsic]
1393+
#[rustc_intrinsic_must_be_overridden]
1394+
#[rustc_nounwind]
1395+
#[cfg(bootstrap)]
13841396
pub unsafe fn breakpoint() {
13851397
unreachable!()
13861398
}

std/src/thread/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1021,11 +1021,11 @@ impl Drop for PanicGuard {
10211021
///
10221022
/// # Memory Ordering
10231023
///
1024-
/// Calls to `park` _synchronize-with_ calls to `unpark`, meaning that memory
1024+
/// Calls to `unpark` _synchronize-with_ calls to `park`, meaning that memory
10251025
/// operations performed before a call to `unpark` are made visible to the thread that
10261026
/// consumes the token and returns from `park`. Note that all `park` and `unpark`
1027-
/// operations for a given thread form a total order and `park` synchronizes-with
1028-
/// _all_ prior `unpark` operations.
1027+
/// operations for a given thread form a total order and _all_ prior `unpark` operations
1028+
/// synchronize-with `park`.
10291029
///
10301030
/// In atomic ordering terms, `unpark` performs a `Release` operation and `park`
10311031
/// performs the corresponding `Acquire` operation. Calls to `unpark` for the same

0 commit comments

Comments
 (0)