Is there macro to debug what happened in memory layout in rust? Or do I actually use debug features in vscode or another IDE? What is the best practice to debugging memory with looking current value and its address in a variable in rust?
Given simple code like this:
fn main(){
let my_int: u8 = 2;
let my_float: f32 = 2.4;
let my_bool: bool = true;
show_memory_layout!(&my_int, &my_float, &my_bool);
}
Expecting output like this:
Address | Value | Type | Var_Name | Location
0x1000 | 0x02 | u8 | my_int | Stack
...
0x2000 | 0x40 | f32 | 0_my_float | Stack
0x2001 | 0x19 | f32 | 1_my_float | Stack
0x2002 | 0x99 | f32 | 2_my_float | Stack
0x2003 | 0x9a | f32 | 3_my_float | Stack
...
0x3000 | 0x01 | bool | my_bool | Stack
Or another memory display utilities like this:
show_memory!(src_ptr, dst_ptr);
// src_ptr is 0x1000, dst_ptr is 0x2000
Will display same columns like above but just address and value, and with specified range:
Address | Value
0x1000 | 0x00
0x1001 | 0x69
...
0x2000 | 0x69
No need exactly what I expect, I’m just expecting similar feature like that.