Patent ID: 8370815

Claim:
A computer-implemented method for performing program debugging using an electronic device, the method comprising: adding an appended block to one or more memory blocks of a specified application program using a user-defined function upon a condition that the memory blocks are allocated by one or more memory allocation functions of the specified application program, so as to obtain one or more appended blocks in a memory of the electronic device, wherein the specified application program is a kernel routine program or a driver program in an operating system of the electronic device; storing an identifier of each memory allocation function into an appended block corresponding to the one or more memory blocks, and executing a memory leak test of the specified application program to determine one or more unqualified memory allocation functions in the specified application program; searching for one or more identifiers from the appended blocks upon the condition that the specified application program fails the memory leak test; obtaining a position of each unqualified memory allocation function in the specified application program according to each found identifier of the unqualified memory allocation function upon the condition that source codes of the specified application program are available in a storage device of the electronic device; obtaining the source codes of the specified application program from the storage device upon the condition that source codes of the specified application program are available, and replacing the memory allocation functions in the source codes of the specified application program with the user-defined function, so as to add the appended block to the memory block using the user-defined function; and recording a failure message of the specified application program in the storage device upon the condition that at least one identifier has been found in the memory and the source codes of the specified application program are unavailable in the storage device.