kernel/debug: Fix newlines on serial output

* kputs uses the string printing functions per arch
  which includes logic to detect \ n and add a \ r before it on
  serial devices.
* kputchar uses the individual character printing arch code
  which doesn't include this check.  This results in a floating
  prompt on serial kernel debugger sessions:
  kdebug>
         kdebug> help
                     Prints a command...
* Since kputchar is lower level and most would expect it to print
  "a single untampered character", just convert these newline calls
  to use kputs which includes the \ r check serial devices use.

Change-Id: I8389899e7670859597aeddbb6f58e9b7f7942230
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5992
Reviewed-by: Alex von Gluck IV <kallisti5@unixzen.com>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
This commit is contained in:
Alexander von Gluck IV 2023-01-12 10:39:37 -06:00 committed by Adrien Destugues
parent 4fc16a17cf
commit f65d24dfd9

View File

@ -343,7 +343,7 @@ public:
*firstSpace = tmpChar;
if (command != NULL) {
kputchar('\n');
kputs("\n");
print_debugger_command_usage(command->name);
} else {
if (ambiguous)
@ -430,12 +430,12 @@ public:
!= NULL) {
// spacing
if (column > 0 && column % columns == 0)
kputchar('\n');
kputs("\n");
column++;
kprintf(" %-*s", (int)longestName, command->name);
}
kputchar('\n');
kputs("\n");
}
}
@ -466,7 +466,7 @@ read_line(char* buffer, int32 maxLength,
case '\n':
case '\r':
buffer[length++] = '\0';
kputchar('\n');
kputs("\n");
done = true;
break;
case '\t':
@ -672,7 +672,7 @@ read_line(char* buffer, int32 maxLength,
if (length >= maxLength - 2) {
buffer[length++] = '\0';
kputchar('\n');
kputs("\n");
done = true;
break;
}