6 #include "../../perf.h" 7 #include "../../util/util.h" 8 #include "../../util/perf_regs.h" 9 #include "../../util/debug.h" 24 #ifdef HAVE_ARCH_X86_64_SUPPORT 41 #define SDT_NAME_REG(n, m) {.sdt_name = "%" #n, .uprobe_name = "%" #m} 42 #define SDT_NAME_REG_END {.sdt_name = NULL, .uprobe_name = NULL} 125 #define SDT_OP_REGEX "^([+\\-]?)([0-9]*)(\\(?)(%[a-z][a-z0-9]+)(\\)?)$" 131 static int initialized;
152 #define SDT_REG_NAME_SIZE 6 164 for (i = 0; sdt_reg_tbl[i].
sdt_name != NULL; i++) {
165 if (!strncmp(sdt_reg_tbl[i].
sdt_name, sdt_reg, sdt_len)) {
171 strncpy(uprobe_reg, sdt_reg, sdt_len);
177 int new_len = 0, ret;
194 char prefix[3] = {0};
204 if (strchr(old_op,
',') || strchr(old_op,
'$') ||
207 pr_debug4(
"Skipping unsupported SDT argument: %s\n", old_op);
223 if (rm[3].rm_so != rm[3].rm_eo) {
224 if (rm[1].rm_so != rm[1].rm_eo)
225 prefix[0] = *(old_op + rm[1].rm_so);
226 else if (rm[2].rm_so != rm[2].rm_eo)
229 strncpy(prefix,
"+0", 2);
237 new_len = strlen(prefix) +
238 (rm[2].rm_eo - rm[2].rm_so) +
239 (rm[3].rm_eo - rm[3].rm_so) +
241 (rm[5].rm_eo - rm[5].rm_so) +
244 *new_op =
zalloc(new_len);
248 scnprintf(*new_op, new_len,
"%.*s%.*s%.*s%.*s%.*s",
249 strlen(prefix), prefix,
250 (
int)(rm[2].rm_eo - rm[2].rm_so), old_op + rm[2].rm_so,
251 (
int)(rm[3].rm_eo - rm[3].rm_so), old_op + rm[3].rm_so,
252 strlen(new_reg), new_reg,
253 (
int)(rm[5].rm_eo - rm[5].rm_so), old_op + rm[5].rm_so);
const struct sample_reg sample_reg_masks[]
int arch_sdt_arg_parse_op(char *old_op, char **new_op)
#define pr_debug4(fmt,...)
static void sdt_rename_register(char *sdt_reg, int sdt_len, char *uprobe_reg)
#define SDT_REG_NAME_SIZE
#define SDT_NAME_REG(n, m)
static int sdt_init_op_regex(void)
static regex_t sdt_op_regex
static const struct sdt_name_reg sdt_reg_tbl[]
void static void * zalloc(size_t size)