Generate trace logs in wiggle albeit behind a feature gate

This commit augments `wiggle` with trace log generation for the shims,
returned errno values, and returned values proper (if any, i.e.,
different than unit type `()`). What that means is that every syscall
will have auto-generated up to 3 traces, for instance,

```
 TRACE wasi_common::wasi::wasi_snapshot_preview1 > fd_prestat_get(fd=Fd(3))
 TRACE wasi_common::wasi::wasi_snapshot_preview1 >      | result=(buf=Dir(PrestatDir { pr_name_len: 1 }))
 TRACE wasi_common::wasi::wasi_snapshot_preview1 >      | errno=No error occurred. System call completed successfully. (Errno::Success(0))
```

Putting logging behind a feature gate in this case means that the log calls
are generated by the `wiggle` crate regardless if the client requested
the feature or not, however, then their usage in the client lib is
dictated by the presence of the feature flag. So, for instance, `wasi-common`
has this feature enabled by default, while any other client lib
using `wiggle` if they don't want tracing enabled, they will just
leave the feature off. I'm not sure if this is what we wanted
but seemed easiest to implement quickly. Lemme y'all know your thoughts
about this!
This commit is contained in:
Jakub Konka
2020-03-28 17:11:32 +01:00
committed by Jakub Konka
parent cd900d72db
commit 78772cf5e1
4 changed files with 82 additions and 231 deletions

View File

@@ -115,9 +115,9 @@ impl EntryRights {
impl fmt::Display for EntryRights {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
writeln!(
write!(
f,
"EntryRights {{\n\tbase: {},\n\tinheriting: {}\n}}",
"EntryRights {{ base: {}, inheriting: {} }}",
self.base, self.inheriting
)
}