A method for the selective tracing of program instructions which, given a program for which pre-processed source files , object files with debugging information , and a symbol localisation file generated during the linking are provided, comprises the following steps : 1. selecting the statements to be traced on the pre-processed source files of the program , the elements that characterize each statement being: the name of the source file , the line number of the statement within that file, and the type of trace ; basic if it only traces the time of execution of the statement, or non-basic if it also traces the value of some element of the internal state of the processor, which is intended to be performed; 2. automatically identifying, for each statement selected, the relative address of the instruction to be traced that completes the execution of said statement, using the object files with program debugging information ; 3. automatically obtaining the content of an auxiliary memory , comprising trace codes and no-operation codes , using the elements that characterize each statement selected, the relative address identified within the object file of the instruction to be traced that corresponds to the statement selected, and the information from the symbol localisation file obtained during the linking of the object files of the program that generates the executable file ; in order to obtain, for each statement selected, the trace code and its displacement within the auxiliary memory storing the same, the trace codes being aligned with the instructions to be traced in the content of the program memory ; where aligned means that the displacement of each trace code within the content of the auxiliary memory is the same as that of the instruction to be traced within the content of the program memory , and those positions of the auxiliary memory that have the same displacement as the program instructions that have not been selected for tracing are completed with NOP no-operation codes . 1. selecting the statements to be traced on the pre-processed source files of the program , the elements that characterize each statement being: the name of the source file , the line number of the statement within that file, and the type of trace ; basic if it only traces the time of execution of the statement, or non-basic if it also traces the value of some element of the internal state of the processor, which is intended to be performed; 2. automatically identifying, for each statement selected, the relative address of the instruction to be traced that completes the execution of said statement, using the object files with program debugging information ; 3. automatically obtaining the content of an auxiliary memory , comprising trace codes and no-operation codes , using the elements that characterize each statement selected, the relative address identified within the object file of the instruction to be traced that corresponds to the statement selected, and the information from the symbol localisation file obtained during the linking of the object files of the program that generates the executable file ; in order to obtain, for each statement selected, the trace code and its displacement within the auxiliary memory storing the same, the trace codes being aligned with the instructions to be traced in the content of the program memory ; where aligned means that the displacement of each trace code within the content of the auxiliary memory is the same as that of the instruction to be traced within the content of the program memory , and those positions of the auxiliary memory that have the same displacement as the program instructions that have not been selected for tracing are completed with NOP no-operation codes . <EOS>