VSCode extension #922
Replies: 5 comments 14 replies
-
Just thought of something that I think would be helpful as well. In constraints, sometimes it would be helpful to hide certain clauses joined by conjunctions. Here is a concrete example from something that I'm working on: I have the following precondition for a function (what it actually means is not so important): requires mode_is_thread_privileged(old_cpu.mode, old_cpu.control) && sp_can_handle_exception_entry(old_cpu) The constraint for this is as follows: old_cpu.7.0 = 1 ∧ ¬old_cpu.2.1 ∧ (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) }, old_cpu.1.1 } } else { SP { old_cpu.1.0, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) } } }.0 } else { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) }, old_cpu.1.1 } } else { SP { old_cpu.1.0, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) } } }.1 }.0) ≥ armv7m::mem::RAM_START ∧ (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) }, old_cpu.1.1 } } else { SP { old_cpu.1.0, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) } } }.0 } else { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) }, old_cpu.1.1 } } else { SP { old_cpu.1.0, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0, (bv_int_to_bv32)(32)) } } }.1 }.0) ≤ armv7m::mem::RAM_END ∧ (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0) ≥ armv7m::mem::RAM_START ∧ (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { old_cpu.1.0 } else { old_cpu.1.1 }.0) ≤ armv7m::mem::RAM_END where old_cpu.7.0 = 1 ∧ ¬old_cpu.2.1 corresponds to It would be extremely helpful in contexts like this if we could have the option to hide the constraint that corresponds to a specific surface level function. e.g. I don't want to see |
Beta Was this translation helpful? Give feedback.
-
In a similar vein as above, it might be nice to be able to hide these sorts of things in postconditions as well. I'm trying to debug something not checking and there is a very very specific field that I am interested in but it is cluttered by others. My postcondition looks like this: ensures self: Armv7m { new_cpu: get_gpr(r0(), new_cpu) == bv32(10) } but the constraint looks like: Armv7m { a0, SP { BV32 { a1 }, BV32 { a2 } }, Control { a3, a4 }, BV32 { a5 }, BV32 { a6 }, BV32 { a7 }, Memory { a8 }, CPUMode { a9 } } = Armv7m { (map_store)((map_store)(old_cpu.0, GPR { 0 }, BV32 { (bv_int_to_bv32)(10) }), GPR { 0 }, (map_select)((map_store)(old_cpu.6.0, (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0 } else { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1 }.0), (map_select)((map_store)(old_cpu.0, GPR { 0 }, BV32 { (bv_int_to_bv32)(10) }), GPR { 0 })), if BV32 { (bv_int_to_bv32)(4294967289) } = BV32 { (bv_int_to_bv32)(68719476729) } { (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0.0) } else { (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1.0) })), if BV32 { (bv_int_to_bv32)(4294967289) } = BV32 { (bv_int_to_bv32)(68719476729) } { SP { BV32 { (bv_add)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0.0, (bv_int_to_bv32)(32)) }, if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1 } } else { SP { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0, BV32 { (bv_add)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1.0, (bv_int_to_bv32)(32)) } } }, Control { old_cpu.2.0, BV32 { (bv_int_to_bv32)(4294967289) } ≠ BV32 { (bv_int_to_bv32)(4294967289) } }, (map_select)((map_store)(old_cpu.6.0, (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0 } else { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1 }.0), (map_select)((map_store)(old_cpu.0, GPR { 0 }, BV32 { (bv_int_to_bv32)(10) }), GPR { 0 })), if BV32 { (bv_int_to_bv32)(4294967289) } = BV32 { (bv_int_to_bv32)(68719476729) } { (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0.0) } else { (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1.0) } + 20), BV32 { old_cpu.4.0 }, (map_select)((map_store)(old_cpu.6.0, (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0 } else { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1 }.0), (map_select)((map_store)(old_cpu.0, GPR { 0 }, BV32 { (bv_int_to_bv32)(10) }), GPR { 0 })), if BV32 { (bv_int_to_bv32)(4294967289) } = BV32 { (bv_int_to_bv32)(68719476729) } { (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0.0) } else { (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1.0) } + 28), Memory { (map_store)(old_cpu.6.0, (bv_bv32_to_int)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.0 } else { if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { SP { BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) }, BV32 { old_cpu.1.1.0 } } } else { SP { BV32 { old_cpu.1.0.0 }, BV32 { (bv_sub)(if old_cpu.7.0 = 0 ∨ ¬old_cpu.2.1 { BV32 { old_cpu.1.0.0 } } else { BV32 { old_cpu.1.1.0 } }.0, (bv_int_to_bv32)(32)) } } }.1 }.0), (map_select)((map_store)(old_cpu.0, GPR { 0 }, BV32 { (bv_int_to_bv32)(10) }), GPR { 0 })) }, CPUMode { 1 } } which is just not parseable. I think there are two things that might be helpful here:
|
Beta Was this translation helpful? Give feedback.
-
Btw @nilehmann - I think for all these fancier selective show/hide -- presumably we should render the flux information as some sort of structured JSON and deal with show/hide in the vscode-extension, yes? |
Beta Was this translation helpful? Give feedback.
-
I tried to implement point 2 in #922 (reply in thread), but veriasm hangs if we stop eta-expanding data sorts. We can do the same we did with unfolding and implement it as a pass on the constraint, but this requires meddling with the structure of the |
Beta Was this translation helpful? Give feedback.
-
@vrindisbacher I added nested/toggleable fields to the vscode-flux thing, lmk if that helps! |
Beta Was this translation helpful? Give feedback.
-
A list of possible improvements for the
vscode
extensionsrcx
) (fixed in Pretty print records using field names #927)a0 a1 a2 a3 a4 : int
instead of splitting into separate lines (fixed in VSCODE: Collapse names, remove dup constraints #926)n > 0, n > 0
... once is enough! (fixed in VSCODE: Collapse names, remove dup constraints #926)n.cols
instead ofn.0
(fixed in Pretty print records using field names #927) or @vrindisbacher example belowx
,y
,z
instead of places_1
,_2
,_3
(pending @Samir-Rashid 's PR) (fixed in Source-level names in JSON trace #930)_1 : &'?5 [&'?6 ∃b0. str[b0]][n]
show_1 : &[&∃b0. str[b0]][n]
(fixed in Source-level names in JSON trace #930)_1 : &[&∃b0. str[b0]][n]
show_1 : &[&str][n]
a0,a1,...
?record-indices
Instead of
CSV[ CSV { n } ]
we should showCSV[ { cols : n } ]
record-fields via @vrindisbacher
For example. If I have:
and this is part of a bigger struct like:
Then, in constraints I will see something like
if old_cpu.0.0 = 0 ∨ ...
which is difficult to understand what that corresponds to. Instead I think something like this would be more usefulif old_cpu.sp.sp_main = 0 ...
Beta Was this translation helpful? Give feedback.
All reactions