Proctal

Documentation

Measuring values

Suppose you want to allocate memory in a program. It's easy to know how much space you'd need if you were to store three 32-bit integers. Doing the math yields 12 bytes.
Calculating the storage for fixed sized values is easy, but if you were to store code that you wrote in assembly, you would have to know the size of the bytecode resulting from every instruction but even if you knew that information you would still have a lot of math to do if your code was composed of many instructions.
Proctal provides the measure command that takes type options and counts the values for you. You can read all about type options here.
Here are some examples:

$ proctal measure --address=1c09346 --type=integer --integer-bits=32 0
4
$ proctal measure --address=1c09346 --type=integer --integer-bits=64 0
8
$ proctal measure --address=1c09346 --type=x86 "call 0x5"
5

You may find it odd that the --address option is required. That's because assembly instructions may get assembled into different bytecode depending on where they are placed in memory.