You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@teaclave.apache.org by Tate Tian <no...@github.com> on 2020/04/24 03:50:41 UTC

[apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

### Background

When debugging, one usually needs to inspect the value of an object. For exactly this purpose, Rust offers the ability to implementing or automatically deriving Debug traits for user-defined types. Rust programmers have taken this godsend feature for granted.

### Problem

However, the SGX-related types defined in sgx_types crate do not have Debug trait implemented or derived. This makes it really cumbersome to debug values of SGX types. This absence of Debug trait for basic types also deviates the practice in Rust std crate, where (almost) all types support Debug traits. Moreover, due to Rust's the orphan rule, it is impossible for the users of Rust SGX SDK to manually implement Debug trait for SGX types defined in sgx_types crate.

### Feature Request

For the reasons above, I hope that Debug trait to be implemented (most can be derived automatically) for all SGX types defined in sgx_types. 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229

Re: [apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

Posted by Tate Tian <no...@github.com>.
Thanks for the quick coding! The commit looks good.

I got a question: why the implementation for Debug trait needs to be feature gated? I suppose that it is useful enough to be always enabled.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229#issuecomment-620024717

Re: [apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

Posted by Yu Ding <no...@github.com>.
i remember last time i failed on large arrays. just created a new branch to continue ...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229#issuecomment-618797839

Re: [apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

Posted by volcano <no...@github.com>.
It's OK.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229#issuecomment-619985914

Re: [apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

Posted by Tate Tian <no...@github.com>.
I believe Debug is only implemented for `[T: n]`, where n <= 32. So, yes, some types need manual implementation for Debug trait.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229#issuecomment-618808334

Re: [apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

Posted by Yu Ding <no...@github.com>.
@volcano0dr how do you think about it? https://github.com/apache/incubator-teaclave-sgx-sdk/commit/3c1edf464a6353f14fd0f665a1206494bea6c5a6

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229#issuecomment-619476122

Re: [apache/incubator-teaclave-sgx-sdk] Derive Debug trait for SGX types (#229)

Posted by Yu Ding <no...@github.com>.
check https://github.com/apache/incubator-teaclave-sgx-sdk/commit/3c1edf464a6353f14fd0f665a1206494bea6c5a6

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/apache/incubator-teaclave-sgx-sdk/issues/229#issuecomment-619463625