<div dir="ltr"><div class="gmail_extra">On Tue, May 28, 2013 at 9:40 AM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><div class="gmail_quote">

<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"><div id=":xe" style="overflow:hidden">The only tricky thing you have to do is to have this second <span class="">ObjectFileELF</span> create section/offset addresses using the sections from the Module's <span class="">object</span> <span class="">file</span>. I am not sure what these debug info files look like, or if they both have the same section definitions. On MacOSX, we have a copy of all the section definitions in the dSYM <span class="">file</span> so any symbols in the extra debug info will get mapped back to the actual sections from the main executable very easily. The dSYM <span class="">file</span> has a symbol table, the symbol table has a section index, so if and when we make symbols in this extra debug symbols <span class="">object</span> <span class="">file</span>, we use the actual section definitions from the actual <span class="">object</span> <span class="">file</span>.</div>

</blockquote></div><div class="gmail_extra"><br></div><div class="gmail_extra" style>First off, thank you for your reply Greg. Very useful as usual.</div><div class="gmail_extra" style><br></div><div class="gmail_extra" style>

The copying sections part seems less than ideal for these elf files. I've taken a very simple app (blah) and stripped the symbols (blah.debug). The section infos for both are down below.<br></div><div class="gmail_extra" style>

<br></div><div class="gmail_extra" style>blah has stripped the .debug_* sections and bumped the following sections down. Plus the .shrstrtab (section names), .symtab (symbol table), and .strtab are all quite different. Several sections are in blah.debug but marked as having no data, so the offsets of the various sections would intersect if just copied.</div>

<div class="gmail_extra" style><br></div><div class="gmail_extra" style>All those .debug sections are only used by ObjectFileELF::GetSymtab() and the routines it calls, yes? Is there anything gained by having an entirely separate SymbolVendorELF abstraction vs. just having ObjectFileELF do the searching and parsing of the .debug routines always - even if that means it loads a separate debug file? Or possibly sections could have a ObjectFileSP so they'll know where to read their data from? I'd (obviously) really like to avoid copying large amounts of data around...</div>

<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Thanks.</div><div class="gmail_extra" style> -Mike</div><div class="gmail_extra" style><br></div><div class="gmail_extra">blah:</div><div class="gmail_extra">

[Nr] Name              Type       Addr   Off   Size  </div><div class="gmail_extra">[ 0]                   NULL       000000 00000 000000</div><div class="gmail_extra">[ 1] .interp           PROGBITS   400238 00238 00001c</div>

<div class="gmail_extra">[ 2] .note.ABI-tag     NOTE       400254 00254 000020</div><div class="gmail_extra">[ 3] .note.gnu.build-i NOTE       400274 00274 000024</div><div class="gmail_extra">[ 4] .gnu.hash         GNU_HASH   400298 00298 004cc0</div>

<div class="gmail_extra">[ 5] .dynsym           DYNSYM     404f58 04f58 00e550</div><div class="gmail_extra">[ 6] .dynstr           STRTAB     4134a8 134a8 026a80</div><div class="gmail_extra">[ 7] .gnu.version      VERSYM     439f28 39f28 00131c</div>

<div class="gmail_extra">[ 8] .gnu.version_r    VERNEED    43b248 3b248 0000d0</div><div class="gmail_extra">[ 9] .rela.dyn         RELA       43b318 3b318 0000a8</div><div class="gmail_extra">[10] .rela.plt         RELA       43b3c0 3b3c0 0009a8</div>

<div class="gmail_extra">[11] .init             PROGBITS   43bd68 3bd68 000018</div><div class="gmail_extra">[12] .plt              PROGBITS   43bd80 3bd80 000680</div><div class="gmail_extra">[13] .text             PROGBITS   43c400 3c400 075cf8</div>

<div class="gmail_extra">[14] .fini             PROGBITS   4b20f8 b20f8 00000e</div><div class="gmail_extra">[15] .rodata           PROGBITS   4b2120 b2120 00be00</div><div class="gmail_extra">[16] .eh_frame_hdr     PROGBITS   4bdf20 bdf20 00387c</div>

<div class="gmail_extra">[17] .eh_frame         PROGBITS   4c17a0 c17a0 01360c</div><div class="gmail_extra">[18] .gcc_except_table PROGBITS   4d4dac d4dac 004f3d</div><div class="gmail_extra">[19] .init_array       INIT_ARRAY 6d9da0 d9da0 000038</div>

<div class="gmail_extra">[20] .ctors            PROGBITS   6d9dd8 d9dd8 000010</div><div class="gmail_extra">[21] .dtors            PROGBITS   6d9de8 d9de8 000010</div><div class="gmail_extra">[22] .jcr              PROGBITS   6d9df8 d9df8 000008</div>

<div class="gmail_extra">[23] .dynamic          DYNAMIC    6d9e00 d9e00 0001e0</div><div class="gmail_extra">[24] .got              PROGBITS   6d9fe0 d9fe0 000008</div><div class="gmail_extra">[25] .got.plt          PROGBITS   6d9fe8 d9fe8 000350</div>

<div class="gmail_extra">[26] .data             PROGBITS   6da338 da338 0000fc</div><div class="gmail_extra">[27] .bss              NOBITS     6da440 da434 000eb0</div><div class="gmail_extra">[28] .comment          PROGBITS   000000 da434 00005a</div>

<div class="gmail_extra">[29] .gnu_debuglink    PROGBITS   000000 da48e 000010</div><div class="gmail_extra">[xx]</div><div class="gmail_extra">[xx]</div><div class="gmail_extra">[xx]</div><div class="gmail_extra">[xx]</div>

<div class="gmail_extra">[xx]</div><div class="gmail_extra">[xx]</div><div class="gmail_extra">[30] .shstrtab         STRTAB     000000 da49e 00012b</div><div class="gmail_extra">[31] .symtab           SYMTAB     000000 dae10 0100b0</div>

<div class="gmail_extra">[32] .strtab           STRTAB     000000 eaec0 02c85f</div><div><br></div><div>blah.debug:<br></div><div><div>[Nr] Name              Type     Addr   Off    Size</div><div>[ 0]                   NULL     000000 000000 000000</div>

<div>[ 1] .interp           NOBITS   400238 000238 00001c</div><div>[ 2] .note.ABI-tag     NOTE     400254 000254 000020</div><div>[ 3] .note.gnu.build-i NOTE     400274 000274 000024</div><div>[ 4] .gnu.hash         NOBITS   400298 000298 004cc0</div>

<div>[ 5] .dynsym           NOBITS   404f58 000298 00e550</div><div>[ 6] .dynstr           NOBITS   4134a8 000298 026a80</div><div>[ 7] .gnu.version      NOBITS   439f28 000298 00131c</div><div>[ 8] .gnu.version_r    NOBITS   43b248 000298 0000d0</div>

<div>[ 9] .rela.dyn         NOBITS   43b318 000298 0000a8</div><div>[10] .rela.plt         NOBITS   43b3c0 000298 0009a8</div><div>[11] .init             NOBITS   43bd68 000298 000018</div><div>[12] .plt              NOBITS   43bd80 000298 000680</div>

<div>[13] .text             NOBITS   43c400 000298 075cf8</div><div>[14] .fini             NOBITS   4b20f8 000298 00000e</div><div>[15] .rodata           NOBITS   4b2120 000298 00be00</div><div>[16] .eh_frame_hdr     NOBITS   4bdf20 000298 00387c</div>

<div>[17] .eh_frame         NOBITS   4c17a0 000298 01360c</div><div>[18] .gcc_except_table NOBITS   4d4dac 000298 004f3d</div><div>[19] .init_array       NOBITS   6d9da0 0d9da0 000038</div><div>[20] .ctors            NOBITS   6d9dd8 0d9da0 000010</div>

<div>[21] .dtors            NOBITS   6d9de8 0d9da0 000010</div><div>[22] .jcr              NOBITS   6d9df8 0d9da0 000008</div><div>[23] .dynamic          NOBITS   6d9e00 0d9da0 0001e0</div><div>[24] .got              NOBITS   6d9fe0 0d9da0 000008</div>

<div>[25] .got.plt          NOBITS   6d9fe8 0d9da0 000350</div><div>[26] .data             NOBITS   6da338 0d9da0 0000fc</div><div>[27] .bss              NOBITS   6da440 0d9da0 000eb0</div><div>[28] .comment          PROGBITS 000000 000298 00005a</div>

<div>[29] .debug_aranges    PROGBITS 000000 0002f2 001ca0</div><div>[30] .debug_info       PROGBITS 000000 001f92 295cc9</div><div>[31] .debug_abbrev     PROGBITS 000000 297c5b 01409a</div><div>[32] .debug_line       PROGBITS 000000 2abcf5 03881d</div>

<div>[33] .debug_str        PROGBITS 000000 2e4512 0f32f8</div><div>[34] .debug_loc        PROGBITS 000000 3d780a 1c031e</div><div>[35] .debug_ranges     PROGBITS 000000 597b28 08e7d0</div><div>[36] .shstrtab         STRTAB   000000 6262f8 000175</div>

<div>[37] .symtab           SYMTAB   000000 626e30 010440</div><div>[38] .strtab           STRTAB   000000 637270 02ca87</div></div><div><br></div></div><div class="gmail_extra"><br></div></div>