Writing values
With Proctal not only can you read the contents in memory straight from
your terminal, you can also easily modify them. The
write command is able to write text, integers, IEEE754
floating point numbers, CPU instructions and more.
The command accepts type options. You can find out all about them
here.
Here's how you would write a 32-bit integer with the value 0 at the
memory address 7FFE79DEA90C in a program whose PID is
12345.
$ proctal write --pid=12345 --address=7FFE79DEA90C --type=integer --integer-bits=32 0
You can pass the --pause option to keep the program paused while writing.
Writing arrays
But what if you had an array of 32-bit integers in memory? One
way to write all the elements would be to execute the
write command at the corresponding address for
each element. But a better way is to take advantage of the
--array option. It takes the number of
elements as its value.
Here's how you would write an array of 5 32-bit integers.
$ proctal write --pid=12345 --address=7FFE79DEA90C --type=integer --integer-bits=32 --array=5 0 0 0 0 0
You can also let the command loop back to the first value if you don't provide the same number of values as the array option. This means that the previous command is equivalent to this one:
$ proctal write --pid=12345 --address=7FFE79DEA90C --type=integer --integer-bits=32 --array=5 0
Repeat writing
With the --repeat option you can make the
command repeatedly write the same values over and over again.
With the --repeat-delay option you can even
specify the delay in milliseconds between writes.
The command will keep running until you tell it to stop. You
can stop it by sending it the SIGINT signal
(^C on most terminals).
By default the delay is set to be 5 milliseconds.
Binary input
The --binary option makes the command write values from the standard input stream in binary.