Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPDLOG-like logging in SGX #681

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

SPDLOG-like logging in SGX #681

wants to merge 1 commit into from

Conversation

csegarragonz
Copy link
Collaborator

No description provided.

@csegarragonz csegarragonz self-assigned this Oct 7, 2022
// For code outside SGX enclaves we use spdlog macros for logging. We provide
// similar macros for logging (only in debug mode) from inside the enclave. Note
// that this logging is very costly as it does an ocall to print the message,
// as a consequence we no-op it at compile time for release builds
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It took me a while to work out that we no-op ocallLogDebug, and not the SPDLOG_ macros here. Do we still call snprintf even in release builds? I would have expected:

#ifdef FAASM_SGX_DEBUG
#define SPDLOG_DEBUG_SGX(...) 
    size_t __bufferSize = 512;
    ...
#else
#define SPDLOG_DEBUG_SGX(...)
    // No-op
#endif

"Caught WASM runtime exception: " + errorMessage;
ocallLogError(errorText.c_str());
SPDLOG_ERROR_SGX("Caught WASM runtime exception: %s",
errorMessage.c_str());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that spdlog formatting used {} not printf-style %s. Does this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants