The Pedigree Project  0.1
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
DebuggerIO Class Referenceabstract

#include <DebuggerIO.h>

+ Inheritance diagram for DebuggerIO:
+ Collaboration diagram for DebuggerIO:

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
 

Detailed Description

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.

Member Enumeration Documentation

Enumeration of all possible foreground and background colours.

Definition at line 54 of file DebuggerIO.h.

Constructor & Destructor Documentation

DebuggerIO::DebuggerIO ( )
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().

Member Function Documentation

virtual void DebuggerIO::drawHorizontalLine ( char  c,
size_t  row,
size_t  colStart,
size_t  colEnd,
Colour  foreColour,
Colour  backColour 
)
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().

+ Here is the caller graph for this function:

virtual void DebuggerIO::drawString ( const char *  str,
size_t  row,
size_t  col,
Colour  foreColour,
Colour  backColour 
)
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().

+ Here is the caller graph for this function:

virtual void DebuggerIO::enableCli ( )
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().

+ Here is the caller graph for this function:

virtual void DebuggerIO::enableRefreshes ( )
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().

+ Here is the caller graph for this function:

virtual char DebuggerIO::getChar ( )
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().

+ Here is the caller graph for this function:

virtual size_t DebuggerIO::getWidth ( )
pure virtual
virtual void DebuggerIO::moveCursor ( )
protectedpure virtual

Updates the hardware cursor position.

Implemented in LocalIO, and SerialIO.

Referenced by DebuggerIO(), and writeCli().

+ Here is the caller graph for this function:

bool DebuggerIO::readCli ( HugeStaticString str,
DebuggerCommand pAutoComplete 
)
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().

+ Here is the caller graph for this function:

virtual void DebuggerIO::scroll ( )
protectedpure virtual

Scrolls the CLI screen down a line, if needed.

Implemented in LocalIO, and SerialIO.

Referenced by DebuggerIO(), and writeCli().

+ Here is the caller graph for this function:

virtual void DebuggerIO::setCliUpperLimit ( size_t  nlines)
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().

+ Here is the caller graph for this function:

void DebuggerIO::writeCli ( const char *  str,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
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().

+ Here is the caller graph for this function:

Member Data Documentation

bool DebuggerIO::m_bReady
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().

bool DebuggerIO::m_bRefreshesEnabled
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().

char DebuggerIO::m_pCommand[COMMAND_MAX]
protected

Command buffer.

Definition at line 187 of file DebuggerIO.h.

Referenced by SerialIO::enableCli(), LocalIO::enableCli(), LocalIO::LocalIO(), and readCli().


The documentation for this class was generated from the following files: