21
21
import os
22
22
import hashlib
23
23
from optparse import OptionParser
24
+ import re
24
25
25
26
bt_threshold = 3
26
27
callgraph_threshold = 3
29
30
output_format = "png"
30
31
is_simplify = False
31
32
33
+ black_lists_stap = ("kretprobe_trampoline" ,)
34
+
32
35
def get_random_id ():
33
- return '' .join (random .SystemRandom ().choice (string .digits ) for _ in range (3 ))
36
+ return '' .join (random .SystemRandom ().choice (string .digits + string . ascii_lowercase ) for _ in range (6 ))
34
37
35
38
def write_file (basename , suffix , content ):
36
39
outfile = basename + suffix
@@ -54,7 +57,7 @@ def draw_backtrace(funcs):
54
57
if len (funcs ) < bt_threshold :
55
58
return None
56
59
header = """digraph backtrace{
57
- \t node [shape="record"];
60
+ \t node [shape="record", width=4, height=.3, fixedsize=true ];
58
61
"""
59
62
footer = "\n \t label=\" backtrace of %s\" }\n " % (funcs [0 ],)
60
63
@@ -290,8 +293,12 @@ def main():
290
293
bt_list = []
291
294
callgraph_list = []
292
295
dotfiles = []
296
+ hex_pat = re .compile (r'^0x([0-9a-f]+)$' )
293
297
for l in content :
294
298
if '+' not in l :
299
+ if not is_dtrace : # stap, only address
300
+ if re .search (hex_pat , l .strip (' \n \t ' )):
301
+ continue
295
302
outfile = draw_backtrace (bt_list )
296
303
if outfile :
297
304
dotfiles .append (outfile )
@@ -309,7 +316,8 @@ def main():
309
316
else :
310
317
if ':' in l :
311
318
func_name = l .split (':' )[1 ].split ('+' )[0 ].strip ()
312
- bt_list .append (func_name )
319
+ if func_name not in black_lists_stap :
320
+ bt_list .append (func_name )
313
321
else :
314
322
continue
315
323
0 commit comments