Skip to content

LLVM.GetBasicBlockName(...) crashing application entirely #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jangofett4 opened this issue Feb 22, 2019 · 1 comment
Closed

LLVM.GetBasicBlockName(...) crashing application entirely #90

jangofett4 opened this issue Feb 22, 2019 · 1 comment
Assignees
Labels

Comments

@jangofett4
Copy link

LLVMSharp 5.0.0
LibLLVM 5.0.1
.Net Core 2.1 Project

LLVM.GetBasicBlockName(...) seems to be crashing wherever I use it at. No segfaulting or error messages. Just plain old crashing.

Example code:

LLVMBool llvmtrue = new LLVMBool(0);
LLVMModuleRef mod = LLVM.ModuleCreateWithName("basic_block_test");

LLVMTypeRef[] param_types = { };
LLVMTypeRef func_type = LLVM.FunctionType(LLVM.Int32Type(), param_types, false);
LLVMValueRef main = LLVM.AddFunction(mod, "main", func_type);

LLVMBasicBlockRef entry = LLVM.AppendBasicBlock(main, "entry");

LLVMBuilderRef builder = LLVM.CreateBuilder();
LLVM.PositionBuilderAtEnd(builder, entry);
LLVM.BuildRet(builder, LLVM.ConstInt(LLVM.Int32Type(), 0ul, !llvmtrue));

if (LLVM.VerifyModule(mod, LLVMVerifierFailureAction.LLVMPrintMessageAction, out var error) != llvmtrue)
	Console.WriteLine($"Error: {error}");
Console.WriteLine("Entry block name: {0}", LLVM.GetBasicBlockName(entry));
			
LLVM.DisposeBuilder(builder);
Console.WriteLine("Program End");

Small gif showing what is happening

Application starts running. Then waits for 4 to 6 seconds and then application ends.
Visual studio debug output:

'dotnet.exe' (CoreCLR: DefaultDomain): 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.5\System.Private.CoreLib.dll' yüklendi. Sembollerin yüklemesi atlandı. Modül iyileştirildi ve hata ayıklayıcının 'Yalnızca Kendi Kodum' seçeneği etkin hale getirildi.
'dotnet.exe' (CoreCLR: clrhost): 'C:\Users\Yahya Gedik\source\repos\Teal\Teal\bin\Debug\netcoreapp2.1\Teal.dll' yüklendi. Semboller yüklendi.
'dotnet.exe' (CoreCLR: clrhost): 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.5\System.Runtime.dll' yüklendi. Sembollerin yüklemesi atlandı. Modül iyileştirildi ve hata ayıklayıcının 'Yalnızca Kendi Kodum' seçeneği etkin hale getirildi.
'dotnet.exe' (CoreCLR: clrhost): 'C:\Users\Yahya Gedik\.nuget\packages\llvmsharp\5.0.0\lib\netstandard1.1\LLVMSharp.dll' yüklendi. Sembollerin yüklemesi atlandı. Modül iyileştirildi ve hata ayıklayıcının 'Yalnızca Kendi Kodum' seçeneği etkin hale getirildi.
'dotnet.exe' (CoreCLR: clrhost): 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.5\System.Console.dll' yüklendi. Sembollerin yüklemesi atlandı. Modül iyileştirildi ve hata ayıklayıcının 'Yalnızca Kendi Kodum' seçeneği etkin hale getirildi.
'dotnet.exe' (CoreCLR: clrhost): 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\2.1.5\System.Runtime.InteropServices.dll' yüklendi. Sembollerin yüklemesi atlandı. Modül iyileştirildi ve hata ayıklayıcının 'Yalnızca Kendi Kodum' seçeneği etkin hale getirildi.
'[11756] dotnet.exe' programı -1073740940 (0xc0000374) koduyla çıktı.

Every line except second line says module is loaded, but symbols are not (sice Just My Code is active). And exit code seems to be -1073740940.

@jangofett4
Copy link
Author

Issue seems to be resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants