Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Tracing can only be done inside the body of a cpp file. It requires C++, so it won’t work on pure C files.

You need to include BAS/BAStrace.h and invoke the BAS_TRACE_INIT macro:

#include <BAS/BAStrace.h>
BAS_TRACE_INIT;

The for functions you want to trace use:

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

For methods, so that you get the this pointer. You need to use BAS_METHOD macro:

APPfoo::~APPfoo(){
   BAS_METHOD(APPfoo::~APPfoo);
}

void APPfoo::run(const BASstring& Value, int Count){
   BAS_METHOD(APPfoo::run);
   // ....
}

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

void APPfunction(int Number, const char* pString){
   BAS_VAR(Number);
   BAR_VAR(pString);
   BAS_VAR2(Number, pString);
}

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

void APPfunction(const char* pData, int Size, const BASstring& String){
   BAS_HEX("Data", pData, Size);
   // For strings we can use the data and size methods.
   BAS_HEX("String Data", String.data(), String.size()); 
}

And that is it! Not much to learn to use tracing which is why I find it a very effective way to make teams productive with C++.

  • No labels