Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I inspect variable values while debugging MSVC ABI Rust programs?

I've downloaded the MSVC ABI version of Rust 1.7.0 and followed the guessing game section from the docs.

I notice that the builds use the native toolchain (Visual Studio 2015 Update 2 in my case) and therefore generate native PDBs (debugging symbols) consumable by native debuggers, such as WinDBG, CDB or the Visual Studio debugger. I can easily set breakpoints, step into standard library source and so on.

What I cannot do is to inspect variable values. Regardless of the debugger used, the 'Locals' display is empty.

From what I can gather, the Visual Rust/RustDT IDEs display locals when using GDB or LLDB as a backend, not the native Windows debugging engine. I'm not entirely sure if I can use these to debug Rust programs compiled for MSVC ABI (with PDBs and so on).

If I want to have the necessary debugging experience, is my only option to switch to the GNU ABI? Barring that, is there an easy way to map to Rust symbols (variable values) from the raw debugging tools (registers, memory map)?

like image 736
cynic Avatar asked Apr 14 '16 11:04

cynic


1 Answers

Features don't exist until they're implemented. Rust is built upon LLVM and full PDB support has only recently been considered for LLVM. For now LLVM has only a limited PDB support, with the limitations best described on the Clang project's MSVC compatibility page. In my opinion, it's best to wait until the support is there, although for other programming languages interesting workarounds have been implemented.

like image 101
cynic Avatar answered Oct 16 '22 10:10

cynic