shadow / shadow

Shadow is a discrete-event network simulator that directly executes real application code, enabling you to simulate distributed systems with thousands of network-connected processes in realistic and scalable private network experiments using your laptop, desktop, or server running Linux.

Home Page:https://shadow.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Improve strace formatting in shim

stevenengler opened this issue · comments

Most syscalls are logged from the main shadow process, but some syscalls are handled entirely in the shim. The shim doesn't have access to the strace formatting code, so it can only do a simple format which doesn't log the syscall arguments. It would be nice if we could migrate the strace formatting code to shadow_shim_helper so that it could be used from the shim. A complication is that the strace formatting code uses the memory manager, which would not be available in the shim. So we'd need some kind of abstract plugin memory interface so that the strace logging code could access plugin memory regardless of if it's running in shadow or in the shim.

There are currently two ways that the strace lines are formatted in the shim. One is in C for the time-related syscalls, and one is in rust for syscalls that are handled natively.

They are both roughly the same, but the C version doesn't format the time nicely. For example:

00:00:02.000000000 [tid 1000] shadow_init_memory_manager(...) = 0
000000002000000000 [tid 1000] gettimeofday(...) = 0
000000002000000000 [tid 1000] time(...) = 946684802
000000002000000000 [tid 1000] gettimeofday(...) = 0
00:00:02.000000000 [tid 1000] fstat(...) = 0

It would be nice to improve the time formatting here in the C code by moving it to rust.