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

Enable logging for responses with only alloc. #78

Merged
merged 4 commits into from
Sep 24, 2021

Conversation

gz
Copy link
Contributor

@gz gz commented Sep 24, 2021

Description

Enable logging for responses (as discussed here #77)

API Stability

  • This PR does not require a breaking API change

Checklist

  • Implementation
    • cargo build compiles without errors or warnings
    • cargo fmt was run
    • All tests pass

@daniel5151 daniel5151 linked an issue Sep 24, 2021 that may be closed by this pull request
@daniel5151 daniel5151 self-requested a review September 24, 2021 18:18
Copy link
Owner

@daniel5151 daniel5151 left a comment

Choose a reason for hiding this comment

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

Wow, just as I wrap up opening #79, I realize you've opened a PR fixing it. Thank you!

As per my suggestion in #79, instead of overloading the "alloc" feature here, can you add a new feature to Cargo.toml called "trace-pkt"? This feature would have a dependency on alloc, while not forcing this additional logging overhead on all alloc users.

You'd also want to cfg-gate the incoming packet trace statement, which is currently always enabled.

src/protocol/response_writer.rs Outdated Show resolved Hide resolved
@daniel5151
Copy link
Owner

Ah, also, I'd make "trace-pkt" a on-by-default feature as well.

@daniel5151 daniel5151 self-requested a review September 24, 2021 18:39
Copy link
Owner

@daniel5151 daniel5151 left a comment

Choose a reason for hiding this comment

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

You'd also want to cfg-gate the incoming packet trace statement, which is currently always enabled.

i.e: please also feature = "trace-pkt" gate the following lines:

https://github.com/daniel5151/gdbstub/blob/dev/0.6/src/protocol/recv_packet.rs#L56-L59
https://github.com/daniel5151/gdbstub/blob/dev/0.6/src/protocol/recv_packet.rs#L114-L117

EDIT: aaaand you beat me to the punch again 😅

@gz
Copy link
Contributor Author

gz commented Sep 24, 2021

You'd also want to cfg-gate the incoming packet trace statement, which is currently always enabled.

I think I did this in 9e060d2 but let me know if I missed something.

@daniel5151 daniel5151 self-requested a review September 24, 2021 18:41
@daniel5151 daniel5151 merged commit 52ae3c7 into daniel5151:dev/0.6 Sep 24, 2021
@daniel5151
Copy link
Owner

Awesome, thanks again!

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.

Split packet trace logging into separate feature
2 participants