MCPcopy Create free account
hub / github.com/boostorg/build / builtin_backtrace

Function builtin_backtrace

v2/engine/builtins.c:1312–1341  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1310 */
1311
1312LIST * builtin_backtrace( FRAME * frame, int flags )
1313{
1314 LIST * const levels_arg = lol_get( frame->args, 0 );
1315 int levels = list_empty( levels_arg )
1316 ? (int)( (unsigned int)(-1) >> 1 )
1317 : atoi( object_str( list_front( levels_arg ) ) );
1318
1319 LIST * result = L0;
1320 for ( ; ( frame = frame->prev ) && levels; --levels )
1321 {
1322 char const * file;
1323 int line;
1324 char buf[ 32 ];
1325 string module_name[ 1 ];
1326 get_source_line( frame, &file, &line );
1327 sprintf( buf, "%d", line );
1328 string_new( module_name );
1329 if ( frame->module->name )
1330 {
1331 string_append( module_name, object_str( frame->module->name ) );
1332 string_append( module_name, "." );
1333 }
1334 result = list_push_back( result, object_new( file ) );
1335 result = list_push_back( result, object_new( buf ) );
1336 result = list_push_back( result, object_new( module_name->value ) );
1337 result = list_push_back( result, object_new( frame->rulename ) );
1338 string_free( module_name );
1339 }
1340 return result;
1341}
1342
1343
1344/*

Callers

nothing calls this directly

Calls 8

lol_getFunction · 0.85
object_strFunction · 0.85
get_source_lineFunction · 0.85
string_newFunction · 0.85
string_appendFunction · 0.85
list_push_backFunction · 0.85
object_newFunction · 0.85
string_freeFunction · 0.85

Tested by

no test coverage detected