Skip to contentSkip to conversation

perf-probe: Improve probing on versioned symbols

PATCH Superseded Masami Hiramatsu 5 participants 27 messages Dec 7, 2017 – Dec 12, 2017 perf events

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

v2 cover perf-probe: Improve probing on versioned symbols

Hi,

Here is the 2nd version of the series for probing on versioned symbols in libraries. This includes 5 patches to fix the issues discussed on perf-users ML
(https://www.spinics.net/lists/linux-perf-users/msg04637.html)

The first version is here; https://lkml.org/lkml/2017/12/5/1124

Here is the updates;

[3/5] Add a description in Documentation/perf-probe.txt [5/5] Add a description and examples in Documentation/perf-probe.txt

Thank you,
---

Masami Hiramatsu (5):
perf-probe: Add warning message if there is unexpected event name
perf-probe: Cut off the version suffix from event name
perf-probe: Add __return suffix for return events
perf-probe: Find versioned symbols from map
perf-probe: Support escaped character in parser

 tools/perf/Documentation/perf-probe.txt     |   18 ++++++
 tools/perf/arch/powerpc/util/sym-handling.c |    8 +++
 tools/perf/util/probe-event.c               |   81 +++++++++++++++++++--------
 tools/perf/util/string.c                    |   46 +++++++++++++++
 tools/perf/util/string2.h                   |    2 +
 tools/perf/util/symbol.c                    |    5 ++
 tools/perf/util/symbol.h                    |    1 
 7 files changed, 137 insertions(+), 24 deletions(-)

--
Masami Hiramatsu (Linaro Ltd.) <[email protected]>

#1 lore raw

PATCH v2 1/5 perf-probe: Add warning message if there is unexpected event name

This improve the error message so that user can know event-name error before writing new events to kprobe-events interface.

E.g.
======
#./perf probe -x /lib64/libc-2.25.so malloc_get_state*

   Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
     Error: Failed to add events.
   ======
---
 tools/perf/util/probe-event.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/util/probe-event.c +8 -0
index b7aaf9b2294d..c0067950e56f 100644
@@ -2625,6 +2625,14 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 
 out:
 	free(nbase);
+
+	/* Final validation */
+	if (ret >= 0 && !is_c_func_name(buf)) {
+		pr_warning("Internal error: \"%s\" is wrong event name.\n",
+			   buf);
+		ret = -EINVAL;
+	}
+
 	return ret;
 }
 
#2 lore raw

Re: [PATCH v2 1/5] perf-probe: Add warning message if there is unexpected event name

Em Thu, Dec 07, 2017 at 04:19:45PM +0900, Masami Hiramatsu escreveu:

Quoted 8 lines

This improve the error message so that user can know event-name error before writing new events to kprobe-events interface.

E.g.
======
#./perf probe -x /lib64/libc-2.25.so malloc_get_state*

   Internal error: "malloc_get_state@GLIBC_2" is wrong event name.

I'm changing this to:

Internal error: "malloc_get_state@GLIBC_2" is an invalid event name for the /sys/kernel/debug/tracing/kprobe_events interface.

Ok?

- Arnaldo

Quoted 27 lines

Error: Failed to add events.
======

---
 tools/perf/util/probe-event.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/util/probe-event.c +8 -0
index b7aaf9b2294d..c0067950e56f 100644
@@ -2625,6 +2625,14 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 
 out:
 	free(nbase);
+
+	/* Final validation */
+	if (ret >= 0 && !is_c_func_name(buf)) {
+		pr_warning("Internal error: \"%s\" is wrong event name.\n",
+			   buf);
+		ret = -EINVAL;
+	}
+
 	return ret;
 }
 
#3 lore raw

Re: [PATCH v2 1/5] perf-probe: Add warning message if there is unexpected event name

Quoted 10 lines · On Thu, 7 Dec 2017 12:53:43 -0300 Arnaldo Carvalho de Melo <[email protected]>…

Em Thu, Dec 07, 2017 at 04:19:45PM +0900, Masami Hiramatsu escreveu:

Quoted 8 lines

This improve the error message so that user can know event-name error before writing new events to kprobe-events interface.

E.g.
======
#./perf probe -x /lib64/libc-2.25.so malloc_get_state*

   Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
Quoted 5 lines

I'm changing this to:

Internal error: "malloc_get_state@GLIBC_2" is an invalid event name for the /sys/kernel/debug/tracing/kprobe_events interface.

Ok?

Hmm, it is a kernel limitation (or spec). Would you think we really need it? (are there any chance to allow '@' for event name?)

Thank you,

Quoted 30 lines

- Arnaldo

Quoted 27 lines

Error: Failed to add events.
======

---
 tools/perf/util/probe-event.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/util/probe-event.c +8 -0
index b7aaf9b2294d..c0067950e56f 100644
@@ -2625,6 +2625,14 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 
 out:
 	free(nbase);
+
+	/* Final validation */
+	if (ret >= 0 && !is_c_func_name(buf)) {
+		pr_warning("Internal error: \"%s\" is wrong event name.\n",
+			   buf);
+		ret = -EINVAL;
+	}
+
 	return ret;
 }
 
Signature · 1 line
Masami Hiramatsu <[email protected]>
#4 lore raw

PATCH v2 2/5 perf-probe: Cut off the version suffix from event name

In reply to Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

---
 tools/perf/util/probe-event.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/probe-event.c +2 -2
index c0067950e56f..74435fb7ab7f 100644
@@ -2584,8 +2584,8 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 	if (!nbase)
 		return -ENOMEM;
 
-	/* Cut off the dot suffixes (e.g. .const, .isra)*/
-	p = strchr(nbase, '.');
+	/* Cut off the dot suffixes (e.g. .const, .isra) and version suffixes */
+	p = strpbrk(nbase, ".@");
 	if (p && p != nbase)
 		*p = '\0';
 
#5 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Quoted 30 lines · Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)
Quoted 5 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

I think this will still fall over for a case where there are multiple versions of the same base symbol, like:

$ nm /lib64/libc.so.6 | egrep ' sched_getaffinity'
0000000000134430 T sched_getaffinity@GLIBC_2.3.3
00000000000dcf00 T sched_getaffinity@@GLIBC_2.3.4

Should we retain the versioning string in some form? "sched_getaffinity--GLIBC_2.3.4"? Should we instead interpret the '@' symbol more flexibly, so maybe first assume it is a version string, and if not found, try to see if it's a valid "@SRC" specification?

PC

#6 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Quoted 37 lines · On Thu, 7 Dec 2017 10:34:51 -0600 Paul Clarke <[email protected]> wrote:
Quoted 34 lines · Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

Quoted 7 lines
Quoted 1 line

=====

I think this will still fall over for a case where there are multiple versions of the same base symbol, like:

$ nm /lib64/libc.so.6 | egrep ' sched_getaffinity'
0000000000134430 T sched_getaffinity@GLIBC_2.3.3
00000000000dcf00 T sched_getaffinity@@GLIBC_2.3.4

No, in that case perf probe adds number suffix (_1, _2...) for new events :)

This feature (number suffix) is anyway required for the case that inlined function is spreaded in multiple places. I think this is natural for perf probe.

Thank you,

Quoted 5 lines

Should we retain the versioning string in some form? "sched_getaffinity--GLIBC_2.3.4"? Should we instead interpret the '@' symbol more flexibly, so maybe first assume it is a version string, and if not found, try to see if it's a valid "@SRC" specification?

PC

Signature · 1 line
Masami Hiramatsu <[email protected]>
#7 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Quoted 41 lines · Masami Hiramatsu
Quoted 39 lines · On Thu, 7 Dec 2017 10:34:51 -0600 Paul Clarke <[email protected]> wrote:
Quoted 30 lines · Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)
Quoted 5 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

I think this will still fall over for a case where there are multiple versions of the same base symbol, like:

Quoted 8 lines
Quoted 3 lines
$ nm /lib64/libc.so.6 | egrep ' sched_getaffinity'
0000000000134430 T sched_getaffinity@GLIBC_2.3.3
00000000000dcf00 T sched_getaffinity@@GLIBC_2.3.4

No, in that case perf probe adds number suffix (_1, _2...) for new events :)

This feature (number suffix) is anyway required for the case that inlined function is spreaded in multiple places. I think this is natural for perf probe.

I can live with that.

Is the versioning tag retained for display with "perf probe -l" display, so the probe points can be distinguished?

In other words, will one see:

# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity@GLIBC_2.3.3 in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity@@GLIBC_2.3.4 in /usr/lib64/libc-2.17.so)
or
# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity in /usr/lib64/libc-2.17.so)

PC

#8 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Quoted 53 lines · On Fri, 8 Dec 2017 08:49:46 -0600 Paul Clarke <[email protected]> wrote:
Quoted 41 lines · Masami Hiramatsu
Quoted 39 lines · On Thu, 7 Dec 2017 10:34:51 -0600 Paul Clarke <[email protected]> wrote:
Quoted 30 lines · Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)
Quoted 5 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

I think this will still fall over for a case where there are multiple versions of the same base symbol, like:

Quoted 8 lines
Quoted 3 lines
$ nm /lib64/libc.so.6 | egrep ' sched_getaffinity'
0000000000134430 T sched_getaffinity@GLIBC_2.3.3
00000000000dcf00 T sched_getaffinity@@GLIBC_2.3.4

No, in that case perf probe adds number suffix (_1, _2...) for new events :)

This feature (number suffix) is anyway required for the case that inlined function is spreaded in multiple places. I think this is natural for perf probe.

Quoted 8 lines

I can live with that.

Is the versioning tag retained for display with "perf probe -l" display, so the probe points can be distinguished?

In other words, will one see:

# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity@GLIBC_2.3.3 in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity@@GLIBC_2.3.4 in /usr/lib64/libc-2.17.so)

Yes, this style, since the symbols are recorded with version suffixes.

Thank you,

Quoted 11 lines

or

# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity in /usr/lib64/libc-2.17.so)

PC

--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Masami Hiramatsu <[email protected]>
#9 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

In reply to Paul Clarke

Em Fri, Dec 08, 2017 at 08:49:46AM -0600, Paul Clarke escreveu:

Quoted 57 lines · Masami Hiramatsu
Quoted 41 lines
Quoted 39 lines · On Thu, 7 Dec 2017 10:34:51 -0600 Paul Clarke <[email protected]> wrote:
Quoted 30 lines · Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)
Quoted 5 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

I think this will still fall over for a case where there are multiple versions of the same base symbol, like:

Quoted 8 lines
Quoted 3 lines
$ nm /lib64/libc.so.6 | egrep ' sched_getaffinity'
0000000000134430 T sched_getaffinity@GLIBC_2.3.3
00000000000dcf00 T sched_getaffinity@@GLIBC_2.3.4

No, in that case perf probe adds number suffix (_1, _2...) for new events :)

This feature (number suffix) is anyway required for the case that inlined function is spreaded in multiple places. I think this is natural for perf probe.

I can live with that.

Is the versioning tag retained for display with "perf probe -l" display, so the probe points can be distinguished?

Quoted 8 lines

In other words, will one see:

# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity@GLIBC_2.3.3 in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity@@GLIBC_2.3.4 in /usr/lib64/libc-2.17.so)
or
# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity in /usr/lib64/libc-2.17.so)

[root@jouet ~]# perf probe -x /lib64/libc-2.25.so malloc* Added new events:
probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
probe_libc:malloc (on malloc* in /usr/lib64/libc-2.25.so)
probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

[root@jouet ~]# perf probe -l
probe_libc:malloc (on 0xd22a6973 in /usr/lib64/libc-2.25.so)
probe_libc:malloc_check (on 0x25db6f5a in /usr/lib64/libc-2.25.so) probe_libc:malloc_consolidate (on 0x88f7c44a in /usr/lib64/libc-2.25.so) probe_libc:malloc_get_state (on 0xdd38eca7 in /usr/lib64/libc-2.25.so) probe_libc:malloc_hook_ini (on 0x8de2b533 in /usr/lib64/libc-2.25.so) probe_libc:malloc_info (on 0x8b327bde in /usr/lib64/libc-2.25.so) probe_libc:malloc_printerr (on 0x8fff087c in /usr/lib64/libc-2.25.so) probe_libc:malloc_set_state (on 0x861940e6 in /usr/lib64/libc-2.25.so) probe_libc:malloc_stats (on 0x51fa3cdc in /usr/lib64/libc-2.25.so) probe_libc:malloc_trim (on 0xa9fa4e43 in /usr/lib64/libc-2.25.so) probe_libc:malloc_usable_size (on 0xceb5e090 in /usr/lib64/libc-2.25.so) probe_libc:mallochook (on 0x6ebc00f5 in /usr/lib64/libc-2.25.so)
[root@jouet ~]#

[acme@jouet perf]$ nm /lib64/libc-2.25.so | grep malloc_get_state 0000000000151ba0 T malloc_get_state@GLIBC_2.2.5 [acme@jouet perf]$

For your example it finds two symbols, adds two but I couldn't find a simple way of mapping one to the other, would be nice if 'perf probe -l' showed them like 'nm' does.

[root@jouet ~]# nm /lib64/libc-2.25.so | grep ' sched_getaffinity' 0000000000151cd0 T sched_getaffinity@GLIBC_2.3.3 00000000000f3c10 T sched_getaffinity@@GLIBC_2.3.4 [root@jouet ~]#

[root@jouet ~]# perf probe -x /lib64/libc-2.25.so sched_getaffinity* Added new events:
probe_libc:sched_getaffinity (on sched_getaffinity* in /usr/lib64/libc-2.25.so) probe_libc:sched_getaffinity_1 (on sched_getaffinity* in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:sched_getaffinity_1 -aR sleep 1

[root@jouet ~]# perf probe -l
probe_libc:sched_getaffinity (on 0x5fd95e7c in /usr/lib64/libc-2.25.so) probe_libc:sched_getaffinity_1 (on 0xd8d51601 in /usr/lib64/libc-2.25.so)
[root@jouet ~]#

#10 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Quoted 86 lines · On Mon, 11 Dec 2017 15:25:47 -0300 Arnaldo Carvalho de Melo <[email protected]>…

Em Fri, Dec 08, 2017 at 08:49:46AM -0600, Paul Clarke escreveu:

Quoted 57 lines · Masami Hiramatsu
Quoted 41 lines
Quoted 39 lines · On Thu, 7 Dec 2017 10:34:51 -0600 Paul Clarke <[email protected]> wrote:
Quoted 30 lines · Masami Hiramatsu

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)
Quoted 5 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

I think this will still fall over for a case where there are multiple versions of the same base symbol, like:

Quoted 8 lines
Quoted 3 lines
$ nm /lib64/libc.so.6 | egrep ' sched_getaffinity'
0000000000134430 T sched_getaffinity@GLIBC_2.3.3
00000000000dcf00 T sched_getaffinity@@GLIBC_2.3.4

No, in that case perf probe adds number suffix (_1, _2...) for new events :)

This feature (number suffix) is anyway required for the case that inlined function is spreaded in multiple places. I think this is natural for perf probe.

I can live with that.

Is the versioning tag retained for display with "perf probe -l" display, so the probe points can be distinguished?

Quoted 8 lines

In other words, will one see:

# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity@GLIBC_2.3.3 in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity@@GLIBC_2.3.4 in /usr/lib64/libc-2.17.so)
or
# perf probe -l
  probe_libc:sched_getaffinity (on sched_getaffinity in /usr/lib64/libc-2.17.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity in /usr/lib64/libc-2.17.so)

[root@jouet ~]# perf probe -x /lib64/libc-2.25.so malloc* Added new events:
probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
probe_libc:malloc (on malloc* in /usr/lib64/libc-2.25.so)
probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so) probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

Quoted 13 lines

[root@jouet ~]# perf probe -l
probe_libc:malloc (on 0xd22a6973 in /usr/lib64/libc-2.25.so)
probe_libc:malloc_check (on 0x25db6f5a in /usr/lib64/libc-2.25.so) probe_libc:malloc_consolidate (on 0x88f7c44a in /usr/lib64/libc-2.25.so) probe_libc:malloc_get_state (on 0xdd38eca7 in /usr/lib64/libc-2.25.so) probe_libc:malloc_hook_ini (on 0x8de2b533 in /usr/lib64/libc-2.25.so) probe_libc:malloc_info (on 0x8b327bde in /usr/lib64/libc-2.25.so) probe_libc:malloc_printerr (on 0x8fff087c in /usr/lib64/libc-2.25.so) probe_libc:malloc_set_state (on 0x861940e6 in /usr/lib64/libc-2.25.so) probe_libc:malloc_stats (on 0x51fa3cdc in /usr/lib64/libc-2.25.so) probe_libc:malloc_trim (on 0xa9fa4e43 in /usr/lib64/libc-2.25.so) probe_libc:malloc_usable_size (on 0xceb5e090 in /usr/lib64/libc-2.25.so) probe_libc:mallochook (on 0x6ebc00f5 in /usr/lib64/libc-2.25.so)

This looks something wrong. perf-probe should try to get symbol at least. What happened on that ? Could you run perf probe -l with -vv ?

On my Fedora26,

$ sudo ./perf probe -l
  probe_libc:malloc    (on __malloc in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_check (on malloc_check in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_consolidate (on malloc_consolidate.part.1 in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_hook_ini (on malloc_hook_ini in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_info (on __malloc_info in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_printerr (on malloc_printerr in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_set_state (on malloc_set_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_stats (on __malloc_stats in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_trim (on __malloc_trim in /usr/lib64/libc-2.25.so)
  probe_libc:malloc_usable_size (on __malloc_usable_size in /usr/lib64/libc-2.25.so)
  probe_libc:mallochook (on mallochook in /usr/lib64/libc-2.25.so)

I can see the symbols with version suffixes.

Quoted 20 lines

[root@jouet ~]#

[acme@jouet perf]$ nm /lib64/libc-2.25.so | grep malloc_get_state 0000000000151ba0 T malloc_get_state@GLIBC_2.2.5 [acme@jouet perf]$

For your example it finds two symbols, adds two but I couldn't find a simple way of mapping one to the other, would be nice if 'perf probe -l' showed them like 'nm' does.

[root@jouet ~]# nm /lib64/libc-2.25.so | grep ' sched_getaffinity' 0000000000151cd0 T sched_getaffinity@GLIBC_2.3.3 00000000000f3c10 T sched_getaffinity@@GLIBC_2.3.4 [root@jouet ~]#

[root@jouet ~]# perf probe -x /lib64/libc-2.25.so sched_getaffinity* Added new events:
probe_libc:sched_getaffinity (on sched_getaffinity* in /usr/lib64/libc-2.25.so) probe_libc:sched_getaffinity_1 (on sched_getaffinity* in /usr/lib64/libc-2.25.so)

Quoted 8 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:sched_getaffinity_1 -aR sleep 1

[root@jouet ~]# perf probe -l
probe_libc:sched_getaffinity (on 0x5fd95e7c in /usr/lib64/libc-2.25.so) probe_libc:sched_getaffinity_1 (on 0xd8d51601 in /usr/lib64/libc-2.25.so)
[root@jouet ~]#

This case also shows

$ sudo ./perf probe -l
  probe_libc:sched_getaffinity (on __sched_getaffinity_new in /usr/lib64/libc-2.25.so)
  probe_libc:sched_getaffinity_1 (on sched_getaffinity@GLIBC_2.3.3 in /usr/lib64/libc-2.25.so)

(but the first one seems a bit different, maybe it is an alias of sched_getaffinity@<some new version>.)

Thank you,

Signature · 1 line
Masami Hiramatsu <[email protected]>
#11 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

In reply to Masami Hiramatsu

Em Thu, Dec 07, 2017 at 04:20:28PM +0900, Masami Hiramatsu escreveu:

Quoted 15 lines

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

Quoted 14 lines
  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)

Thanks for working on this! I'm now going over it, and one thing I noticed was that the (on malloc*) on all the entries matched by that wildcard, can I suggest that you expand it there as well? I.e.

probe_libc:malloc_set_state (on malloc_set_state in /usr/lib64/libc-2.25.so)

This way we'll now when aliases are used, and also for the versioning case, i.e. to which version is a probe pointing?

See also Paul Clarke's question and suggestion, which I agree, i.e. instead of chopping off the version, just replace the chars with valid ones or better, do what Paul suggests, be more flexible in interpreting @, i.e. if it is a number and/or fails to point to any file, interpret it as versioning.

- Arnaldo

Quoted 28 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

---
 tools/perf/util/probe-event.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/probe-event.c +2 -2
index c0067950e56f..74435fb7ab7f 100644
@@ -2584,8 +2584,8 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 	if (!nbase)
 		return -ENOMEM;
 
-	/* Cut off the dot suffixes (e.g. .const, .isra)*/
-	p = strchr(nbase, '.');
+	/* Cut off the dot suffixes (e.g. .const, .isra) and version suffixes */
+	p = strpbrk(nbase, ".@");
 	if (p && p != nbase)
 		*p = '\0';
 
#12 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Quoted 37 lines · Arnaldo Carvalho de Melo

Em Thu, Dec 07, 2017 at 04:20:28PM +0900, Masami Hiramatsu escreveu:

Quoted 15 lines

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

Quoted 14 lines
  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)

Thanks for working on this! I'm now going over it, and one thing I noticed was that the (on malloc*) on all the entries matched by that wildcard, can I suggest that you expand it there as well? I.e.

probe_libc:malloc_set_state (on malloc_set_state in /usr/lib64/libc-2.25.so)

Quoted 8 lines

This way we'll now when aliases are used, and also for the versioning case, i.e. to which version is a probe pointing?

See also Paul Clarke's question and suggestion, which I agree, i.e. instead of chopping off the version, just replace the chars with valid ones or better, do what Paul suggests, be more flexible in interpreting @, i.e. if it is a number and/or fails to point to any file, interpret it as versioning.

It's a nit, and subjective, but I'd favor checking for versioning first, then file. The namespaces are very unlikely to intersect, but I could foresee symbols like "[email protected]" and "[email protected]" more likely than a symbol in a file "GLIBC_2.2.5".

Perhaps straying toward bikeshedding...

PC

#13 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

Em Thu, Dec 07, 2017 at 11:24:47AM -0600, Paul Clarke escreveu:

Quoted 8 lines · Arnaldo Carvalho de Melo
Quoted 6 lines

Em Thu, Dec 07, 2017 at 04:20:28PM +0900, Masami Hiramatsu escreveu:
See also Paul Clarke's question and suggestion, which I agree, i.e. instead of chopping off the version, just replace the chars with valid ones or better, do what Paul suggests, be more flexible in interpreting @, i.e. if it is a number and/or fails to point to any file, interpret it as versioning.

Quoted 6 lines

It's a nit, and subjective, but I'd favor checking for versioning first, then file. The namespaces are very unlikely to intersect, but I could foresee symbols like "[email protected]" and "[email protected]" more likely than a symbol in a file "GLIBC_2.2.5".

Perhaps straying toward bikeshedding...

Nah, those are valid concerns, and I share them.

- Arnaldo

#14 lore raw

Re: [PATCH v2 2/5] perf-probe: Cut off the version suffix from event name

In reply to Arnaldo Carvalho de Melo
Quoted 31 lines · On Thu, 7 Dec 2017 13:56:59 -0300 Arnaldo Carvalho de Melo <[email protected]>…

Em Thu, Dec 07, 2017 at 04:20:28PM +0900, Masami Hiramatsu escreveu:

Quoted 15 lines

Cut off the version suffix (e.g. @GLIBC_2.2.5 etc.) from automatic generated event name. This fixes wildcard event adding like below case;

=====

  # perf probe -x /lib64/libc-2.25.so malloc*
  Internal error: "malloc_get_state@GLIBC_2" is wrong event name.
    Error: Failed to add events.
  =====

This failure was caused by a versioned suffix symbol. With this fix, perf probe automatically cuts the suffix after @ as below.

=====

Quoted 14 lines
  # ./perf probe -x /lib64/libc-2.25.so malloc*
  Added new events:
    probe_libc:malloc_printerr (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc    (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state (on malloc* in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state (on malloc* in /usr/lib64/libc-2.25.so)
Quoted 6 lines

Thanks for working on this! I'm now going over it, and one thing I noticed was that the (on malloc*) on all the entries matched by that wildcard, can I suggest that you expand it there as well? I.e.

probe_libc:malloc_set_state (on malloc_set_state in /usr/lib64/libc-2.25.so)

Hmm, the reason why I chose it was perf probe accepted multiple probe points at once. e.g.

./perf probe -x /lib64/libc-2.25.so -a malloc* -a free*

So, if we specify several probe points, I guess user will like to see which events come from which one.

Quoted 2 lines

This way we'll now when aliases are used, and also for the versioning case, i.e. to which version is a probe pointing?

Currently we can know that by perf probe -l. I would recommend this way, since -l can show you more precise information (and if it take a time to read/analyze debuginfo, user can understand the reason why).

Thank you,

Quoted 37 lines

See also Paul Clarke's question and suggestion, which I agree, i.e. instead of chopping off the version, just replace the chars with valid ones or better, do what Paul suggests, be more flexible in interpreting @, i.e. if it is a number and/or fails to point to any file, interpret it as versioning.

- Arnaldo

Quoted 28 lines

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state -aR sleep 1

=====

---
 tools/perf/util/probe-event.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/probe-event.c +2 -2
index c0067950e56f..74435fb7ab7f 100644
@@ -2584,8 +2584,8 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 	if (!nbase)
 		return -ENOMEM;
 
-	/* Cut off the dot suffixes (e.g. .const, .isra)*/
-	p = strchr(nbase, '.');
+	/* Cut off the dot suffixes (e.g. .const, .isra) and version suffixes */
+	p = strpbrk(nbase, ".@");
 	if (p && p != nbase)
 		*p = '\0';
 
Signature · 1 line
Masami Hiramatsu <[email protected]>
#15 lore raw

PATCH v2 3/5 perf-probe: Add __return suffix for return events

In reply to Masami Hiramatsu

Add __return suffix for function return events automatically. Without this, user have to give --force option and will see the number suffix for each event like "function_1", which is not easy to recognize. Instead, this adds __return suffix to it automatically. E.g.

=====

  # ./perf probe -x /lib64/libc-2.25.so 'malloc*%return'
  Added new events:
    probe_libc:malloc_printerr__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_consolidate__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_check__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_hook_ini__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_trim__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_usable_size__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_stats__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_info__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:mallochook__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_get_state__return (on malloc*%return in /usr/lib64/libc-2.25.so)
    probe_libc:malloc_set_state__return (on malloc*%return in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_set_state__return -aR sleep 1

=====

---
Changes in v2:
- Add a description in Documentation/perf-probe.txt.

---
 tools/perf/Documentation/perf-probe.txt |    2 +-
 tools/perf/util/probe-event.c           |    9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)
tools/perf/Documentation/perf-probe.txt +1 -1
index d7e4869905f1..f96382692f42 100644
@@ -170,7 +170,7 @@ Probe points are defined by following syntax.
      or,
      sdt_PROVIDER:SDTEVENT
 
-'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function. You can also specify a group name by 'GROUP', if omitted, set 'probe' is used for kprobe and 'probe_<bin>' is used for uprobe.
+'EVENT' specifies the name of new event, if omitted, it will be set the name of the probed function, and for return probes, a "\_\_return" suffix is automatically added to the function name. You can also specify a group name by 'GROUP', if omitted, set 'probe' is used for kprobe and 'probe_<bin>' is used for uprobe.
 Note that using existing group name can conflict with other events. Especially, using the group name reserved for kernel modules can hide embedded events in the
 modules.
 'FUNC' specifies a probed function name, and it may have one of the following options; '+OFFS' is the offset from function entry address in bytes, ':RLN' is the relative-line number from function entry line, and '%return' means that it probes function return. And ';PTN' means lazy matching pattern (see LAZY MATCHING). Note that ';PTN' must be the end of the probe point definition.  In addition, '@SRC' specifies a source file which has that function.
tools/perf/util/probe-event.c +5 -4
index 74435fb7ab7f..959c4d2ef455 100644
@@ -2573,7 +2573,8 @@ int show_perf_probe_events(struct strfilter *filter)
 }
 
 static int get_new_event_name(char *buf, size_t len, const char *base,
-			      struct strlist *namelist, bool allow_suffix)
+			      struct strlist *namelist, bool ret_event,
+			      bool allow_suffix)
 {
 	int i, ret;
 	char *p, *nbase;
@@ -2590,7 +2591,7 @@ static int get_new_event_name(char *buf, size_t len, const char *base,
 		*p = '\0';
 
 	/* Try no suffix number */
-	ret = e_snprintf(buf, len, "%s", nbase);
+	ret = e_snprintf(buf, len, "%s%s", nbase, ret_event ? "__return" : "");
 	if (ret < 0) {
 		pr_debug("snprintf() failed: %d\n", ret);
 		goto out;
@@ -2689,8 +2690,8 @@ static int probe_trace_event__set_name(struct probe_trace_event *tev,
 		group = PERFPROBE_GROUP;
 
 	/* Get an unused new event name */
-	ret = get_new_event_name(buf, 64, event,
-				 namelist, allow_suffix);
+	ret = get_new_event_name(buf, 64, event, namelist,
+				 tev->point.retprobe, allow_suffix);
 	if (ret < 0)
 		return ret;
 
#16 lore raw

PATCH v2 4/5 perf-probe: Find versioned symbols from map

In reply to Masami Hiramatsu

Find versioned symbols correctly from map. Commit d80406453ad4 ("perf symbols: Allow user probes on versioned symbols") allows user to find default versioned symbols (with "@@") in map. However, it did not enable normal versioned symbol (with "@") for perf-probe. E.g.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state
  Failed to find symbol malloc_get_state in /usr/lib64/libc-2.25.so
    Error: Failed to add events.
  =====

This solves above issue by improving perf-probe symbol search function, as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state
  Added new event:
    probe_libc:malloc_get_state (on malloc_get_state in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_get_state -aR sleep 1

  # ./perf probe -l
    probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)
  =====
---
 tools/perf/arch/powerpc/util/sym-handling.c |    8 ++++++++
 tools/perf/util/probe-event.c               |   16 +++++++++++++++-
 tools/perf/util/symbol.c                    |    5 +++++
 tools/perf/util/symbol.h                    |    1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
tools/perf/arch/powerpc/util/sym-handling.c +8 -0
index 9c4e23d8c8ce..a3613c8d97b6 100644
@@ -64,6 +64,14 @@ int arch__compare_symbol_names_n(const char *namea, const char *nameb,
 
 	return strncmp(namea, nameb, n);
 }
+
+const char *arch__normalize_symbol_name(const char *name)
+{
+	/* Skip over initial dot */
+	if (*name == '.')
+		name++;
+	return name;
+}
 #endif
 
 #if defined(_CALL_ELF) && _CALL_ELF == 2
tools/perf/util/probe-event.c +15 -1
index 959c4d2ef455..94acc5846e2a 100644
@@ -2801,16 +2801,30 @@ static int find_probe_functions(struct map *map, char *name,
 	int found = 0;
 	struct symbol *sym;
 	struct rb_node *tmp;
+	const char *norm, *ver;
+	char *buf = NULL;
 
 	if (map__load(map) < 0)
 		return 0;
 
 	map__for_each_symbol(map, sym, tmp) {
-		if (strglobmatch(sym->name, name)) {
+		norm = arch__normalize_symbol_name(sym->name);
+		if (!norm)
+			continue;
+
+		/* We don't care about default symbol or not */
+		ver = strchr(norm, '@');
+		if (ver) {
+			buf = strndup(norm, ver - norm);
+			norm = buf;
+		}
+		if (strglobmatch(norm, name)) {
 			found++;
 			if (syms && found < probe_conf.max_probes)
 				syms[found - 1] = sym;
 		}
+		if (buf)
+			zfree(&buf);
 	}
 
 	return found;
tools/perf/util/symbol.c +5 -0
index 1b67a8639dfe..cc065d4bfafc 100644
@@ -94,6 +94,11 @@ static int prefix_underscores_count(const char *str)
 	return tail - str;
 }
 
+const char * __weak arch__normalize_symbol_name(const char *name)
+{
+	return name;
+}
+
 int __weak arch__compare_symbol_names(const char *namea, const char *nameb)
 {
 	return strcmp(namea, nameb);
tools/perf/util/symbol.h +1 -0
index a4f0075b4e5c..0563f33c1eb3 100644
@@ -349,6 +349,7 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
 void arch__sym_update(struct symbol *s, GElf_Sym *sym);
 #endif
 
+const char *arch__normalize_symbol_name(const char *name);
 #define SYMBOL_A 0
 #define SYMBOL_B 1
 
#17 lore raw

Re: [PATCH v2 4/5] perf-probe: Find versioned symbols from map

Quoted 63 lines · Masami Hiramatsu

Find versioned symbols correctly from map. Commit d80406453ad4 ("perf symbols: Allow user probes on versioned symbols") allows user to find default versioned symbols (with "@@") in map. However, it did not enable normal versioned symbol (with "@") for perf-probe. E.g.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state
  Failed to find symbol malloc_get_state in /usr/lib64/libc-2.25.so
    Error: Failed to add events.
  =====

This solves above issue by improving perf-probe symbol search function, as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state
  Added new event:
    probe_libc:malloc_get_state (on malloc_get_state in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_get_state -aR sleep 1

  # ./perf probe -l
    probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)
  =====
---
 tools/perf/arch/powerpc/util/sym-handling.c |    8 ++++++++
 tools/perf/util/probe-event.c               |   16 +++++++++++++++-
 tools/perf/util/symbol.c                    |    5 +++++
 tools/perf/util/symbol.h                    |    1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
tools/perf/arch/powerpc/util/sym-handling.c +8 -0
index 9c4e23d8c8ce..a3613c8d97b6 100644
@@ -64,6 +64,14 @@ int arch__compare_symbol_names_n(const char *namea, const char *nameb,
 
 	return strncmp(namea, nameb, n);
 }
+
+const char *arch__normalize_symbol_name(const char *name)
+{
+	/* Skip over initial dot */
+	if (*name == '.')
+		name++;
+	return name;
+}
 #endif
 
 #if defined(_CALL_ELF) && _CALL_ELF == 2
tools/perf/util/probe-event.c +0 -0
index 959c4d2ef455..94acc5846e2a 100644
@@ -2801,16 +2801,30 @@ static int find_probe_functions(struct map *map, char *name,
 	int found = 0;
 	struct symbol *sym;

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2811

Quoted 10 lines
tools/perf/util/probe-event.c +3 -1
 	struct rb_node *tmp;
+	const char *norm, *ver;
+	char *buf = NULL;
 
 	if (map__load(map) < 0)
 		return 0;
 
 	map__for_each_symbol(map, sym, tmp) {
-		if (strglobmatch(sym->name, name)) {
+		norm = arch__normalize_symbol_name(sym->name);

The weak default function arch__normalize_symbol_name() simply returns its parameter, so norm can be a NULL ptr when parameter sym->name is a NULL pointer.
However when sym->name is a NULL pointer (or can be one) then the Powerpc version of arch__normalize_symbol_name() dereferences a NULL ptr (by checking the symbol's first character is a '.').

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2819

Quoted 8 lines
tools/perf/util/probe-event.c +8 -0
+		if (!norm)
+			continue;
+
+		/* We don't care about default symbol or not */
+		ver = strchr(norm, '@');
+		if (ver) {
+			buf = strndup(norm, ver - norm);
+			norm = buf;

if strndup() returns a NULL pointer (due to lack of memory) then variable norm is a NULL ptr and strglobmatch() --> __match_glob() derefenences that NULL pointer (1. parameter).

Quoted 45 lines
tools/perf/util/probe-event.c +4 -0
+		}
+		if (strglobmatch(norm, name)) {
 			found++;
 			if (syms && found < probe_conf.max_probes)
 				syms[found - 1] = sym;
 		}
+		if (buf)
+			zfree(&buf);
 	}
 
 	return found;
tools/perf/util/symbol.c +5 -0
index 1b67a8639dfe..cc065d4bfafc 100644
@@ -94,6 +94,11 @@ static int prefix_underscores_count(const char *str)
 	return tail - str;
 }
 
+const char * __weak arch__normalize_symbol_name(const char *name)
+{
+	return name;
+}
+
 int __weak arch__compare_symbol_names(const char *namea, const char *nameb)
 {
 	return strcmp(namea, nameb);
tools/perf/util/symbol.h +1 -1
index a4f0075b4e5c..0563f33c1eb3 100644
@@ -349,6 +349,7 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
 void arch__sym_update(struct symbol *s, GElf_Sym *sym);
 #endif
 
+const char *arch__normalize_symbol_name(const char *name);
 #define SYMBOL_A 0
 #define SYMBOL_B 1
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
#18 lore raw

Re: [PATCH v2 4/5] perf-probe: Find versioned symbols from map

Quoted 71 lines · On Fri, 8 Dec 2017 12:08:41 +0100 Thomas-Mich Richter…
Quoted 70 lines · Masami Hiramatsu

Find versioned symbols correctly from map. Commit d80406453ad4 ("perf symbols: Allow user probes on versioned symbols") allows user to find default versioned symbols (with "@@") in map. However, it did not enable normal versioned symbol (with "@") for perf-probe. E.g.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state
  Failed to find symbol malloc_get_state in /usr/lib64/libc-2.25.so
    Error: Failed to add events.
  =====

This solves above issue by improving perf-probe symbol search function, as below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state
  Added new event:
    probe_libc:malloc_get_state (on malloc_get_state in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_get_state -aR sleep 1

  # ./perf probe -l
    probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)
  =====
---
 tools/perf/arch/powerpc/util/sym-handling.c |    8 ++++++++
 tools/perf/util/probe-event.c               |   16 +++++++++++++++-
 tools/perf/util/symbol.c                    |    5 +++++
 tools/perf/util/symbol.h                    |    1 +
 4 files changed, 29 insertions(+), 1 deletion(-)
tools/perf/arch/powerpc/util/sym-handling.c +8 -0
index 9c4e23d8c8ce..a3613c8d97b6 100644
@@ -64,6 +64,14 @@ int arch__compare_symbol_names_n(const char *namea, const char *nameb,
 
 	return strncmp(namea, nameb, n);
 }
+
+const char *arch__normalize_symbol_name(const char *name)
+{
+	/* Skip over initial dot */
+	if (*name == '.')
+		name++;
+	return name;
+}
 #endif
 
 #if defined(_CALL_ELF) && _CALL_ELF == 2
tools/perf/util/probe-event.c +2 -0
index 959c4d2ef455..94acc5846e2a 100644
@@ -2801,16 +2801,30 @@ static int find_probe_functions(struct map *map, char *name,
 	int found = 0;
 	struct symbol *sym;
 	struct rb_node *tmp;
+	const char *norm, *ver;
+	char *buf = NULL;
 
 	if (map__load(map) < 0)
 		return 0;
 
Quoted 10 lines

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2811

Quoted 3 lines
tools/perf/util/probe-event.c +1 -1
 	map__for_each_symbol(map, sym, tmp) {
-		if (strglobmatch(sym->name, name)) {
+		norm = arch__normalize_symbol_name(sym->name);

The weak default function arch__normalize_symbol_name() simply returns its parameter, so norm can be a NULL ptr when parameter sym->name is a NULL pointer.
However when sym->name is a NULL pointer (or can be one) then the Powerpc version of arch__normalize_symbol_name() dereferences a NULL ptr (by checking the symbol's first character is a '.').

Oops, right!
Thank you for pointing out. :)

Quoted 13 lines

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2819

Quoted 9 lines
tools/perf/util/probe-event.c +8 -0
+		if (!norm)
+			continue;
+
+		/* We don't care about default symbol or not */
+		ver = strchr(norm, '@');
+		if (ver) {
+			buf = strndup(norm, ver - norm);
+			norm = buf;

if strndup() returns a NULL pointer (due to lack of memory) then variable norm is a NULL ptr and strglobmatch() --> __match_glob() derefenences that NULL pointer (1. parameter).

Ah, right. easy miss...

OK, I'll update.

Thank you,

Quoted 55 lines
Quoted 46 lines
tools/perf/util/probe-event.c +4 -0
+		}
+		if (strglobmatch(norm, name)) {
 			found++;
 			if (syms && found < probe_conf.max_probes)
 				syms[found - 1] = sym;
 		}
+		if (buf)
+			zfree(&buf);
 	}
 
 	return found;
tools/perf/util/symbol.c +5 -0
index 1b67a8639dfe..cc065d4bfafc 100644
@@ -94,6 +94,11 @@ static int prefix_underscores_count(const char *str)
 	return tail - str;
 }
 
+const char * __weak arch__normalize_symbol_name(const char *name)
+{
+	return name;
+}
+
 int __weak arch__compare_symbol_names(const char *namea, const char *nameb)
 {
 	return strcmp(namea, nameb);
tools/perf/util/symbol.h +1 -1
index a4f0075b4e5c..0563f33c1eb3 100644
@@ -349,6 +349,7 @@ bool elf__needs_adjust_symbols(GElf_Ehdr ehdr);
 void arch__sym_update(struct symbol *s, GElf_Sym *sym);
 #endif
 
+const char *arch__normalize_symbol_name(const char *name);
 #define SYMBOL_A 0
 #define SYMBOL_B 1
 
 
--

To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Signature · 1 line
Masami Hiramatsu <[email protected]>
#19 lore raw

PATCH v2 5/5 perf-probe: Support escaped character in parser

In reply to Masami Hiramatsu

Support the special characters escaped by '\' in parser. This allows user to specify versions directly like below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state\\@GLIBC_2.2.5
  Added new event:
    probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_get_state -aR sleep 1

=====

Or, you can use separators in source filename, e.g.

=====

  # ./perf probe -x /opt/test/a.out foo+bar.c:3
  Semantic error :There is non-digit character in offset.
    Error: Command Parse Error.
  =====

Usually "+" in source file cause parser error, but

=====

  # ./perf probe -x /opt/test/a.out foo\\+bar.c:4
  Added new event:
    probe_a:main         (on @foo+bar.c:4 in /opt/test/a.out)

You can now use it in all perf tools, such as:

perf record -e probe_a:main -aR sleep 1
=====

escaped "\+" allows you to specify that.

---
Changes in v2:
- Add a description and samples in Documentation/perf-probe.txt

---
 tools/perf/Documentation/perf-probe.txt |   16 +++++++++
 tools/perf/util/probe-event.c           |   54 +++++++++++++++++++------------
 tools/perf/util/string.c                |   46 ++++++++++++++++++++++++++
 tools/perf/util/string2.h               |    2 +
 4 files changed, 97 insertions(+), 21 deletions(-)
tools/perf/Documentation/perf-probe.txt +16 -0
index f96382692f42..b6866a05edd2 100644
@@ -182,6 +182,14 @@ Note that before using the SDT event, the target binary (on which SDT events are
 For details of the SDT, see below.
 https://sourceware.org/gdb/onlinedocs/gdb/Static-Probe-Points.html
 
+ESCAPED CHARACTER
+-----------------
+
+In the probe syntax, '=', '@', '+', ':' and ';' are treated as a special character. You can use a backslash ('\') to escape the special characters.
+This is useful if you need to probe on a specific versioned symbols, like @GLIBC_... suffixes, or also you need to specify a source file which includes the special characters.
+Note that usually single backslash is consumed by shell, so you might need to pass double backslash (\\) or wrapping with single quotes (\'AAA\@BBB').
+See EXAMPLES how it is used.
+
 PROBE ARGUMENT
 --------------
 Each probe argument follows below syntax.
@@ -277,6 +285,14 @@ Add a USDT probe to a target process running in a different mount namespace
 
  ./perf probe --target-ns <target pid> -x /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/amd64/server/libjvm.so %sdt_hotspot:thread__sleep__end
 
+Add a probe on specific versioned symbol by backslash escape
+
+ ./perf probe -x /lib64/libc-2.25.so 'malloc_get_state\@GLIBC_2.2.5'
+
+Add a probe in a source file using special characters by backslash escape
+
+ ./perf probe -x /opt/test/a.out 'foo\+bar.c:4'
+
 
 SEE ALSO
 --------
tools/perf/util/probe-event.c +33 -21

134 lines not on this page · raw message

tools/perf/util/string.c +46 -0

49 lines not on this page · raw message

tools/perf/util/string2.h +2 -0
index ee14ca5451ab..4c68a09b97e8 100644
@@ -39,5 +39,7 @@ static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int
 	return asprintf_expr_inout_ints(var, false, nints, ints);
 }
 
+char *strpbrk_esc(char *str, const char *stopset);
+char *strdup_esc(const char *str);
 
 #endif /* PERF_STRING_H */
#20 lore raw

Re: [PATCH v2 5/5] perf-probe: Support escaped character in parser

Quoted 197 lines · Masami Hiramatsu

Support the special characters escaped by '\' in parser. This allows user to specify versions directly like below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state\\@GLIBC_2.2.5
  Added new event:
    probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_get_state -aR sleep 1

=====

Or, you can use separators in source filename, e.g.

=====

  # ./perf probe -x /opt/test/a.out foo+bar.c:3
  Semantic error :There is non-digit character in offset.
    Error: Command Parse Error.
  =====

Usually "+" in source file cause parser error, but

=====

  # ./perf probe -x /opt/test/a.out foo\\+bar.c:4
  Added new event:
    probe_a:main         (on @foo+bar.c:4 in /opt/test/a.out)

You can now use it in all perf tools, such as:

perf record -e probe_a:main -aR sleep 1
=====

escaped "\+" allows you to specify that.

---
Changes in v2:
- Add a description and samples in Documentation/perf-probe.txt

---
 tools/perf/Documentation/perf-probe.txt |   16 +++++++++
 tools/perf/util/probe-event.c           |   54 +++++++++++++++++++------------
 tools/perf/util/string.c                |   46 ++++++++++++++++++++++++++
 tools/perf/util/string2.h               |    2 +
 4 files changed, 97 insertions(+), 21 deletions(-)
tools/perf/Documentation/perf-probe.txt +16 -0
index f96382692f42..b6866a05edd2 100644
@@ -182,6 +182,14 @@ Note that before using the SDT event, the target binary (on which SDT events are
 For details of the SDT, see below.
 https://sourceware.org/gdb/onlinedocs/gdb/Static-Probe-Points.html
 
+ESCAPED CHARACTER
+-----------------
+
+In the probe syntax, '=', '@', '+', ':' and ';' are treated as a special character. You can use a backslash ('\') to escape the special characters.
+This is useful if you need to probe on a specific versioned symbols, like @GLIBC_... suffixes, or also you need to specify a source file which includes the special characters.
+Note that usually single backslash is consumed by shell, so you might need to pass double backslash (\\) or wrapping with single quotes (\'AAA\@BBB').
+See EXAMPLES how it is used.
+
 PROBE ARGUMENT
 --------------
 Each probe argument follows below syntax.
@@ -277,6 +285,14 @@ Add a USDT probe to a target process running in a different mount namespace
 
  ./perf probe --target-ns <target pid> -x /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/amd64/server/libjvm.so %sdt_hotspot:thread__sleep__end
 
+Add a probe on specific versioned symbol by backslash escape
+
+ ./perf probe -x /lib64/libc-2.25.so 'malloc_get_state\@GLIBC_2.2.5'
+
+Add a probe in a source file using special characters by backslash escape
+
+ ./perf probe -x /opt/test/a.out 'foo\+bar.c:4'
+
 
 SEE ALSO
 --------
tools/perf/util/probe-event.c +21 -16
index 94acc5846e2a..c082a27982e5 100644
@@ -1325,27 +1325,30 @@ static int parse_perf_probe_event_name(char **arg, struct perf_probe_event *pev)
 {
 	char *ptr;
 
-	ptr = strchr(*arg, ':');
+	ptr = strpbrk_esc(*arg, ":");
 	if (ptr) {
 		*ptr = '\0';
 		if (!pev->sdt && !is_c_func_name(*arg))
 			goto ng_name;
-		pev->group = strdup(*arg);
+		pev->group = strdup_esc(*arg);
 		if (!pev->group)
 			return -ENOMEM;
 		*arg = ptr + 1;
 	} else
 		pev->group = NULL;
-	if (!pev->sdt && !is_c_func_name(*arg)) {
+
+	pev->event = strdup_esc(*arg);
+	if (pev->event == NULL)
+		return -ENOMEM;
+
+	if (!pev->sdt && !is_c_func_name(pev->event)) {
+		zfree(&pev->event);
 ng_name:
+		zfree(&pev->group);
 		semantic_error("%s is bad for event name -it must "
 			       "follow C symbol-naming rule.\n", *arg);
 		return -EINVAL;
 	}
-	pev->event = strdup(*arg);
-	if (pev->event == NULL)
-		return -ENOMEM;
-
 	return 0;
 }
 
@@ -1373,7 +1376,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 			arg++;
 	}
 
-	ptr = strpbrk(arg, ";=@+%");
+	ptr = strpbrk_esc(arg, ";=@+%");
 	if (pev->sdt) {
 		if (ptr) {
 			if (*ptr != '@') {
@@ -1387,7 +1390,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 				pev->target = build_id_cache__origname(tmp);
 				free(tmp);
 			} else
-				pev->target = strdup(ptr + 1);
+				pev->target = strdup_esc(ptr + 1);
 			if (!pev->target)
 				return -ENOMEM;
 			*ptr = '\0';
@@ -1421,13 +1424,14 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 	 *
 	 * Otherwise, we consider arg to be a function specification.
 	 */
-	if (!strpbrk(arg, "+@%") && (ptr = strpbrk(arg, ";:")) != NULL) {
+	if (!strpbrk_esc(arg, "+@%")) {
+		ptr = strpbrk_esc(arg, ";:");
 		/* This is a file spec if it includes a '.' before ; or : */
-		if (memchr(arg, '.', ptr - arg))
+		if (ptr && memchr(arg, '.', ptr - arg))
 			file_spec = true;
 	}
 
-	ptr = strpbrk(arg, ";:+@%");
+	ptr = strpbrk_esc(arg, ";:+@%");
 	if (ptr) {
 		nc = *ptr;
 		*ptr++ = '\0';
@@ -1436,7 +1440,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 	if (arg[0] == '\0')
 		tmp = NULL;
 	else {
-		tmp = strdup(arg);
+		tmp = strdup_esc(arg);
 		if (tmp == NULL)
 			return -ENOMEM;
 	}
@@ -1469,12 +1473,12 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 		arg = ptr;
 		c = nc;
 		if (c == ';') {	/* Lazy pattern must be the last part */
-			pp->lazy_line = strdup(arg);
+			pp->lazy_line = strdup(arg); /* let leave escapes */
 			if (pp->lazy_line == NULL)
 				return -ENOMEM;
 			break;
 		}
-		ptr = strpbrk(arg, ";:+@%");
+		ptr = strpbrk_esc(arg, ";:+@%");
 		if (ptr) {
 			nc = *ptr;
 			*ptr++ = '\0';
@@ -1501,7 +1505,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 				semantic_error("SRC@SRC is not allowed.\n");
 				return -EINVAL;
 			}
-			pp->file = strdup(arg);
+			pp->file = strdup_esc(arg);
 			if (pp->file == NULL)
 				return -ENOMEM;
 			break;
@@ -2803,21 +2807,29 @@ static int find_probe_functions(struct map *map, char *name,
 	struct rb_node *tmp;
 	const char *norm, *ver;
 	char *buf = NULL;
+	bool cut_version = true;

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2820

Quoted 10 lines
tools/perf/util/probe-event.c +4 -0
 
 	if (map__load(map) < 0)
 		return 0;
 
+	/* If user gives a version, don't cut off the version from symbols */
+	if (strchr(name, '@'))
+		cut_version = false;
+
 	map__for_each_symbol(map, sym, tmp) {
 		norm = arch__normalize_symbol_name(sym->name);

Same as before (patch 4)

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2819

Quoted 8 lines
tools/perf/util/probe-event.c +0 -5
 		if (!norm)
 			continue;
 
-		/* We don't care about default symbol or not */
-		ver = strchr(norm, '@');
-		if (ver) {
-			buf = strndup(norm, ver - norm);
-			norm = buf;

Again strndup() may return a NULL ptr and then strglobmatch() / strchr() below dereferences it.

Quoted 84 lines
tools/perf/util/probe-event.c +8 -0
+		if (cut_version) {
+			/* We don't care about default symbol or not */
+			ver = strchr(norm, '@');
+			if (ver) {
+				buf = strndup(norm, ver - norm);
+				norm = buf;
+			}
 		}
+
 		if (strglobmatch(norm, name)) {
 			found++;
 			if (syms && found < probe_conf.max_probes)
tools/perf/util/string.c +46 -0
index aaa08ee8c717..d8bfd0c4d2cb 100644
@@ -396,3 +396,49 @@ char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints
 	free(expr);
 	return NULL;
 }
+
+/* Like strpbrk(), but not break if it is right after a backslash (escaped) */
+char *strpbrk_esc(char *str, const char *stopset)
+{
+	char *ptr;
+
+	do {
+		ptr = strpbrk(str, stopset);
+		if (ptr == str ||
+		    (ptr == str + 1 && *(ptr - 1) != '\\'))
+			break;
+		str = ptr + 1;
+	} while (ptr && *(ptr - 1) == '\\' && *(ptr - 2) != '\\');
+
+	return ptr;
+}
+
+/* Like strdup, but do not copy a single backslash */
+char *strdup_esc(const char *str)
+{
+	char *s, *d, *p, *ret = strdup(str);
+
+	if (!ret)
+		return NULL;
+
+	d = strchr(ret, '\\');
+	if (!d)
+		return ret;
+
+	s = d + 1;
+	do {
+		if (*s == '\0') {
+			*d = '\0';
+			break;
+		}
+		p = strchr(s + 1, '\\');
+		if (p) {
+			memmove(d, s, p - s);
+			d += p - s;
+			s = p + 1;
+		} else
+			memmove(d, s, strlen(s) + 1);
+	} while (p);
+
+	return ret;
+}
tools/perf/util/string2.h +2 -1
index ee14ca5451ab..4c68a09b97e8 100644
@@ -39,5 +39,7 @@ static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int
 	return asprintf_expr_inout_ints(var, false, nints, ints);
 }
 
+char *strpbrk_esc(char *str, const char *stopset);
+char *strdup_esc(const char *str);
 
 #endif /* PERF_STRING_H */
 
--

To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
#21 lore raw

Re: [PATCH v2 5/5] perf-probe: Support escaped character in parser

Quoted 214 lines · On Fri, 8 Dec 2017 12:45:45 +0100 Thomas-Mich Richter…
Quoted 197 lines · Masami Hiramatsu

Support the special characters escaped by '\' in parser. This allows user to specify versions directly like below.

=====

  # ./perf probe -x /lib64/libc-2.25.so malloc_get_state\\@GLIBC_2.2.5
  Added new event:
    probe_libc:malloc_get_state (on malloc_get_state@GLIBC_2.2.5 in /usr/lib64/libc-2.25.so)

You can now use it in all perf tools, such as:

perf record -e probe_libc:malloc_get_state -aR sleep 1

=====

Or, you can use separators in source filename, e.g.

=====

  # ./perf probe -x /opt/test/a.out foo+bar.c:3
  Semantic error :There is non-digit character in offset.
    Error: Command Parse Error.
  =====

Usually "+" in source file cause parser error, but

=====

  # ./perf probe -x /opt/test/a.out foo\\+bar.c:4
  Added new event:
    probe_a:main         (on @foo+bar.c:4 in /opt/test/a.out)

You can now use it in all perf tools, such as:

perf record -e probe_a:main -aR sleep 1
=====

escaped "\+" allows you to specify that.

---
Changes in v2:
- Add a description and samples in Documentation/perf-probe.txt

---
 tools/perf/Documentation/perf-probe.txt |   16 +++++++++
 tools/perf/util/probe-event.c           |   54 +++++++++++++++++++------------
 tools/perf/util/string.c                |   46 ++++++++++++++++++++++++++
 tools/perf/util/string2.h               |    2 +
 4 files changed, 97 insertions(+), 21 deletions(-)
tools/perf/Documentation/perf-probe.txt +16 -0
index f96382692f42..b6866a05edd2 100644
@@ -182,6 +182,14 @@ Note that before using the SDT event, the target binary (on which SDT events are
 For details of the SDT, see below.
 https://sourceware.org/gdb/onlinedocs/gdb/Static-Probe-Points.html
 
+ESCAPED CHARACTER
+-----------------
+
+In the probe syntax, '=', '@', '+', ':' and ';' are treated as a special character. You can use a backslash ('\') to escape the special characters.
+This is useful if you need to probe on a specific versioned symbols, like @GLIBC_... suffixes, or also you need to specify a source file which includes the special characters.
+Note that usually single backslash is consumed by shell, so you might need to pass double backslash (\\) or wrapping with single quotes (\'AAA\@BBB').
+See EXAMPLES how it is used.
+
 PROBE ARGUMENT
 --------------
 Each probe argument follows below syntax.
@@ -277,6 +285,14 @@ Add a USDT probe to a target process running in a different mount namespace
 
  ./perf probe --target-ns <target pid> -x /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.121-0.b13.el7_3.x86_64/jre/lib/amd64/server/libjvm.so %sdt_hotspot:thread__sleep__end
 
+Add a probe on specific versioned symbol by backslash escape
+
+ ./perf probe -x /lib64/libc-2.25.so 'malloc_get_state\@GLIBC_2.2.5'
+
+Add a probe in a source file using special characters by backslash escape
+
+ ./perf probe -x /opt/test/a.out 'foo\+bar.c:4'
+
 
 SEE ALSO
 --------
tools/perf/util/probe-event.c +21 -16
index 94acc5846e2a..c082a27982e5 100644
@@ -1325,27 +1325,30 @@ static int parse_perf_probe_event_name(char **arg, struct perf_probe_event *pev)
 {
 	char *ptr;
 
-	ptr = strchr(*arg, ':');
+	ptr = strpbrk_esc(*arg, ":");
 	if (ptr) {
 		*ptr = '\0';
 		if (!pev->sdt && !is_c_func_name(*arg))
 			goto ng_name;
-		pev->group = strdup(*arg);
+		pev->group = strdup_esc(*arg);
 		if (!pev->group)
 			return -ENOMEM;
 		*arg = ptr + 1;
 	} else
 		pev->group = NULL;
-	if (!pev->sdt && !is_c_func_name(*arg)) {
+
+	pev->event = strdup_esc(*arg);
+	if (pev->event == NULL)
+		return -ENOMEM;
+
+	if (!pev->sdt && !is_c_func_name(pev->event)) {
+		zfree(&pev->event);
 ng_name:
+		zfree(&pev->group);
 		semantic_error("%s is bad for event name -it must "
 			       "follow C symbol-naming rule.\n", *arg);
 		return -EINVAL;
 	}
-	pev->event = strdup(*arg);
-	if (pev->event == NULL)
-		return -ENOMEM;
-
 	return 0;
 }
 
@@ -1373,7 +1376,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 			arg++;
 	}
 
-	ptr = strpbrk(arg, ";=@+%");
+	ptr = strpbrk_esc(arg, ";=@+%");
 	if (pev->sdt) {
 		if (ptr) {
 			if (*ptr != '@') {
@@ -1387,7 +1390,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 				pev->target = build_id_cache__origname(tmp);
 				free(tmp);
 			} else
-				pev->target = strdup(ptr + 1);
+				pev->target = strdup_esc(ptr + 1);
 			if (!pev->target)
 				return -ENOMEM;
 			*ptr = '\0';
@@ -1421,13 +1424,14 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 	 *
 	 * Otherwise, we consider arg to be a function specification.
 	 */
-	if (!strpbrk(arg, "+@%") && (ptr = strpbrk(arg, ";:")) != NULL) {
+	if (!strpbrk_esc(arg, "+@%")) {
+		ptr = strpbrk_esc(arg, ";:");
 		/* This is a file spec if it includes a '.' before ; or : */
-		if (memchr(arg, '.', ptr - arg))
+		if (ptr && memchr(arg, '.', ptr - arg))
 			file_spec = true;
 	}
 
-	ptr = strpbrk(arg, ";:+@%");
+	ptr = strpbrk_esc(arg, ";:+@%");
 	if (ptr) {
 		nc = *ptr;
 		*ptr++ = '\0';
@@ -1436,7 +1440,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 	if (arg[0] == '\0')
 		tmp = NULL;
 	else {
-		tmp = strdup(arg);
+		tmp = strdup_esc(arg);
 		if (tmp == NULL)
 			return -ENOMEM;
 	}
@@ -1469,12 +1473,12 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 		arg = ptr;
 		c = nc;
 		if (c == ';') {	/* Lazy pattern must be the last part */
-			pp->lazy_line = strdup(arg);
+			pp->lazy_line = strdup(arg); /* let leave escapes */
 			if (pp->lazy_line == NULL)
 				return -ENOMEM;
 			break;
 		}
-		ptr = strpbrk(arg, ";:+@%");
+		ptr = strpbrk_esc(arg, ";:+@%");
 		if (ptr) {
 			nc = *ptr;
 			*ptr++ = '\0';
@@ -1501,7 +1505,7 @@ static int parse_perf_probe_point(char *arg, struct perf_probe_event *pev)
 				semantic_error("SRC@SRC is not allowed.\n");
 				return -EINVAL;
 			}
-			pp->file = strdup(arg);
+			pp->file = strdup_esc(arg);
 			if (pp->file == NULL)
 				return -ENOMEM;
 			break;
@@ -2803,21 +2807,29 @@ static int find_probe_functions(struct map *map, char *name,
 	struct rb_node *tmp;
 	const char *norm, *ver;
 	char *buf = NULL;
+	bool cut_version = true;

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2820

Quoted 10 lines
tools/perf/util/probe-event.c +4 -0
 
 	if (map__load(map) < 0)
 		return 0;
 
+	/* If user gives a version, don't cut off the version from symbols */
+	if (strchr(name, '@'))
+		cut_version = false;
+
 	map__for_each_symbol(map, sym, tmp) {
 		norm = arch__normalize_symbol_name(sym->name);

Same as before (patch 4)

Quoted 3 lines
tools/perf/util/probe-event.c +0 -0
 		if (!norm)
 			continue;
 
Quoted 8 lines

tools/perf/util/probe-event.c static int find_probe_functions(struct map *map, char *name, · line 2819

Quoted 5 lines
tools/perf/util/probe-event.c +0 -5
-		/* We don't care about default symbol or not */
-		ver = strchr(norm, '@');
-		if (ver) {
-			buf = strndup(norm, ver - norm);
-			norm = buf;

Again strndup() may return a NULL ptr and then strglobmatch() / strchr() below dereferences it.

OK, but those will be fixed in patch 4/5.
(Of course below block should be updated)

Anyway, Thank you!

Quoted 94 lines
Quoted 85 lines
tools/perf/util/probe-event.c +8 -0
+		if (cut_version) {
+			/* We don't care about default symbol or not */
+			ver = strchr(norm, '@');
+			if (ver) {
+				buf = strndup(norm, ver - norm);
+				norm = buf;
+			}
 		}
+
 		if (strglobmatch(norm, name)) {
 			found++;
 			if (syms && found < probe_conf.max_probes)
tools/perf/util/string.c +46 -0
index aaa08ee8c717..d8bfd0c4d2cb 100644
@@ -396,3 +396,49 @@ char *asprintf_expr_inout_ints(const char *var, bool in, size_t nints, int *ints
 	free(expr);
 	return NULL;
 }
+
+/* Like strpbrk(), but not break if it is right after a backslash (escaped) */
+char *strpbrk_esc(char *str, const char *stopset)
+{
+	char *ptr;
+
+	do {
+		ptr = strpbrk(str, stopset);
+		if (ptr == str ||
+		    (ptr == str + 1 && *(ptr - 1) != '\\'))
+			break;
+		str = ptr + 1;
+	} while (ptr && *(ptr - 1) == '\\' && *(ptr - 2) != '\\');
+
+	return ptr;
+}
+
+/* Like strdup, but do not copy a single backslash */
+char *strdup_esc(const char *str)
+{
+	char *s, *d, *p, *ret = strdup(str);
+
+	if (!ret)
+		return NULL;
+
+	d = strchr(ret, '\\');
+	if (!d)
+		return ret;
+
+	s = d + 1;
+	do {
+		if (*s == '\0') {
+			*d = '\0';
+			break;
+		}
+		p = strchr(s + 1, '\\');
+		if (p) {
+			memmove(d, s, p - s);
+			d += p - s;
+			s = p + 1;
+		} else
+			memmove(d, s, strlen(s) + 1);
+	} while (p);
+
+	return ret;
+}
tools/perf/util/string2.h +2 -1
index ee14ca5451ab..4c68a09b97e8 100644
@@ -39,5 +39,7 @@ static inline char *asprintf_expr_not_in_ints(const char *var, size_t nints, int
 	return asprintf_expr_inout_ints(var, false, nints, ints);
 }
 
+char *strpbrk_esc(char *str, const char *stopset);
+char *strdup_esc(const char *str);
 
 #endif /* PERF_STRING_H */
 
--

To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 5 lines
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
Signature · 1 line
Masami Hiramatsu <[email protected]>
#22 lore raw
In reply to Masami Hiramatsu
Quoted 7 lines · Masami Hiramatsu

Hi,

Here is the 2nd version of the series for probing on versioned symbols in libraries. This includes 5 patches to fix the issues discussed on perf-users ML
(https://www.spinics.net/lists/linux-perf-users/msg04637.html)

Quoted 8 lines

The first version is here; https://lkml.org/lkml/2017/12/5/1124

Here is the updates;

[3/5] Add a description in Documentation/perf-probe.txt [5/5] Add a description and examples in Documentation/perf-probe.txt

Thank you,

#23 lore raw
Quoted 12 lines · On Thu, 7 Dec 2017 18:17:51 +0530 Ravi Bangoria…
Quoted 9 lines · Masami Hiramatsu

Hi,

Here is the 2nd version of the series for probing on versioned symbols in libraries. This includes 5 patches to fix the issues discussed on perf-users ML
(https://www.spinics.net/lists/linux-perf-users/msg04637.html)

The first version is here; https://lkml.org/lkml/2017/12/5/1124

Quoted 8 lines
Quoted 6 lines

Here is the updates;

[3/5] Add a description in Documentation/perf-probe.txt [5/5] Add a description and examples in Documentation/perf-probe.txt

Thank you,

Thanks!, is that OK for series? and Acked-by ? B-)

Quoted 1 line
Signature · 1 line
Masami Hiramatsu <[email protected]>
#24 lore raw
Quoted 14 lines · Masami Hiramatsu
Quoted 11 lines · On Thu, 7 Dec 2017 18:17:51 +0530 Ravi Bangoria…
Quoted 9 lines · Masami Hiramatsu

Hi,

Here is the 2nd version of the series for probing on versioned symbols in libraries. This includes 5 patches to fix the issues discussed on perf-users ML
(https://www.spinics.net/lists/linux-perf-users/msg04637.html)

The first version is here; https://lkml.org/lkml/2017/12/5/1124

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines

Here is the updates;

[3/5] Add a description in Documentation/perf-probe.txt [5/5] Add a description and examples in Documentation/perf-probe.txt

Thank you,

Thanks!, is that OK for series? and Acked-by ? B-)

Yes Masami, Acked for the series.

( Sorry, I just forgot to add 'ed' in Acked-by :) )

Thanks,
Ravi

Reviewed-by on the v2 series
#25 lore raw
In reply to Masami Hiramatsu
Quoted 34 lines · Masami Hiramatsu

Hi,

Here is the 2nd version of the series for probing on versioned symbols in libraries. This includes 5 patches to fix the issues discussed on perf-users ML
(https://www.spinics.net/lists/linux-perf-users/msg04637.html)

The first version is here; https://lkml.org/lkml/2017/12/5/1124

Here is the updates;

[3/5] Add a description in Documentation/perf-probe.txt [5/5] Add a description and examples in Documentation/perf-probe.txt

Thank you,
---

Masami Hiramatsu (5):
perf-probe: Add warning message if there is unexpected event name
perf-probe: Cut off the version suffix from event name
perf-probe: Add __return suffix for return events
perf-probe: Find versioned symbols from map
perf-probe: Support escaped character in parser

 tools/perf/Documentation/perf-probe.txt     |   18 ++++++
 tools/perf/arch/powerpc/util/sym-handling.c |    8 +++
 tools/perf/util/probe-event.c               |   81 +++++++++++++++++++--------
 tools/perf/util/string.c                    |   46 +++++++++++++++
 tools/perf/util/string2.h                   |    2 +
 tools/perf/util/symbol.c                    |    5 ++
 tools/perf/util/symbol.h                    |    1 
 7 files changed, 137 insertions(+), 24 deletions(-)
Quoted 7 lines

--
Masami Hiramatsu (Linaro Ltd.) <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

If you fix the findings for patch 4 and 5 you have my

Signature · 5 lines
Thomas Richter, Dept 3303, IBM LTC Boeblingen Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294
#26 lore raw
Quoted 43 lines · On Fri, 8 Dec 2017 12:56:06 +0100 Thomas-Mich Richter…
Quoted 34 lines · Masami Hiramatsu

Hi,

Here is the 2nd version of the series for probing on versioned symbols in libraries. This includes 5 patches to fix the issues discussed on perf-users ML
(https://www.spinics.net/lists/linux-perf-users/msg04637.html)

The first version is here; https://lkml.org/lkml/2017/12/5/1124

Here is the updates;

[3/5] Add a description in Documentation/perf-probe.txt [5/5] Add a description and examples in Documentation/perf-probe.txt

Thank you,
---

Masami Hiramatsu (5):
perf-probe: Add warning message if there is unexpected event name
perf-probe: Cut off the version suffix from event name
perf-probe: Add __return suffix for return events
perf-probe: Find versioned symbols from map
perf-probe: Support escaped character in parser

 tools/perf/Documentation/perf-probe.txt     |   18 ++++++
 tools/perf/arch/powerpc/util/sym-handling.c |    8 +++
 tools/perf/util/probe-event.c               |   81 +++++++++++++++++++--------
 tools/perf/util/string.c                    |   46 +++++++++++++++
 tools/perf/util/string2.h                   |    2 +
 tools/perf/util/symbol.c                    |    5 ++
 tools/perf/util/symbol.h                    |    1 
 7 files changed, 137 insertions(+), 24 deletions(-)
Quoted 7 lines

--
Masami Hiramatsu (Linaro Ltd.) <[email protected]>
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Quoted 3 lines

If you fix the findings for patch 4 and 5 you have my

OK, Thanks!

Signature · 1 line
Masami Hiramatsu <[email protected]>