Open mfilippov opened 1 year ago
Thanks for posting this. I have a PR out, though I wasn't able to reproduce it on my end. Once it's checked in, can you build main and invoke just the Cilsil translation pipeline on your binaries to confirm that the fix works?
I build docker container via docker build .
and re-run analysis. Issue still there:
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.NotImplementedException: None
at Mono.Cecil.SignatureReader.GetPrimitiveType(ElementType etype)
at Mono.Cecil.SignatureReader.ReadMethodSignature(IMethodSignature method)
at Mono.Cecil.MetadataReader.ReadMethod(UInt32 method_rid, Collection`1 methods)
at Mono.Cecil.MetadataReader.ReadMethods(TypeDefinition type)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
at Cilsil.Services.TenvParserService.RegisterCilType(TypeDefinition type, TypeEnvironment typeEnvironment) in /Cilsil/Services/TenvParserService.cs:line 160
at Cilsil.Services.TenvParserService.ComputeTypeEnvironment() in /Cilsil/Services/TenvParserService.cs:line 98
at Cilsil.Services.TenvParserService.Execute() in /Cilsil/Services/TenvParserService.cs:line 52
at Cilsil.Services.TenvParserService.ExecuteFromResult(ServiceExecutionResult result) in /Cilsil/Services/TenvParserService.cs:line 66
at Cilsil.Services.ServiceExecutionResult.ThenExecute(IService service) in /Cilsil/Services/Results/ServiceExecutionResult.cs:line 11
at Cilsil.Program.ExecuteTranslation(String[] paths, Boolean extensionProgress, Boolean loadTenv) in /Cilsil/Program.cs:line 144
at Cilsil.Program.Translate(String[] paths, String outcfg, String cfgtxt, String outtenv, String dot, Boolean debug, Boolean extprogress) in /Cilsil/Program.cs:line 102
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass3_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
I try to wrap place when call it with try catch:
List<FieldIdentifier> staticFields = new List<FieldIdentifier>();
List<ProcedureName> procNames = new List<ProcedureName>();
try
{
staticFields = allFields
.Where(f => f.IsStatic)
.Select(f => f.Field)
.Concat(baseStaticFields)
.ToList();
procNames = type.Methods.Select(m => new ProcedureName(m)).ToList();
}
catch (NotImplementedException ex)
{
Console.Error.WriteLine();
Console.Error.WriteLine(ex.ToString());
Console.Error.WriteLine(typeFullName);
}
var typeStruct = new Struct(instanceFields,
staticFields,
baseSupers.Concat(baseTypes).ToList(),
procNames);
and identify a problem type:
System.NotImplementedException: None
at Mono.Cecil.SignatureReader.GetPrimitiveType(ElementType etype)
at Mono.Cecil.SignatureReader.ReadMethodSignature(IMethodSignature method)
at Mono.Cecil.MetadataReader.ReadMethod(UInt32 method_rid, Collection`1 methods)
at Mono.Cecil.MetadataReader.ReadMethods(TypeDefinition type)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
at Cilsil.Services.TenvParserService.RegisterCilType(TypeDefinition type, TypeEnvironment typeEnvironment) in /Cilsil/Services/TenvParserService.cs:line 171
System.Runtime.CompilerServices.ReferenceAssemblyAttribute
I hope it helps you for reproduce
Thanks. Actually it looks like the exception handler placed in the CfgParser worked, but we need another in the TenvParser. I have accordingly made the fix. Please give that a try and let me know if you run into further issues.
Thanks. I will check if you create of new version of patch. Also I found one more issue in PrintCoverageStats
, this is patch for workaround:
/// <summary>
/// TODO: use https://nlog-project.org or log4net instead of this class.
/// </summary>
public static void PrintCoverageStats(IEnumerable<MethodDefinition> methods)
{
var totalMethodCount = 0;
var failMethodCount = 0;
var succMethodCount = 0;
var totalInstr = 0;
var failInstr = 0;
var succInstr = 0;
try
{
totalMethodCount = methods.Count();
failMethodCount = UnfinishedMethods.Count;
succMethodCount = totalMethodCount - failMethodCount;
totalInstr = methods.Sum(m => m.Body.Instructions.Count);
failInstr = UnfinishedMethods.Sum(kv => kv.Value);
succInstr = totalInstr - failInstr;
}
catch (NotImplementedException ex)
{
Console.Error.WriteLine();
Console.Error.WriteLine(ex.ToString());
}
WriteLine("Coverage Statistics:\n");
WriteLine($@"Method successfully translated: {succMethodCount} ({
ComputePercent(succMethodCount, totalMethodCount)}%)");
WriteLine($@"Method partially translated: {failMethodCount} ({
ComputePercent(failMethodCount, totalMethodCount)}%)");
WriteLine($@"Instructions translated: {succInstr} ({
ComputePercent(succInstr, totalInstr)}%)");
WriteLine($@"Instructions skipped: {failInstr} ({
ComputePercent(failInstr, totalInstr)}%)");
WriteLine("======================================\n");
}
and one more :)
System.NotImplementedException: GenericInst
at Mono.Cecil.SignatureReader.ReadPrimitiveValue(ElementType type)
at Mono.Cecil.MetadataReader.ReadLocalConstant(UInt32 rid)
at Mono.Cecil.MetadataReader.ReadLocalScope(Row`6 record)
at Mono.Cecil.MetadataReader.ReadScope(MethodDefinition method)
at Mono.Cecil.Cil.PortablePdbReader.Read(MethodDefinition method)
at Mono.Cecil.Cil.CodeReader.ReadMethodBody()
at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method)
at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read)
at Cilsil.Log.<>c.<PrintCoverageStats>b__11_0(MethodDefinition m) in /Cilsil/Log.cs:line 88
at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector)
at Cilsil.Log.PrintCoverageStats(IEnumerable`1 methods) in /Cilsil/Log.cs:line 88
Coverage Statistics:
Method successfully translated: 797850 (88%)
Method partially translated: 105779 (12%)
Instructions translated: 0 (-2147483648%)
Instructions skipped: 0 (-2147483648%)
======================================
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'minimumLength')
at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength)
at System.Text.ValueStringBuilder.Grow(Int32 additionalCapacityBeyondPos)
at System.String.Join(String separator, IEnumerable`1 values)
at Cilsil.Sil.Cfg.ToString(IEnumerable`1 proceduresToPrint) in /Cilsil/Sil/Cfg.cs:line 175
at Cilsil.Sil.Cfg.ToString() in /Cilsil/Sil/Cfg.cs:line 148
at Cilsil.Program.Translate(String[] paths, String outcfg, String cfgtxt, String outtenv, String dot, Boolean debug, Boolean extprogress) in /Cilsil/Program.cs:line 104
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass3_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
Code translation completed. Analyzing...
and one more :)
System.NotImplementedException: GenericInst at Mono.Cecil.SignatureReader.ReadPrimitiveValue(ElementType type) at Mono.Cecil.MetadataReader.ReadLocalConstant(UInt32 rid) at Mono.Cecil.MetadataReader.ReadLocalScope(Row`6 record) at Mono.Cecil.MetadataReader.ReadScope(MethodDefinition method) at Mono.Cecil.Cil.PortablePdbReader.Read(MethodDefinition method) at Mono.Cecil.Cil.CodeReader.ReadMethodBody() at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read) at Cilsil.Log.<>c.<PrintCoverageStats>b__11_0(MethodDefinition m) in /Cilsil/Log.cs:line 88 at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector) at Cilsil.Log.PrintCoverageStats(IEnumerable`1 methods) in /Cilsil/Log.cs:line 88 Coverage Statistics: Method successfully translated: 797850 (88%) Method partially translated: 105779 (12%) Instructions translated: 0 (-2147483648%) Instructions skipped: 0 (-2147483648%) ====================================== Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'minimumLength') at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength) at System.Text.ValueStringBuilder.Grow(Int32 additionalCapacityBeyondPos) at System.String.Join(String separator, IEnumerable`1 values) at Cilsil.Sil.Cfg.ToString(IEnumerable`1 proceduresToPrint) in /Cilsil/Sil/Cfg.cs:line 175 at Cilsil.Sil.Cfg.ToString() in /Cilsil/Sil/Cfg.cs:line 148 at Cilsil.Program.Translate(String[] paths, String outcfg, String cfgtxt, String outtenv, String dot, Boolean debug, Boolean extprogress) in /Cilsil/Program.cs:line 104 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Delegate.DynamicInvoke(Object[] args) at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass3_0.<<UseVersionOption>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext() Code translation completed. Analyzing...
Sorry for the delay in reply. I think that you are having a memory issue, similar to this issue (it makes sense, as you have nearly 1 million methods in your project). Can you try breaking up the project into different parts or increase the computing power of your machine? It's also possible that Docker memory limitations are playing a factor here, if your host machine has large amounts of memory.
Thanks. I will check if you create of new version of patch. Also I found one more issue in
PrintCoverageStats
, this is patch for workaround:/// <summary> /// TODO: use https://nlog-project.org or log4net instead of this class. /// </summary> public static void PrintCoverageStats(IEnumerable<MethodDefinition> methods) { var totalMethodCount = 0; var failMethodCount = 0; var succMethodCount = 0; var totalInstr = 0; var failInstr = 0; var succInstr = 0; try { totalMethodCount = methods.Count(); failMethodCount = UnfinishedMethods.Count; succMethodCount = totalMethodCount - failMethodCount; totalInstr = methods.Sum(m => m.Body.Instructions.Count); failInstr = UnfinishedMethods.Sum(kv => kv.Value); succInstr = totalInstr - failInstr; } catch (NotImplementedException ex) { Console.Error.WriteLine(); Console.Error.WriteLine(ex.ToString()); } WriteLine("Coverage Statistics:\n"); WriteLine($@"Method successfully translated: {succMethodCount} ({ ComputePercent(succMethodCount, totalMethodCount)}%)"); WriteLine($@"Method partially translated: {failMethodCount} ({ ComputePercent(failMethodCount, totalMethodCount)}%)"); WriteLine($@"Instructions translated: {succInstr} ({ ComputePercent(succInstr, totalInstr)}%)"); WriteLine($@"Instructions skipped: {failInstr} ({ ComputePercent(failInstr, totalInstr)}%)"); WriteLine("======================================\n"); }
Thanks for the suggestion, I pushed it into that PR!
I checked your PR again. Now pass Translation phase and stats. New error:
Processing {binary_path}
Copying binaries to a staging folder...
Code translation started...
Translation stage 1/3: Loading binaries.
Translation stage 2/3: Computing type environment.
Translation stage 3/3: Computing control-flow graph.
Coverage Statistics:
Method successfully translated: 797863 (88%)
Method partially translated: 105796 (12%)
Instructions translated: 0 (-2147483648%)
Instructions skipped: 0 (-2147483648%)
======================================
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'minimumLength')
at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength)
at System.Text.ValueStringBuilder.Grow(Int32 additionalCapacityBeyondPos)
at System.String.Join(String separator, IEnumerable`1 values)
at Cilsil.Sil.Cfg.ToString(IEnumerable`1 proceduresToPrint) in /Cilsil/Sil/Cfg.cs:line 175
at Cilsil.Sil.Cfg.ToString() in /Cilsil/Sil/Cfg.cs:line 148
at Cilsil.Program.Translate(String[] paths, String outcfg, String cfgtxt, String outtenv, String dot, Boolean debug, Boolean extprogress) in /Cilsil/Program.cs:line 104
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Delegate.DynamicInvokeImpl(Object[] args)
at System.Delegate.DynamicInvoke(Object[] args)
at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass3_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext()
Code translation completed. Analyzing...
Capturing using JSON mode...
Uncaught Internal Error: (Sys_error "/infersharp/infer-staging/tenv.json: No such file or directory")
Error backtrace:
Raised by primitive operation at Stdlib.open_in_gen in file "stdlib.ml", line 405, characters 28-54
Called from Stdlib.open_in in file "stdlib.ml" (inlined), line 410, characters 2-45
Called from Yojson.Safe.from_file in file "lib/read.mll" (inlined), line 1135, characters 13-25
Called from Integration__CaptureSILJson.capture in file "src/integration/CaptureSILJson.ml", line 720, characters 24-57
Called from Integration__Driver.capture in file "src/integration/Driver.ml", line 184, characters 8-51
Called from IBase__Utils.timeit in file "src/base/Utils.ml", line 423, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 83, characters 29-44
Called from Integration__Driver.capture.(fun) in file "src/integration/Driver.ml", line 224, characters 2-233
Called from Backend__GCStats.log_f in file "src/backend/GCStats.ml", line 93, characters 10-14
Called from Dune__exe__Infer.run in file "src/infer.ml" (inlined), line 21, characters 2-36
Called from IBase__Utils.timeit in file "src/base/Utils.ml" (inlined), line 423, characters 16-20
Called from IBase__ScubaLogging.execute_with_time_logging in file "src/base/ScubaLogging.ml" (inlined), line 83, characters 29-44
Called from Dune__exe__Infer.run in file "src/infer.ml", line 27, characters 22-94
Run the command again with `--keep-going` to try and ignore this error.
cp: cannot stat 'infer-out/report.txt': No such file or directory
and one more :)
System.NotImplementedException: GenericInst at Mono.Cecil.SignatureReader.ReadPrimitiveValue(ElementType type) at Mono.Cecil.MetadataReader.ReadLocalConstant(UInt32 rid) at Mono.Cecil.MetadataReader.ReadLocalScope(Row`6 record) at Mono.Cecil.MetadataReader.ReadScope(MethodDefinition method) at Mono.Cecil.Cil.PortablePdbReader.Read(MethodDefinition method) at Mono.Cecil.Cil.CodeReader.ReadMethodBody() at Mono.Cecil.Cil.CodeReader.ReadMethodBody(MethodDefinition method) at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TRet& variable, TItem item, Func`3 read) at Cilsil.Log.<>c.<PrintCoverageStats>b__11_0(MethodDefinition m) in /Cilsil/Log.cs:line 88 at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector) at Cilsil.Log.PrintCoverageStats(IEnumerable`1 methods) in /Cilsil/Log.cs:line 88 Coverage Statistics: Method successfully translated: 797850 (88%) Method partially translated: 105779 (12%) Instructions translated: 0 (-2147483648%) Instructions skipped: 0 (-2147483648%) ====================================== Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'minimumLength') at System.Buffers.TlsOverPerCoreLockedStacksArrayPool`1.Rent(Int32 minimumLength) at System.Text.ValueStringBuilder.Grow(Int32 additionalCapacityBeyondPos) at System.String.Join(String separator, IEnumerable`1 values) at Cilsil.Sil.Cfg.ToString(IEnumerable`1 proceduresToPrint) in /Cilsil/Sil/Cfg.cs:line 175 at Cilsil.Sil.Cfg.ToString() in /Cilsil/Sil/Cfg.cs:line 148 at Cilsil.Program.Translate(String[] paths, String outcfg, String cfgtxt, String outtenv, String dot, Boolean debug, Boolean extprogress) in /Cilsil/Program.cs:line 104 --- End of inner exception stack trace --- at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Delegate.DynamicInvokeImpl(Object[] args) at System.Delegate.DynamicInvoke(Object[] args) at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context) at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass2_0.<<InvokeAsync>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseErrorReporting>b__16_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass8_0.<<UseTypoCorrections>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseSuggestDirective>b__7_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseParseDirective>b__6_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<UseHelp>b__14_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass3_0.<<UseVersionOption>b__0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c.<<RegisterWithDotnetSuggest>b__17_0>d.MoveNext() --- End of stack trace from previous location --- at System.CommandLine.Invocation.InvocationExtensions.<>c__DisplayClass5_0.<<UseExceptionHandler>b__0>d.MoveNext() Code translation completed. Analyzing...
Sorry for the delay in reply. I think that you are having a memory issue, similar to this issue (it makes sense, as you have nearly 1 million methods in your project). Can you try breaking up the project into different parts or increase the computing power of your machine? It's also possible that Docker memory limitations are playing a factor here, if your host machine has large amounts of memory.
Yes, I saw that you had pointed out this issue before (" ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. (Parameter 'minimumLength')"). Responded to it in my above message, quoted again here. I think there is a memory issue: for this, I would either increase the machine memory or partition the project
@matjin I have 128GB of memory and I setup 96 in .wslconfig and I not see memory consumption more than 70Gb. I will try on smaller project.
I think actually it might be the writing of the CFG to the cfg.txt file which might be causing this issue. The cfg.txt file is not necessary; if this is the case and the cfg.json can be written without issue, then we should be able to proceed with the analysis. I have pushed a try-catch to avoid this to the PR. Would you mind rerunning your large project and seeing if that does the trick?
Thanks for being persistent! This feedback is very helpful.
@matjin I checked, and now it is better, but it crashed anyway with stack overflow ) Also, stat looks like int overflow:
Instructions translated: 0 (-2147483648%)
Instructions skipped: 0 (-2147483648%)
======================================
The stat shows 0 because of the try-catch we added earlier; you have something in your binaries which is hard for Cecil to read/causing it throw an exception -- thus, the stat doesn't get computed and gets left at 0. This should not pose a substantive issue for the actual analysis, though.
I see the key blocker is that now Infer itself is suffering from a StackOverflow:
While analysing function Src/DataContext/DataContextCopier.cs:Func`3<!0,!1,!2> DataContextCopier.GetCopier(IDataContext) at Src/DataContext/DataContextCopier.cs:20:5, raised ("Stack overflow")
Would you mind taking the DLL that contains this particular file and rerunning the analysis on just this DLL? This will help us understand whether there is a particular construct in this file which is causing the stack overflow.