log lines of tty-output in debug-log
This commit is contained in:
parent
11fc6c5d86
commit
04d9c89b3b
2 changed files with 15 additions and 1 deletions
14
console.cpp
14
console.cpp
|
@ -163,8 +163,15 @@ void console::put_char(const char c)
|
||||||
}
|
}
|
||||||
else if (c == 13)
|
else if (c == 13)
|
||||||
tx = 0;
|
tx = 0;
|
||||||
else if (c == 10)
|
else if (c == 10) {
|
||||||
|
if (debug_buffer.empty() == false) {
|
||||||
|
D(fprintf(stderr, "TTY: %s\n", debug_buffer.c_str());)
|
||||||
|
|
||||||
|
debug_buffer.clear();
|
||||||
|
}
|
||||||
|
|
||||||
ty++;
|
ty++;
|
||||||
|
}
|
||||||
else if (c == 8) { // backspace
|
else if (c == 8) { // backspace
|
||||||
if (tx > 0)
|
if (tx > 0)
|
||||||
tx--;
|
tx--;
|
||||||
|
@ -177,6 +184,9 @@ void console::put_char(const char c)
|
||||||
|
|
||||||
ty++;
|
ty++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (debug_buffer.size() < 4096)
|
||||||
|
debug_buffer += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ty == t_height) {
|
if (ty == t_height) {
|
||||||
|
@ -208,6 +218,8 @@ void console::operator()()
|
||||||
|
|
||||||
bool running_flag = *get_running_flag();
|
bool running_flag = *get_running_flag();
|
||||||
|
|
||||||
|
printf("%d %d\n", running_flag, c);
|
||||||
|
|
||||||
if (running_flag == false && c == 3) // ^c
|
if (running_flag == false && c == 3) // ^c
|
||||||
*interrupt_emulation = *terminate = true;
|
*interrupt_emulation = *terminate = true;
|
||||||
else if (running_flag == true && c == 5) // ^e
|
else if (running_flag == true && c == 5) // ^e
|
||||||
|
|
|
@ -34,6 +34,8 @@ protected:
|
||||||
uint8_t tx { 0 };
|
uint8_t tx { 0 };
|
||||||
uint8_t ty { 0 };
|
uint8_t ty { 0 };
|
||||||
|
|
||||||
|
std::string debug_buffer;
|
||||||
|
|
||||||
virtual int wait_for_char_ll(const short timeout) = 0;
|
virtual int wait_for_char_ll(const short timeout) = 0;
|
||||||
|
|
||||||
virtual void put_char_ll(const char c) = 0;
|
virtual void put_char_ll(const char c) = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue