MCPcopy Create free account
hub / github.com/crownengine/crown / callstack

Function callstack

src/core/debug/callstack_linux.cpp:184–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

182 }
183
184 void callstack(log_internal::System system, LogSeverity::Enum severity)
185 {
186 char msg[512] = {};
187 void *array[64];
188
189 if (demangler <= 0) {
190 log_internal::logx(severity, system, "Callstack unavailable.");
191 return;
192 }
193
194 // Get symbols and write them to demangler process.
195 int size = backtrace(array, countof(array));
196 backtrace_symbols_fd(array, size, symbol_fds[1]);
197 const ssize_t written = write(symbol_fds[1], "\n", 1);
198 CE_UNUSED(written);
199
200 // Log demangled symbols.
201 for (int i = 0; i < size; ++i) {
202 if (read(demangled_fds[0], msg, sizeof(msg)) <= 0)
203 break;
204 if (i >= 1) // Skip this very function.
205 log_internal::logx(severity, system, "[%2d] %s", i, msg);
206 }
207 }
208
209} // namespace debug
210

Callers

nothing calls this directly

Calls 3

logxFunction · 0.85
writeFunction · 0.50
readFunction · 0.50

Tested by

no test coverage detected