1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
#
# strings.py - print the unique strings of runtime function arguments and return values.
#
# uftrace-option: --nest-libcall --auto-args
#
strset = set()
def uftrace_entry(ctx):
global strset
if "args" in ctx:
args = ctx["args"]
for arg in args:
if isinstance(arg, str):
arg = arg.strip()
if arg != "" and arg[:8] != "struct: ":
strset.add(arg)
def uftrace_exit(ctx):
global strset
if "retval" in ctx:
ret = ctx["retval"]
if isinstance(ret, str):
ret = ret.strip()
if ret != "" and ret[:8] != "struct: ":
strset.add(ret)
def uftrace_end():
global strset
for strval in strset:
print('"%s"' % strval)
print("---")
|