Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
#include <BAS/BAStrace.h>
BAS_TRACE_INIT;

The for functions you want to trace useHere’s an example of tracing one function:

Code Block
void MyFunc(){
   BAS_FUNCTION(MyFunc);
   // blah
}

For inspecting variables you can use BAS_VAR for one variable, BAS_VAR2 for two, BAS_VAR3 for three and so on:

void APPfunction
Code Block
languagecpp
void APPmyFunction(int Number, const char* pString, int StringLength, bool Flag){
   BAS_VARFUNCTION(NumberAPPmyFunction);
   BARBAS_VAR(pStringNumber);   // print one number
   BAS_VAR2(Number, pStringFlag); }

For hexdumps you will need to use BAS_HEX with a label, a pointer to the data and it’s length:

Code Block
languagecpp
void APPfunction(const char* pData, int Size, const BASstring& String){ // print two variables
   BAS_TRC("This function is just for demonstration: " << Flag); 
   BAS_HEX("String Data", pDatapString, SizeStringLength);
   // do Forsome stringsstuff
we can use the data and size methods.
   BAS_HEX("String Data", String.data(), String.size()); 
}

...

}

This is what we are using:

  • BAS_FUNCTION to show entry and exit from the function - the argument is the just the name supplied, see See the flow of calls and values of variables

  • BAS_VAR, BAS_VAR2, BAS_VAR3 etc display variables in Name=Value pairs - see inspecting variables

  • BAS_TRC is like a general print statement to print whatever you want.

  • BAS_HEX will output a hex dump of the data given, pass in a label, pointer to the data and the length. See hexdumps.