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

Function onConsoleReadCompleted

samples/LiveDebug/app/application.cpp:570–593  ·  view source on GitHub ↗

* Completion callback for console read test. See readConsole(). * * When the syscall is executed, GDB is instructed to read a line of text from the console. * GDB implements a line-editor, so information will only be sent when you hit return. * Typing Ctrl+D sends the line immediately without any return (note: this doesn't work on Windows.) * * We continue running until GDB is ready to send

Source from the content-addressed store, hash-verified

568 * Data received will include any return character typed.
569 */
570void onConsoleReadCompleted(const GdbSyscallInfo& info)
571{
572 int result = info.result;
573 char* bufptr = static_cast<char*>(info.read.buffer);
574
575 debug_i("gdb_read_console() returned %d", result);
576 if(result > 0) {
577 // Remove trailing newline character
578 unsigned len = result;
579 if(bufptr[len - 1] == '\n') {
580 --len;
581 }
582
583 if(len > 0) {
584 String cmd(bufptr, len);
585 if(!handleCommand(cmd)) {
586 return; // Don't call readConsole
587 }
588 }
589 }
590
591 // Start another console read
592 readConsole();
593}
594
595/*
596 * Demonstrate GDB console access.

Callers

nothing calls this directly

Calls 2

readConsoleFunction · 0.85
handleCommandFunction · 0.70

Tested by

no test coverage detected