Skip to content

Commit

Permalink
Fix clone3() syscall simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
mgedmin committed Apr 19, 2024
1 parent bb61f62 commit f672c52
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion strace_process_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down
5 changes: 5 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down

0 comments on commit f672c52

Please sign in to comment.