@@ -1427,96 +1427,123 @@ ISC_STATUS filter_debug_info(USHORT action, BlobControl* control)
14271427 if (p > end)
14281428 return isc_segstr_eof;
14291429
1430- DbgInfo dbgInfo (*getDefaultMemoryPool ());
1431- DBG_parse_debug_info (p - temp, temp, dbgInfo );
1430+ DbgInfo mainDbgInfo (*getDefaultMemoryPool ());
1431+ DBG_parse_debug_info (p - temp, temp, mainDbgInfo );
14321432
14331433 string str;
14341434
1435- if (auto args = dbgInfo.argInfoToName .constAccessor ();
1436- args.getFirst ())
1435+ const auto print = [&](const DbgInfo* dbgInfo)
14371436 {
1438- string_put (control, " Parameters:" );
1439- str.printf (" %10s %-32s %-6s" , " Number" , " Name" , " Type" );
1440- string_put (control, str.c_str ());
1441- str.replace (str.begin (), str.end (), str.length (), ' -' );
1442- string_put (control, str.c_str ());
1437+ if (auto args = dbgInfo->argInfoToName .constAccessor ();
1438+ args.getFirst ())
1439+ {
1440+ string_put (control, " Parameters:" );
1441+ str.printf (" %10s %-32s %-6s" , " Number" , " Name" , " Type" );
1442+ string_put (control, str.c_str ());
1443+ str.replace (str.begin (), str.end (), str.length (), ' -' );
1444+ string_put (control, str.c_str ());
14431445
1444- do
1446+ do
1447+ {
1448+ str.printf (" %10d %-32s %-6s" ,
1449+ args.current ()->first .index ,
1450+ args.current ()->second .c_str (),
1451+ (args.current ()->first .type == fb_dbg_arg_input ? " INPUT" : " OUTPUT" ));
1452+ string_put (control, str.c_str ());
1453+ } while (args.getNext ());
1454+
1455+ string_put (control, " " );
1456+ }
1457+
1458+ if (auto vars = dbgInfo->varIndexToName .constAccessor ();
1459+ vars.getFirst ())
14451460 {
1446- str. printf ( " %10d %-32s %-6s " ,
1447- args. current ()-> first . index ,
1448- args. current ()-> second .c_str (),
1449- (args. current ()-> first . type == fb_dbg_arg_input ? " INPUT " : " OUTPUT " ) );
1461+ string_put (control, " Variables: " );
1462+ str. printf ( " %10s %-32s " , " Number " , " Name " );
1463+ string_put (control, str .c_str ());
1464+ str. replace (str. begin (), str. end (), str. length (), ' - ' );
14501465 string_put (control, str.c_str ());
1451- } while (args.getNext ());
14521466
1453- string_put (control, " " );
1454- }
1467+ do
1468+ {
1469+ str.printf (" %10d %-32s" , vars.current ()->first , vars.current ()->second .c_str ());
1470+ string_put (control, str.c_str ());
1471+ } while (vars.getNext ());
14551472
1456- if (auto vars = dbgInfo.varIndexToName .constAccessor ();
1457- vars.getFirst ())
1458- {
1459- string_put (control, " Variables:" );
1460- str.printf (" %10s %-32s" , " Number" , " Name" );
1461- string_put (control, str.c_str ());
1462- str.replace (str.begin (), str.end (), str.length (), ' -' );
1463- string_put (control, str.c_str ());
1473+ string_put (control, " " );
1474+ }
14641475
1465- do
1476+ if (auto cursors = dbgInfo->declaredCursorIndexToName .constAccessor ();
1477+ cursors.getFirst ())
14661478 {
1467- str.printf (" %10d %-32s" , vars.current ()->first , vars.current ()->second .c_str ());
1479+ string_put (control, " Cursors:" );
1480+ str.printf (" %10s %-32s" , " Number" , " Name" );
1481+ string_put (control, str.c_str ());
1482+ str.replace (str.begin (), str.end (), str.length (), ' -' );
14681483 string_put (control, str.c_str ());
1469- } while (vars.getNext ());
14701484
1471- string_put (control, " " );
1472- }
1485+ do
1486+ {
1487+ str.printf (" %10d %-32s" , cursors.current ()->first , cursors.current ()->second .c_str ());
1488+ string_put (control, str.c_str ());
1489+ } while (cursors.getNext ());
14731490
1474- if (auto cursors = dbgInfo.declaredCursorIndexToName .constAccessor ();
1475- cursors.getFirst ())
1476- {
1477- string_put (control, " Cursors:" );
1478- str.printf (" %10s %-32s" , " Number" , " Name" );
1479- string_put (control, str.c_str ());
1480- str.replace (str.begin (), str.end (), str.length (), ' -' );
1481- string_put (control, str.c_str ());
1491+ string_put (control, " " );
1492+ }
14821493
1483- do
1494+ if (auto cursors = dbgInfo->forCursorOffsetToName .constAccessor ();
1495+ cursors.getFirst ())
14841496 {
1485- str.printf (" %10d %-32s" , cursors.current ()->first , cursors.current ()->second .c_str ());
1497+ string_put (control, " FOR Cursors:" );
1498+ str.printf (" %10s %-32s" , " Offset" , " Name" );
1499+ string_put (control, str.c_str ());
1500+ str.replace (str.begin (), str.end (), str.length (), ' -' );
14861501 string_put (control, str.c_str ());
1487- } while (cursors.getNext ());
14881502
1489- string_put (control, " " );
1490- }
1503+ do
1504+ {
1505+ str.printf (" %10d %-32s" , cursors.current ()->first , cursors.current ()->second .c_str ());
1506+ string_put (control, str.c_str ());
1507+ } while (cursors.getNext ());
14911508
1492- if ( auto cursors = dbgInfo. forCursorOffsetToName . constAccessor ( );
1493- cursors. getFirst ())
1494- {
1495- string_put (control, " FOR Cursors :" );
1496- str.printf (" %10s %-32s " , " Offset " , " Name " );
1509+ string_put (control, " " );
1510+ }
1511+
1512+ string_put (control, " BLR to Source mapping :" );
1513+ str.printf (" %10s %10s %10s " , " BLR offset " , " Line " , " Column " );
14971514 string_put (control, str.c_str ());
14981515 str.replace (str.begin (), str.end (), str.length (), ' -' );
14991516 string_put (control, str.c_str ());
15001517
1501- do
1518+ for ( const MapBlrToSrcItem* i = dbgInfo-> blrToSrc . begin (); i < dbgInfo-> blrToSrc . end (); i++)
15021519 {
1503- str.printf (" %10d %-32s " , cursors. current ()-> first , cursors. current ()-> second . c_str () );
1520+ str.printf (" %10d %10d %10d " , i-> mbs_offset , i-> mbs_src_line , i-> mbs_src_col );
15041521 string_put (control, str.c_str ());
1505- } while (cursors.getNext ());
1522+ }
1523+ };
15061524
1525+ print (&mainDbgInfo);
1526+
1527+ for (const auto & [name, dbgInfo] : mainDbgInfo.subFuncs )
1528+ {
1529+ string_put (control, " " );
1530+ string_put (control, " " );
1531+ str.printf (" Sub function %s:" , name.c_str ());
1532+ string_put (control, str.c_str ());
15071533 string_put (control, " " );
1508- }
15091534
1510- string_put (control, " BLR to Source mapping:" );
1511- str.printf (" %10s %10s %10s" , " BLR offset" , " Line" , " Column" );
1512- string_put (control, str.c_str ());
1513- str.replace (str.begin (), str.end (), str.length (), ' -' );
1514- string_put (control, str.c_str ());
1535+ print (dbgInfo);
1536+ }
15151537
1516- for (const MapBlrToSrcItem* i = dbgInfo. blrToSrc . begin (); i < dbgInfo. blrToSrc . end (); i++ )
1538+ for (const auto & [name, dbgInfo] : mainDbgInfo. subProcs )
15171539 {
1518- str.printf (" %10d %10d %10d" , i->mbs_offset , i->mbs_src_line , i->mbs_src_col );
1540+ string_put (control, " " );
1541+ string_put (control, " " );
1542+ str.printf (" Sub procedure %s:" , name.c_str ());
15191543 string_put (control, str.c_str ());
1544+ string_put (control, " " );
1545+
1546+ print (dbgInfo);
15201547 }
15211548
15221549 control->ctl_data [1 ] = control->ctl_data [0 ];
0 commit comments