CFE debug info progress

Hi, I've got the cfe debug info to the point where it outputs correct
function info, stoppoints for statements (but not for declarations
anymore) and region ends at the beginning of the return block. So this
is about as far as I wanted to go with it.

However, there's one last big problem that I need some advice on. Running :
gcc -g -S -o foo.ll
llvmas foo.ll

produces bytecode that works under lli -force-interpreter on OS X (JIT
not working on my system)
and llvm-db can list sources and functions.

*but*

gcc -g -o foo

llvm-db foo.bc

doesn't see any debug info.

Worse, it doesn't work:

that's a JIT error, OK, so:

% lli -force-interpreter loops.bc
Tried to execute an unknown external function: __main
Loops begin:
/Users/mike/Documents/hpcl/LLVM/llvm/include/llvm/Support/Casting.h:197:
failed assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"'
Abort

That's not good.
Any advice on debugging this?

Thanks,
-mike

Hi, I've got the cfe debug info to the point where it outputs correct
function info, stoppoints for statements (but not for declarations
anymore) and region ends at the beginning of the return block. So this
is about as far as I wanted to go with it.

However, there's one last big problem that I need some advice on. Running :
gcc -g -S -o foo.ll
llvmas foo.ll

produces bytecode that works under lli -force-interpreter on OS X (JIT
not working on my system)
and llvm-db can list sources and functions.

Okay.

*but*

gcc -g -o foo

What's the source file to be compiled? This should produce a "no input
files" error. Assuming you were attempting "gcc -g -o foo foo.c" ..

llvm-db foo.bc

Did gcc link foo.bc with glibc and/or stdc++ library? It invokes gccld
to do that.

doesn't see any debug info.

Worse, it doesn't work:

that's a JIT error, OK, so:

% lli -force-interpreter loops.bc
Tried to execute an unknown external function: __main

This indicates you didn't link loops.bc with the stdc++ library which it
requires.

Loops begin:
/Users/mike/Documents/hpcl/LLVM/llvm/include/llvm/Support/Casting.h:197:
failed assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"'
Abort

Not sure what that's about, but its probably related to missing __main.

That's not good.
Any advice on debugging this?

Thanks,
-mike

Hope this helps.

Reid.

Hi, I've got the cfe debug info to the point where it outputs correct
function info, stoppoints for statements (but not for declarations
anymore) and region ends at the beginning of the return block. So this
is about as far as I wanted to go with it.

That is great!

However, there's one last big problem that I need some advice on. Running :
gcc -g -S -o foo.ll
llvmas foo.ll

produces bytecode that works under lli -force-interpreter on OS X (JIT
not working on my system)
and llvm-db can list sources and functions.

Ok.

*but*

gcc -g -o foo
llvm-db foo.bc
doesn't see any debug info.

I bet this is due to the internalize pass marking globals as internal,
then the optimizer stripping stuff out. Oops. :slight_smile: Try passing
-Wl,-disable-internalize to llvm-gcc, and seeing if that helps.

This is not your problem, so once we get debug info into the llvm-gcc
tree, I will fix this (it's probably quite easy to fix).

Worse, it doesn't work:
that's a JIT error, OK, so:
% lli -force-interpreter loops.bc
Tried to execute an unknown external function: __main

This is probably due to your LLVM_LIB_SEARCH_PATH env variable not being
set. Please see the getting started guide for info on how to set this.

Loops begin:
/Users/mike/Documents/hpcl/LLVM/llvm/include/llvm/Support/Casting.h:197:
failed assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible
type!"'
Abort

That's not good.

No, that's not.

Any advice on debugging this?

I would run lli under gdb and look at what the stack trace is. If you
can't figure it out in a reasonable amount of time, create a bugzilla bug,
attach the bytecode file, and we'll take a look.

Also, when they are ready, please send me the llvm-gcc diff so that I can
get them applied to the tree.

Thanks a lot!

-Chris