Skip to content

Commit

Permalink
Temporary support to accommodate both PERF_EVENT_IOC_MODIFY_ATTRIBUTE…
Browse files Browse the repository at this point in the history
…S and PERF_EVENT_IOC_UPDATE_BREAKPOINT flags
  • Loading branch information
chabbimilind committed Jan 15, 2018
1 parent 154f50a commit 7c09421
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/tool/hpcrun/sample-sources/watchpoint_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@
#endif


#if defined(PERF_EVENT_IOC_UPDATE_BREAKPOINT)
#define FAST_BP_IOC_FLAG (PERF_EVENT_IOC_UPDATE_BREAKPOINT)
#elif defined(PERF_EVENT_IOC_MODIFY_ATTRIBUTES)
#define FAST_BP_IOC_FLAG (PERF_EVENT_IOC_MODIFY_ATTRIBUTES)
#else
#endif


#define CHECK(x) ({int err = (x); \
if (err) { \
EMSG("%s: Failed with %d on line %d of file %s\n", strerror(errno), err, __LINE__, __FILE__); \
Expand Down Expand Up @@ -209,7 +217,7 @@ static void InitConfig(){
CHECK(close(fd));


#if defined(PERF_EVENT_IOC_MODIFY_ATTRIBUTES)
#if defined(FAST_BP_IOC_FLAG)
wpConfig.isWPModifyEnabled = true;
#else
wpConfig.isWPModifyEnabled = false;
Expand Down Expand Up @@ -415,13 +423,13 @@ static void CreateWatchPoint(WatchPointInfo_t * wpi, SampleData_t * sampleData,
default: pe.bp_type = HW_BREAKPOINT_W | HW_BREAKPOINT_R;
}

#if defined(PERF_EVENT_IOC_MODIFY_ATTRIBUTES)
#if defined(FAST_BP_IOC_FLAG)
if(modify) {
// modification
assert(wpi->fileHandle != -1);
assert(wpi->mmapBuffer != 0);
//DisableWatchpoint(wpi);
CHECK(ioctl(wpi->fileHandle, PERF_EVENT_IOC_MODIFY_ATTRIBUTES, (unsigned long) (&pe)));
CHECK(ioctl(wpi->fileHandle, FAST_BP_IOC_FLAG, (unsigned long) (&pe)));
//if(wpi->isActive == false) {
//EnableWatchpoint(wpi->fileHandle);
//}
Expand Down

0 comments on commit 7c09421

Please sign in to comment.