3 topfunc = re.compile(
"::(produce|analyze|filter|beginLuminosityBlock|beginRun|beginStream)\(")
4 baseclass = re.compile(
"edm::(one::|stream::|global::)?ED(Producer|Filter|Analyzer)(Base)?")
5 farg = re.compile(
"\(.*\)")
7 epfunc = re.compile(
"TGraph::(.*)\(.*\)")
8 skipfunc = re.compile(
"TGraph::IsA\(.*\)")
14 f = open(
'function-calls-db.txt')
17 fields = line.split(
"'")
18 if fields[2] ==
' calls function ' :
19 if not skipfunc.search(line) :
20 G.add_edge(fields[1],fields[3],kind=fields[2])
21 if epfunc.search(fields[3]) : epfuncs.add(fields[3])
22 if fields[2] ==
' overrides function ' :
23 if baseclass.search(fields[3]) :
24 if topfunc.search(fields[3]) : toplevelfuncs.add(fields[1])
25 G.add_edge(fields[1],fields[3],kind=
' overrides function ')
27 if not skipfunc.search(line) :
28 G.add_edge(fields[3],fields[1],kind=
' calls override function ')
29 if epfunc.search(fields[1]) : epfuncs.add(fields[1])
32 for epfunc
in sorted(epfuncs):
print epfunc
35 for epfunc
in epfuncs:
36 for tfunc
in toplevelfuncs:
37 if nx.has_path(G,tfunc,epfunc) :
38 path = nx.shortest_path(G,tfunc,epfunc)
39 print "Call stack \'",
41 print re.sub(farg,
"()",p)+
"; ",