Skip to content

Conversation

@csegarragonz
Copy link
Collaborator

No description provided.

@csegarragonz csegarragonz self-assigned this Oct 7, 2022
@csegarragonz csegarragonz requested a review from Shillaker October 7, 2022 16:42
// 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.

3 participants