O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercises

  1. Try the explore command of GDB. How does it differ from print?

Solution: print gives you a single representation of a value. explore is more conversational: if there's just a single value, it displays that, but if used on a compound value (such as nums in the example function), it interactively allows diving as deep to the structure as it goes.

  1. Try the step command in GDB or LLDB. How is it different? What happens between the function calls?

Solution: They're pretty much the same. Both descend to the underlying library code. LLDB is a tad more verbose.

  1. Both GDB and LLDB support attaching to a running process. Make a program that doesn't quit, perhaps an erroneous never-ending loop, then attach to it via rust-gdb or rust-lldb ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required