* Demonstrate GDB console access. * We actually queue this so it can be called directly from GDB to re-enable console reading * after using the `consoleOff` command. */
| 598 | * after using the `consoleOff` command. |
| 599 | */ |
| 600 | void readConsole() |
| 601 | { |
| 602 | consoleOffRequested = false; |
| 603 | System.queueCallback(InterruptCallback([]() { |
| 604 | showPrompt(); |
| 605 | if(gdb_present() == eGDB_Attached) { |
| 606 | // Issue the syscall |
| 607 | static char buffer[MAX_COMMAND_LENGTH]; |
| 608 | int res = gdb_console_read(buffer, MAX_COMMAND_LENGTH, onConsoleReadCompleted); |
| 609 | if(res < 0) { |
| 610 | Serial.printf(_F("gdb_console_read() failed, %d\r\n"), res); |
| 611 | Serial.println(_F("Is GDBSTUB_ENABLE_SYSCALL enabled ?")); |
| 612 | showPrompt(); |
| 613 | } |
| 614 | |
| 615 | /* |
| 616 | * GDB executes the system call, finished in onReadCompleted(). |
| 617 | * Note that any serial output gets ignored by GDB whilst executing a system |
| 618 | * call. |
| 619 | */ |
| 620 | } else { |
| 621 | /* |
| 622 | * GDB is either detached or not present, serial callback will process input |
| 623 | */ |
| 624 | } |
| 625 | })); |
| 626 | } |
| 627 | |
| 628 | void printTimerDetails() |
| 629 | { |
no test coverage detected