Skip to content

Commit 1bca043

Browse files
committed
update backtrace generated
1 parent 64ff590 commit 1bca043

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

callee.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
import hashlib
2323
from optparse import OptionParser
24+
import re
2425

2526
bt_threshold = 3
2627
callgraph_threshold = 3
@@ -29,8 +30,10 @@
2930
output_format = "png"
3031
is_simplify = False
3132

33+
black_lists_stap = ("kretprobe_trampoline",)
34+
3235
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))
3437

3538
def write_file(basename, suffix, content):
3639
outfile = basename + suffix
@@ -54,7 +57,7 @@ def draw_backtrace(funcs):
5457
if len(funcs) < bt_threshold:
5558
return None
5659
header = """digraph backtrace{
57-
\tnode [shape="record"];
60+
\tnode [shape="record", width=4, height=.3, fixedsize=true];
5861
"""
5962
footer = "\n\t label=\"backtrace of %s\"}\n" %(funcs[0],)
6063

@@ -290,8 +293,12 @@ def main():
290293
bt_list = []
291294
callgraph_list = []
292295
dotfiles = []
296+
hex_pat = re.compile(r'^0x([0-9a-f]+)$')
293297
for l in content:
294298
if '+' not in l:
299+
if not is_dtrace: # stap, only address
300+
if re.search(hex_pat, l.strip(' \n\t')):
301+
continue
295302
outfile = draw_backtrace(bt_list)
296303
if outfile:
297304
dotfiles.append(outfile)
@@ -309,7 +316,8 @@ def main():
309316
else:
310317
if ':' in l:
311318
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)
313321
else:
314322
continue
315323

-3.04 KB
Loading

0 commit comments

Comments
 (0)