Where is this “system state" defined? If it was unix, you could send signal 9 to the process ...
If you really need to, you can share all the application memory with another process (or stream), and this stream accidentally writes random data to some unsuccessful memory location - I think NASA did this for some of its space projects, but I really could not give a link.
The real question is - why do you want to do this - what are you / really / testing?
If this, for example, is some kind of program that monitors some medical service that prescribes medicines ... Unit test, this service instead analyzes the API and looks for flaws.
Arafangion
source share