@@ -677,22 +677,23 @@ DkmStackWalkFrame GetLuaFunctionStackWalkFrame(ulong callInfoAddress, LuaFunctio
677
677
break ;
678
678
679
679
var currCallLuaFunction = currCallInfoData . func as LuaValueDataLuaFunction ;
680
+ var currCallExternalClosure = currCallInfoData . func as LuaValueDataExternalClosure ;
680
681
681
- Debug . Assert ( currCallLuaFunction != null ) ;
682
+ Debug . Assert ( currCallLuaFunction != null || currCallExternalClosure != null ) ;
682
683
683
- if ( currCallLuaFunction == null )
684
+ if ( currCallLuaFunction == null && currCallExternalClosure == null )
684
685
break ;
685
686
686
687
var prevCallLuaFunction = prevCallInfoData . func as LuaValueDataLuaFunction ;
687
688
688
689
string currFunctionName = "[name unavailable]" ;
689
690
690
691
// Can't get function name if calling function is unknown because of a tail call or if call was not from Lua
691
- if ( currCallLuaFunction . value . isC_5_1 == 0 && currCallInfoData . tailCallCount_5_1 > 0 )
692
+ if ( currCallInfoData . tailCallCount_5_1 > 0 )
692
693
{
693
694
currFunctionName = $ "[name unavailable - tail call]";
694
695
}
695
- else if ( prevCallLuaFunction != null && prevCallLuaFunction . value . isC_5_1 != 0 )
696
+ else if ( prevCallLuaFunction == null )
696
697
{
697
698
currFunctionName = $ "[name unavailable - not called from Lua]";
698
699
}
@@ -705,21 +706,39 @@ DkmStackWalkFrame GetLuaFunctionStackWalkFrame(ulong callInfoAddress, LuaFunctio
705
706
stateSymbols = processData . symbolStore . FetchOrCreate ( stateAddress . Value ) ;
706
707
}
707
708
708
- string functionName = stateSymbols . FetchFunctionName ( currCallLuaFunction . value . functionAddress ) ;
709
-
710
- if ( functionName == null )
709
+ if ( currCallLuaFunction != null )
711
710
{
712
- functionName = GetLuaFunctionName ( currCallInfoAddress , prevCallInfoDataAddress , currCallLuaFunction . targetAddress ) ;
711
+ string functionName = stateSymbols . FetchFunctionName ( currCallLuaFunction . value . functionAddress ) ;
712
+
713
+ if ( functionName == null )
714
+ {
715
+ functionName = GetLuaFunctionName ( currCallInfoAddress , prevCallInfoDataAddress , currCallLuaFunction . targetAddress ) ;
716
+
717
+ if ( functionName != null )
718
+ stateSymbols . AddFunctionName ( currCallLuaFunction . value . functionAddress , functionName ) ;
719
+ }
713
720
714
721
if ( functionName != null )
715
- stateSymbols . AddFunctionName ( currCallLuaFunction . value . functionAddress , functionName ) ;
722
+ currFunctionName = functionName ;
716
723
}
724
+ else if ( currCallExternalClosure != null )
725
+ {
726
+ string functionName = stateSymbols . FetchFunctionName ( currCallExternalClosure . value . functionAddress ) ;
717
727
718
- if ( functionName != null )
719
- currFunctionName = functionName ;
728
+ if ( functionName == null )
729
+ {
730
+ functionName = GetLuaFunctionName ( currCallInfoAddress , prevCallInfoDataAddress , currCallExternalClosure . targetAddress ) ;
731
+
732
+ if ( functionName != null )
733
+ stateSymbols . AddFunctionName ( currCallExternalClosure . value . functionAddress , functionName ) ;
734
+ }
735
+
736
+ if ( functionName != null )
737
+ currFunctionName = functionName ;
738
+ }
720
739
}
721
740
722
- if ( currCallLuaFunction . value . isC_5_1 == 0 )
741
+ if ( currCallLuaFunction != null )
723
742
{
724
743
stackContextData . seenLuaFrame = true ;
725
744
stackContextData . seenFrames ++ ;
@@ -744,7 +763,7 @@ DkmStackWalkFrame GetLuaFunctionStackWalkFrame(ulong callInfoAddress, LuaFunctio
744
763
745
764
stackContextData . seenFrames ++ ;
746
765
747
- luaFrames . Add ( DkmStackWalkFrame . Create ( stackContext . Thread , input . InstructionAddress , input . FrameBase , input . FrameSize , luaFrameFlags , $ "[{ currFunctionName } C function ]", input . Registers , input . Annotations ) ) ;
766
+ luaFrames . Add ( DkmStackWalkFrame . Create ( stackContext . Thread , input . InstructionAddress , input . FrameBase , input . FrameSize , luaFrameFlags , $ "[{ currFunctionName } C closure ]", input . Registers , input . Annotations ) ) ;
748
767
749
768
luaFrameFlags &= ~ DkmStackWalkFrameFlags . TopFrame ;
750
769
}
0 commit comments