diff --git a/strace_process_tree.py b/strace_process_tree.py index 362bd56..b586e5a 100755 --- a/strace_process_tree.py +++ b/strace_process_tree.py @@ -318,7 +318,7 @@ def simplify_syscall(event): # clone(child_stack=0x..., flags=FLAGS, parent_tidptr=..., tls=..., # child_tidptr=...) => clone(FLAGS) if event.startswith(('clone(', 'clone3(')): - event = re.sub('[(].*, flags=([^,]*), .*[)]', r'(\1)', event) + event = re.sub('[(].*(?:, |{)flags=([^,]*), .*[)]', r'(\1)', event) return event.rstrip() diff --git a/tests.py b/tests.py index 5feff73..24f9e03 100644 --- a/tests.py +++ b/tests.py @@ -295,6 +295,11 @@ def test_simplify_syscall(): ) == ( 'clone(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID)' ) + assert stp.simplify_syscall( + 'clone3({flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, child_tid=0x7f1e00bff910, parent_tid=0x7f1e00bff910, exit_signal=0, stack=0x7f1e003ff000, stack_size=0x7feb40, tls=0x7f1e00bff640} => {parent_tid=[1942]}, 88)' + ) == ( + 'clone3(CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID)' + ) def test_extract_command_line():