-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Assert and printk not printed on RTT #12410
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
Comments
@Qbicz i've reproduced the issue. |
Thank you @nordic-krch. Let me know if you need any further info. |
So the problem is that assert ends up in forever loop in current context so logger thread cannot process logs: zephyr/include/misc/__assert.h Line 90 in c716f9c
I'm not sure what is the intention there because depending on the context it will block the system (high priority task or interrupt) or system will continue if it happens in low priority task. @nashif I see that it's been like that from the beginning of github history. Do we consider assert as unrecoverable? If yes then we need to do something with it because current local loop is not good. |
I think the goal of assert is to print the message and hang/exit. |
IMHO assert should be considered a fatal, unrecoverable condition. This is used in development only and its goal is to early reveal bugs in the code and show it to a developer. If the program is buggy, it does not matter if the program can continue or not (in development) - because the bug should be fixed. In production, the program is released without assertions. Because of that, it makes no difference if assert trigger fatal termination of thread or entire system. So I believe there should be LOG_PANIC when assert happens. |
Calling |
@nordic-krch can we first fix the problem I mentioned? The visible problem is that on any assert, nothing is printed out and user has to guess that it was an assertion and use debugger to get to know where it happened. And the Let's handle this problem first, maybe by using logger panic? |
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
Log messages are printed, but assert message is not printed out. As a result, it gives impression that device hanged, but does not give any clue why. You can see that it was an assertion, by opening debugger and stopping after the device hanged:
To Reproduce
Happens for any assert in Zephyr subsystems.
Can be reproduced on hello_world with small modification:
Output:
Assert message
ASSERTION FAIL ...
is not printed. Is is the same with__ASSERT_NO_MSG
or if instead of assert there is just a call toprintk()
;Environment:
In configuration, printk is processed by logger:
CONFIG_LOG_PRINTK=y
Full config:
The text was updated successfully, but these errors were encountered: