@@ -373,11 +373,14 @@ DkmStackWalkFrame[] IDkmCallStackFilter.FilterNextFrame(DkmStackContext stackCon
373
373
return new DkmStackWalkFrame [ 1 ] { input } ;
374
374
}
375
375
376
- if ( processData . scratchMemory == 0 )
377
- processData . scratchMemory = process . AllocateVirtualMemory ( 0 , 4096 , 0x3000 , 0x04 ) ;
376
+ if ( process . LivePart != null )
377
+ {
378
+ if ( processData . scratchMemory == 0 )
379
+ processData . scratchMemory = process . AllocateVirtualMemory ( 0 , 4096 , 0x3000 , 0x04 ) ;
378
380
379
- if ( processData . scratchMemory == 0 )
380
- return new DkmStackWalkFrame [ 1 ] { input } ;
381
+ if ( processData . scratchMemory == 0 )
382
+ return new DkmStackWalkFrame [ 1 ] { input } ;
383
+ }
381
384
382
385
// Find out the current process working directory (Lua script files will be resolved from that location)
383
386
if ( processData . workingDirectory == null && ! processData . workingDirectoryRequested )
@@ -397,7 +400,7 @@ DkmStackWalkFrame[] IDkmCallStackFilter.FilterNextFrame(DkmStackContext stackCon
397
400
// Jumping through hoops, kernel32.dll should be loaded
398
401
ulong callAddress = DebugHelpers . FindFunctionAddress ( process . GetNativeRuntimeInstance ( ) , "GetCurrentDirectoryA" ) ;
399
402
400
- if ( callAddress != 0 )
403
+ if ( callAddress != 0 && processData . scratchMemory != 0 )
401
404
{
402
405
long ? length = EvaluationHelpers . TryEvaluateNumberExpression ( $ "((int(*)(int, char*))0x{ callAddress : x} )(4095, (char*){ processData . scratchMemory } )", stackContext . InspectionSession , stackContext . Thread , input , DkmEvaluationFlags . None ) ;
403
406
@@ -453,6 +456,9 @@ DkmStackWalkFrame[] IDkmCallStackFilter.FilterNextFrame(DkmStackContext stackCon
453
456
454
457
string GetLuaFunctionName ( ulong currCallInfoAddress , ulong prevCallInfoAddress , ulong closureAddress )
455
458
{
459
+ if ( processData . scratchMemory == 0 )
460
+ return null ;
461
+
456
462
string functionNameType = null ;
457
463
458
464
DkmCustomMessage . Create ( process . Connection , process , MessageToRemote . guid , MessageToRemote . pauseBreakpoints , null , null ) . SendLower ( ) ;
@@ -2270,12 +2276,6 @@ void IDkmModuleInstanceLoadNotification.OnModuleInstanceLoad(DkmModuleInstance m
2270
2276
}
2271
2277
#endif
2272
2278
2273
- if ( process . LivePart == null )
2274
- {
2275
- log . Debug ( $ "Process is not live, do not attach to Lua") ;
2276
- return ;
2277
- }
2278
-
2279
2279
var processData = DebugHelpers . GetOrCreateDataItem < LuaLocalProcessData > ( process ) ;
2280
2280
2281
2281
var moduleName = nativeModuleInstance . FullName ;
@@ -2286,6 +2286,13 @@ void IDkmModuleInstanceLoadNotification.OnModuleInstanceLoad(DkmModuleInstance m
2286
2286
// Request the RemoteComponent to create the runtime and a module
2287
2287
DkmCustomMessage . Create ( process . Connection , process , MessageToRemote . guid , MessageToRemote . createRuntime , null , null ) . SendLower ( ) ;
2288
2288
2289
+ if ( process . LivePart == null )
2290
+ {
2291
+ log . Debug ( $ "Process is not live, do not attach to Lua") ;
2292
+
2293
+ return ;
2294
+ }
2295
+
2289
2296
if ( ! attachOnLaunch )
2290
2297
{
2291
2298
log . Warning ( "Lua attach on launch is disabled, skip search for Lua" ) ;
0 commit comments