ping<br><br><div class="gmail_quote">On Tue, Feb 28, 2012 at 1:57 PM, Dmitry Vyukov <span dir="ltr"><<a href="mailto:dvyukov@google.com">dvyukov@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<div><br></div><div>I would like to ask you to review and land the following patch.</div><div>It improves SBTarget::SetModuleLoadAddress() (at least for Linux) by skipping sections that are not actually mapped. I had to hack around .tbss section, because it has weird elf representation on Linux (from everything you see in the elf itself it is mapped, but it is actually not).</div>

<div><br><div><br></div><div><div>Index: include/lldb/lldb-enumerations.h</div><div>===================================================================</div><div>--- include/lldb/lldb-enumerations.h<span style="white-space:pre-wrap">     </span>(revision 151625)</div>

<div>+++ include/lldb/lldb-enumerations.h<span style="white-space:pre-wrap">      </span>(working copy)</div><div>@@ -467,6 +467,7 @@</div><div>         eSectionTypeCode,</div><div>         eSectionTypeContainer,              // The section contains child sections</div>

<div>         eSectionTypeData,</div><div>+        eSectionTypeThreadData,             // Thread-local data</div><div>         eSectionTypeDataCString,            // Inlined C string data</div><div>         eSectionTypeDataCStringPointers,    // Pointers to C string data</div>

<div>         eSectionTypeDataSymbolAddress,      // Address of a symbol in the symbol table</div><div>@@ -476,6 +477,7 @@</div><div>         eSectionTypeDataPointers,</div><div>         eSectionTypeDebug,</div><div>         eSectionTypeZeroFill,</div>

<div>+        eSectionTypeThreadZeroFill,         // Thread-local zero data</div><div>         eSectionTypeDataObjCMessageRefs,    // Pointer to function pointer + selector</div><div>         eSectionTypeDataObjCCFStrings,      // Objective C const CFString/NSString objects</div>

<div>         eSectionTypeDWARFDebugAbbrev,</div><div>Index: source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp</div><div>===================================================================</div><div>--- source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp<span style="white-space:pre-wrap">   </span>(revision 151625)</div>

<div>+++ source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp<span style="white-space:pre-wrap">       </span>(working copy)</div><div>@@ -620,6 +620,8 @@</div><div>             static ConstString g_sect_name_text (".text");</div>

<div>             static ConstString g_sect_name_data (".data");</div><div>             static ConstString g_sect_name_bss (".bss");</div><div>+            static ConstString g_sect_name_tdata (".tdata");</div>

<div>+            static ConstString g_sect_name_tbss (".tbss");</div><div>             static ConstString g_sect_name_dwarf_debug_abbrev (".debug_abbrev");</div><div>             static ConstString g_sect_name_dwarf_debug_aranges (".debug_aranges");</div>

<div>             static ConstString g_sect_name_dwarf_debug_frame (".debug_frame");</div><div>@@ -638,6 +640,8 @@</div><div>             if      (name == g_sect_name_text)                  sect_type = eSectionTypeCode;</div>

<div>             else if (name == g_sect_name_data)                  sect_type = eSectionTypeData;</div><div>             else if (name == g_sect_name_bss)                   sect_type = eSectionTypeZeroFill;</div><div>+            else if (name == g_sect_name_tdata)                 sect_type = eSectionTypeThreadData;</div>

<div>+            else if (name == g_sect_name_tbss)                  sect_type = eSectionTypeThreadZeroFill;</div><div>             else if (name == g_sect_name_dwarf_debug_abbrev)    sect_type = eSectionTypeDWARFDebugAbbrev;</div>

<div>             else if (name == g_sect_name_dwarf_debug_aranges)   sect_type = eSectionTypeDWARFDebugAranges;</div><div>             else if (name == g_sect_name_dwarf_debug_frame)     sect_type = eSectionTypeDWARFDebugFrame;</div>

<div>Index: source/API/SBTarget.cpp</div><div>===================================================================</div><div>--- source/API/SBTarget.cpp<span style="white-space:pre-wrap">        </span>(revision 151625)</div>
<div>+++ source/API/SBTarget.cpp<span style="white-space:pre-wrap">       </span>(working copy)</div><div>@@ -2010,7 +2010,19 @@</div><div>                     {</div><div>                         SectionSP section_sp (section_list->GetSectionAtIndex(sect_idx));</div>

<div>                         if (section_sp)</div><div>+                        {</div><div>+                            // These are not actually mapped.</div><div>+                            if (section_sp->GetFileAddress() == 0)</div>

<div>+                                continue;</div><div>+                            // Skip .tbss</div><div>+                            // On Linux I observe that .tbss has some real virtual address</div><div>+                            // and ALLOC flag, but the next section starts at the same address.</div>

<div>+                            // It suggests that .tbss is not actually mapped</div><div>+                            // (even if it is mapped, it should be uninteresting for us).</div><div>+                            if (section_sp->GetType() == eSectionTypeThreadZeroFill)</div>

<div>+                                continue;</div><div>                             target_sp->GetSectionLoadList().SetSectionLoadAddress (section_sp.get(), section_sp->GetFileAddress() + slide_offset);</div><div>

+                        }</div><div>                     }</div><div>                 }</div><div>                 else</div></div><div><br></div></div>
</blockquote></div><br>