You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bool SkeletonPass::runOnModule(Module &M) {
// Get the function to call from our runtime library.
auto global_annos = M.getNamedGlobal("llvm.global.annotations");
if (global_annos) {
auto a = cast<ConstantArray>(global_annos->getOperand(0));
for (int i=0; i<a->getNumOperands(); i++) {
auto e = cast<ConstantStruct>(a->getOperand(i));
if (auto fn = dyn_cast<Function>(e->getOperand(0)->getOperand(0))) {
auto anno = cast<ConstantDataArray>(cast<GlobalVariable>(e->getOperand(1)->getOperand(0))->getOperand(0))->getAsCString();
if (anno == "async") { async_fns.insert(fn); } }
}
}
}
Running pass 'Unnamed pass: implement Pass::getPassName()' on function '@foo'
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 5.0.0 (trunk 305458)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-5.0: note: diagnostic msg:
Any idea how to fix this ?
The text was updated successfully, but these errors were encountered:
Hi! Can you please format your post so that the code and terminal output is legible (i.e., use ```)?
If you're getting a segmentation fault, you'll want to load your program up in a debugger (gdb or lldb) to find out where the crash is happening and to get a traceback. I unfortunately can't make any useful guesses just by looking at code on the screen. 😃
Hi,
am trying to run annotation module code from the link in the tutorial
http://bholt.org/posts/llvm-quick-tricks.html
`
#include "llvm/Pass.h"
#include "llvm/IR/Function.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/InstrTypes.h"
#include "llvm/Transforms/IPO/PassManagerBuilder.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/Transforms/Utils/BasicBlockUtils.h"
#include "llvm/IR/Module.h"
#include
using namespace llvm;
namespace {
struct SkeletonPass : public ModulePass {
static char ID;
SkeletonPass() : ModulePass(ID) {}
};
}
char SkeletonPass::ID = 0;
std::set<Function*> async_fns;
// Automatically enable the pass.
// http://adriansampson.net/blog/clangpass.html
static void registerSkeletonPass(const PassManagerBuilder &,
legacy::PassManagerBase &PM) {
PM.add(new SkeletonPass());
}
static RegisterStandardPasses
MyPassRegistration(PassManagerBuilder::EP_EarlyAsPossible,
registerSkeletonPass);
static RegisterStandardPasses
RegisterMyPass0(PassManagerBuilder::EP_EnabledOnOptLevel0, registerSkeletonPass);`
and something.c
`#include <stdio.h>
attribute((annotate("async"))) int foo() {
printf("foo does nothing\n");
}
int main(int argc, const char** argv) {
int num;
int x = foo();
scanf("%i", &num);
printf("%i\n", x + num + 2);
return 0;
}`
am getting these errors:
0. Program arguments: /usr/local/bin/clang-5.0 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name something.c -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb -coverage-notes-file /home/atamli/StaticAnalysis/llvm-pass-skeleton/build/example/something.gcno -resource-dir /usr/local/lib/clang/5.0.0 -internal-isystem /usr/local/include -internal-isystem /usr/local/lib/clang/5.0.0/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdebug-compilation-dir /home/atamli/StaticAnalysis/llvm-pass-skeleton/build/example -ferror-limit 19 -fmessage-length 111 -fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -load ../skeleton/libSkeletonPass.so -o something.o -x c something.c
clang-5.0: error: unable to execute command: Segmentation fault (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 5.0.0 (trunk 305458)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and associated run script.
clang-5.0: note: diagnostic msg:
Any idea how to fix this ?
The text was updated successfully, but these errors were encountered: