Skip to content

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented May 10, 2022

This got removed in #75143, and I find this makes long traces a lot harder to read, so I propose we add this back.

Example trace:

│ │ ├─0ms  INFO rustc_const_eval::interpret::step return
│ │ ├─0ms  INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
│ │┌┘rustc_const_eval::interpret::eval_context::frame std::ptr::mut_ptr::<impl *mut u8>::guaranteed_eq
│ ├┘rustc_const_eval::interpret::eval_context::frame std::ptr::mut_ptr::<impl *mut u8>::is_null
│ ├─1ms  INFO rustc_const_eval::interpret::step // executing bb2
│ ├─1ms  INFO rustc_const_eval::interpret::step StorageDead(_4)
│ ├─1ms  INFO rustc_const_eval::interpret::step StorageDead(_2)
│ ├─1ms  INFO rustc_const_eval::interpret::step return
│ ├─1ms  INFO rustc_const_eval::interpret::eval_context popping stack frame (returning from function)
│┌┘rustc_const_eval::interpret::eval_context::frame std::ptr::mut_ptr::<impl *mut u8>::is_null
├┘rustc_const_eval::interpret::eval_context::frame std::sys_common::thread_local_dtor::register_dtor_fallback::run_dtors
├─178ms  INFO rustc_const_eval::interpret::step // executing bb2
├─178ms  INFO rustc_const_eval::interpret::step StorageDead(_5)

r? @oli-obk

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

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 May 10, 2022
@oli-obk
Copy link
Contributor

oli-obk commented May 10, 2022

Actually it got removed in #87903

I think we should just revert that and make it configurable?

@RalfJung
Copy link
Member Author

You mean these with_verbose_exit/entry things?

@RalfJung
Copy link
Member Author

Ah, yes, that is also pretty nice (though it is rather implicit).

I presume it is not possible to turn this on only for the interpreter trace?

@oli-obk
Copy link
Contributor

oli-obk commented May 10, 2022

I presume it is not possible to turn this on only for the interpreter trace?

not as far as I can tell. I do have to say I want to make them configurable anyway as I encounter the problem of not knowing what function just finished in situations other than the interpreter, too

@RalfJung
Copy link
Member Author

I don't even know how such logging would happen outside the interpreter 😂 but making those flags configurable would also work for me. Miri might do this automatically when MIRI_LOG is set.

The question is... configurable how? Just an env var? RUSTC_LOG_ENTRY_EXIT=1, or something like that?

@oli-obk
Copy link
Contributor

oli-obk commented May 10, 2022

Just an env var? RUSTC_LOG_ENTRY_EXIT=1, or something like that?

Yea, that's what I had in mind

@RalfJung RalfJung force-pushed the interpret-pop-debug branch from 9621f72 to 831bd96 Compare May 11, 2022 08:03
@RalfJung
Copy link
Member Author

All right, I implemented such an env var.

@oli-obk
Copy link
Contributor

oli-obk commented May 11, 2022

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented May 11, 2022

📌 Commit 831bd96 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 May 11, 2022
@RalfJung RalfJung changed the title interpret: when a function returns, debug-log more details logging: add env var to control verbose scope entry/exit logging May 11, 2022
bors added a commit to rust-lang/miri that referenced this pull request May 11, 2022
when MIRI_LOG is set, set RUSTC_LOG_ENTRY_EXIT

This will be useful once rust-lang/rust#96898 landed.
bors added a commit to rust-lang-ci/rust that referenced this pull request May 11, 2022
Rollup of 4 pull requests

Successful merges:

 - rust-lang#91518 (Add readable rustdoc display for RISC-V target)
 - rust-lang#95281 (Fix inaccurate function name in `rustc_const_eval` docs)
 - rust-lang#96898 (logging: add env var to control verbose scope entry/exit logging)
 - rust-lang#96936 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit afb9171 into rust-lang:master May 11, 2022
@rustbot rustbot added this to the 1.62.0 milestone May 11, 2022
@RalfJung RalfJung deleted the interpret-pop-debug branch May 12, 2022 07:20
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.

5 participants