Skip to content

Commit 18cac43

Browse files
Do not generate broken debug info for non-methods (#94693)
The related methods (`EmitDebugInfo`, `EmitEHClauseInfo`) already do this - if the node is not a method node, don't emit anything. It is not clear what purpose the "if this is not a method, emit broken debug information" serves. I traced it all the way back to https://github.com/dotnet/corert/blob/d78cf62480331f63b26eb08b86b838ffa355ff0d/src/ILCompiler.Compiler/src/Compiler/DependencyAnalysis/ObjectWriter.cs#L427-L447 - it was surrounded by TODOs so maybe it didn't fully stand out but it doesn't look right there already.
1 parent 961257b commit 18cac43

File tree

1 file changed

+3
-7
lines changed
  • src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis

1 file changed

+3
-7
lines changed

src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/ObjectWriter.cs

+3-7
Original file line numberDiff line numberDiff line change
@@ -439,15 +439,11 @@ public void EmitDebugEHClauseInfo(ObjectNode node)
439439
private static extern void EmitDebugFunctionInfo(IntPtr objWriter, byte[] methodName, int methodSize, uint methodTypeIndex);
440440
public void EmitDebugFunctionInfo(ObjectNode node, int methodSize)
441441
{
442-
uint methodTypeIndex = 0;
443-
444-
var methodNode = node as IMethodNode;
445-
if (methodNode != null)
442+
if (node is IMethodNode methodNode)
446443
{
447-
methodTypeIndex = _userDefinedTypeDescriptor.GetMethodFunctionIdTypeIndex(methodNode.Method);
444+
uint methodTypeIndex = _userDefinedTypeDescriptor.GetMethodFunctionIdTypeIndex(methodNode.Method);
445+
EmitDebugFunctionInfo(_nativeObjectWriter, _currentNodeZeroTerminatedName.UnderlyingArray, methodSize, methodTypeIndex);
448446
}
449-
450-
EmitDebugFunctionInfo(_nativeObjectWriter, _currentNodeZeroTerminatedName.UnderlyingArray, methodSize, methodTypeIndex);
451447
}
452448

453449
[DllImport(NativeObjectWriterFileName)]

0 commit comments

Comments
 (0)