com.github.croesch.micro_debug.console
Class Mic1Interpreter

java.lang.Object
  extended by com.github.croesch.micro_debug.console.Mic1Interpreter
All Implemented Interfaces:
IProcessorInterpreter

public final class Mic1Interpreter
extends Object
implements IProcessorInterpreter

Interpreter of a processor, can access and manipulate the processor.

Since:
Date: Feb 13, 2012
Author:
croesch

Constructor Summary
Mic1Interpreter(Mic1 mic)
          Constructs an interpreter for the given processor.
 
Method Summary
 void addMacroBreakpoint(Integer line)
          Adds a breakpoint for the given line number in the macro code.
 void addMicroBreakpoint(Integer line)
          Adds a breakpoint for the given line number in the micro code.
 void addRegisterBreakpoint(Register r, Integer value)
          Adds a breakpoint for the given Register and the given value.
 boolean canContinue(int microLine, int macroLine)
          Returns whether the processor should halt now or if it can continue.
 Mic1 getProcessor()
          Returns the processor that this is interpreting.
 boolean isTracing(Register r)
          Returns whether the given Register is currently traced.
 void listAllRegisters()
          Lists the values of all Registers.
 void listBreakpoints()
          Lists all breakpoints.
 void listSingleRegister(Register r)
          Lists the value of a single Register.
 void printContent(int pos1, int pos2)
          Prints the content of the memory between the given addresses.
 void printMacroCode()
          Prints the whole ijvm code to the user.
 void printMacroCode(int scope)
          Prints the given number of lines of code around the current line to the user.
 void printMacroCode(int from, int to)
          Prints the whole ijvm code to the user.
 void printMicroCode()
          Prints the whole micro code to the user.
 void printMicroCode(int scope)
          Prints the given number of lines of micro code around the current line to the user.
 void printMicroCode(int from, int to)
          Prints the micro code to the user.
 void printStack(int elementsToHide)
          Prints the content of the stack.
 void removeBreakpoint(int id)
          Removes the breakpoint with the given unique id.
 void tickDone(MicroInstruction instruction, boolean macroCodeFetching)
          Informs the interpreter that the processor has done one tick.
 void traceLocalVariable(int num)
          Performs to trace the local variable with the given number.
 void traceMacro()
          Performs to trace the macro code.
 void traceMicro()
          Performs to trace the micro code.
 void traceRegister()
          Performs to trace all Registers.
 void traceRegister(Register r)
          Performs to trace the given Register.
 void untraceLocalVariable(int num)
          Performs to not trace the local variable with the given number.
 void untraceMacro()
          Performs to not trace the macro code.
 void untraceMicro()
          Performs to not trace the micro code.
 void untraceRegister()
          Performs to not trace any Register.
 void untraceRegister(Register r)
          Performs to not trace the given Register anymore.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Mic1Interpreter

public Mic1Interpreter(Mic1 mic)
Constructs an interpreter for the given processor.

Parameters:
mic - the processor to interprete
Since:
Date: Feb 13, 2012
Method Detail

addRegisterBreakpoint

public void addRegisterBreakpoint(Register r,
                                  Integer value)
Adds a breakpoint for the given Register and the given value. Debugger will break, if the given Register has the given value.

Parameters:
r - the Register to watch for the given value
value - the value that should be a break point if the given Register has it.
Since:
Date: Jan 27, 2012

addMicroBreakpoint

public void addMicroBreakpoint(Integer line)
Adds a breakpoint for the given line number in the micro code.

Parameters:
line - the line number in micro code the debugger should break at
Since:
Date: Feb 4, 2012

addMacroBreakpoint

public void addMacroBreakpoint(Integer line)
Adds a breakpoint for the given line number in the macro code.

Parameters:
line - the line number in macro code the debugger should break at
Since:
Date: Feb 4, 2012

removeBreakpoint

public void removeBreakpoint(int id)
Removes the breakpoint with the given unique id.

Parameters:
id - the unique id of the breakpoint to remove
Since:
Date: Jan 30, 2012

listBreakpoints

public void listBreakpoints()
Lists all breakpoints.

Since:
Date: Jan 28, 2012

listAllRegisters

public void listAllRegisters()
Lists the values of all Registers.

Since:
Date: Jan 15, 2012

listSingleRegister

public void listSingleRegister(Register r)
Lists the value of a single Register.

Parameters:
r - the Register to print with its value.
Since:
Date: Jan 15, 2012

traceLocalVariable

public void traceLocalVariable(int num)
Performs to trace the local variable with the given number.

Parameters:
num - the number of the local variable in the given macro code method as an offset to the LV.
Since:
Date: Feb 8, 2012

traceMacro

public void traceMacro()
Performs to trace the macro code.

Since:
Date: Feb 3, 2012

untraceMacro

public void untraceMacro()
Performs to not trace the macro code.

Since:
Date: Feb 3, 2012

traceMicro

public void traceMicro()
Performs to trace the micro code.

Since:
Date: Jan 21, 2012

traceRegister

public void traceRegister()
Performs to trace all Registers.

Since:
Date: Jan 15, 2012

traceRegister

public void traceRegister(Register r)
Performs to trace the given Register.

Parameters:
r - the Register to trace.
Since:
Date: Jan 15, 2012

untraceLocalVariable

public void untraceLocalVariable(int num)
Performs to not trace the local variable with the given number.

Parameters:
num - the number of the local variable in the given macro code method as an offset to the LV.
Since:
Date: Feb 8, 2012

untraceMicro

public void untraceMicro()
Performs to not trace the micro code.

Since:
Date: Jan 21, 2012

untraceRegister

public void untraceRegister()
Performs to not trace any Register.

Since:
Date: Jan 15, 2012

untraceRegister

public void untraceRegister(Register r)
Performs to not trace the given Register anymore.

Parameters:
r - the Register not being traced anymore.
Since:
Date: Jan 15, 2012

isTracing

public boolean isTracing(Register r)
Returns whether the given Register is currently traced.

Parameters:
r - the Register to check, if it's traced
Returns:
true, if the Register is currently traced
false otherwise.
Since:
Date: Jan 15, 2012

printMacroCode

public void printMacroCode()
Prints the whole ijvm code to the user.

Since:
Date: Jan 23, 2012

printMacroCode

public void printMacroCode(int scope)
Prints the given number of lines of code around the current line to the user.

Parameters:
scope - the number of lines to print before and after the current line
Since:
Date: Jan 26, 2012

printMacroCode

public void printMacroCode(int from,
                           int to)
Prints the whole ijvm code to the user. Between the given line numbers.

Parameters:
from - the first line to print
to - the last line to print
Since:
Date: Jan 26, 2012

printContent

public void printContent(int pos1,
                         int pos2)
Prints the content of the memory between the given addresses.

Parameters:
pos1 - the address to start (inclusive)
pos2 - the address to end (inclusive)
Since:
Date: Jan 29, 2012

printStack

public void printStack(int elementsToHide)
Prints the content of the stack. Technical speaking it prints the content of the memory between the initial stack pointer value and the current value of the stack (inclusive edges).

Parameters:
elementsToHide - the number of elements to hide. The first possible element is the one the initial stack pointer points to.
Since:
Date: Feb 5, 2012

canContinue

public boolean canContinue(int microLine,
                           int macroLine)
Returns whether the processor should halt now or if it can continue.

Specified by:
canContinue in interface IProcessorInterpreter
Parameters:
microLine - the number of the line in micro code being executed next
macroLine - the number of the line in macro code being executed next
Returns:
true if the processor can continue executing instructions,
false otherwise
Since:
Date: Feb 13, 2012

tickDone

public void tickDone(MicroInstruction instruction,
                     boolean macroCodeFetching)
Informs the interpreter that the processor has done one tick.

Specified by:
tickDone in interface IProcessorInterpreter
Parameters:
instruction - the executed micro instruction
macroCodeFetching - true if the next macro code instruction has being fetched,
false otherwise
Since:
Date: Feb 13, 2012

getProcessor

public Mic1 getProcessor()
Returns the processor that this is interpreting.

Returns:
the instance of the processor this is interpreting.
Since:
Date: Feb 13, 2012

printMicroCode

public void printMicroCode()
Prints the whole micro code to the user.

Since:
Date: Feb 5, 2012

printMicroCode

public void printMicroCode(int scope)
Prints the given number of lines of micro code around the current line to the user.

Parameters:
scope - the number of lines to print before and after the current line
Since:
Date: Feb 5, 2012

printMicroCode

public void printMicroCode(int from,
                           int to)
Prints the micro code to the user. Between the given line numbers.

Parameters:
from - the first line to print
to - the last line to print
Since:
Date: Feb 5, 2012


Copyright © 2012. All Rights Reserved.