Skip to content

Commit 09e18c9

Browse files
committed
Added registration of missing scripts found during luajit stack walk
1 parent 5c432fb commit 09e18c9

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

LuaDkmDebuggerComponent/LocalComponent.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,54 @@ DkmStackWalkFrame GetLuaFunctionStackWalkFrame(ulong callInfoAddress, LuaFunctio
11451145

11461146
if (callLuaFunction != null)
11471147
{
1148+
void RegisterMissingScript()
1149+
{
1150+
var currFunctionData = callLuaFunction.value.ReadFunction(process);
1151+
1152+
if (currFunctionData == null)
1153+
return;
1154+
1155+
string source = currFunctionData.ReadSource(process);
1156+
1157+
if (source == null)
1158+
return;
1159+
1160+
bool foundNewScript = false;
1161+
1162+
lock (processData.symbolStore)
1163+
{
1164+
LuaStateSymbols stateSymbols = processData.symbolStore.FetchOrCreate(stateAddress.Value);
1165+
1166+
if (stateSymbols.FetchScriptSource(source) == null)
1167+
{
1168+
stateSymbols.AddScriptSource(source, null, null);
1169+
1170+
foundNewScript = true;
1171+
}
1172+
}
1173+
1174+
if (!foundNewScript)
1175+
return;
1176+
1177+
string filePath = TryGetSourceFilePath(process, processData, source);
1178+
1179+
if (filePath == null)
1180+
return;
1181+
1182+
log.Debug($"IDkmCallStackFilter.FilterNextFrame Resolved new script {source} to {filePath}");
1183+
1184+
if (HasPendingBreakpoint(process, processData, filePath))
1185+
{
1186+
log.Debug($"IDkmCallStackFilter.FilterNextFrame Reloading script {source} pending breakpoints");
1187+
1188+
var message = DkmCustomMessage.Create(process.Connection, process, Guid.Empty, MessageToVsService.reloadBreakpoints, Encoding.UTF8.GetBytes(filePath), null);
1189+
1190+
message.SendToVsService(Guids.luaVsPackageComponentGuid, false);
1191+
}
1192+
}
1193+
1194+
RegisterMissingScript();
1195+
11481196
ulong nextframe = frameSize != 0 ? frameAddress + (ulong)frameSize * LuaHelpers.GetValueSize(process) : 0u;
11491197

11501198
instructionPointer = LuajitHelpers.FindFrameInstructionPointer(process, luajitStateData, callLuaFunction, nextframe);

0 commit comments

Comments
 (0)