File: mangled.stp

package info (click to toggle)
systemtap 3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 32,860 kB
  • ctags: 12,513
  • sloc: cpp: 58,610; ansic: 58,189; exp: 37,322; sh: 10,633; xml: 7,771; perl: 2,252; python: 2,066; tcl: 1,305; makefile: 969; lisp: 105; java: 100; awk: 94; asm: 91; sed: 16
file content (41 lines) | stat: -rwxr-xr-x 1,274 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! stap -p2
#
# PR11880, allow probing by mangled name, especially useful for advanced users
# to distinguish overloaded function names in C++.
#
# For example, stap itself has:
#   std::vector<Dwarf_Die> dwflpp::getscopes(Dwarf_Die* die)
#   std::vector<Dwarf_Die> dwflpp::getscopes(Dwarf_Addr pc)
#
# We can probe both as process("stap").function("dwflpp::getscopes"), but we
# didn't have a way to select just one, except by matching line numbers.  If
# you want both but with different handlers, then @defined would work, but
# that's still all-or-nothing.
#
# Now we can use the mangled name instead, and probe them individually as we
# please.  The test here checks that the right $vars are available in the
# separate probes.

probe process("stap").function("_ZN6dwflpp9getscopesE[my]")
{
    if (@defined($pc) && !@defined($die))
        println("pc=", $pc$)
    else
        println($assert_nosuchvar)
}

probe process("stap").function("_ZN6dwflpp9getscopesEP9Dwarf_Die")
{
    if (@defined($die) && !@defined($pc))
        println("die=", $die$)
    else
        println($assert_nosuchvar)
}

probe process("stap").function("_ZN6dwflpp9getscopesE*")
{
    if (@defined($pc) ^ @defined($die))
        println("XOR ok")
    else
        println($assert_nosuchvar)
}