Debug Stream
| Line 7: | Line 7: | ||
| + | {| | ||
| + | |- | ||
| + | |style="vertical-align:top"| __TOC__ | ||
| + | |style="vertical-align:top"| | ||
| + | {| width="100" cellpadding="2" cellspacing="0" style="border-collapse: collapse; border-width: 1px; border-style: solid; border-color: #000" | ||
| + | !colspan="2" class="wikiHeader"|Color Key | ||
| + | |- | ||
| + | |class="wikiText" width="75%" style="border-style: solid; border-width: 1px 0px 0px 0px"|Function: | ||
| + | |width="25%" style="border-style: solid; border-width: 1px 0px 0px 0px;" class="colorKeyFunc"| | ||
| + | |- | ||
| + | |class="wikiText" width="75%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Variable: | ||
| + | |width="25%" style="border-style: solid; border-width: 0px 0px 0px 0px;" class="colorKeyVar"| | ||
| + | |} | ||
| + | |- | ||
| + | |} | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | == “Traditional” Debugging Techniques == | ||
{| class="wikiText" | {| class="wikiText" | ||
|- | |- | ||
| − | | | + | | Debugging a program – finding the errors and correcting them – can be a slow process in solutions without a run-time debugger. Without a debugger you may have to resort to different techniques like: |
| − | + | ||
| − | Debugging a program – finding the errors and correcting them – can be a slow process in solutions without a run-time debugger. Without a debugger you may have to resort to different techniques like: | + | |
*There’s no way to determine if your program is executing the intended logic. So you add code to play different tones/sounds to your program as it executes different “blocks” of code. You determine from the sound what is being executed within your program. | *There’s no way to determine if your program is executing the intended logic. So you add code to play different tones/sounds to your program as it executes different “blocks” of code. You determine from the sound what is being executed within your program. | ||
| Line 22: | Line 40: | ||
|- | |- | ||
|} | |} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| Line 41: | Line 45: | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">writeDebugStream</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">const string </span><span class="bigCodeBasic">sFormatString</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">...</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|Writes a String to the Debug Stream. | | style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|Writes a String to the Debug Stream. | ||
| − | + | |- | |
| − | + | | | |
| − | {| | + | {| class="parameterTable" cellpadding="5%" width="100%" |
| − | + | ! width="20%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Parameter | |
| − | + | ! width="60%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Explanation | |
| + | ! width="20%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Data Type | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString'' | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|A string to write to the debug stream (can be formatted!) | | style="border-style: solid; border-width: 0px 0px 0px 0px"|A string to write to the debug stream (can be formatted!) | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_string|string]] | ||
|- | |- | ||
|} | |} | ||
| − | + | |- | |
| − | + | | | |
{| | {| | ||
|- | |- | ||
| Line 63: | Line 69: | ||
|- | |- | ||
|} | |} | ||
| − | + | <br /> | |
== writeDebugStreamLine == | == writeDebugStreamLine == | ||
{| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | {| style="color:black;" width="100%" cellpadding="5%" cellspacing="0" border="0" | ||
|- | |- | ||
| − | | | + | | class="functionType"| <span class="bigKeywordBI">void </span><span class="bigKeywordB">writeDebugStreamLine</span><span class="bigCodePunc">(</span><span class="bigKeywordBI">const string </span><span class="bigCodeBasic">sFormatString</span><span class="bigCodePunc">, </span><span class="bigCodeBasic">...</span><span class="bigCodePunc">)</span> |
|- | |- | ||
| style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|Writes a String to the Debug Stream starting on a new line. | | style="font-family:Verdana, Geneva, sans-serif; color:black; background-color:#FFFFFF; text-align:left; font-size:100%;"|Writes a String to the Debug Stream starting on a new line. | ||
| − | + | |- | |
| − | + | | | |
| − | {| | + | {| class="parameterTable" cellpadding="5%" width="100%" |
| − | + | ! width="20%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Parameter | |
| − | + | ! width="60%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Explanation | |
| + | ! width="20%" style="border-style: solid; border-width: 0px 0px 0px 0px"|Data Type | ||
|- | |- | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString'' | | style="border-style: solid; border-width: 0px 0px 0px 0px"|''sFormatString'' | ||
| style="border-style: solid; border-width: 0px 0px 0px 0px"|A string to write to the debug stream (can be formatted!) | | style="border-style: solid; border-width: 0px 0px 0px 0px"|A string to write to the debug stream (can be formatted!) | ||
| + | | style="border-style: solid; border-width: 0px 0px 0px 0px"|[[Data_Types#dataType_string|string]] | ||
|- | |- | ||
|} | |} | ||
| − | + | |- | |
| − | + | | | |
{| | {| | ||
|- | |- | ||
| Line 90: | Line 98: | ||
|- | |- | ||
|} | |} | ||
| + | <br /> | ||
Revision as of 10:46, 25 January 2012
|
Main >> NXT >> Functions and Variables >> Debug Stream |
|
| |||||||
“Traditional” Debugging Techniques
Debugging a program – finding the errors and correcting them – can be a slow process in solutions without a run-time debugger. Without a debugger you may have to resort to different techniques like:
Both of the above techniques are available in ROBOTC. However, a real-time debugger eliminates the need to resort to them. There’s no need to add code for debugging to your program. A built-in debugger provides better functionality without ever having to modify your source code! There is also a built-in Debug Stream that you can use to keep track of your program from behind the scenes. For example, you could print a message to the Debug Stream when you enter and exit loops, functions, etc. Then you can view the cached Debug Stream to help in the debugging process. |
writeDebugStream
| void writeDebugStream(const string sFormatString, ...) | ||||||
| Writes a String to the Debug Stream. | ||||||
| ||||||
|
writeDebugStreamLine
| void writeDebugStreamLine(const string sFormatString, ...) | ||||||
| Writes a String to the Debug Stream starting on a new line. | ||||||
| ||||||
|
