summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/probe-file.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2021-03-11 08:19:46 +0200
committerJani Nikula <jani.nikula@intel.com>2021-03-11 08:52:53 +0200
commit35bb28ece90dfb7f72b77ba529f25f79323d9581 (patch)
tree4ae931a45b83b5701214952066bb6fa6d839d7ff /tools/perf/util/probe-file.c
parentaaca50ef45ed247d98a66c0a754d1be93ff35dde (diff)
parenta38fd8748464831584a19438cbb3082b5a2dab15 (diff)
downloadlinux-stable-35bb28ece90dfb7f72b77ba529f25f79323d9581.tar.gz
linux-stable-35bb28ece90dfb7f72b77ba529f25f79323d9581.tar.bz2
linux-stable-35bb28ece90dfb7f72b77ba529f25f79323d9581.zip
Merge drm/drm-next into drm-intel-next
Sync up with upstream. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Diffstat (limited to 'tools/perf/util/probe-file.c')
-rw-r--r--tools/perf/util/probe-file.c38
1 files changed, 36 insertions, 2 deletions
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index bbecb449ea94..52273542e6ef 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -794,6 +794,8 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note,
char *ret = NULL;
int i, args_count, err;
unsigned long long ref_ctr_offset;
+ char *arg;
+ int arg_idx = 0;
if (strbuf_init(&buf, 32) < 0)
return NULL;
@@ -818,11 +820,43 @@ static char *synthesize_sdt_probe_command(struct sdt_note *note,
if (args == NULL)
goto error;
- for (i = 0; i < args_count; ++i) {
- if (synthesize_sdt_probe_arg(&buf, i, args[i]) < 0) {
+ for (i = 0; i < args_count; ) {
+ /*
+ * FIXUP: Arm64 ELF section '.note.stapsdt' uses string
+ * format "-4@[sp, NUM]" if a probe is to access data in
+ * the stack, e.g. below is an example for the SDT
+ * Arguments:
+ *
+ * Arguments: -4@[sp, 12] -4@[sp, 8] -4@[sp, 4]
+ *
+ * Since the string introduces an extra space character
+ * in the middle of square brackets, the argument is
+ * divided into two items. Fixup for this case, if an
+ * item contains sub string "[sp,", need to concatenate
+ * the two items.
+ */
+ if (strstr(args[i], "[sp,") && (i+1) < args_count) {
+ err = asprintf(&arg, "%s %s", args[i], args[i+1]);
+ i += 2;
+ } else {
+ err = asprintf(&arg, "%s", args[i]);
+ i += 1;
+ }
+
+ /* Failed to allocate memory */
+ if (err < 0) {
argv_free(args);
goto error;
}
+
+ if (synthesize_sdt_probe_arg(&buf, arg_idx, arg) < 0) {
+ free(arg);
+ argv_free(args);
+ goto error;
+ }
+
+ free(arg);
+ arg_idx++;
}
argv_free(args);