[Lldb-commits] [lldb] r121154 - /lldb/trunk/source/Core/Section.cpp

Greg Clayton gclayton at apple.com
Tue Dec 7 10:05:22 PST 2010


Author: gclayton
Date: Tue Dec  7 12:05:22 2010
New Revision: 121154

URL: http://llvm.org/viewvc/llvm-project?rev=121154&view=rev
Log:
Improved the "image dump section" command output by making sure
it indents and shows things correctly. When we are debugging DWARF
in .o files with debug map, we can see the remapped sections by
dumping the sections for the .o files by explicitly dumping the
module by name. For example, debugging the lldb/test/class_types
example on MacOSX without a dSYM file we can make a query that 
causes the main.o file to be loaded, then we can do a:

(lldb) image dump section main.o

This will show the exact section map that is used and can help
track down when things are going wrong with DWARF in .o files with
debug map.


Modified:
    lldb/trunk/source/Core/Section.cpp

Modified: lldb/trunk/source/Core/Section.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Section.cpp?rev=121154&r1=121153&r2=121154&view=diff
==============================================================================
--- lldb/trunk/source/Core/Section.cpp (original)
+++ lldb/trunk/source/Core/Section.cpp Tue Dec  7 12:05:22 2010
@@ -234,7 +234,7 @@
         s->Printf("%39s", "");
     else
     {
-        if (target)
+        if (target && m_linked_section == NULL)
             addr = GetLoadBaseAddress (target);
 
         if (addr == LLDB_INVALID_ADDRESS)
@@ -257,7 +257,7 @@
     if (m_linked_section)
     {
         addr = LLDB_INVALID_ADDRESS;
-
+        resolved = true;
         if (target)
         {
             addr = m_linked_section->GetLoadBaseAddress(target);
@@ -668,6 +668,7 @@
 void
 SectionList::Dump (Stream *s, Target *target, bool show_header) const
 {
+    bool target_has_loaded_sections = target && !target->GetSectionLoadList().IsEmpty();
     if (show_header && !m_sections.empty())
     {
 //        s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
@@ -676,7 +677,7 @@
 //        s->IndentMore();
 //        s->Printf("%*s", 2*(sizeof(void *) + 2), "");
         s->Indent();
-        s->Printf("SectID     Type           %s Address                             File Off.  File Size  Flags      Section Name\n", (target && target->GetSectionLoadList().IsEmpty() == false) ? "Load" : "File");
+        s->Printf("SectID     Type           %s Address                             File Off.  File Size  Flags      Section Name\n", target_has_loaded_sections ? "Load" : "File");
 //        s->Printf("%*s", 2*(sizeof(void *) + 2), "");
         s->Indent();
         s->PutCString("---------- -------------- ---------------------------------------  ---------- ---------- ---------- ----------------------------\n");
@@ -687,7 +688,7 @@
     const_iterator end = m_sections.end();
     for (sect_iter = m_sections.begin(); sect_iter != end; ++sect_iter)
     {
-        (*sect_iter)->Dump(s, target);
+        (*sect_iter)->Dump(s, target_has_loaded_sections ? target : NULL);
     }
 
     if (show_header && !m_sections.empty())





More information about the lldb-commits mailing list