mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-03-02 15:26:29 +00:00

Dwarf says (Section 2.5.1.1. of DWARF v5) that these operations should push "generic" (pointer-sized) values. This was not the case for DW_OP_const operations (which were pushing values based on the size of arguments), nor DW_OP_litN (which were always pushing 64-bit values). The practical effect of this that were were unable to display the values of variables if the size of the DW_OP_const opcode was smaller than the value of the variable it was describing. This would happen because we would store this (small) result into a buffer and then would not be able to read sufficient data out of it (in Value::GetValueAsData). Gcc emits debug info like this. Other (more subtle) effects are also possible. The same fix should be applied to DW_OP_const[us] (leb128 versions), but I'm not doing that right now, because that would cause us to display wrong (truncated) values of variables on 32-bit targets (pr48087). Differential Revision: https://reviews.llvm.org/D90840