FunctionTracer: use __PRETTY_FUNCTION__

Change-Id: I49d53f4bb7b65d32c9e1e22be89add6199ccad24
Reviewed-on: https://review.haiku-os.org/c/haiku/+/10038
Reviewed-by: Adrien Destugues <[email protected]>
Reviewed-by: Niels Sascha Reedijk <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
PulkoMandy
2025-12-01 09:48:36 +00:00
committed by Adrien Destugues
parent 7ad0bd3735
commit b1ff3e6c46
4 changed files with 5 additions and 10 deletions
+2 -4
View File
@@ -13,15 +13,13 @@ namespace BPrivate {
class FunctionTracer { class FunctionTracer {
public: public:
FunctionTracer(const char* className, const char* functionName, FunctionTracer(const char* functionName, int32& depth)
int32& depth) : fFunctionName(functionName),
: fFunctionName(),
fPrepend(), fPrepend(),
fFunctionDepth(depth) fFunctionDepth(depth)
{ {
fFunctionDepth++; fFunctionDepth++;
fPrepend.Append(' ', fFunctionDepth * 2); fPrepend.Append(' ', fFunctionDepth * 2);
fFunctionName << className << "::" << functionName << "()";
printf("%s%s {\n", fPrepend.String(), fFunctionName.String()); printf("%s%s {\n", fPrepend.String(), fFunctionName.String());
} }
+1 -2
View File
@@ -47,8 +47,7 @@
#ifdef TRACE_MENU_FIELD #ifdef TRACE_MENU_FIELD
# include <FunctionTracer.h> # include <FunctionTracer.h>
static int32 sFunctionDepth = -1; static int32 sFunctionDepth = -1;
# define CALLED(x...) FunctionTracer _ft("BMenuField", __FUNCTION__, \ # define CALLED(x...) FunctionTracer _ft(__PRETTY_FUNCTION__, sFunctionDepth)
sFunctionDepth)
# define TRACE(x...) { BString _to; \ # define TRACE(x...) { BString _to; \
_to.Append(' ', (sFunctionDepth + 1) * 2); \ _to.Append(' ', (sFunctionDepth + 1) * 2); \
printf("%s", _to.String()); printf(x); } printf("%s", _to.String()); printf(x); }
+1 -2
View File
@@ -37,8 +37,7 @@
# include <stdio.h> # include <stdio.h>
# include <FunctionTracer.h> # include <FunctionTracer.h>
static int32 sFunctionDepth = -1; static int32 sFunctionDepth = -1;
# define CALLED(x...) FunctionTracer _ft("BTextControl", __FUNCTION__, \ # define CALLED(x...) FunctionTracer _ft(__PRETTY_FUNCTION__, sFunctionDepth)
sFunctionDepth)
# define TRACE(x...) { BString _to; \ # define TRACE(x...) { BString _to; \
_to.Append(' ', (sFunctionDepth + 1) * 2); \ _to.Append(' ', (sFunctionDepth + 1) * 2); \
printf("%s", _to.String()); printf(x); } printf("%s", _to.String()); printf(x); }
+1 -2
View File
@@ -78,8 +78,7 @@ using BPrivate::gSystemCatalog;
#ifdef TRACE_TEXT_VIEW #ifdef TRACE_TEXT_VIEW
# include <FunctionTracer.h> # include <FunctionTracer.h>
static int32 sFunctionDepth = -1; static int32 sFunctionDepth = -1;
# define CALLED(x...) FunctionTracer _ft("BTextView", __FUNCTION__, \ # define CALLED(x...) FunctionTracer _ft(__PRETTY_FUNCTION__, sFunctionDepth)
sFunctionDepth)
# define TRACE(x...) { BString _to; \ # define TRACE(x...) { BString _to; \
_to.Append(' ', (sFunctionDepth + 1) * 2); \ _to.Append(' ', (sFunctionDepth + 1) * 2); \
printf("%s", _to.String()); printf(x); } printf("%s", _to.String()); printf(x); }