File: mangled.stp

package info (click to toggle)
systemtap 5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 47,556 kB
  • sloc: cpp: 81,117; ansic: 54,933; xml: 49,795; exp: 43,595; sh: 11,526; python: 5,003; perl: 2,252; tcl: 1,312; makefile: 1,006; javascript: 149; lisp: 105; awk: 101; asm: 91; java: 70; 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)
}