1. A system for storing trace information of a program to debug an error in the program comprising: a processor; a PC (Program Counter) register for traversing program codes in the program in an executable order; a main memory buffer for storing one or more of: trace data of the program, an entry data of a subroutine, and an exit data of the subroutine; a first-level memory buffer, being created when the subroutine is called for execution, for storing trace data related to the subroutine execution, wherein the processor is configured to perform steps of: linking the main memory buffer and the first-level memory buffer, the first-level memory buffer being a subordinate of the main memory buffer; deleting the first-level memory buffer and any stored trace data, without transferring the trace data stored in the first-level memory buffer, in response to that the subroutine successfully completes the execution; and transferring all contents of currently existing memory buffers to a storage device, in response to that an error or a failure occurs during running the program, wherein the transferred contents of the currently existing memory buffers are used to debug the error or the failure without attempting to recreate the error or the failure.