-
Notifications
You must be signed in to change notification settings - Fork 3k
Fix issue in fault handler #6302
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
Incase used \r or \n inside the prints of the fault handler fault_print_str function would only \r. The fix is adding \n if needed
serial_putc(&stdio_uart, '\r'); | ||
if (fmtstr[i] == '\n') { | ||
serial_putc(&stdio_uart, '\n'); | ||
} |
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.
Should this just be
if(fmtstr[i] == '\r') {
serial_putc(&stdio_uart, '\r');
serial_putc(&stdio_uart, '\n');
and let '\r' fall through to the else statement?
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.
@geky actually no, this will cause double newline in case of the user will print something like
"hello work double newline \r\n"
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.
and of course if use only \n you will not have any carriage return
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.
Oh hmm, won't this turn "\r\n" into "\r\n\r\n" in that case?
I mistyped, meant:
if(fmtstr[i] == '\n') {
In this case "\r\n" would turn into "\r\r\n", but I think the extra "\r" doesn't hurt anything?
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.
No, the current implementation will do '\r\r\n'
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.
oh I see, gotcha
That would be the same as this right? But with more conditionals?
if(fmtstr[i] == '\n') {
serial_putc(&stdio_uart, '\r');
serial_putc(&stdio_uart, '\n');
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.
not quite as you are discarding any \r char sent to print...
i think the outcome may be the same but in some edge cases it will cause a different issue
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.
Hmm, wouldn't the '\r' still go through the else statement and get printed out?
if(fmtstr[i] == '\n') {
serial_putc(&stdio_uart, '\r');
serial_putc(&stdio_uart, '\n');
} else {
if(fmtstr[i]=='%') {
hex_to_str(values[vidx++],hex_str);
for(idx=7; idx>=0; idx--) {
serial_putc(&stdio_uart, hex_str[idx]);
}
} else {
serial_putc(&stdio_uart, fmtstr[i]);
}
}
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 think we're bikeshedding, but this is good change.
Don't let my comments block the pr
This is already taken care of in - #6257 |
👍 |
Description
Incase used \r or \n inside the prints of the fault handler
fault_print_str function would only \r.
The fix is adding \n if needed
Pull request type