Low-overhead method and apparatus for collecting function call trace data
First Claim
Patent Images
1. 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.
2 Assignments
0 Petitions
Accused Products
Abstract
An apparatus and method for aiding in debugging and optimizing software is presented, in particular for instrumenting software to trace function calls. Source code is compiled with placeholder memory ranges. While executing the compiled binary object, a call-trace profiling function is inserted into at least certain of the placeholder memory ranges to log call-trace profiling data. Then, the compiled binary object is restored to its original state by removing the call-trace profiling function(s). A NOP function can be inserted in each placeholder memory range during compilation.
57 Citations
16 Claims
-
1. 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. - View Dependent Claims (2, 3, 4)
-
-
5. A method of on-demand call-trace profiling an application having source code to be executed on a system, the method comprising:
-
inserting, while executing a compiled binary object, a call to a first call-trace profiling function in at least one of a plurality of placeholder memory ranges included in the compiled binary object, the compiled binary object compiled from the source code and stored in a memory and each placeholder memory range being of a size suitable for the inserted call-trace profiling function call and including a NOP instruction inserted during compilation of the compiled binary object, wherein inserting the call-trace profiling function call comprises replacing the NOP function in the at least one of the plurality of placeholder memory ranges with a respective call-trace profiling function call and 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 function and replacing the jump instruction with the return instruction and the subsequent NOP instruction. - View Dependent Claims (6, 7, 8, 9)
-
-
10. An apparatus for on-demand call-trace profiling an application having source code to be executed on a system, the apparatus comprising:
-
a memory; and a processor configured to execute instructions stored in the memory to; insert, while executing the compiled binary object, a call to a first call-trace profiling function in at least one of a plurality of placeholder memory ranges included in a compiled binary object, the compiled binary object compiled from the source code and stored in a memory and each placeholder memory range being of a size suitable for the inserted call-trace profiling function call and including a NOP instruction inserted during compilation of the compiled binary object, wherein the processor is configured to insert the call-trace profiling function call by replacing the NOP function in the at least one of the plurality of placeholder memory ranges with a respective call-trace profiling function call and replacing a return instruction and a subsequent NOP instruction with a jump instruction associated with a call to a second call-trace profiling function; log call-trace profiling data using the inserted call-trace profiling function calls; and remove 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 function and replacing the jump instruction with the return instruction and the subsequent NOP instruction. - View Dependent Claims (11, 12, 13, 14, 15)
-
-
16. 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 NOP functions in the compiled binary object, each NOP function defining a placeholder memory range of a size suitable for inserting a call-trace profiling function call; and providing a set of code modification instructions configured to modify the compiled binary object while it is being executed, the instructions including; replacing at least one of the NOP functions with a call to a first call-trace profiling function; 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 subsequent to logging call-trace profiling data, removing the inserted call-trace profiling function call and restoring the NOP function and replacing the jump instruction with the return instruction and the subsequent NOP instruction.
-
Specification