Skip to content

Commit 60fc893

Browse files
Costa ShulyupinCosta Shulyupin
authored andcommitted
*func_referers_ ....
1 parent 4ea44ce commit 60fc893

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

srcxray.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ def func_referers_git_grep(name):
164164
res.append(r)
165165
r = None
166166
r = extract_referer(line)
167+
# r is list of file line func
167168
if verbose and r:
168169
print("%-40s\t%s"%(("%s:%s"%(r[0],r[1])),r[2]))
169170
return res
@@ -179,9 +180,16 @@ def func_referers_cscope(name):
179180
print("Recommended: cscope -Rcbk", file=sys.stderr)
180181
cscope_warned = True
181182
return []
182-
res = list(dict.fromkeys([l.split()[1] for l in popen(r'cscope -d -L3 "%s"' %
183-
(name)) if l not in black_list]))
184-
if not res:
183+
res = list()
184+
r = None
185+
for l in popen(r'cscope -d -L3 "%s"' % (name)):
186+
log(l)
187+
m = re.match(r'([^ ]*) ([^ ]*) ([^ ]*) (.*)', l)
188+
file, func, line_num, line_str = m.groups()
189+
if func in black_list: continue
190+
res.append([file, line_num, func])
191+
if not res and len(name) > 3:
192+
log(name)
185193
res = func_referers_git_grep(name)
186194
log(res)
187195
return res

0 commit comments

Comments
 (0)