rust-lang / rust-lang/rust

Stepping with "next" in a debugger skips past end-of-scope drops

Open
#128,971 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-debuginfo C-bug T-compiler WG-debugging
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

I am trying to re-enable a lot of disabled debuginfo tests, and in doing that I learned that tests/debuginfo/drop-locations https://github.com/rust-lang/rust/blob/c9bd03cb724e13cca96ad320733046cbdb16fbbe/tests/debuginfo/drop-locations.rs was broken at some point in the past 6 years. No idea when, I will not be doing a bisection.

The bug is that in code like this:

{
    let s = String::from("s");
}

stepping through this with the gdb command next should step from the String::from call to the close brace. But gdb never stops on the close brace, even though there is indeed a call to drop_in_place for the String, and the debuginfo for the call correctly points at the close brace.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with tests/debuginfo/drop-locations.rs and reproduce the issue by stepping through the scoped String example with GDB's next command. Investigate why execution skips the close brace despite the drop_in_place call being associated with it. Done means GDB stops on the close brace as expected and the debuginfo test passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.