MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / printStack

Function printStack

src/OSspecific/POSIX/printStack.C:212–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

210
211
212void Foam::error::printStack(Ostream& os)
213{
214 // Get raw stack symbols
215 const size_t CALLSTACK_SIZE = 128;
216
217 void *callstack[CALLSTACK_SIZE];
218 size_t size = backtrace(callstack, CALLSTACK_SIZE);
219
220 Dl_info *info = new Dl_info;
221
222 fileName fname = "???";
223 word address;
224
225 for(size_t i=0; i<size; i++)
226 {
227 int st = dladdr(callstack[i], info);
228
229 os << '#' << label(i) << " ";
230 if (st != 0 && info->dli_fname != nullptr && info->dli_fname[0] != '\0')
231 {
232 fname = absolutePath(info->dli_fname);
233
234 os <<
235 (
236 (info->dli_sname != nullptr)
237 ? demangleSymbol(info->dli_sname)
238 : "?"
239 );
240 }
241 else
242 {
243 os << "?";
244 }
245
246 printSourceFileAndLine(os, fname, info, callstack[i]);
247 os << nl;
248 }
249
250 delete info;
251}
252
253
254// ************************************************************************* //

Callers 15

mkDirFunction · 0.70
chModFunction · 0.70
POSIX.CFile · 0.70
existsFunction · 0.70
isDirFunction · 0.70
isFileFunction · 0.70
fileSizeFunction · 0.70
lastModifiedFunction · 0.70
highResLastModifiedFunction · 0.70
cpFunction · 0.70
lnFunction · 0.70
mvFunction · 0.70

Calls 4

labelFunction · 0.85
absolutePathFunction · 0.85
demangleSymbolFunction · 0.85
printSourceFileAndLineFunction · 0.85

Tested by

no test coverage detected