Displaying 3 results from an estimated 3 matches for "abortf".
Did you mean:
abort
2011 Aug 19
0
[LLVMdev] How to halt a program
...sertfail);
> abort->addAttribute(~0, Attribute::NoReturn);
> abort->addAttribute(~0, Attribute::NoUnwind);
>
> However, I do not know what to fill up in /*POINTER TO ABORT*/. Can
> anyone help me?
Something like:
// Once, M = llvm::Module*, C = LLVMContext&:
FunctionType *AbortFTy = FunctionType::get(Type::getVoidTy(C), false);
Function *AbortF = Function::Create(AbortFTy,
GlobalValue::ExternalLinkage, "abort", M);
// Each call site:
CallInst *abort = CallInst::Create(AbortF, ...
Nick
>
> Thank you very much,
>
> Victor
>
>
>
> _______...
2011 Aug 19
2
[LLVMdev] How to halt a program
Guys,
I would like to instrument the bytecode that LLVM produces with
assertions. I have written the instrumentation code manually, but I do not
know how to halt the program in case the assertion is false. I took a look
into the bytecode that LLVM produces for a program like:
#include <stdlib.h>
int main() {
exit(1);
}
And it is like this:
define i32 @main() nounwind {
entry:
2011 Sep 01
1
[LLVMdev] How to halt a program
...th
some assertions, and to do this, I want to insert the abort() function into
the bytecode. The problem is that LLVM is creating a new abort() function,
instead of using the one that already exists in libc. Let me show my code to
add the abort into the code:
// Create abort function
FunctionType *AbortFTy = FunctionType::get(Type::getVoidTy(*context),
false);
Function *AbortF = Function::Create(AbortFTy, GlobalValue::ExternalLinkage,
"abort", &M);
// Call to abort function
CallInst *abort = CallInst::Create(AbortF, Twine(), assertfail);
// Add atributes to the abort call instructio...