aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/callstack.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2024-08-14 09:23:19 +0200
committerGitHub Enterprise <[email protected]>2024-08-14 09:23:19 +0200
commit501d5e3b0be37ebceda96240af1e4d8df927d68f (patch)
tree1279228466433e992ec1dd2635c317d1ce78dcc3 /src/zencore/callstack.cpp
parentdon't try to memcache the empty buffer if invalid format (#110) (diff)
downloadzen-501d5e3b0be37ebceda96240af1e4d8df927d68f.tar.xz
zen-501d5e3b0be37ebceda96240af1e4d8df927d68f.zip
improve logging on main failure (#111)
* add support for indenting callstack output * Explicitly catch option-parse error and reduce log spam on bad parameters * add command line to sentry error reports * log command line at startup
Diffstat (limited to 'src/zencore/callstack.cpp')
-rw-r--r--src/zencore/callstack.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/zencore/callstack.cpp b/src/zencore/callstack.cpp
index 905ab3d9e..d16605fb9 100644
--- a/src/zencore/callstack.cpp
+++ b/src/zencore/callstack.cpp
@@ -172,7 +172,7 @@ GetFrameSymbols(uint32_t FrameCount, void** Frames)
}
void
-FormatCallstack(const CallstackFrames* Callstack, StringBuilderBase& SB)
+FormatCallstack(const CallstackFrames* Callstack, StringBuilderBase& SB, std::string_view Prefix)
{
bool First = true;
for (const std::string& Symbol : GetFrameSymbols(Callstack))
@@ -185,15 +185,19 @@ FormatCallstack(const CallstackFrames* Callstack, StringBuilderBase& SB)
{
First = false;
}
+ if (!Prefix.empty())
+ {
+ SB.Append(Prefix);
+ }
SB.Append(Symbol);
}
}
std::string
-CallstackToString(const CallstackFrames* Callstack)
+CallstackToString(const CallstackFrames* Callstack, std::string_view Prefix)
{
StringBuilder<2048> SB;
- FormatCallstack(Callstack, SB);
+ FormatCallstack(Callstack, SB, Prefix);
return SB.ToString();
}