@@ -43,13 +43,21 @@ KNOB<UINT64> knobMaxThreads(KNOB_MODE_WRITEONCE, "pintool", "threads", "10000",
4343 " Upper limit of the number of threads that can be used by the program \
4444 being profiled." );
4545
46+ // Stack based access logging (1: enable, 0: disable)
47+ KNOB<bool > knobStack (KNOB_MODE_WRITEONCE, " pintool" , " stack" , " 0" , " Stack based access logging \
48+ [1: enable, 0: disable (default)]." );
49+
50+ // Instruction pointer relative access logging (1: enable, 0: disable)
51+ KNOB<bool > knobIP (KNOB_MODE_WRITEONCE, " pintool" , " ip" , " 1" , " IP relative access logging \
52+ [1: enable (default), 0: disable]." );
53+
4654// Read logging (1: enable, 0: disable)
4755KNOB<bool > knobRead (KNOB_MODE_WRITEONCE, " pintool" , " read" , " 1" , " Read logging \
48- ( 1: enable, 0: disable) ." );
56+ [ 1: enable (default) , 0: disable] ." );
4957
5058// Write logging (1: enable, 0: disable)
5159KNOB<bool > knobWrite (KNOB_MODE_WRITEONCE, " pintool" , " write" , " 1" , " Write \
52- logging ( 1: enable, 0: disable) ." );
60+ logging [ 1: enable (default) , 0: disable] ." );
5361
5462
5563
@@ -107,7 +115,6 @@ bool read_log_en = true;
107115bool write_log_en = true ;
108116
109117
110-
111118/* ******************************************************************************
112119 * Functions
113120 ******************************************************************************/
@@ -169,8 +176,16 @@ VOID RecordMemWrite(THREADID tid, ADDRINT ea) {
169176 * Instruments instructions having read or write accesses.
170177 */
171178VOID Instruction (INS ins, VOID *v){
172- if (INS_IsStackRead (ins) || INS_IsStackWrite (ins)){
173- return ;
179+ if (!knobStack.Value ()){
180+ if (INS_IsStackRead (ins) || INS_IsStackWrite (ins)){
181+ return ;
182+ }
183+ }
184+
185+ if (!knobIP.Value ()){
186+ if (INS_IsIpRelRead (ins) || INS_IsIpRelWrite (ins)){
187+ return ;
188+ }
174189 }
175190
176191 // Get the memory operand count of the current instruction.
0 commit comments