By Jakob Engblom
In 2011, we mark several anniversaries here at Wind River and in the world of virtual platforms. First of all, it is 30 years since Wind River was founded, in 1981. Ten years later, in 1991, the first code of what would become Simics was written by Peter S Magnusson at the Swedish Institute of Computer Science. Thus, Simics turns 20! 2011 also marks the 60th anniversary of the instruction-set simulator and virtual platform-based debug.
In 1951, Stanley Gill from the Mathematical Laboratory at the University of Cambridge published a paper called "The Diagnosis of Programmes on the EDSAC" in the Proceedings of the Royal Society of London. In it, he describes how he created a single-stepping debugger for the EDSAC computer. As an aside, the EDSAC was the first programmable general-purpose computer in the world, and the team around it built early versions of many of today's standard software tools such as the first bootloader and the first symbolic assembler, which was very visionary and an amazing feat of programming.
In order to make it possible to step through running programs and investigate their state and behavior, Gill resorted to building a simulator of the EDSAC. He recognized that step-by-step elaboration of a program run was invaluable to help a human mind understand where the instructions to the machine went bad. It was clear to him that not all errors could be prevented in the programming stage:
It is natural to first dismiss mistakes in programming as an inevitable but temporary evil, due to lack of experience, and to assume that if reasonable care is taken to prevent such mistakes occurring no other remedy is necessary. However, experience with the EDSAC has shown that although a high proportion of mistakes can be removed by preliminary checking, there frequently remains mistakes which could only have been detected in the early stages by prolonged and laborious study. Some attention has, therefore, been given to the problem of dealing with mistakes after the programme has been tried and found to fail.
I sounds like a 60 years later echo of this in a blog post from 2010 - bugs will happen, and you will need a debugger of some kind to understand them. The bugs that they saw 60 years ago are still familiar to us today: bad computation results, arithmetic overflow, execution stop from executing an invalid instruction (after jumping to some bad place), infinite looping, and garbled output.
The core of what Gill created to diagnose bugs was known as Library Sub-Routine C11, which was a step-by-step interpreter of programs that printed a trace of all instructions executed (already then, trace was considered a powerful debug tool). This was achieved using a grand total of 31 machine instructions – it exploited that fact that it was an EDSAC simulating an EDSAC to handle instruction interpretation and IO. Still, it was in essence a full-system simulator or virtual machine, and it presents us with the first example of using
virtualization or simulation to debug software.
When it comes down to it, bugs have been with us for as long as we have had computers – and simulation as a tool to get rid of them has been used for almost as long.
The first Simics slogan was "Resistance is futile. You will be simulated."
That is still true. And you will enjoy it.
References Stanley Gill, The diagnosis of mistakes in programmes on the EDSAC, Proceedings of the Royal Society, Series A, Vol. 206, 1951, pp. 538-554.  Martin Campbell-Kelly: Programming the EDSAC: Early Programming Activity at the University of Cambridge, IEEE Annals of the History of Computing, Vol 20, Issue 4, 1998.