Skip to content

Improve strace string logging#2669

Merged
stevenengler merged 2 commits intoshadow:mainfrom
stevenengler:improve-strace-string
Jan 18, 2023
Merged

Improve strace string logging#2669
stevenengler merged 2 commits intoshadow:mainfrom
stevenengler:improve-strace-string

Conversation

@stevenengler
Copy link
Copy Markdown
Contributor

Small improvements to the syscall string logging in fmt_string to make it more readable, and more similar to fmt_buffer. Also added an optional len argument since some syscalls that take string arguments can also have a length argument (for example getsockopt with TCP_CONGESTION).

I tried using the memory manager's string methods (copy_str_from_ptr) but these don't return partial strings when a NUL isn't found so they can't be used here. I think the current method should be of similar performance (it iterates over a ProcessMemoryRef), only it does an extra String allocation. We could have a stack-allocated u8 array and cast it to a &str at the end, but I'm not sure it's worth it here.

@stevenengler stevenengler self-assigned this Jan 17, 2023
@github-actions github-actions bot added the Component: Main Composing the core Shadow executable label Jan 17, 2023
@codecov
Copy link
Copy Markdown

codecov bot commented Jan 18, 2023

Codecov Report

Base: 67.73% // Head: 68.01% // Increases project coverage by +0.27% 🎉

Coverage data is based on head (2d1afe9) compared to base (5989e24).
Patch coverage: 80.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2669      +/-   ##
==========================================
+ Coverage   67.73%   68.01%   +0.27%     
==========================================
  Files         202      202              
  Lines       30305    30304       -1     
  Branches     5917     5920       +3     
==========================================
+ Hits        20527    20611      +84     
+ Misses       5125     5025     -100     
- Partials     4653     4668      +15     
Flag Coverage Δ
tests 68.01% <80.00%> (+0.27%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/main/host/syscall/type_formatting.rs 77.39% <80.00%> (+2.39%) ⬆️
src/main/core/logger/shadow_logger.rs 69.61% <0.00%> (-2.77%) ⬇️
src/main/core/scheduler/pools/bounded.rs 74.50% <0.00%> (-1.97%) ⬇️
src/main/host/descriptor/pipe.rs 83.75% <0.00%> (-1.25%) ⬇️
src/main/host/syscall/handler/socket.rs 69.06% <0.00%> (-0.43%) ⬇️
src/main/core/manager.rs 63.41% <0.00%> (-0.23%) ⬇️
src/main/host/descriptor/mod.rs 67.63% <0.00%> (+0.20%) ⬆️
src/main/host/process.rs 79.79% <0.00%> (+0.41%) ⬆️
src/test/futex/test_futex.c 65.33% <0.00%> (+0.44%) ⬆️
src/main/host/syscall/handler/mod.rs 78.63% <0.00%> (+0.85%) ⬆️
... and 5 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stevenengler stevenengler force-pushed the improve-strace-string branch from 22de644 to 2d1afe9 Compare January 18, 2023 20:39
@stevenengler stevenengler merged commit b6e410e into shadow:main Jan 18, 2023
@stevenengler stevenengler deleted the improve-strace-string branch January 18, 2023 21:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component: Main Composing the core Shadow executable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants