The Pedigree Project
0.1
|
#include <DebuggerIO.h>
Public Types | |
enum | Colour { Black = 0, Blue = 1, Green = 2, Cyan = 3, Red = 4, Magenta = 5, Orange = 6, LightGrey = 7, DarkGrey = 8, LightBlue = 9, LightGreen = 10, LightCyan = 11, LightRed = 12, LightMagenta = 13, Yellow = 14, White = 15 } |
Public Member Functions | |
DebuggerIO () | |
virtual void | initialise ()=0 |
virtual void | destroy ()=0 |
virtual void | setCliUpperLimit (size_t nlines)=0 |
virtual void | setCliLowerLimit (size_t nlines)=0 |
virtual void | cls ()=0 |
virtual char | getCharNonBlock ()=0 |
virtual void | enableCli ()=0 |
virtual void | disableCli ()=0 |
virtual void | writeCli (const char *str, Colour foreColour, Colour backColour) |
virtual void | writeCli (char ch, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour) |
virtual bool | readCli (HugeStaticString &str, DebuggerCommand *pAutoComplete) |
virtual void | drawHorizontalLine (char c, size_t row, size_t colStart, size_t colEnd, Colour foreColour, Colour backColour)=0 |
virtual void | drawVerticalLine (char c, size_t col, size_t rowStart, size_t rowEnd, Colour foreColour, Colour backColour)=0 |
virtual void | drawString (const char *str, size_t row, size_t col, Colour foreColour, Colour backColour)=0 |
virtual size_t | getWidth ()=0 |
virtual size_t | getHeight ()=0 |
virtual void | enableRefreshes ()=0 |
virtual void | disableRefreshes ()=0 |
virtual void | forceRefresh ()=0 |
virtual void | readDimensions ()=0 |
virtual char | getChar ()=0 |
Protected Member Functions | |
virtual void | putChar (char c, DebuggerIO::Colour foreColour, DebuggerIO::Colour backColour)=0 |
virtual void | scroll ()=0 |
virtual void | moveCursor ()=0 |
Protected Attributes | |
bool | m_bReady |
char | m_pCommand [COMMAND_MAX] |
bool | m_bRefreshesEnabled |
Defines an interface for a console for the debugger to interact with the user.
The console can be in "raw" or "cli" mode - In CLI mode it is expected that the writeCli and readCli functions are heavily used - scrolling and backspacing is provided. In "raw" mode, any function (except writeCli and readCli) may be used.
The CLI interface has support for contracting the available window used for the CLI. The setCli{Upper|Lower}Limit functions define how many lines the CLI should not touch from the top and bottom of the screen, respectively.
Note that columns are numbered starting at 0 from the left, and rows are numbered starting at 0 from the top.
Definition at line 48 of file DebuggerIO.h.
enum DebuggerIO::Colour |
Enumeration of all possible foreground and background colours.
Definition at line 54 of file DebuggerIO.h.
|
inline |
Default constructor and destructor.
Definition at line 77 of file DebuggerIO.h.
References drawHorizontalLine(), drawString(), enableCli(), enableRefreshes(), getChar(), getWidth(), moveCursor(), readCli(), scroll(), setCliUpperLimit(), and writeCli().
|
pure virtual |
Draw a line of characters in the given fore and back colours, in the horizontal or vertical direction. Note that if the CLI is enabled, anything drawn across the CLI area can be wiped without warning.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), SyscallTracerCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), SlamCommand::execute(), ThreadsCommand::execute(), AllocationCommand::execute(), TraceCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), and Debugger::start().
|
pure virtual |
Draws a string of text at the given location in the given colour. note that wrapping is not performed, the string will be clipped.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), SyscallTracerCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), SlamCommand::execute(), ThreadsCommand::execute(), AllocationCommand::execute(), TraceCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), and Debugger::start().
|
pure virtual |
Enables or disables the command line interface, allowing full access to the display.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), LogViewer::execute(), MemoryInspector::execute(), SlamCommand::execute(), ThreadsCommand::execute(), AllocationCommand::execute(), TraceCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), and Debugger::start().
|
pure virtual |
Allows disabling of refreshes, for example when deleting something then writing it back.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), TraceCommand::execute(), and DevicesCommand::execute().
|
pure virtual |
Gets a character from the keyboard. Blocking. Returns 0 for a nonprintable character.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), SyscallTracerCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), SlamCommand::execute(), ThreadsCommand::execute(), AllocationCommand::execute(), TraceCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), and readCli().
|
pure virtual |
Returns the width and height respectively of the console.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), SyscallTracerCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), SlamCommand::execute(), ThreadsCommand::execute(), AllocationCommand::execute(), TraceCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), and Debugger::start().
|
protectedpure virtual |
Updates the hardware cursor position.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), and writeCli().
|
virtual |
Reads a command from the interface. Blocks until a character is pressed, and then the current buffer is returned in *str, and the return value is true if the command is complete (if enter has been pressed). *str will never exceed maxLen.
Definition at line 24 of file DebuggerIO.cc.
References getChar(), DebuggerCommand::getString(), m_bReady, m_pCommand, and writeCli().
Referenced by DebuggerIO(), and Debugger::start().
|
protectedpure virtual |
Scrolls the CLI screen down a line, if needed.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), and writeCli().
|
pure virtual |
Forces the command line interface not to use the specified number of lines from either the top or bottom of the screen, respectively. Can be used to create status lines that aren't destroyed by screen scrolling.
Implemented in LocalIO, and SerialIO.
Referenced by DebuggerIO(), and Debugger::start().
|
virtual |
Writes the given text out to the CLI, in the given colour and background colour.
Definition at line 114 of file DebuggerIO.cc.
References m_bRefreshesEnabled, moveCursor(), and scroll().
Referenced by DebuggerIO(), readCli(), and Debugger::start().
|
protected |
Are we ready to recieve a new command? (or are we recieving one already)
Definition at line 182 of file DebuggerIO.h.
Referenced by readCli().
|
protected |
Should we auto-refresh the screen?
Definition at line 192 of file DebuggerIO.h.
Referenced by LocalIO::drawHorizontalLine(), LocalIO::drawString(), SerialIO::enableRefreshes(), LocalIO::enableRefreshes(), and writeCli().
|
protected |
Command buffer.
Definition at line 187 of file DebuggerIO.h.
Referenced by SerialIO::enableCli(), LocalIO::enableCli(), LocalIO::LocalIO(), and readCli().