Debugging rust code with async functions

Using Rust-GDB

please help to debug rust code with async functions, next command seems to always enter async functions. For example, if I have a breakpoint on the line below, I would expect next jumps to the next line but it will always jump into the mod.rs file and break on the line with the =>

next on the line below jumps to

let password = password_hash(format!("{}:{}", password, &get_nonce(client).await.unwrap())).to_string();

jumps into

/home/username/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs

            // Resume the generator, turning the `&mut Context` into a `NonNull` raw pointer. The
            // `.await` lowering will safely cast that back to a `&mut Context`.
            match gen.resume(ResumeTy(NonNull::from(cx).cast::<Context<'static>>())) {
=>              GeneratorState::Yielded(()) => Poll::Pending,
                GeneratorState::Complete(x) => Poll::Ready(x),
            }
        }

this happens for any function with async and getting back out to the next line on my code takes a lot of next typing or step-over buttons when using IDEs

just want to know how other Rustaceans do this

1 Like

You can mark files to be skipped while stepping: https://stackoverflow.com/questions/5676241/tell-gdb-to-skip-standard-files/42985979#42985979