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

Miri/interpreter debugging tweaks #96160

Merged
merged 3 commits into from
Apr 20, 2022
Merged

Conversation

RalfJung
Copy link
Member

Some changes I made to make debugging Miri with trace logging less terrible.

r? @oli-obk

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 17, 2022
@rust-highfive
Copy link
Collaborator

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

Some changes occured to the CTFE / Miri engine

cc @rust-lang/miri

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 17, 2022
@@ -509,6 +509,9 @@ impl<Tag: Copy, Extra> Allocation<Tag, Extra> {
if Tag::ERR_ON_PARTIAL_PTR_OVERWRITE {
return Err(AllocError::PartialPointerOverwrite(first));
}
warn!(
"Partial pointer overwrite! De-initializing memory at offsets {first:?}..{start:?}."
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have RUSTC_LOG=warn set in my zshrc I believe. This will cause be rather noisy I think.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We kind of emit warn and error unconditionally, or at least used to at some point.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They alsodon't get optimized out, so nightly will have them

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At least warn is only emitted when using RUSTC_LOG=warn.

Copy link
Member Author

@RalfJung RalfJung Apr 19, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have RUSTC_LOG=warn set in my zshrc I believe. This will cause be rather noisy I think.

Note that this is never printed by rustc, since ERR_ON_PARTIAL_PTR_OVERWRITE is true there.
Only Miri can ever trigger this.

They alsodon't get optimized out, so nightly will have them

This is a very cold path, so that's fine. We have info! for each statement and terminator we run (also exists on nightly), this is at least as important as that.

When this triggers, it can cause subtly wrong execution later in the program, where memory is uninit that should be init -- so there should be a good way to figure out if this triggered.

We kind of emit warn and error unconditionally, or at least used to at some point.

This is definitely not printed by default, I verified that.

@oli-obk
Copy link
Contributor

oli-obk commented Apr 19, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Apr 19, 2022

📌 Commit f3bdcfb has been approved by oli-obk

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 19, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 20, 2022
Miri/interpreter debugging tweaks

Some changes I made to make debugging Miri with trace logging less terrible.

r? `@oli-obk`
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 20, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#93313 (Check if call return type is visibly uninhabited when building MIR)
 - rust-lang#96160 (Miri/interpreter debugging tweaks)
 - rust-lang#96167 (Replace sys/unix/weak AtomicUsize with AtomicPtr)
 - rust-lang#96168 (Improve AddrParseError description)
 - rust-lang#96206 (Use sys::unix::locks::futex* on wasm+atomics.)
 - rust-lang#96234 (remove_dir_all_recursive: treat ELOOP the same as ENOTDIR)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 72cb094 into rust-lang:master Apr 20, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 20, 2022
@RalfJung RalfJung deleted the interpret-debug branch April 26, 2022 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants