I have learned programming for a couple of years, and used debug frequently.But I still don’t understand the core principle of debug, how it works?How does singe line debugging(step into) implement?
take the java language for example.
What does CPU do for debug implementation?
what does JVM do for debug implementation?
what does eclipse do for debug implementation?
May be the three stuff I listed above have nothing to do with debug. I only guessed it.I have googled for some time and gained nothing useful for me(of course,debug itself is complicated), I hope more simple interpretation.
Thanks.
Each processor has its own design of debugging mechanism.
For the case of x86 CPU, the processor has 6 debug registers which store the debug break-points and break-conditions. Have a brief look at this article for Intel x86 CPU debugging mechanism: http://en.wikipedia.org/wiki/X86_debug_register
For the case of Java debugging mechanism, see: http://docs.oracle.com/javase/7/docs/technotes/guides/jpda/architecture.html as pointed out by Mukul Goel in the comment stream under the question.