# \[Solved\] How to step into std source code when debugging in VS Code?

**URL:** <https://users.rust-lang.org/t/solved-how-to-step-into-std-source-code-when-debugging-in-vs-code/25319>\
**Category:** help\
**Created:** [February 15, 2019, 2:42pm UTC](https://users.rust-lang.org/t/solved-how-to-step-into-std-source-code-when-debugging-in-vs-code/25319 "2019-02-15T14:42:02Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![koutheir](https://sea1.discourse-cdn.com/flex019/user_avatar/users.rust-lang.org/koutheir/32/8133_2.png) [@koutheir](https://users.rust-lang.org/u/koutheir)\
**Post date:** [March 8, 2019, 9:02am UTC](https://users.rust-lang.org/t/solved-how-to-step-into-std-source-code-when-debugging-in-vs-code/25319/6 "2019-03-08T09:02:49Z")

</div>

In case someone uses **Visual Studio Code** with **GDB** and wants to achieve the same behavior, here is how I do it:

In `launch.json`:

```json
{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "gdb",
            ...,
            "autorun": [
                "set substitute-path /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858 <your-home-dir>/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust"
            ],
        }
    ]
}

```

Notice that `/rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858` depends on **the exact toolchain** you're using. So updating your toolchain will probably require modifying this string. The way I easily find the hash is by running the following command in the project directory:

```nohighlight
$ strings target/debug/<your-binary-name> | grep -o '^/rustc/[^/]\+/' | uniq

```

The idea is that Visual Studio Code will issue the GDB commands specified in the `autorun` array right after GDB is initialized, before actual debugging is started. The command `set substitute-path` of GDB is documented in [Specifying Source Directories](https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html#set-substitute_002dpath).

---

_[View the full topic](https://users.rust-lang.org/t/solved-how-to-step-into-std-source-code-when-debugging-in-vs-code/25319)._
