See "DwarfDebug problem with line section" thread on llvmdev. Bottom line, we may need a target specific patch for targets that do not follow dwarf standard (as per my reading) in this particular case. <div>-</div>
<div>Devang<br><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 16px; border-collapse: collapse; color: rgb(51, 51, 51); font-weight: bold; "></span><br><br><div class="gmail_quote">On Wed, Aug 25, 2010 at 5:49 AM, Renato Golin <span dir="ltr"><<a href="mailto:rengolin@systemcall.org">rengolin@systemcall.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
I'm trying to compile two files together with debug information but<br>
seems that LLVM is getting the DW_AT_stmt_list wrong when ld is<br>
linking the final executable.<br>
<br>
Originally, I tried on ARM with Clang (+llc+gas+ln) and, the object<br>
files, the DW_AT_stmt_list were null, as expected. When linking, they<br>
should point to the offset in the line table, but all of them are<br>
still null, so pointing all to the same line table (whichever object<br>
gets linked first).<br>
<br>
I then tested with SVN Clang+LLVM and got the same problem for x86-64.<br>
In GDB, when you're stepping through the program, whichever file got<br>
linked first has line information and you can only step on the source<br>
of the first object.<br>
<br>
My Files:<br>
<br>
-------------------------------- ext.c<br>
#include <stdio.h><br>
<br>
int external_fn(void)<br>
{<br>
  int i;<br>
  for (i = 0; i < 5; ++i) {<br>
    printf("ext fn #%d\n", i);<br>
  }<br>
  return 0;<br>
}<br>
<br>
-------------------------------- main.c<br>
#include <stdio.h><br>
<br>
int external_fn(void);<br>
<br>
int main(int argc, char** argv)<br>
{<br>
  printf("TestMsg\n");<br>
  external_fn();<br>
  return 0;<br>
}<br>
<br>
$ clang -g main.c ext.c<br>
$ gdb -q a.out<br>
(gdb) start<br>
Temporary breakpoint 1 at 0x4004c0: file main.c, line 7.<br>
Starting program: /work/temp/a.out<br>
<br>
Temporary breakpoint 1, main (argc=1, argv=0x7fffffffbf18) at main.c:7<br>
7         printf("TestMsg\n");<br>
(gdb) n<br>
TestMsg<br>
8         external_fn();<br>
(gdb) s<br>
ext fn #0<br>
ext fn #1<br>
ext fn #2<br>
ext fn #3<br>
ext fn #4<br>
9         return 0;<br>
(gdb)<br>
<br>
If I compile ext.c first, main has no line information:<br>
<br>
$ clang -g ext.c main.c<br>
$ gdb a.out<br>
(gdb) start<br>
Temporary breakpoint 1 at 0x4004e4<br>
Starting program: /work/temp/a.out<br>
<br>
Temporary breakpoint 1, 0x00000000004004e4 in main (argc=0, argv=0x7fffffffbf10)<br>
(gdb) n<br>
Single stepping until exit from function main,<br>
which has no line number information.<br>
TestMsg<br>
ext fn #0<br>
ext fn #1<br>
ext fn #2<br>
ext fn #3<br>
ext fn #4<br>
0x00000033c5e1d974 in __libc_start_main () from /lib64/libc.so.6<br>
(gdb)<br>
<br>
<br>
What am I missing?<br>
<br>
--<br>
cheers,<br>
--renato<br>
<br>
<a href="http://systemcall.org/" target="_blank">http://systemcall.org/</a><br>
<br>
Reclaim your digital rights, eliminate DRM, learn more at<br>
<a href="http://www.defectivebydesign.org/what_is_drm" target="_blank">http://www.defectivebydesign.org/what_is_drm</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>-<br>Devang<br>
</div></div>