-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Darwin] Add a MdnsContexts::Print method for debugging purposes #36763
base: master
Are you sure you want to change the base?
[Darwin] Add a MdnsContexts::Print method for debugging purposes #36763
Conversation
PR #36763: Size comparison from af8d173 to 807964f Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
@@ -259,6 +259,36 @@ CHIP_ERROR MdnsContexts::Has(GenericContext * context) | |||
return CHIP_ERROR_KEY_NOT_FOUND; | |||
} | |||
|
|||
#ifdef DEBUG |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: within chip we prefer #if
instead of ifdef, so we guarantee the existence of the condition.
Would it make sense to maybe have a config for mdns debug instead of a global debug flag?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Would it make sense to maybe have a config for mdns debug instead of a global debug flag?
If you’re thinking of something similar to lwip_debug
, I agree it could be useful.
However, I’d generally prefer a solution like ChipLogDebug(Discovery, ...)
that can be toggled on or off easily, such as through an environment variable or a build-time define.
This approach would be less intrusive than adding #if ... #endif directives throughout the code and aligns better with our current practices.
Followup ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or did you mean just for src/platform/Darwin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be thinking of a gn flag inside platform/Darwin that controls these things. You should also likely use a build_header
instead of using defines, since defines leak throughout all calls and DEBUG
sounds like a very generic define to use.
My recommendation would be to have some config and have a constant in there for MDNS_VERBOSE_CONTEXT_PRINT
(or some other name that seems intuitive)
break; | ||
} | ||
|
||
ChipLogDetail(Discovery, "\t%p: %s", *iter, contextType); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the value of printing pointer values here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have multiple resolves in flight simultaneously. When debugging, printing the pointer serves as a unique identifier, making it easier to track which resolve operation is performing which actions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair, let's add that as a comment.
807964f
to
947391d
Compare
PR #36763: Size comparison from 2c11741 to 947391d Full report (10 builds for cc32xx, nrfconnect, qpg, stm32, tizen)
|
947391d
to
84c7a82
Compare
PR #36763: Size comparison from 2c11741 to 84c7a82 Full report (69 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, efr32, esp32, linux, nrfconnect, nxp, psoc6, qpg, stm32, telink, tizen)
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivien-apple please add a Testing
section on how this was tested.
It seems to me this is "manual" just by looking at logs. We need to meet a higher (i.e. more annoying to type everything out) bar for manual so that we do not have most PRs marked as manual because it is more convenient than writing tests. Please add justification why automated tests are imposssible (seems like this is platform dnssd triggering and logging for debug only, so maybe impractical or of little user value maybe) and a description on how you tested and ensured that your manual tests had good coverage of the added code.
Problem
This PR adds a
MdnsContexts::Print
method for listing the different contexts currently registered. That is for debugging purposes.