Hi Robin, there is still debug info in a.out.bc, however the reference
to "a" has been replaced with "null" in the debug meta data.
Please open
a bug report about this.
Ciao, Duncan.
> It seems that llvm-ld is stripping debugging symbols even with
> optimizations disabled:
>
> > cat main.c
> int main()
> {
> int a = 42;
> return a;
> }
> > clang -c -g -emit-llvm -o main.bc main.c
> > llvm-ld -disable-opt -b=a.out.bc main.bc
> > clang -g a.out.bc -o a.out
>
> >gdb a.out
> [...]
> (gdb) break main
> Breakpoint 1 at 0x40045b: file main.c, line 4.
> (gdb) run
> Starting program: a.out
>
> Breakpoint 1, main () at main.c:4
> 4 int a = 42;
> (gdb) print a
> No symbol "a" in current context.
>
> However, if I leave llvm-ld out of the picture, it works:
>
> > clang -g main.bc -o a.out
> > gdb a.out
> (gdb) break main
> Breakpoint 1 at 0x40045b: file main.c, line 4.
> (gdb) run
> Starting program: a.out
>
> Breakpoint 1, main () at main.c:4
> 4 int a = 42;
> (gdb) print a
> $1 = 0
>
>
> Am I missing something?
>
> This is with LLVM/clang 2.8 on x86_64 Linux.
>
> Thanks,
>
> Robin
>