<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 2:20 PM, Kuba Brecka <span dir="ltr"><<a href="mailto:kuba.brecka@gmail.com" target="_blank">kuba.brecka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dwarfdumping a.out produces nothing, but dwarfdumping a.o does and there are differences. Attaching the two outputs. This is the diff for running  cc1, ld and dwarfdump, between r218128 and r218129:</div></blockquote><div><br></div><div>The changes to the dump of a.o look like what I intended. It sounds like dsymutil is being smart and omitting debug info if there are no subprograms in the CU? Perhaps you'd need to disable this optimization on Darwin unless/until you can teach dsymutil not to do this?<br><br>You'd have to experiment more/investigate/read/etc dsymutil to understand whether my hypothesis is correct.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div><div><div>--- clang-218128.txt<span style="white-space:pre-wrap">      </span>2014-09-25 14:17:51.000000000 -0700</div><div>+++ clang-218129.txt<span style="white-space:pre-wrap">  </span>2014-09-25 14:17:44.000000000 -0700</div><div>@@ -1,190 +1,171 @@</div><div> $ ./bin/clang -v</div><div>-clang version 3.6.0 (218128)</div><div>+clang version 3.6.0 (218129)</div><span class=""><div> Target: x86_64-apple-darwin14.0.0</div><div> Thread model: posix</div></span><div> $ ./bin/clang -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -gline-tables-only a.c -o a.o</div><div> $ ld -arch x86_64 -macosx_version_min 10.10.0 a.o -o a.out -lSystem</div><div> $ ./bin/llvm-dwarfdump -debug-dump=all a.out</div><span class=""><div> a.out:  file format Mach-O 64-bit x86-64</div><div> </div><div> .debug_abbrev contents:</div></span><div> < EMPTY ></div><span class=""><div> </div><div> .debug_abbrev.dwo contents:</div><div> < EMPTY ></div><div> </div><div> .debug_info contents:</div><div> </div><div> .debug_loc contents:</div><div> </div><div> .debug_loc.dwo contents:</div><div> </div><div> .debug_frame contents:</div><div> </div><div> </div><div> .debug_aranges contents:</div><div> </div><div> .debug_line contents:</div><div> </div><div> .debug_line.dwo contents:</div><div> </div><div> .debug_str contents:</div><div> </div></span><span class=""><div> .debug_ranges contents:</div><div> </div><div> .debug_pubnames contents:</div><div> </div><div> .debug_pubtypes contents:</div><div> </div><div> .debug_gnu_pubnames contents:</div><div> </div><div> .debug_gnu_pubtypes contents:</div></span><div> $ ./bin/llvm-dwarfdump -debug-dump=all a.o</div><div> error: failed to compute relocation: X86_64_RELOC_UNSIGNED</div><div> error: failed to compute relocation: X86_64_RELOC_UNSIGNED</div><div>-error: failed to compute relocation: X86_64_RELOC_UNSIGNED</div><div> a.o:  file format Mach-O 64-bit x86-64</div><span class=""><div> </div><div> .debug_abbrev contents:</div><div> Abbrev table for offset: 0x00000000</div></span><div>-[1] DW_TAG_compile_unit DW_CHILDREN_yes</div><div>+[1] DW_TAG_compile_unit DW_CHILDREN_no</div><span class=""><div>   DW_AT_producer  DW_FORM_strp</div><div>   DW_AT_language  DW_FORM_data2</div><div>   DW_AT_name  DW_FORM_strp</div></span><div>   DW_AT_stmt_list DW_FORM_sec_offset</div><div>   DW_AT_comp_dir  DW_FORM_strp</div><div>-</div><div>-[2] DW_TAG_subprogram DW_CHILDREN_no</div><div>   DW_AT_low_pc  DW_FORM_addr</div><div>   DW_AT_high_pc DW_FORM_data4</div><div>-  DW_AT_APPLE_omit_frame_ptr  DW_FORM_flag_present</div><div>-  DW_AT_name  DW_FORM_strp</div><span class=""><div> </div><div> </div><div> .debug_abbrev.dwo contents:</div><div> < EMPTY ></div><div> </div><div> .debug_info contents:</div></span><div>-0x00000000: Compile Unit: length = 0x0000003d version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000041)</div><div>+0x00000000: Compile Unit: length = 0x00000026 version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x0000002a)</div><div> </div><div>-0x0000000b: DW_TAG_compile_unit [1] *</div><div>-              DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 3.6.0 (218128)")</div><div>+0x0000000b: DW_TAG_compile_unit [1]  </div><div>+              DW_AT_producer [DW_FORM_strp] ( .debug_str[0x00000000] = "clang version 3.6.0 (218129)")</div><div>               DW_AT_language [DW_FORM_data2]  (DW_LANG_C99)</div><div>               DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000001d] = "<stdin>")</div><div>               DW_AT_stmt_list [DW_FORM_sec_offset]  (0x00000000)</div><div>               DW_AT_comp_dir [DW_FORM_strp] ( .debug_str[0x00000025] = "/Users/kuba/llvm-tot-cmake-release")</div><div>-</div><div>-0x0000001e:   DW_TAG_subprogram [2]  </div><div>-                DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)</div><div>-                DW_AT_high_pc [DW_FORM_data4] (0x00000019)</div><div>-                DW_AT_APPLE_omit_frame_ptr [DW_FORM_flag_present] (true)</div><div>-                DW_AT_name [DW_FORM_strp] ( .debug_str[0x00000048] = "f")</div><div>-</div><div>-0x0000002f:   DW_TAG_subprogram [2]  </div><div>-                DW_AT_low_pc [DW_FORM_addr] (0x0000000000000020)</div><div>-                DW_AT_high_pc [DW_FORM_data4] (0x00000043)</div><div>-                DW_AT_APPLE_omit_frame_ptr [DW_FORM_flag_present] (true)</div><div>-                DW_AT_name [DW_FORM_strp] ( .debug_str[0x0000004a] = "main")</div><div>-</div><div>-0x00000040:   NULL</div><div>+              DW_AT_low_pc [DW_FORM_addr] (0x0000000000000000)</div><div>+              DW_AT_high_pc [DW_FORM_data4] (0x00000063)</div><span class=""><div> </div><div> .debug_loc contents:</div><div> </div><div> .debug_loc.dwo contents:</div><div> </div><div> .debug_frame contents:</div><div> </div><div> 00000000 00000014 ffffffff CIE</div><div>   Version:               3</div><div>   Augmentation:          ""</div><div>   Code alignment factor: 1</div><div>   Data alignment factor: -8</div><div>   Return address column: 16</div><div> </div><div>   DW_CFA_def_cfa:</div><div>   DW_CFA_offset:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div> </div></span><div> 00000018 0000001c 00000000 FDE cie=00000000 pc=00000000...00000019</div><span class=""><div>   DW_CFA_advance_loc:</div><div>   DW_CFA_def_cfa_offset:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div> </div></span><div> 00000038 0000001c 00000000 FDE cie=00000000 pc=00000020...00000063</div><span class=""><div>   DW_CFA_advance_loc:</div><div>   DW_CFA_def_cfa_offset:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div>   DW_CFA_nop:</div><div> </div><div> </div><div> .debug_aranges contents:</div><div> </div></span><span class=""><div> .debug_line contents:</div><div> Line table prologue:</div></span><div>     total_length: 0x0000003b</div><span class=""><div>          version: 2</div><div>  prologue_length: 0x0000001a</div><div>  min_inst_length: 1</div><div>  default_is_stmt: 1</div><div>        line_base: -5</div><div>       line_range: 14</div><div>      opcode_base: 13</div><div> standard_opcode_lengths[DW_LNS_copy] = 0</div><div> standard_opcode_lengths[DW_LNS_advance_pc] = 1</div><div> standard_opcode_lengths[DW_LNS_advance_line] = 1</div><div> standard_opcode_lengths[DW_LNS_set_file] = 1</div><div> standard_opcode_lengths[DW_LNS_set_column] = 1</div><div> standard_opcode_lengths[DW_LNS_negate_stmt] = 0</div><div> standard_opcode_lengths[DW_LNS_set_basic_block] = 0</div><div> standard_opcode_lengths[DW_LNS_const_add_pc] = 0</div><div> standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1</div><div> standard_opcode_lengths[DW_LNS_set_prologue_end] = 0</div><div> standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0</div><div> standard_opcode_lengths[DW_LNS_set_isa] = 1</div><div>                 Dir  Mod Time   File Len   File Name</div><div>                 ---- ---------- ---------- ---------------------------</div><div> file_names[  1]    0 0x00000000 0x00000000 a.c</div><div> </div><div> Address            Line   Column File   ISA Discriminator Flags</div><div> ------------------ ------ ------ ------ --- ------------- -------------</div></span><div> 0x0000000000000000      3      0      1   0             0  is_stmt</div><div> 0x0000000000000008      4      0      1   0             0  is_stmt prologue_end</div><div> 0x0000000000000011      5      0      1   0             0  is_stmt</div><div> 0x0000000000000020      8      0      1   0             0  is_stmt</div><div> 0x000000000000002b      9      0      1   0             0  is_stmt prologue_end</div><div> 0x0000000000000039     10      0      1   0             0  is_stmt</div><div> 0x000000000000004b     11      0      1   0             0  is_stmt</div><div> 0x0000000000000058     12      0      1   0             0  is_stmt</div><div> 0x0000000000000063     12      0      1   0             0  is_stmt end_sequence</div><div> </div><div> .debug_line.dwo contents:</div><div> </div><div> .debug_str contents:</div><div>-0x00000000: "clang version 3.6.0 (218128)"</div><div>+0x00000000: "clang version 3.6.0 (218129)"</div><div> 0x0000001d: "<stdin>"</div><div> 0x00000025: "/Users/kuba/llvm-tot-cmake-release"</div><div>-0x00000048: "f"</div><div>-0x0000004a: "main"</div><div> </div><div> .debug_ranges contents:</div><div> </div><div> .debug_pubnames contents:</div><div> </div><span class=""><div> .debug_pubtypes contents:</div><div> </div><div> .debug_gnu_pubnames contents:</div><div> </div><div> .debug_gnu_pubtypes contents:</div><div> $ </div></span></div><span class="HOEnZb"><font color="#888888"><div><br></div><div><br></div><div>Kuba</div><div><br></div><div><br></div></font></span></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 1:42 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Thu, Sep 25, 2014 at 1:03 PM, Kuba Brecka <span dir="ltr"><<a href="mailto:kuba.brecka@gmail.com" target="_blank">kuba.brecka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Clang r218129:<div><br></div><div><div>$ ./bin/clang -gline-tables-only a.c -o a.out -###</div><div>clang version 3.6.0 (218129) </div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>Target: x86_64-apple-darwin14.0.0</div><div>Thread model: posix</div><div> "/Users/kuba/llvm-tot-cmake-release/bin/clang-3.6" "-cc1" "-triple" "x86_64-apple-macosx10.10.0" "-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "a.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-cpu" "core2" "-gline-tables-only" "-gdwarf-2" "-dwarf-column-info" "-resource-dir" "/Users/kuba/llvm-tot-cmake-release/bin/../lib/clang/3.6.0" "-fdebug-compilation-dir" "/Users/kuba/llvm-tot-cmake-release" "-ferror-limit" "19" "-fmessage-length" "364" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-10.10.0" "-fencode-extended-block-signature" "-fmax-type-align=16" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "/var/folders/k0/qjt5nwj91314gwrg0j9ltrrw0000gn/T/a-87344c.o" "-x" "c" "a.c"</div><div> "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.10.0" "-o" "a.out" "/var/folders/k0/qjt5nwj91314gwrg0j9ltrrw0000gn/T/a-87344c.o" "-lSystem"</div><div> "/usr/bin/dsymutil" "-o" "a.out.dSYM" "a.out"</div><div>$ ./bin/clang -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -gline-tables-only -gdwarf-2 -dwarf-column-info a.c -o a.o</div><div>$ ld -dynamic -arch x86_64 -o a.out a.o -lSystem -macosx_version_min 10.10.0</div><div>$ dsymutil a.out -o a.out.dSYM</div><span><div>warning: no debug symbols in executable (-arch x86_64)</div></span></div></div></blockquote><div><br></div></span><div>I'm not sure what this warning is meant to express - but it might be related to the issue. Have you tried dwarfdumping a.out before running dsymutil? At least using your command line and running dwarfdump on the object file (on Linux I don't have dsymutil, nm for MachO, etc) I see the debug info I expect, whereas it looks like no debug info made it to the dsym file below \/.</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>$ ./bin/llvm-dwarfdump -debug-dump=all a.out.dSYM/Contents/Resources/DWARF/a.out</div><span><div>a.out.dSYM/Contents/Resources/DWARF/a.out:<span style="white-space:pre-wrap">       </span>file format Mach-O 64-bit x86-64</div></span><div>.debug_abbrev contents:</div><div>Abbrev table for offset: 0x00000000</div><div>.debug_abbrev.dwo contents:</div><div>< EMPTY ></div><div>.debug_info contents:</div><div>.debug_loc contents:</div><div>.debug_loc.dwo contents:</div><div>.debug_frame contents:</div><div>.debug_aranges contents:</div><div>.debug_line contents:</div><div>.debug_line.dwo contents:</div><div>.debug_str contents:</div><div>0x00000000: ""</div><div>.debug_ranges contents:</div><div>.debug_pubnames contents:</div><div>.debug_pubtypes contents:</div><div>.debug_gnu_pubnames contents:</div><div>.debug_gnu_pubtypes contents:</div><div>$ </div></div><div><br></div><div>Clang r218128:</div><div><br></div><div><div>$ ./bin/clang -gline-tables-only a.c -o a.out -###</div><div>clang version 3.6.0 (218128)</div><div>Target: x86_64-apple-darwin14.0.0</div><div>Thread model: posix</div><div> "/Users/kuba/llvm-tot-cmake-release/bin/clang-3.6" "-cc1" "-triple" "x86_64-apple-macosx10.10.0" "-emit-obj" "-mrelax-all" "-disable-free" "-main-file-name" "a.c" "-mrelocation-model" "pic" "-pic-level" "2" "-mdisable-fp-elim" "-masm-verbose" "-munwind-tables" "-target-cpu" "core2" "-gline-tables-only" "-gdwarf-2" "-dwarf-column-info" "-resource-dir" "/Users/kuba/llvm-tot-cmake-release/bin/../lib/clang/3.6.0" "-fdebug-compilation-dir" "/Users/kuba/llvm-tot-cmake-release" "-ferror-limit" "19" "-fmessage-length" "364" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-10.10.0" "-fencode-extended-block-signature" "-fmax-type-align=16" "-fdiagnostics-show-option" "-fcolor-diagnostics" "-o" "/var/folders/k0/qjt5nwj91314gwrg0j9ltrrw0000gn/T/a-d4d93b.o" "-x" "c" "a.c"</div><div> "/usr/bin/ld" "-dynamic" "-arch" "x86_64" "-macosx_version_min" "10.10.0" "-o" "a.out" "/var/folders/k0/qjt5nwj91314gwrg0j9ltrrw0000gn/T/a-d4d93b.o" "-lSystem"</div><div> "/usr/bin/dsymutil" "-o" "a.out.dSYM" "a.out"</div><div>$ ./bin/clang -cc1 -triple x86_64-apple-macosx10.10.0 -emit-obj -gline-tables-only -gdwarf-2 -dwarf-column-info a.c -o a.o</div><div>$ ld -dynamic -arch x86_64 -o a.out a.o -lSystem -macosx_version_min 10.10.0</div><div>$ dsymutil a.out -o a.out.dSYM</div><div>$ ./bin/llvm-dwarfdump -debug-dump=all a.out.dSYM/Contents/Resources/DWARF/a.out</div><span><div>a.out.dSYM/Contents/Resources/DWARF/a.out:<span style="white-space:pre-wrap">       </span>file format Mach-O 64-bit x86-64</div><div><br></div></span><div>.debug_abbrev contents:</div><div>Abbrev table for offset: 0x00000000</div><div>[1] DW_TAG_compile_unit<span style="white-space:pre-wrap">    </span>DW_CHILDREN_yes</div><div><span style="white-space:pre-wrap">  </span>DW_AT_producer<span style="white-space:pre-wrap">  </span>DW_FORM_strp</div><div><span style="white-space:pre-wrap">     </span>DW_AT_language<span style="white-space:pre-wrap">  </span>DW_FORM_data2</div><div><span style="white-space:pre-wrap">    </span>DW_AT_name<span style="white-space:pre-wrap">      </span>DW_FORM_strp</div><div><span style="white-space:pre-wrap">     </span>DW_AT_stmt_list<span style="white-space:pre-wrap"> </span>DW_FORM_data4</div><div><span style="white-space:pre-wrap">    </span>DW_AT_comp_dir<span style="white-space:pre-wrap">  </span>DW_FORM_strp</div><div><br></div><div>[2] DW_TAG_subprogram<span style="white-space:pre-wrap">       </span>DW_CHILDREN_no</div><div><span style="white-space:pre-wrap">   </span>DW_AT_low_pc<span style="white-space:pre-wrap">    </span>DW_FORM_addr</div><div><span style="white-space:pre-wrap">     </span>DW_AT_high_pc<span style="white-space:pre-wrap">   </span>DW_FORM_addr</div><div><span style="white-space:pre-wrap">     </span>DW_AT_APPLE_omit_frame_ptr<span style="white-space:pre-wrap">      </span>DW_FORM_flag</div><div><span style="white-space:pre-wrap">     </span>DW_AT_name<span style="white-space:pre-wrap">      </span>DW_FORM_strp</div><div><br></div><div><br></div><div>.debug_abbrev.dwo contents:</div><div>< EMPTY ></div><div><br></div><div>.debug_info contents:</div><div>0x00000000: Compile Unit: length = 0x00000047 version = 0x0002 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x0000004b)</div><div><br></div><div>0x0000000b: DW_TAG_compile_unit [1] *</div><div>              DW_AT_producer [DW_FORM_strp]<span style="white-space:pre-wrap">  </span>( .debug_str[0x00000001] = "clang version 3.6.0 (218128)")</div><div>              DW_AT_language [DW_FORM_data2]<span style="white-space:pre-wrap">  </span>(DW_LANG_C99)</div><div>              DW_AT_name [DW_FORM_strp]<span style="white-space:pre-wrap">      </span>( .debug_str[0x0000001e] = "<stdin>")</div><div>              DW_AT_stmt_list [DW_FORM_data4]<span style="white-space:pre-wrap">        </span>(0x00000000)</div><div>              DW_AT_comp_dir [DW_FORM_strp]<span style="white-space:pre-wrap">   </span>( .debug_str[0x00000026] = "/Users/kuba/llvm-tot-cmake-release")</div><div><br></div><div>0x0000001e:   DW_TAG_subprogram [2]  </div><div>                DW_AT_low_pc [DW_FORM_addr]<span style="white-space:pre-wrap">     </span>(0x0000000100000f20)</div><div>                DW_AT_high_pc [DW_FORM_addr]<span style="white-space:pre-wrap"> </span>(0x0000000100000f39)</div><div>                DW_AT_APPLE_omit_frame_ptr [DW_FORM_flag]<span style="white-space:pre-wrap">    </span>(0x01)</div><div>                DW_AT_name [DW_FORM_strp]<span style="white-space:pre-wrap">  </span>( .debug_str[0x00000049] = "f")</div><div><br></div><div>0x00000034:   DW_TAG_subprogram [2]  </div><div>                DW_AT_low_pc [DW_FORM_addr]<span style="white-space:pre-wrap">      </span>(0x0000000100000f40)</div><div>                DW_AT_high_pc [DW_FORM_addr]<span style="white-space:pre-wrap"> </span>(0x0000000100000f83)</div><div>                DW_AT_APPLE_omit_frame_ptr [DW_FORM_flag]<span style="white-space:pre-wrap">    </span>(0x01)</div><div>                DW_AT_name [DW_FORM_strp]<span style="white-space:pre-wrap">  </span>( .debug_str[0x0000004b] = "main")</div><div><br></div><div>0x0000004a:   NULL</div><div><br></div><div>.debug_loc contents:</div><div><br></div><div>.debug_loc.dwo contents:</div><div><br></div><div>.debug_frame contents:</div><div><br></div><div>00000000 00000014 ffffffff CIE</div><div>  Version:               1</div><div>  Augmentation:          ""</div><div>  Code alignment factor: 1</div><div>  Data alignment factor: -8</div><div>  Return address column: 16</div><div><br></div><div>  DW_CFA_def_cfa:</div><div>  DW_CFA_offset:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div><br></div><div>00000018 0000001c 00000000 FDE cie=00000000 pc=00000f20...00000f39</div><div>  DW_CFA_advance_loc:</div><div>  DW_CFA_def_cfa_offset:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div><br></div><div>00000038 0000001c 00000000 FDE cie=00000000 pc=00000f40...00000f83</div><div>  DW_CFA_advance_loc:</div><div>  DW_CFA_def_cfa_offset:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div>  DW_CFA_nop:</div><div><br></div><div><br></div><div>.debug_aranges contents:</div><div>Address Range Header: length = 0x0000003c, version = 0x0002, cu_offset = 0x00000000, addr_size = 0x08, seg_size = 0x00</div><div>[0x0000000100000f20 - 0x0000000100000f39)</div><div>[0x0000000100000f40 - 0x0000000100000f83)</div><div><div><div><br></div><div>.debug_line contents:</div><div>Line table prologue:</div><div>    total_length: 0x00000052</div><div>         version: 2</div><div> prologue_length: 0x0000001a</div><div> min_inst_length: 1</div><div> default_is_stmt: 1</div><div>       line_base: -5</div><div>      line_range: 14</div><div>     opcode_base: 13</div><div>standard_opcode_lengths[DW_LNS_copy] = 0</div><div>standard_opcode_lengths[DW_LNS_advance_pc] = 1</div><div>standard_opcode_lengths[DW_LNS_advance_line] = 1</div><div>standard_opcode_lengths[DW_LNS_set_file] = 1</div><div>standard_opcode_lengths[DW_LNS_set_column] = 1</div><div>standard_opcode_lengths[DW_LNS_negate_stmt] = 0</div><div>standard_opcode_lengths[DW_LNS_set_basic_block] = 0</div><div>standard_opcode_lengths[DW_LNS_const_add_pc] = 0</div><div>standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1</div><div>standard_opcode_lengths[DW_LNS_set_prologue_end] = 0</div><div>standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0</div><div>standard_opcode_lengths[DW_LNS_set_isa] = 1</div><div>                Dir  Mod Time   File Len   File Name</div><div>                ---- ---------- ---------- ---------------------------</div><div>file_names[  1]    0 0x00000000 0x00000000 a.c</div><div><br></div><div>Address            Line   Column File   ISA Discriminator Flags</div><div>------------------ ------ ------ ------ --- ------------- -------------</div></div></div><div>0x0000000100000f20      3      0      1   0             0  is_stmt</div><div>0x0000000100000f28      4      2      1   0             0  is_stmt prologue_end</div><div>0x0000000100000f31      5      2      1   0             0  is_stmt</div><div>0x0000000100000f39      5      2      1   0             0  is_stmt end_sequence</div><div>0x0000000100000f40      8      0      1   0             0  is_stmt</div><div>0x0000000100000f4b      9      2      1   0             0  is_stmt prologue_end</div><div>0x0000000100000f59     10      2      1   0             0  is_stmt</div><div>0x0000000100000f6b     11      2      1   0             0  is_stmt</div><div>0x0000000100000f78     12      1      1   0             0  is_stmt</div><div>0x0000000100000f83     12      1      1   0             0  is_stmt end_sequence</div><div><br></div><div>.debug_line.dwo contents:</div><div><br></div><div>.debug_str contents:</div><div>0x00000000: ""</div><div>0x00000001: "clang version 3.6.0 (218128)"</div><div>0x0000001e: "<stdin>"</div><div>0x00000026: "/Users/kuba/llvm-tot-cmake-release"</div><div>0x00000049: "f"</div><div>0x0000004b: "main"</div><div><br></div><div>.debug_ranges contents:</div><div><br></div><div>.debug_pubnames contents:</div><div>length = 0x0000001d version = 0x0002 unit_offset = 0x00000000 unit_size = 0x0000004b</div><div>Offset     Name</div><div>0x0000001e "f"</div><div>0x00000034 "main"</div><div><br></div><div>.debug_pubtypes contents:</div><div><br></div><div>.debug_gnu_pubnames contents:</div><div><br></div><div>.debug_gnu_pubtypes contents:</div><div>$ </div></div><span><font color="#888888"><div><br></div><div><br></div><div><br></div><div>Kuba</div><div><br></div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Sep 25, 2014 at 10:51 AM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Sep 24, 2014 at 12:27 PM, Kuba Brecka <span dir="ltr"><<a href="mailto:kuba.brecka@gmail.com" target="_blank">kuba.brecka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Sure. It works with my system's clang, but when using my just-built ./bin/clang, the symbolizer doesn't give me any line information.<div><br></div><div><div>$ cat a.c</div><div>#include <stdio.h></div><div><br></div><div>int f() {</div><div>        printf("X");</div><div>        return 0;</div><div>}</div><div><br></div><div>int main() {</div><div>        printf("1");</div><div>        printf("2");</div><div>        printf("3");</div><div>}</div><div>$ clang a.c -o a.out -gline-tables-only</div></div></div></blockquote><div><br></div></span><div>A -cc1 command line would be helpful, not sure which -target I should use, etc.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>$ nm a.out</div><div>0000000100000000 T __mh_execute_header</div><div>0000000100000f00 T _f</div><div>0000000100000f30 T _main</div><div>                 U _printf</div><div>                 U dyld_stub_binder</div><div>$ echo "a.out 0x0000000100000f00" | ./bin/llvm-symbolizer </div><div>f</div><div>/Users/kuba/llvm-tot-cmake-release/a.c:3:0</div><div>$ echo "a.out 0x0000000100000f18" | ./bin/llvm-symbolizer </div><div>f</div><div>/Users/kuba/llvm-tot-cmake-release/a.c:5:2</div><div>$ ./bin/llvm-dwarfdump -debug-dump=line a.out.dSYM/Contents/Resources/DWARF/a.out</div></div></div></blockquote><div><br></div></span><div>The full dwarfdump, not just the line table, is probably necessary to investigate this - my change didn't modify the line table, it modified the compile units in the debug_info section (and added ranges back into the debug_ranges section).</div><div><div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div>a.out.dSYM/Contents/Resources/DWARF/a.out:      file format Mach-O 64-bit x86-64</div><div>.debug_line contents:</div><div>Line table prologue:</div><div>    total_length: 0x00000052</div><div>         version: 2</div><div> prologue_length: 0x0000001a</div><div> min_inst_length: 1</div><div> default_is_stmt: 1</div><div>       line_base: -5</div><div>      line_range: 14</div><div>     opcode_base: 13</div><div>standard_opcode_lengths[DW_LNS_copy] = 0</div><div>standard_opcode_lengths[DW_LNS_advance_pc] = 1</div><div>standard_opcode_lengths[DW_LNS_advance_line] = 1</div><div>standard_opcode_lengths[DW_LNS_set_file] = 1</div><div>standard_opcode_lengths[DW_LNS_set_column] = 1</div><div>standard_opcode_lengths[DW_LNS_negate_stmt] = 0</div><div>standard_opcode_lengths[DW_LNS_set_basic_block] = 0</div><div>standard_opcode_lengths[DW_LNS_const_add_pc] = 0</div><div>standard_opcode_lengths[DW_LNS_fixed_advance_pc] = 1</div><div>standard_opcode_lengths[DW_LNS_set_prologue_end] = 0</div><div>standard_opcode_lengths[DW_LNS_set_epilogue_begin] = 0</div><div>standard_opcode_lengths[DW_LNS_set_isa] = 1</div><div>                Dir  Mod Time   File Len   File Name</div><div>                ---- ---------- ---------- ---------------------------</div><div>file_names[  1]    0 0x00000000 0x00000000 a.c</div><div>Address            Line   Column File   ISA Discriminator Flags</div><div>------------------ ------ ------ ------ --- ------------- -------------</div><div>0x0000000100000f00      3      0      1   0             0  is_stmt</div><div>0x0000000100000f0f      4      2      1   0             0  is_stmt prologue_end</div><div>0x0000000100000f18      5      2      1   0             0  is_stmt</div><div>0x0000000100000f23      5      2      1   0             0  is_stmt end_sequence</div><div>0x0000000100000f30      8      0      1   0             0  is_stmt</div><div>0x0000000100000f3f      9      2      1   0             0  is_stmt prologue_end</div><div>0x0000000100000f4d     10      2      1   0             0  is_stmt</div><div>0x0000000100000f5e     11      2      1   0             0  is_stmt</div><div>0x0000000100000f6a     12      1      1   0             0  is_stmt</div><div>0x0000000100000f75     12      1      1   0             0  is_stmt end_sequence</div><div><br></div><div>$ ./bin/clang a.c -o a.out -gline-tables-only</div><div>warning: no debug symbols in executable (-arch x86_64)</div><div>$ echo "a.out 0x0000000100000f00" | ./bin/llvm-symbolizer </div><div>f</div><div>??:0:0</div><div>$ echo "a.out 0x0000000100000f18" | ./bin/llvm-symbolizer </div><div>f</div><div>??:0:0</div><div>$ ./bin/llvm-dwarfdump -debug-dump=line a.out.dSYM/Contents/Resources/DWARF/a.out</div><div>a.out.dSYM/Contents/Resources/DWARF/a.out:      file format Mach-O 64-bit x86-64</div><div><br></div><div><br></div><div>.debug_line contents:</div><div>$</div></div><span><font color="#888888"><div><br></div><div>Kuba</div><div><br></div></font></span></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 24, 2014 at 12:10 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Wed, Sep 24, 2014 at 12:08 PM, Kuba Brecka <span dir="ltr"><<a href="mailto:kuba.brecka@gmail.com" target="_blank">kuba.brecka@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I'm getting test failures for compiler-rt asan tests after this patch. It seems the symbolizer stops working with -gline-tables-only on OS X:</div></div></blockquote></span><div><br>Could you provide a simple reproduction? (a clang command line with a -target and an llvm-symbolizer invocation that should symbolize a particular instruction/offset in the binary, etc) and/or llvm-dwarfdump of a simple binary that fails symbolication when it shouldn't.<br> </div><div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><div>FAIL: AddressSanitizer32 :: TestCases/use-after-free.cc (222 of 460)</div></div><div><div>******************** TEST 'AddressSanitizer32 :: TestCases/use-after-free.cc' FAILED ********************</div></div><div><div>Script:</div></div><div><div>--</div></div><div><div>/Users/kuba/llvm-tot-cmake-release/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m32 -O0 /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc -o /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp && not  /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp 2>&1 | FileCheck /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc --check-prefix=CHECK-Darwin --check-prefix=CHECK</div></div><div><div>/Users/kuba/llvm-tot-cmake-release/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m32 -O1 /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc -o /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp && not  /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp 2>&1 | FileCheck /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc --check-prefix=CHECK-Darwin --check-prefix=CHECK</div></div><div><div>/Users/kuba/llvm-tot-cmake-release/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m32 -O2 /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc -o /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp && not  /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp 2>&1 | FileCheck /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc --check-prefix=CHECK-Darwin --check-prefix=CHECK</div></div><div><div>/Users/kuba/llvm-tot-cmake-release/./bin/clang --driver-mode=g++ -fsanitize=address -mno-omit-leaf-frame-pointer -fno-omit-frame-pointer -fno-optimize-sibling-calls -gline-tables-only -m32 -O3 /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc -o /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp && not  /Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp 2>&1 | FileCheck /Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc --check-prefix=CHECK-Darwin --check-prefix=CHECK</div></div><div><div>--</div></div><div><div>Exit Code: 1</div></div><div><div><br></div></div><div><div>Command Output (stdout):</div></div><div><div>--</div></div><div><div>warning: no debug symbols in executable (-arch i386)</div></div><div><div><br></div></div><div><div>--</div></div><div><div>Command Output (stderr):</div></div><div><div>--</div></div><div><div>/Users/kuba/llvm-tot/projects/compiler-rt/test/asan/TestCases/use-after-free.cc:15:12: error: expected string not found in input</div></div><div><div> // CHECK: {{ #0 0x.* in main .*use-after-free.cc:}}[[@LINE-4]]</div></div><div><div>           ^</div></div><div><div><stdin>:4:2: note: scanning from here</div></div><div><div> #0 0x75e5f in main (/Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp+0x1e5f)</div></div><div><div> ^</div></div><div><div><stdin>:4:2: note: with expression "@LINE-4" equal to "11"</div></div><div><div> #0 0x75e5f in main (/Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp+0x1e5f)</div></div><div><div> ^</div></div><div><div><stdin>:4:97: note: possible intended match here</div></div><div><div> #0 0x75e5f in main (/Users/kuba/llvm-tot-cmake-release/projects/compiler-rt/test/asan/32bitConfig/TestCases/Output/use-after-free.cc.tmp+0x1e5f)</div></div></blockquote><span><font color="#888888"><div><br></div><div>Kuba</div></font></span><div><div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Author: dblaikie<br>Date: Fri Sep 19 12:03:16 2014<br>New Revision: 218129<br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=218129&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=218129&view=rev</a><br>Log:<br>Omit DW_TAG_subprograms for subprograms without inlined subroutines when producing -gmlt data<br>To reduce the size of -gmlt data, skip the subprograms without any<br>inlined subroutines. Since we've now got the ability to make these<br>determinations in the backend (funnily enough - we added the flag so we<br>wouldn't produce ranges under -gmlt, but with this change we use the<br>flag, but go back to producing ranges under -gmlt).<br>Instead, just produce CU ranges to inform the consumer which parts of<br>the code are described by this CU's line table. Tools could inspect the<br>line table directly to compute the range, but the CU ranges only seem to<br>be about 0.5% of object/executable size, so I'm not too worried about<br>teaching llvm-symbolizer that trick just yet - it's certainly a possible<br>piece of future work.<br>Update an llvm-symbolizer test just to demonstrate that this schema is<br>acceptable there (if it wasn't, the compiler-rt tests would catch this,<br>but good to have an in-llvm-tree test for llvm-symbolizer's behavior<br>here)<br>Building the clang binary with -gmlt with this patch reduces the total<br>size of object files by 5.1% (5.56% without ranges) without compression<br>and the executable by 4.37% (4.75% without ranges).<br>Modified:<br>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>    llvm/trunk/test/DebugInfo/Inputs/dwarfdump-inl-test.elf-x86-64<br>    llvm/trunk/test/DebugInfo/gmlt.ll<br>    llvm/trunk/test/DebugInfo/llvm-symbolizer.test</blockquote></div></div></div>
</blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div>