When we use BAS_METHOD it is an alternative tracing macro to use for method on C++ objects. It gives is a unique pointer for the “this” pointer of the object we are tracing calls into the methods of. See the trace out from the tracing sandbox. This is what a trace might look like for a APPfoo object with this code:
Code Block |
---|
|
#include <BAS/BASstring.h>
#include <BAS/BAStrace.h>
BAS_TRACE_INIT;
class BASstring;
class APPfoo{
public:
APPfoo();
~APPfoo();
void run(const BASstring& Value, int Count);
};
APPfoo::APPfoo(){
BAS_METHOD(APPfoo::APPfoo);
}
APPfoo::~APPfoo(){
BAS_METHOD(APPfoo::~APPfoo);
}
void APPfoo::run(const BASstring& Value, int Count){
BAS_METHOD(APPfoo::run);
BAS_VAR2(Value, Count);
BASstring Out;
for (int i=0; i < Count; i++){
BAS_VAR(i);
Out += Value + "\n";
}
BAS_HEX("Dump", Out.data(), Out.size());
BASout << Out;
} |
Here’s the potential trace:
Code Block |
---|
|
T 17:58:05.844701 0x1107d25c0 APPfoo . >APPfoo::APPfoo Line:10 this=0x7ffee9b9d7d0
T 17:58:05.844756 0x1107d25c0 APPfoo . <APPfoo::APPfoo
T 17:58:05.844798 0x1107d25c0 main . About to call run on Foo
T 17:58:05.844832 0x1107d25c0 APPfoo . >APPfoo::run Line:17 this=0x7ffee9b9d7d0
T 17:58:05.844889 0x1107d25c0 APPfoo . . Value = Rabbit, Count = 5
T 17:58:05.844924 0x1107d25c0 APPfoo . . i = 0
T 17:58:05.844960 0x1107d25c0 APPfoo . . i = 1
T 17:58:05.844995 0x1107d25c0 APPfoo . . i = 2
T 17:58:05.845029 0x1107d25c0 APPfoo . . i = 3
T 17:58:05.845064 0x1107d25c0 APPfoo . . i = 4
T 17:58:05.845104 0x1107d25c0 APPfoo . . Dump= (size=35)
52 61 62 62 69 74 0A 52 Rabb it.R
61 62 62 69 74 0A 52 61 abbi t.Ra
62 62 69 74 0A 52 61 62 bbit .Rab
62 69 74 0A 52 61 62 62 bit. Rabb
69 74 0A it.
T 17:58:05.845140 0x1107d25c0 APPfoo . <APPfoo::run
T 17:58:05.845182 0x1107d25c0 main . All done!
T 17:58:05.845217 0x1107d25c0 APPfoo . >APPfoo::~APPfoo Line:13 this=0x7ffee9b9d7d0
T 17:58:05.845271 0x1107d25c0 APPfoo . <APPfoo::~APPfoo
T 17:58:05.845326 0x1107d25c0 main <main |
...