getMetadata(“dbg”) returns NULL

Hi,
getMetadata(“dbg”) returns NULL for such a small program as follows:

int main(){
char a[10], b[2];
if(a[0] != 0 && a[1] != 0){
strcpy(a, b);
}
return 0;
}

The compiling command is: llvm-gcc --emit-llvm -g -c ./src.c

I also tried the solutions I found through Google:
http://stackoverflow.com/questions/14943447/llvm-line-number-of-an-instruction
http://stackoverflow.com/questions/23089316/getmetadatadbg-returns-null-despite-producing-ir-with-clang-g-s-emit-llv

but neither of them works.

Does anyone have any idea about this?
Thanks,
Yongchao.

Hi,
getMetadata(“dbg”) returns NULL for such a small program as follows:

int main(){
char a[10], b[2];
if(a[0] != 0 && a[1] != 0){
strcpy(a, b);
}
return 0;
}

The compiling command is: llvm-gcc --emit-llvm -g -c ./src.c

llvm-gcc is dead and unmaintained. Try clang?

Neither of the solutions you found uses llvm-gcc.

As David said llvm-gcc is dead. Is there a reason you are using
llvm-gcc (and consequently LLVM <= 2.9)?

Are you by chance trying to use KLEE [1]? I think I've seen your
e-mail on the klee mailing list before. If you are using KLEE you
should in bear in mind that KLEE does build against LLVM3.4 and works
fine with Clang, not everything works yet but it is pretty usable.

You are more likely to get a positive response from developers if you
use a version of LLVM that isn't >= 3 years old.

[1] http://klee.github.io/klee/