From 60fc893b1ce1735f07af242d9b393f042bc9936b Mon Sep 17 00:00:00 2001 From: Costa Shulyupin Date: Wed, 24 Jun 2020 08:08:59 +0300 Subject: [PATCH] *func_referers_ .... --- srcxray.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/srcxray.py b/srcxray.py index d96ed1f..89a3f58 100755 --- a/srcxray.py +++ b/srcxray.py @@ -164,6 +164,7 @@ def func_referers_git_grep(name): res.append(r) r = None r = extract_referer(line) + # r is list of file line func if verbose and r: print("%-40s\t%s"%(("%s:%s"%(r[0],r[1])),r[2])) return res @@ -179,9 +180,16 @@ def func_referers_cscope(name): print("Recommended: cscope -Rcbk", file=sys.stderr) cscope_warned = True return [] - res = list(dict.fromkeys([l.split()[1] for l in popen(r'cscope -d -L3 "%s"' % - (name)) if l not in black_list])) - if not res: + res = list() + r = None + for l in popen(r'cscope -d -L3 "%s"' % (name)): + log(l) + m = re.match(r'([^ ]*) ([^ ]*) ([^ ]*) (.*)', l) + file, func, line_num, line_str = m.groups() + if func in black_list: continue + res.append([file, line_num, func]) + if not res and len(name) > 3: + log(name) res = func_referers_git_grep(name) log(res) return res