Skip to content
This repository has been archived by the owner on Nov 9, 2019. It is now read-only.

Port trace log from wasmtime-wasi-c #28

Merged
merged 1 commit into from
Jun 24, 2019
Merged

Port trace log from wasmtime-wasi-c #28

merged 1 commit into from
Jun 24, 2019

Conversation

kubkon
Copy link
Member

@kubkon kubkon commented Jun 17, 2019

This PR builds directly on #27 (which in turn builds on #26). It ports the trace logs from wasmtime-wasi-c/src/syscalls.rs for easier debugging.

EDIT: Example usage:

Assuming you're using wasi-common together with wasmtime, the logs can be enabled directly from the terminal by running:

$ RUST_LOG=wasi_common=trace wasmtime -d --wasi-common ...

Producing an elegant output of the form:

 TRACE wasi_common::hostcalls::fs > fd_prestat_get(fd=3, prestat_ptr=0xffff0)
 TRACE wasi_common::hostcalls     >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::fs > fd_prestat_dir_name(fd=3, path_ptr=0x110088, path_len=1)
 TRACE wasi_common::hostcalls::fs >      | (path_ptr,path_len)="."
 TRACE wasi_common::hostcalls     >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::fs > fd_fdstat_get(fd=3, fdstat_ptr=0xfffd8)
 TRACE wasi_common::hostcalls::fs >      | *buf=__wasi_fdstat_t { fs_filetype: 3, fs_flags: 0, fs_rights_base: 264240792, fs_rights_inheriting: 268435455 }
 TRACE wasi_common::hostcalls     >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::fs > fd_prestat_get(fd=4, prestat_ptr=0xffff0)
 TRACE wasi_common::hostcalls     >     -> errno=__WASI_EBADF
 TRACE wasi_common::hostcalls::misc > environ_sizes_get(environ_count_ptr=0xffff0, environ_size_ptr=0xffffc)
 TRACE wasi_common::hostcalls::misc >      | *environ_count_ptr=0
 TRACE wasi_common::hostcalls::misc >      | *environ_size_ptr=0
 TRACE wasi_common::hostcalls       >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::misc > args_sizes_get(argc_ptr=0xffffc, argv_buf_size_ptr=0xffff0)
 TRACE wasi_common::hostcalls::misc >      | *argc_ptr=2
 TRACE wasi_common::hostcalls::misc >      | *argv_buf_size_ptr=18
 TRACE wasi_common::hostcalls       >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::misc > args_get(argv_ptr=0x110088, argv_buf=0x1100a8)
 TRACE wasi_common::hostcalls       >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::misc > args_sizes_get(argc_ptr=0xffe58, argv_buf_size_ptr=0xffe5c)
 TRACE wasi_common::hostcalls::misc >      | *argc_ptr=2
 TRACE wasi_common::hostcalls::misc >      | *argv_buf_size_ptr=18
 TRACE wasi_common::hostcalls       >     -> errno=__WASI_ESUCCESS
 TRACE wasi_common::hostcalls::misc > args_get(argv_ptr=0x110118, argv_buf=0x110128)
 TRACE wasi_common::hostcalls       >     -> errno=__WASI_ESUCCESS
...

@kubkon kubkon requested a review from sunfishcode June 17, 2019 20:23
@kubkon kubkon marked this pull request as ready for review June 18, 2019 06:41
@sunfishcode
Copy link
Member

The trace parts here look great! This is just blocked on #27.

@kubkon
Copy link
Member Author

kubkon commented Jun 19, 2019

The trace parts here look great! This is just blocked on #27.

Yeah, that's my fault. Looking back I probably shouldn't have made this PR dependent on #27, but then I thought it was a good idea to build on it and here we are.

@sunfishcode
Copy link
Member

#27 is now merged; would you mind rebasing the merge conflicts here?

@kubkon
Copy link
Member Author

kubkon commented Jun 24, 2019

Since #27 is now merged, I guess we can merge this one as well.

@kubkon kubkon merged commit 513429f into CraneStation:master Jun 24, 2019
@kubkon kubkon deleted the trace_log branch June 24, 2019 20:47
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants