This commit is contained in:
Costa Shulyupin 2020-07-22 19:26:28 +03:00
parent e023757f8c
commit 99c9fe34c8
1 changed files with 19 additions and 11 deletions

View File

@ -628,6 +628,9 @@ def digraph_print(dg, starts=None, dst_fn=None, sort=False):
def cflow_preprocess(a):
'''
prepare Linux source for better cflow parsing results
'''
with open(a, 'rb') as f:
for s in f:
try:
@ -662,6 +665,14 @@ def cflow_preprocess(a):
sys.stdout.write(s)
# export CPATH=:include:arch/x86/include:../build/include/:../build/arch/x86/include/generated/:include/uapi
# srcxray.py "'\n'.join(cflow('init/main.c'))"
def cflow(a=None):
'''
configure and use cflow on Linux sources
'''
cflow_param = {
"modifier": "__init __inline__ noinline __initdata __randomize_layout asmlinkage "
" __visible __init __leaf__ __ref __latent_entropy __init_or_module libmosq_EXPORT",
@ -672,11 +683,6 @@ cflow_param = {
# "wrapper": "__setup early_param"
}
# export CPATH=:include:arch/x86/include:../build/include/:../build/arch/x86/include/generated/:include/uapi
# srcxray.py "'\n'.join(cflow('init/main.c'))"
def cflow(a=None):
if os.path.isfile('include/linux/cache.h'):
for m in popen("ctags -x --c-kinds=d include/linux/cache.h | cut -d' ' -f 1 | sort -u"):
if m in cflow_param['modifier']:
@ -708,7 +714,9 @@ def cflow(a=None):
def import_cflow(a=None, cflow_out=None):
# $none_or_dir_or_file_or_mask
'''
extract graph with cflow from Linux sources
'''
cf = my_graph()
stack = list()
nprev = -1