Skip to content

Commit

Permalink
Added doc folder with useful stuff (including new test documentation)…
Browse files Browse the repository at this point in the history
…. Start work on new xml test output lc3 calling convention checker
  • Loading branch information
TricksterGuy committed Feb 15, 2015
1 parent 11b2557 commit 290d486
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 0 deletions.
75 changes: 75 additions & 0 deletions doc/DebuggingComments.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
Debugging comments in Complx

So the way this system works is explained below.

You make comments in your assembly code and when complx loads your file breakpoints will already be set within the program. You can also set breakpoints/watchpoints within the program,


Breakpoints
===========
;@break address=addresss/symbol name=label condition=1 times=-1

You may omit one of the parameters if you don't need it defaults are shown these may also appear in any order.

or you can type them in this form

;@break address name condition times

(They must appear exactly in this order. You can think of this as an overloaded function call where everything is optional. ex if you want to specify times then you have to provide address, name, and condition)


Watchpoints
===========
Watch points have similar syntax

;@watch target=address condition="0" name=label times=-1

Note that condition is most important here as you will always have to specify a condition if you do not then ti will default to false.

;@watch target condition name times


Blackboxes
==========
Blackboxes which allow you to step over a subroutine that you think its correct (say UDIV)
you can do these as comments as well

;@blackbox address=address name=label condition=1

The parameters and behavior are the same as above.


EXAMPLES
========
;@break

Without any arguments this will put a normal breakpoint at the current address.
(i.e. the defaults are address being the current address of where you put the breakpoint, the name is empty string, the condition is 1 for always break, times is -1 for infinite)

;@break address=x3010 times=3

Will put a breakpoint at x3010 and after 3 hits it will disappear

;@break address=LOL condition=R0==25

This will put a break point at symbol LOL and it will only break if R0 is 25. (LOL had better exist as a symbol.)

;@watch

Without any arguments this will put a watchpoint at the current address. This is a special case and the condition will be 1 for always let me know. (note that @watch address=x3010 is invalid this will create a watchpoint that will never trigger).
(i.e. the defaults are the address being the current address of where you put the watchpoint, the name is an empty string, the condition is 1 for always break, times is -1 for infinite).

;@watch target=R0 condition=R0==3 times=3

This will create a watch point that is watching stores into R0 and will only break when R0 becomes 3. After 3 hits it will disappear.


Conditions
==========
The operators you can use in these conditional expressions for breakpoints and watchpoints is documented here. Its all on a its here if you need it basis!

Multiplication *, Division /, Modulus %, Addition +, Subtraction -, Bitwise xor ^, Bitwise and &, Bitwise or |, Logical and &&, Logical or ||, Logical nor !|, Logical nand !&, Equality ==, Inequality !=, Left shift <<, Right shift >>, Other relational operators < > <= >=.

Note: Learning how to debug things will make your life easier.

Remember that you can send me feature requests and if its feasible I will add it.
File renamed without changes.
53 changes: 53 additions & 0 deletions doc/complx_test_format.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?xml version="1.0"?>
<test-suite>
<!-- Hello this is a comment in xml -->
<!-- Test case you may have multiple of these -->
<test-case>
<!-- Test case name -->
<name>Default</name>
<!-- Enable true traps for this test the default is 0 (false) -->
<true-traps>0</true-traps>
<!-- This flag determines if the test has a time limit in number of instructions default is 0 (false). Best practice is to always use this. -->
<has-max-executions>0</has-max-executions>
<!-- The maximum number of instructions to run for. Only works if the above flag for has-max-executions is 1 (true) -->
<max-executions>1000000</max-executions>
<!-- Randomize memory before the test default is 0 (false)-->
<randomize>0</randomize>
<!-- Enable interrupts for this test the default is 0 (false)-->
<interupt-enabled>0</interupt-enabled>
<!-- Specify the inputs to your assembly code here -->
<!-- For both addresses and values you can use expressions beware that you will need to write the expression as the following <![CDATA[your expression here]]> -->
<input>
<!-- A value, whatever value at the label or address will be replaced by the value, here MEM[A] = 157-->
<test-value><address>A</address><value>157</value></test-value>
<!-- You can even use expressions to specify values will evaluate to whatever A's address is + 1 subtracted by R0's value-->
<test-value><address>A2</address><value>A + 1 - R0</value></test-value>
<!-- A pointer the address is treated to contain an address whose contents will be replaced by the value, here MEM[MEM[B]] = 7-->
<test-pointer><address>B</address><value>7</value></test-pointer>
<!-- Sets the register to be a specified value -->
<test-register><register>R6</register><value>80</value></test-register>
<!-- Sets the PC to be a specified value -->
<test-pc><value>x5000</value></test-pc>
<!-- An array the address is treated to contain an address. The contents starting at that address will sequentially be replaced by the values in the array -->
<!-- here MEM[MEM[C] + 0] = 7, MEM[MEM[C] + 1] = 5, and so on -->
<test-array><address>C</address><value>7,5,3,2,3,4,2,3,1,90</value></test-array>
<!-- A string again the address is treated to contain an address, The contents starting at that address will sequentially be replaced by the characters in the string + the nul character-->
<!-- here MEM[MEM[D] + 0] = 'H', MEM[MEM[D] + 1] = 'E', ... , MEM[MEM[D] + 13] = 0 (the nul character) -->
<test-string><address>D</address><value>HELLO WORLD!</value></test-string>
<!-- Specify console input here -->
<test-stdin><value>HERE IS SOME INPUT</value></test-stdin>
</input>
<output>
<!-- valid conditions for value/pointer/register/pc are equals, notEquals, less, greater, lessOrEquals, greaterOrEquals -->
<!-- A condition is used here to show the syntax for one -->
<test-value condition="equals"><address>E</address><value>158</value></test-value>
<test-pointer><address>F</address><value>8</value></test-pointer>
<!-- valid conditions for array are equals, notEquals -->
<test-array><address>G</address><value>8,6,4,3,4,5,3,4,2,91</value></test-array>
<!-- valid conditions for string/output are equals, notEquals, equalsIgnoreCase, notEqualsIgnoreCase, contains, notContains, containsIgnoreCase, notContainsIgnoreCase -->
<test-string><address>H</address><value>!DLROW OLLEH</value></test-string>
<!-- Specify console output here-->
<test-stdout><value>HERE IS SOME OUTPUT</value></test-stdout>
</output>
</test-case>
</test-suite>
File renamed without changes.
Binary file added doc/lc3test.pdf
Binary file not shown.
22 changes: 22 additions & 0 deletions liblc3/lc3_test.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,31 @@ enum lc3_test_type
TEST_ARRAY,
TEST_STRING,
TEST_IO,
TEST_SUBROUTINE,
SIZE,
};

typedef struct lc3_subr_input
{
std::string name;
std::string stack;
std::string r7_dummy;
std::string r5_dummy;
std::vector<std::string> params;
} lc3_subr_input;

typedef struct lc3_subr_output
{
std::string answer;
std::vector<std::string> locals;
unsigned int points_answer;
unsigned int points_r7;
unsigned int points_r5;
unsigned int points_edist;
unsigned int points_locals;

} lc3_subr_output;

typedef struct lc3_test_input
{
unsigned int type;
Expand Down

0 comments on commit 290d486

Please sign in to comment.