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 49 of file DebuggerIO.h.

Member Enumeration Documentation

◆ Colour

Enumeration of all possible foreground and background colours.

Definition at line 54 of file DebuggerIO.h.

Constructor & Destructor Documentation

◆ DebuggerIO()

DebuggerIO::DebuggerIO ( )
inline

Default constructor and destructor.

Definition at line 76 of file DebuggerIO.h.

◆ ~DebuggerIO()

virtual DebuggerIO::~DebuggerIO ( )
inlinevirtual

Definition at line 77 of file DebuggerIO.h.

Member Function Documentation

◆ drawHorizontalLine()

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 SyscallTracerCommand::execute(), AllocationCommand::execute(), CpuInfoCommand::execute(), LocksCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), ModulesCommand::execute(), SlamCommand::execute(), ThreadsCommand::execute(), and Debugger::start().

+ Here is the caller graph for this function:

◆ drawString()

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 SyscallTracerCommand::execute(), AllocationCommand::execute(), CpuInfoCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), ModulesCommand::execute(), SlamCommand::execute(), ThreadsCommand::execute(), and Debugger::start().

+ Here is the caller graph for this function:

◆ enableCli()

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 AllocationCommand::execute(), CpuInfoCommand::execute(), DevicesCommand::execute(), LocksCommand::execute(), LogViewer::execute(), MemoryInspector::execute(), ModulesCommand::execute(), SlamCommand::execute(), ThreadsCommand::execute(), TraceCommand::execute(), and Debugger::start().

+ Here is the caller graph for this function:

◆ enableRefreshes()

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 DevicesCommand::execute(), and TraceCommand::execute().

+ Here is the caller graph for this function:

◆ getChar()

virtual char DebuggerIO::getChar ( )
pure virtual

◆ getWidth()

virtual size_t DebuggerIO::getWidth ( )
pure virtual

◆ moveCursor()

virtual void DebuggerIO::moveCursor ( )
protectedpure virtual

Updates the hardware cursor position.

Implemented in LocalIO, and SerialIO.

◆ putChar()

virtual void DebuggerIO::putChar ( char  c,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
protectedpure virtual

Implemented in SerialIO.

◆ readCli()

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 25 of file DebuggerIO.cc.

References getChar(), DebuggerCommand::getString(), m_bReady, m_pCommand, ProcessorBase::pause(), and writeCli().

Referenced by Debugger::start().

+ Here is the caller graph for this function:

◆ scroll()

virtual void DebuggerIO::scroll ( )
protectedpure virtual

Scrolls the CLI screen down a line, if needed.

Implemented in LocalIO, and SerialIO.

◆ setCliUpperLimit()

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

+ Here is the caller graph for this function:

◆ writeCli() [1/2]

void DebuggerIO::writeCli ( char  ch,
DebuggerIO::Colour  foreColour,
DebuggerIO::Colour  backColour 
)
virtual

Definition at line 122 of file DebuggerIO.cc.

◆ writeCli() [2/2]

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 100 of file DebuggerIO.cc.

References m_bRefreshesEnabled, and writeCli().

Referenced by IrqsCommand::execute(), readCli(), Debugger::start(), and writeCli().

+ Here is the caller graph for this function:

Member Data Documentation

◆ m_bReady

bool DebuggerIO::m_bReady
protected

Are we ready to recieve a new command? (or are we recieving one already)

Definition at line 170 of file DebuggerIO.h.

Referenced by readCli().

◆ m_bRefreshesEnabled

bool DebuggerIO::m_bRefreshesEnabled
protected

Should we auto-refresh the screen?

Definition at line 180 of file DebuggerIO.h.

Referenced by LocalIO::drawHorizontalLine(), LocalIO::drawString(), LocalIO::enableRefreshes(), SerialIO::enableRefreshes(), and writeCli().

◆ m_pCommand

char DebuggerIO::m_pCommand[COMMAND_MAX]
protected

Command buffer.

Definition at line 175 of file DebuggerIO.h.

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


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