Patent ID: 8910124

Claim:
A method for on-demand call-trace profiling an application having source code to be executed on a system, the method comprising: compiling a binary object from the source code using a processor while including a plurality of placeholder memory ranges in the compiled binary object, each placeholder memory range being of a size suitable for inserting a call-trace profiling function call and each placeholder memory range including a no operation (NOP) instruction; and providing a set of code modification instructions configured to modify the compiled binary object while it is being executed, the instructions including: inserting a call to a first call-trace profiling function in at least one of the plurality of placeholder memory ranges in place of the NOP instruction; replacing a return instruction and a subsequent NOP instruction with a jump instruction associated with a call to a second call-trace profiling function; logging call-trace profiling data using the inserted call-trace profiling function calls; and removing the inserted call-trace profiling function call after logging the call-trace profiling data including replacing the removed call-trace profiling function call with the NOP instruction and replacing the jump instruction with the return instruction and the subsequent NOP instruction.