This commit is contained in:
Costa Shulyupin 2022-11-04 06:36:44 +02:00
parent ecd483e222
commit acc8223d41
1 changed files with 22 additions and 20 deletions

View File

@ -68,6 +68,7 @@ def print_limited(a, out=None):
# raise(Exception('Reached lines limit')) # raise(Exception('Reached lines limit'))
out.write(str(a) + '\n') out.write(str(a) + '\n')
def print_limited2(a, out=None): def print_limited2(a, out=None):
# exits when reaches limit of printed lines # exits when reaches limit of printed lines
out = out if out else sys.stdout out = out if out else sys.stdout
@ -78,6 +79,7 @@ def print_limited2(a, out=None):
level_limit = 2 level_limit = 2
out.write(str(a) + '\n') out.write(str(a) + '\n')
def log(*args, **kwargs): def log(*args, **kwargs):
# log with context function # log with context function
if not verbose: if not verbose:
@ -300,15 +302,15 @@ def call_tree(node, printed=None, level=0):
continue continue
if a in stop: if a in stop:
print_limited2((level + 1)*'\t' + a + print_limited2((level + 1)*'\t' + a +
(' ^' if a in local_printed else '')) (' ^' if a in local_printed else ''))
local_printed.add(a) local_printed.add(a)
continue continue
if a in ignore: if a in ignore:
ignored.add(a) ignored.add(a)
if show_ignored: if show_ignored:
print_limited2((level + 1)*'\t' + '\033[2;30m' + a + print_limited2((level + 1)*'\t' + '\033[2;30m' + a +
(' ^' if a in local_printed else '') + (' ^' if a in local_printed else '') +
'\033[0m') '\033[0m')
local_printed.add(a) local_printed.add(a)
continue continue
local_printed.add(a) local_printed.add(a)
@ -670,24 +672,24 @@ def cflow(a=None):
configure and use cflow on Linux sources configure and use cflow on Linux sources
''' '''
cflow_param = { cflow_param = {
"modifier": "__init __inline__ noinline __initdata __randomize_layout asmlinkage __maybe_unused" "modifier": "__init __inline__ noinline __initdata __randomize_layout asmlinkage __maybe_unused"
" __visible __init __leaf__ __ref __latent_entropy __init_or_module libmosq_EXPORT", " __visible __init __leaf__ __ref __latent_entropy __init_or_module libmosq_EXPORT",
"wrapper": "__attribute__ __section__ " "wrapper": "__attribute__ __section__ "
"TRACE_EVENT MODULE_AUTHOR MODULE_DESCRIPTION MODULE_LICENSE MODULE_LICENSE MODULE_SOFTDEP " "TRACE_EVENT MODULE_AUTHOR MODULE_DESCRIPTION MODULE_LICENSE MODULE_LICENSE MODULE_SOFTDEP "
"INIT_THREAD_INFO " "INIT_THREAD_INFO "
"BUG READ_ONCE EEXIST MAJOR " "BUG READ_ONCE EEXIST MAJOR "
"VM_FAULT_ERROR VM_FAULT_MAJOR VM_FAULT_RETRY VM_PFNMAP VM_READ VM_WRITE " "VM_FAULT_ERROR VM_FAULT_MAJOR VM_FAULT_RETRY VM_PFNMAP VM_READ VM_WRITE "
"FAULT_FLAG_ALLOW_RETRY FAULT_FLAG_KILLABLE " "FAULT_FLAG_ALLOW_RETRY FAULT_FLAG_KILLABLE "
"VM_BUG_ON_VMA FOLL_TOUCH FOLL_POPULATE FOLL_MLOCK VM_LOCKONFAULT VM_SHARED FOLL_WRITE " "VM_BUG_ON_VMA FOLL_TOUCH FOLL_POPULATE FOLL_MLOCK VM_LOCKONFAULT VM_SHARED FOLL_WRITE "
"FOLL_PIN FOLL_NUMA FOLL_GET FOLL_FORCE FOLL_LONGTERM FOLL_FAST_ONLY" "FOLL_PIN FOLL_NUMA FOLL_GET FOLL_FORCE FOLL_LONGTERM FOLL_FAST_ONLY"
"TASK_SIZE " "TASK_SIZE "
"fallthrough EHWPOISON " "fallthrough EHWPOISON "
"__assume_kmalloc_alignment __malloc " "__assume_kmalloc_alignment __malloc "
"__acquires __releases __ATTR", "__acquires __releases __ATTR",
"type": "type":
"pgd_t p4d_t pud_t pmd_t pte_t vm_flags_t" "pgd_t p4d_t pud_t pmd_t pte_t vm_flags_t"
# "wrapper": "__setup early_param" # "wrapper": "__setup early_param"
} }
if os.path.isfile('include/linux/cache.h'): 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"): for m in popen("ctags -x --c-kinds=d include/linux/cache.h | cut -d' ' -f 1 | sort -u"):
@ -954,7 +956,7 @@ def to_dg(a):
if os.path.isfile(a): if os.path.isfile(a):
log(a) log(a)
return read_dot(a) return read_dot(a)
raise(Exception(a)) raise (Exception(a))
def remove_loops(dg): def remove_loops(dg):