Skip to content

Commit 58f3983

Browse files
committed
SystemTap: new role "attached" in "probe" kind
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 6f2d92c commit 58f3983

File tree

9 files changed

+123
-44
lines changed

9 files changed

+123
-44
lines changed

Tmain/list-roles.d/stdout-expected.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Ruby L/library required on loaded by "require"
9494
Ruby L/library requiredRel on loaded by "require_relative" method
9595
Sh h/heredoc endmarker on end marker
9696
Sh s/script loaded on loaded
97+
SystemTap p/probe attached on attached by code for probing
9798
SystemVerilog m/module decl on declaring instances
9899
SystemdUnit u/unit After on referred in After key
99100
SystemdUnit u/unit Before on referred in Before key
@@ -212,6 +213,7 @@ Ruby L/library required on loaded by "require"
212213
Ruby L/library requiredRel on loaded by "require_relative" method
213214
Sh h/heredoc endmarker on end marker
214215
Sh s/script loaded on loaded
216+
SystemTap p/probe attached on attached by code for probing
215217
SystemVerilog m/module decl on declaring instances
216218
SystemdUnit u/unit After on referred in After key
217219
SystemdUnit u/unit Before on referred in Before key
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
--sort=no
2-
--fields=+ne
2+
--fields=+ner
3+
--extras=+r
Lines changed: 41 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
1-
tcp_get_info_rto input.stp /^function tcp_get_info_rto:long(sock:long)$/;" f line:33 end:44
2-
tcp_get_info_snd_cwnd input.stp /^function tcp_get_info_snd_cwnd:long(sock:long)$/;" f line:50 end:60
3-
tcp_ts_get_info_state input.stp /^function tcp_ts_get_info_state:long(sock:long)$/;" f line:78 end:83
4-
__tcp_sock_dport input.stp /^function __tcp_sock_dport:long (sock:long)$/;" f line:86 end:93
5-
__get_skb_tcphdr_new input.stp /^@__private30 function __get_skb_tcphdr_new:long(skb:long)$/;" f line:96 end:107
6-
__get_skb_tcphdr input.stp /^function __get_skb_tcphdr:long(skb:long)$/;" f line:110 end:118
7-
__tcp_skb_urg input.stp /^function __tcp_skb_urg:long (tcphdr:long)$/;" f line:121 end:124
8-
__tcp_skb_ack input.stp /^function __tcp_skb_ack:long (tcphdr:long)$/;" f line:127 end:130
9-
__tcp_skb_psh input.stp /^function __tcp_skb_psh:long (tcphdr:long)$/;" f line:133 end:136
10-
__tcp_skb_rst input.stp /^function __tcp_skb_rst:long (tcphdr:long)$/;" f line:139 end:142
11-
__tcp_skb_syn input.stp /^function __tcp_skb_syn:long (tcphdr:long)$/;" f line:145 end:148
12-
__tcp_skb_fin input.stp /^function __tcp_skb_fin:long (tcphdr:long)$/;" f line:151 end:154
13-
__tcp_skb_sport input.stp /^function __tcp_skb_sport:long (tcphdr:long)$/;" f line:157 end:160
14-
__tcp_skb_dport input.stp /^function __tcp_skb_dport:long (tcphdr:long){$/;" f line:163 end:165
15-
__tcp_sock_sport input.stp /^function __tcp_sock_sport:long (sock:long)$/;" f line:168 end:174
16-
sockstate input.stp /^@__private30 global sockstate[12]$/;" v line:176
17-
tcp_sockstate_str input.stp /^function tcp_sockstate_str:string (state:long) {$/;" f line:192 end:194
18-
tcp_ts_get_info_snd_ssthresh input.stp /^function tcp_ts_get_info_snd_ssthresh:long(sock:long)$/;" f line:199 end:209
19-
tcp_ts_get_info_rcv_mss input.stp /^function tcp_ts_get_info_rcv_mss:long(sock:long)$/;" f line:213 end:224
20-
__sockopt input.stp /^@__private30 global __sockopt[18]$/;" v line:248
21-
tcp_sockopt_str input.stp /^function tcp_sockopt_str:string (optname:long)$/;" f line:281 end:285
22-
__ipv6_sockopt input.stp /^@__private30 global __ipv6_sockopt[55]$/;" v line:349
23-
tcp_ipv6_sockopt_str input.stp /^function tcp_ipv6_sockopt_str:string (optname:long)$/;" f line:467 end:471
24-
tcp.sendmsg input.stp /^probe tcp.sendmsg = kernel.function("tcp_sendmsg") {$/;" p line:483 end:488
25-
tcp.sendmsg.return input.stp /^probe tcp.sendmsg.return = kernel.function("tcp_sendmsg").return {$/;" p line:498 end:501
26-
tcp.recvmsg input.stp /^probe tcp.recvmsg = kernel.function("tcp_recvmsg") {$/;" p line:516 end:525
27-
tcp.recvmsg.return input.stp /^probe tcp.recvmsg.return = kernel.function("tcp_recvmsg").return {$/;" p line:540 end:548
28-
tcp.disconnect input.stp /^probe tcp.disconnect = kernel.function("tcp_disconnect") {$/;" p line:564 end:573
29-
tcp.disconnect.return input.stp /^probe tcp.disconnect.return = kernel.function("tcp_disconnect").return {$/;" p line:583 end:586
30-
tcp.setsockopt input.stp /^probe tcp.setsockopt = tcp.ipv4.setsockopt, tcp.ipv6.setsockopt$/;" p line:601 end:603
31-
tcp.ipv4.setsockopt input.stp /^probe tcp.ipv4.setsockopt = kernel.function("tcp_setsockopt")$/;" p line:604 end:613
32-
tcp.ipv6.setsockopt input.stp /^probe tcp.ipv6.setsockopt = kernel.function("ipv6_setsockopt")!,$/;" p line:614 end:624
33-
tcp.setsockopt.return input.stp /^probe tcp.setsockopt.return = tcp.ipv4.setsockopt.return,$/;" p line:634 end:637
34-
tcp.ipv4.setsockopt.return input.stp /^probe tcp.ipv4.setsockopt.return = kernel.function("tcp_setsockopt").return$/;" p line:638 end:642
35-
tcp.ipv6.setsockopt.return input.stp /^probe tcp.ipv6.setsockopt.return = kernel.function("ipv6_setsockopt").return!,$/;" p line:643 end:648
36-
tcp.receive input.stp /^probe tcp.receive = tcp.ipv4.receive, tcp.ipv6.receive$/;" p line:667 end:669
37-
tcp.ipv4.receive input.stp /^probe tcp.ipv4.receive = kernel.function("tcp_v4_rcv")$/;" p line:671 end:694
38-
tcp.ipv6.receive input.stp /^probe tcp.ipv6.receive = kernel.function("tcp_v6_rcv")!,$/;" p line:696 end:730
1+
tcp_get_info_rto input.stp /^function tcp_get_info_rto:long(sock:long)$/;" f line:33 roles:def end:44
2+
tcp_get_info_snd_cwnd input.stp /^function tcp_get_info_snd_cwnd:long(sock:long)$/;" f line:50 roles:def end:60
3+
tcp_ts_get_info_state input.stp /^function tcp_ts_get_info_state:long(sock:long)$/;" f line:78 roles:def end:83
4+
__tcp_sock_dport input.stp /^function __tcp_sock_dport:long (sock:long)$/;" f line:86 roles:def end:93
5+
__get_skb_tcphdr_new input.stp /^@__private30 function __get_skb_tcphdr_new:long(skb:long)$/;" f line:96 roles:def end:107
6+
__get_skb_tcphdr input.stp /^function __get_skb_tcphdr:long(skb:long)$/;" f line:110 roles:def end:118
7+
__tcp_skb_urg input.stp /^function __tcp_skb_urg:long (tcphdr:long)$/;" f line:121 roles:def end:124
8+
__tcp_skb_ack input.stp /^function __tcp_skb_ack:long (tcphdr:long)$/;" f line:127 roles:def end:130
9+
__tcp_skb_psh input.stp /^function __tcp_skb_psh:long (tcphdr:long)$/;" f line:133 roles:def end:136
10+
__tcp_skb_rst input.stp /^function __tcp_skb_rst:long (tcphdr:long)$/;" f line:139 roles:def end:142
11+
__tcp_skb_syn input.stp /^function __tcp_skb_syn:long (tcphdr:long)$/;" f line:145 roles:def end:148
12+
__tcp_skb_fin input.stp /^function __tcp_skb_fin:long (tcphdr:long)$/;" f line:151 roles:def end:154
13+
__tcp_skb_sport input.stp /^function __tcp_skb_sport:long (tcphdr:long)$/;" f line:157 roles:def end:160
14+
__tcp_skb_dport input.stp /^function __tcp_skb_dport:long (tcphdr:long){$/;" f line:163 roles:def end:165
15+
__tcp_sock_sport input.stp /^function __tcp_sock_sport:long (sock:long)$/;" f line:168 roles:def end:174
16+
sockstate input.stp /^@__private30 global sockstate[12]$/;" v line:176 roles:def
17+
init input.stp /^probe init {$/;" p line:177 roles:attached end:190
18+
tcp_sockstate_str input.stp /^function tcp_sockstate_str:string (state:long) {$/;" f line:192 roles:def end:194
19+
tcp_ts_get_info_snd_ssthresh input.stp /^function tcp_ts_get_info_snd_ssthresh:long(sock:long)$/;" f line:199 roles:def end:209
20+
tcp_ts_get_info_rcv_mss input.stp /^function tcp_ts_get_info_rcv_mss:long(sock:long)$/;" f line:213 roles:def end:224
21+
__sockopt input.stp /^@__private30 global __sockopt[18]$/;" v line:248 roles:def
22+
init input.stp /^probe init {$/;" p line:249 roles:attached end:279
23+
tcp_sockopt_str input.stp /^function tcp_sockopt_str:string (optname:long)$/;" f line:281 roles:def end:285
24+
__ipv6_sockopt input.stp /^@__private30 global __ipv6_sockopt[55]$/;" v line:349 roles:def
25+
init input.stp /^probe init {$/;" p line:350 roles:attached end:465
26+
tcp_ipv6_sockopt_str input.stp /^function tcp_ipv6_sockopt_str:string (optname:long)$/;" f line:467 roles:def end:471
27+
tcp.sendmsg input.stp /^probe tcp.sendmsg = kernel.function("tcp_sendmsg") {$/;" p line:483 roles:def end:488
28+
tcp.sendmsg.return input.stp /^probe tcp.sendmsg.return = kernel.function("tcp_sendmsg").return {$/;" p line:498 roles:def end:501
29+
tcp.recvmsg input.stp /^probe tcp.recvmsg = kernel.function("tcp_recvmsg") {$/;" p line:516 roles:def end:525
30+
tcp.recvmsg.return input.stp /^probe tcp.recvmsg.return = kernel.function("tcp_recvmsg").return {$/;" p line:540 roles:def end:548
31+
tcp.disconnect input.stp /^probe tcp.disconnect = kernel.function("tcp_disconnect") {$/;" p line:564 roles:def end:573
32+
tcp.disconnect.return input.stp /^probe tcp.disconnect.return = kernel.function("tcp_disconnect").return {$/;" p line:583 roles:def end:586
33+
tcp.setsockopt input.stp /^probe tcp.setsockopt = tcp.ipv4.setsockopt, tcp.ipv6.setsockopt$/;" p line:601 roles:def end:603
34+
tcp.ipv4.setsockopt input.stp /^probe tcp.ipv4.setsockopt = kernel.function("tcp_setsockopt")$/;" p line:604 roles:def end:613
35+
tcp.ipv6.setsockopt input.stp /^probe tcp.ipv6.setsockopt = kernel.function("ipv6_setsockopt")!,$/;" p line:614 roles:def end:624
36+
tcp.setsockopt.return input.stp /^probe tcp.setsockopt.return = tcp.ipv4.setsockopt.return,$/;" p line:634 roles:def end:637
37+
tcp.ipv4.setsockopt.return input.stp /^probe tcp.ipv4.setsockopt.return = kernel.function("tcp_setsockopt").return$/;" p line:638 roles:def end:642
38+
tcp.ipv6.setsockopt.return input.stp /^probe tcp.ipv6.setsockopt.return = kernel.function("ipv6_setsockopt").return!,$/;" p line:643 roles:def end:648
39+
tcp.receive input.stp /^probe tcp.receive = tcp.ipv4.receive, tcp.ipv6.receive$/;" p line:667 roles:def end:669
40+
tcp.ipv4.receive input.stp /^probe tcp.ipv4.receive = kernel.function("tcp_v4_rcv")$/;" p line:671 roles:def end:694
41+
tcp.ipv6.receive input.stp /^probe tcp.ipv6.receive = kernel.function("tcp_v6_rcv")!,$/;" p line:696 roles:def end:730

docs/man-pages.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Man pages
2727
ctags-lang-r(7) <man/ctags-lang-r.7.rst>
2828
ctags-lang-rmarkdown(7) <man/ctags-lang-rmarkdown.7.rst>
2929
ctags-lang-sql(7) <man/ctags-lang-sql.7.rst>
30+
ctags-lang-systemtap(7) <man/ctags-lang-systemtap.7.rst>
3031
ctags-lang-tcl(7) <man/ctags-lang-tcl.7.rst>
3132
ctags-lang-verilog(7) <man/ctags-lang-verilog.7.rst>
3233

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. _ctags-lang-systemtap(7):
2+
3+
==============================================================
4+
ctags-lang-systemtap
5+
==============================================================
6+
7+
Random notes about tagging SystepTap source code with Universal Ctags
8+
9+
:Version: 6.0.0
10+
:Manual group: Universal Ctags
11+
:Manual section: 7
12+
13+
SYNOPSIS
14+
--------
15+
| **ctags** ... --languages=+SystemTap ...
16+
| **ctags** ... --language-force=SystemTap ...
17+
| **ctags** ... --map-SystemTap=+.stp ...
18+
19+
DESCRIPTION
20+
-----------
21+
This man page gathers random notes about tagging SystemTap scripts.
22+
23+
VERSIONS
24+
--------
25+
26+
Change since "0.0"
27+
~~~~~~~~~~~~~~~~~~
28+
29+
* New role ``attached`` for ``probe`` kind
30+
31+
SEE ALSO
32+
--------
33+
:ref:`ctags(1) <ctags(1)>`, `SystemTap Language Reference <https://sourceware.org/systemtap/langref>`_ (https://sourceware.org/systemtap/langref/)

man/GNUmakefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ GEN_IN_MAN_FILES = \
4040
ctags-lang-rmarkdown.7 \
4141
ctags-lang-sql.7 \
4242
ctags-lang-elm.7 \
43+
ctags-lang-systemtap.7 \
4344
\
4445
readtags.1 \
4546
tags.5 \

man/ctags-lang-systemtap.7.rst.in

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
.. _ctags-lang-systemtap(7):
2+
3+
==============================================================
4+
ctags-lang-systemtap
5+
==============================================================
6+
---------------------------------------------------------------------
7+
Random notes about tagging SystepTap source code with Universal Ctags
8+
---------------------------------------------------------------------
9+
:Version: @VERSION@
10+
:Manual group: Universal Ctags
11+
:Manual section: 7
12+
13+
SYNOPSIS
14+
--------
15+
| **@CTAGS_NAME_EXECUTABLE@** ... --languages=+SystemTap ...
16+
| **@CTAGS_NAME_EXECUTABLE@** ... --language-force=SystemTap ...
17+
| **@CTAGS_NAME_EXECUTABLE@** ... --map-SystemTap=+.stp ...
18+
19+
DESCRIPTION
20+
-----------
21+
This man page gathers random notes about tagging SystemTap scripts.
22+
23+
VERSIONS
24+
--------
25+
26+
Change since "0.0"
27+
~~~~~~~~~~~~~~~~~~
28+
29+
* New role ``attached`` for ``probe`` kind
30+
31+
SEE ALSO
32+
--------
33+
ctags(1), `SystemTap Language Reference <https://sourceware.org/systemtap/langref>`_ (https://sourceware.org/systemtap/langref/)

optlib/systemtap.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ static void initializeSystemTapParser (const langType language)
119119
"\\1", "p", "{tenter=probeBody}{scope=push}", NULL);
120120
addLanguageTagMultiTableRegex (language, "probe",
121121
"^([[:alpha:]_][[:alnum:]_.]*)[[:space:]]*",
122-
"", "", "{tenter=probeBody}{scope=push}", NULL);
122+
"\\1", "p", "{_role=attached}{tenter=probeBody}{scope=push}", NULL);
123123
addLanguageTagMultiTableRegex (language, "probeBody",
124124
"^[^\\{/#'\"]+",
125125
"", "", "", NULL);
@@ -403,9 +403,13 @@ extern parserDefinition* SystemTapParser (void)
403403
NULL
404404
};
405405

406+
static roleDefinition SystemTapProbeRoleTable [] = {
407+
{ true, "attached", "attached by code for probing" },
408+
};
406409
static kindDefinition SystemTapKindTable [] = {
407410
{
408411
true, 'p', "probe", "probe aliases",
412+
ATTACH_ROLES(SystemTapProbeRoleTable),
409413
},
410414
{
411415
true, 'f', "function", "functions",
@@ -420,8 +424,8 @@ extern parserDefinition* SystemTapParser (void)
420424

421425
parserDefinition* const def = parserNew ("SystemTap");
422426

423-
def->versionCurrent= 0;
424-
def->versionAge = 0;
427+
def->versionCurrent= 1;
428+
def->versionAge = 1;
425429
def->enabled = true;
426430
def->extensions = extensions;
427431
def->patterns = patterns;

optlib/systemtap.ctags

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
#
2727
# - https://sourceware.org/systemtap/langref/
2828
#
29-
--langdef=SystemTap
29+
--langdef=SystemTap{version=1.1}
3030
--map-SystemTap=+.stp
3131
--map-SystemTap=+.stpm
3232
--alias-SystemTap=+stap
3333

3434
--kinddef-SystemTap=p,probe,probe aliases
35+
--_roledef-SystemTap.{probe}=attached,attached by code for probing
3536
--kinddef-SystemTap=f,function,functions
3637
--kinddef-SystemTap=v,variable,variables
3738
--kinddef-SystemTap=m,macro,macros
@@ -116,7 +117,7 @@
116117
--_mtable-regex-SystemTap=probe/([[:alpha:]_][[:alnum:]_.]*)[[:space:]]*\+?=[[:space:]]*/\1/p/{tenter=probeBody}{scope=push}
117118

118119
# This "push" is dummy.
119-
--_mtable-regex-SystemTap=probe/([[:alpha:]_][[:alnum:]_.]*)[[:space:]]*///{tenter=probeBody}{scope=push}
120+
--_mtable-regex-SystemTap=probe/([[:alpha:]_][[:alnum:]_.]*)[[:space:]]*/\1/p/{_role=attached}{tenter=probeBody}{scope=push}
120121

121122
#
122123
# probeBody

0 commit comments

Comments
 (0)