I got stuck here for quite a while, so I'm going make verifying the LLDB/Rust setup a whole step in this tutorial. However, you may only use one or the other form but not both. There's no reason to pick one over the other. If you don't use cargo (I'm looking at you Dropbox!), the rustc compiler supports two command line flags which will do this:Īs far as I can tell, these appear to do exactly the same thing. Digression - Compiling debug symbols using rustc directly The "debuginfo" tells us we have produced a debugable binary. ![]() Running `rustc -crate-name mycrate src/main.rs -crate-type bin -emit=dep-info,link -C debuginfo=2 -C metadata=8b3e6af7e4113faf -C extra-filename=-8b3e6af7e4113faf -out-dir /home/user/programming/mycrate/target/debug/deps -L dependency=/home/user/programming/mycrate/target/debug/deps -extern log=/home/user/programming/mycrate/target/debug/deps/liblog-6d2adb16c0d397ce.rlib -extern mkv=/home/user/programming/mycrate/target/debug/deps/libmkv-391472e7b11b31e6.rlib -extern env_logger=/home/user/programming/mycrate/target/debug/deps/libenv_logger-8b11da9f68ecb368.rlib`įinished dev target(s) in 13.4 secs $ cargo build -vĬompiling mycrate v0.1.0 (file:///home/user/programming/mycrate) I haven't figured out to use LLDB with cargo install, but it's probably very similar what I'm going in this post. However, cargo install does a "release" build with is optimized and contains no debug symbols. 1 - Compile with debug symbolsīy default, cargo build creates a "debug" build that contains the debug symbols. Some of the formatting isn't quite right, so Rust's package manager cargo ships with a wrapper script for each: rust-gdb and rust-lldb that includes a python script for formatting purposes. The Rust compiler team has also embedded debug symbols using the DWARF protocol, so that means that we can use the always-fashionable GDB and LLDB. So, the main options for debugging code are (1) lean on the compiler and (2) lots of println!(), which can only get you so far.įortunately, Rust has C Application Binary Interface (ABI) compatibility so we can mostly pretend that compiled Rust is C code. Additionally, its very cumbersome to use the online playground for understanding the code I'm actually working on right now. There's no repl for Rust, so its especially important to use other techniques to interact with Rust code I believe that its unlikely there would ever be a Rust repl given the fact that Rust is a compiled language. Things are probably very different on Windows, but might be very similar on Linux and friends. Ubuntu) you may need to install the packages libssl-dev and pkg-config prior to installing cargo-generate.I'll explain how to step through a Rust application using LLDB and illustrate some of the most basic commands. We'll use this later to generate a project from a template. WINDOWS: prerequisite C++ Build Tools for Visual Studio 2019 is installed. ![]() For the STM32F3DISCOVERYīoard used for the examples in this book, use the thumbv7em-none-eabihf target.Ĭortex-M0, M0+, and M1 (ARMv6-M architecture): rustup target add thumbv6m-none-eabiĬortex-M3 (ARMv7-M architecture): rustup target add thumbv7m-none-eabiĬortex-M4 and M7 without hardware floating point (ARMv7E-M architecture): rustup target add thumbv7em-none-eabiĬortex-M4F and M7F with hardware floating point (ARMv7E-M architecture): rustup target add thumbv7em-none-eabihfĬortex-M23 (ARMv8-M architecture): rustup target add thumbv8m.base-none-eabiĬortex-M33 and M35P (ARMv8-M architecture): rustup target add thumbv8m.main-none-eabiĬortex-M33F and M35PF with hardware floating point (ARMv8-M architecture): rustup target add thumbv8m.main-none-eabihfĬargo-binutils cargo install cargo-binutils To add cross compilation support for the ARM Cortex-MĪrchitectures choose one of the following compilation targets. $ rustc -Vįor bandwidth and disk usage concerns the default installation only supports rustc -V should return a date newer than the one shown below. NOTE Make sure you have a compiler version equal to or newer than 1.31. Install rustup by following the instructions at. This page contains OS-agnostic installation instructions for a few of the tools: Rust Toolchain
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |