MCPcopy Create free account
hub / github.com/SmingHub/Sming / readConsole

Function readConsole

samples/LiveDebug/app/application.cpp:600–626  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

598 * after using the `consoleOff` command.
599 */
600void 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
628void printTimerDetails()
629{

Callers 3

asyncReadCallbackFunction · 0.85
onConsoleReadCompletedFunction · 0.85
gdb_on_attachFunction · 0.85

Calls 6

gdb_console_readFunction · 0.85
printfMethod · 0.80
printlnMethod · 0.80
showPromptFunction · 0.70
gdb_presentFunction · 0.50
queueCallbackMethod · 0.45

Tested by

no test coverage detected