Skip to content

Commit c50bd8a

Browse files
committed
add more staps
1 parent 1bca043 commit c50bd8a

File tree

3 files changed

+112
-2
lines changed

3 files changed

+112
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Debian
3333
```
3434

3535
![callgraph of scsi_request_fn](/examples/images/scsi_request_fn.cg.png)
36-
![callgraph of scsi_requscsi_execute_req_flagsest_fn](/examples/images/scsi_execute_req_flags.cg.png)
36+
![backtrace of scsi_request_fn](/examples/images/scsi_request_fn.bt.png)
3737

3838

3939
Solaris
@@ -50,7 +50,7 @@ Solaris
5050

5151
![callgraph of sdioctl](/examples/images/sdioctl.cg.png)
5252

53-
![callgraph of sdioctl](/examples/images/sdioctl.bt.png)
53+
![backtrace of sdioctl](/examples/images/sdioctl.bt.png)
5454

5555
Other Graphs
5656
============

staps/scsi.stp

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
#! /bin/sh
2+
3+
# Copyright 2015 vonnyfly(lifeng1519@gmail.com)
4+
5+
# suppress some run-time errors here for cleaner output
6+
//bin/true && exec stap --all-modules --suppress-handler-errors --skip-badvars $0 ${1+"$@"}
7+
8+
9+
/* configuration options; set these with stap -G */
10+
global g_extra = 1
11+
global black_lists
12+
global g_incalls
13+
function trace(entry_p, extra) {
14+
if (g_extra == 0) extra = ""
15+
if (tid() in g_incalls)
16+
printf("%s%s%s %s\n",
17+
thread_indent (entry_p),
18+
(entry_p>0?"->":"<-"),
19+
ppfunc (),
20+
extra)
21+
}
22+
23+
24+
/*probe module("scsi_mod").function("*").call,
25+
module("sg").function("*").call,
26+
module("scsi_transport_spi").function("*").call,
27+
module("libata").function("*").call,
28+
module("mptspi").function("*").call,
29+
module("vmw_pvscsi").function("*").call,
30+
module("sd_mod").function("*").call,
31+
module("sr_mod").function("*").call,
32+
module("mptscsih").function("*").call*/
33+
probe module("scsi_mod").function("*").call,
34+
module("sg").function("*").call,
35+
module("sd_mod").function("*").call
36+
{
37+
if (execname() in black_lists) next
38+
trace(1, $$parms)
39+
}
40+
41+
/*probe module("scsi_mod").function("*").return,
42+
module("sg").function("*").return,
43+
module("scsi_transport_spi").function("*").return,
44+
module("libata").function("*").return,
45+
module("mptspi").function("*").return,
46+
module("vmw_pvscsi").function("*").return,
47+
module("sd_mod").function("*").return,
48+
module("sr_mod").function("*").return,
49+
module("mptscsih").function("*").return*/
50+
probe module("scsi_mod").function("*").return,
51+
module("sg").function("*").return,
52+
module("sd_mod").function("*").return
53+
{
54+
if (execname() in black_lists) next
55+
trace(-1, $$return)
56+
}
57+
58+
//probe kernel.function($1).call {
59+
//probe module("scsi_mod").function($1).call {
60+
probe $1.call {
61+
printf("\nkernel backtrace:\n")
62+
print_backtrace()
63+
black_lists["stapio"] = 1
64+
black_lists["swapper/0"] = 1
65+
g_incalls[tid()] = 1
66+
trace(1, $$parms)
67+
}
68+
probe $1.return {
69+
trace(-1, $$return)
70+
delete g_incalls[tid()]
71+
printf("---------------------------------------------------------\n")
72+
}

staps/scsi_debug.stp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
function trace(entry_p, extra) {
2+
printf("%s%s%s %s\n",
3+
thread_indent (entry_p),
4+
(entry_p>0?"->":"<-"),
5+
ppfunc (),
6+
extra)
7+
}
8+
9+
10+
/*probe module("scsi_mod").function("*").call,
11+
module("sg").function("*").call,
12+
module("scsi_transport_spi").function("*").call,
13+
module("libata").function("*").call,
14+
module("mptspi").function("*").call,
15+
module("vmw_pvscsi").function("*").call,
16+
module("sd_mod").function("*").call,
17+
module("sr_mod").function("*").call,
18+
module("mptscsih").function("*").call*/
19+
probe module("scsi_debug").function("scsi_debug_queuecommand").call
20+
{
21+
print_backtrace()
22+
trace(1, $$parms)
23+
}
24+
25+
/*probe module("scsi_mod").function("*").return,
26+
module("sg").function("*").return,
27+
module("scsi_transport_spi").function("*").return,
28+
module("libata").function("*").return,
29+
module("mptspi").function("*").return,
30+
module("vmw_pvscsi").function("*").return,
31+
module("sd_mod").function("*").return,
32+
module("sr_mod").function("*").return,
33+
module("mptscsih").function("*").return*/
34+
probe module("scsi_debug").function("scsi_debug_queuecommand").return
35+
{
36+
trace(-1, $$return)
37+
}
38+

0 commit comments

Comments
 (0)