-
Notifications
You must be signed in to change notification settings - Fork 3k
More mbed_error refinements #8441
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
Conversation
Fyi:
|
3c0baf2
to
124bb51
Compare
@mbed-os-core Whenever y'all are available, this became unblocked when #8076 came in. |
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.
Looks good to me
Puzzled that GitHub is still showing the first 5 commits from #8076. Expected them to quietly vanish once merged, which they definitely have been. Guess I'll rebase just to clear up view. |
This is potentially useful for printing long strings such as filenames from assert messages, avoiding the buffer limit inherent in mbed_error_printf.
If we want zero-fill, strncpy does it anyway.
Casts were covering up a type mismatch. Print the "ready" list, and remove the explicit print of the idle thread (it should be in the ready list).
As part of this, don't show empty current thread info in non-RTOS build.
Don't extract filename from the stored error - print it directly. Use "mbed_error_puts" for both error message and filename to avoid buffer length limits. Switch to puts also fixes the potential problem of an error message containing a '%' upsetting the formatter - it should have been mbed_printf_error("%s", error_msg) in the first place.
/morph build |
Build : SUCCESSBuild number : 3429 Triggering tests/morph test |
Exporter Build : SUCCESSBuild number : 3051 |
Test : SUCCESSBuild number : 3220 |
@SenRamakri Ok with this PR? |
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.
Just a question.
@@ -29,34 +29,18 @@ | |||
#include <stdio.h> | |||
#endif | |||
|
|||
//Helper macro to get the current SP | |||
#define GET_CURRENT_SP(sp) \ |
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.
Huh. Why is this macro no longer needed?
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.
SP pointer is fetched using the address of local variable, hence not needed
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.
It was a very complicated way of getting the current stack pointer.
Although, on reflection, I now think the current stack pointer is not what you wanted anyway. It was being used as part of a "show current thread" line, where the current SP is being shown next to the stack size and limit for the current thread.
In a fault handler, both the complex and simple version will give you MSP, which is not going to be anywhere near the thread stack. You really wanted the PSP (or SP_usr for Cortex-A).
I'll probably adjust it again in a further patch.
(It's no big deal, as if it is a fault, you'll have the PSP visible in the preceding register dump.)
Description
This is based on and contains #8255 and #8076
New changes:
mbed_error_puts
to allow unlimited-length prints. Use it for error message and filename.puts
avoids undefined behaviour if there was a%
in an error message.print_error_report
, so we get filename fromMBED_ASSERT
after Change behaviour of mbed_asert to use mbed_error instead of mbed_die #8255, regardless of the setting ofplatform.error-capture-filename-enabled
.Pull request type