98 static inline int set_hw_br(pid_t tracee, dr7_t *pdr7, void *addr, int dr_index)
99 {
100 errno = 0;
101 printf("LINE = %d <pid> %d, dr_index= %d addr=%u \n",__LINE__, tracee, dr_index, addr);
102 //if (ptrace(PTRACE_POKEUSER, tracee, offsetof(struct user, u_debugreg[dr_index]), addr))
103 if (ptrace(PTRACE_POKEUSER, tracee, offsetof(struct user, u_debugreg[dr_index]), addr))
104 {
105 int ii = errno;
106 printf("MKH: 22 errno = %d\n", ii);
107 ptrace(PTRACE_DETACH, tracee, 0, 0);
108 return -1;
109 }
110 else
111 printf("PTRACE_POKEUSER passed...\n");
Above code(part of main code) is successfully compiled in GCC compiler. But while compiling through G++, it is giving fillowing error: error: 'dr_index' cannot appear in a constant-expression
in line 103. set_hw_br is called from another function.
Any idea why this failing in g++?
Thanks.