[Lldb-commits] [lldb] r107366 - in /lldb/trunk: include/lldb/Core/Address.h source/Core/Address.cpp source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp

Greg Clayton gclayton at apple.com
Wed Jun 30 18:26:43 PDT 2010


Author: gclayton
Date: Wed Jun 30 20:26:43 2010
New Revision: 107366

URL: http://llvm.org/viewvc/llvm-project?rev=107366&view=rev
Log:
Fixed up disassembly to not emit the module name before all function names
that are in the disassembly comments since most of them are in the same
module (shared library). 

Fixed a crasher that could happen when disassembling special section data.

Added an address dump style that shows the symbol context without the module
(used in the disassembly code).


Modified:
    lldb/trunk/include/lldb/Core/Address.h
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp

Modified: lldb/trunk/include/lldb/Core/Address.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Address.h?rev=107366&r1=107365&r2=107366&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Address.h (original)
+++ lldb/trunk/include/lldb/Core/Address.h Wed Jun 30 20:26:43 2010
@@ -86,6 +86,7 @@
                                         ///< be anything from a symbol context summary (module, function/symbol, 
                                         ///< and file and line), to information about what the pointer points to
                                         ///< if the address is in a section (section of pointers, c strings, etc).
+        DumpStyleResolvedDescriptionNoModule,
         DumpStyleDetailedSymbolContext  ///< Detailed symbol context information for an address for all symbol
                                         ///< context members.
     } DumpStyle;

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=107366&r1=107365&r2=107366&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Wed Jun 30 20:26:43 2010
@@ -410,9 +410,13 @@
     if (m_section == NULL)
         style = DumpStyleLoadAddress;
 
+    Target *target = NULL;
     Process *process = NULL;
     if (exe_scope)
+    {
+        target = exe_scope->CalculateTarget();
         process = exe_scope->CalculateProcess();
+    }
     // If addr_byte_size is UINT32_MAX, then determine the correct address
     // byte size for the process or default to the size of addr_t
     if (addr_size == UINT32_MAX)
@@ -475,6 +479,7 @@
         break;
 
     case DumpStyleResolvedDescription:
+    case DumpStyleResolvedDescriptionNoModule:
         if (IsSectionOffset())
         {
             lldb::AddressType addr_type = eAddressTypeLoad;
@@ -524,12 +529,12 @@
                     {
                         if (ReadAddress (exe_scope, *this, pointer_size, so_addr))
                         {
-                            if (so_addr.IsSectionOffset())
+                            if (target && so_addr.IsSectionOffset())
                             {
                                 lldb_private::SymbolContext func_sc;
-                                process->GetTarget().GetImages().ResolveSymbolContextForAddress (so_addr,
-                                                                                                 eSymbolContextEverything,
-                                                                                                 func_sc);
+                                target->GetImages().ResolveSymbolContextForAddress (so_addr,
+                                                                                    eSymbolContextEverything,
+                                                                                    func_sc);
                                 if (func_sc.function || func_sc.symbol)
                                 {
                                     showed_info = true;
@@ -541,7 +546,7 @@
 #endif
                                     Address cstr_addr(*this);
                                     cstr_addr.SetOffset(cstr_addr.GetOffset() + pointer_size);
-                                    func_sc.DumpStopContext(s, process, so_addr, true);
+                                    func_sc.DumpStopContext(s, exe_scope, so_addr, true);
                                     if (ReadAddress (exe_scope, cstr_addr, pointer_size, so_addr))
                                     {
 #if VERBOSE_OUTPUT
@@ -625,7 +630,7 @@
                                     if (pointer_sc.function || pointer_sc.symbol)
                                     {
                                         s->PutCString(": ");
-                                        pointer_sc.DumpStopContext(s, process, so_addr, false);
+                                        pointer_sc.DumpStopContext(s, exe_scope, so_addr, false);
                                     }
                                 }
                             }
@@ -644,20 +649,24 @@
                     if (sc.function || sc.symbol)
                     {
                         bool show_stop_context = true;
+                        bool show_module = (style == DumpStyleResolvedDescription);
                         if (sc.function == NULL && sc.symbol != NULL)
                         {
                             // If we have just a symbol make sure it is in the right section
                             if (sc.symbol->GetAddressRangePtr())
                             {
                                 if (sc.symbol->GetAddressRangePtr()->GetBaseAddress().GetSection() != GetSection())
+                                {
+                                    // don't show the module if the symbol is a trampoline symbol
                                     show_stop_context = false;
+                                }
                             }
                         }
                         if (show_stop_context)
                         {
                             // We have a function or a symbol from the same
                             // sections as this address.
-                            sc.DumpStopContext(s, process, *this, true);
+                            sc.DumpStopContext(s, exe_scope, *this, show_module);
                         }
                         else
                         {

Modified: lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp?rev=107366&r1=107365&r2=107366&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp (original)
+++ lldb/trunk/source/Plugins/Disassembler/llvm/DisassemblerLLVM.cpp Wed Jun 30 20:26:43 2010
@@ -245,7 +245,7 @@
                                         if (process && process->IsAlive())
                                         {
                                             if (process->ResolveLoadAddress (operand_value, so_addr))
-                                                so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
+                                                so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
                                         }
                                         else if (inst_addr_ptr)
                                         {
@@ -253,7 +253,7 @@
                                             if (module)
                                             {
                                                 if (module->ResolveFileAddress (operand_value, so_addr))
-                                                    so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescription, Address::DumpStyleSectionNameOffset);
+                                                    so_addr.Dump(&comment, exe_scope, Address::DumpStyleResolvedDescriptionNoModule, Address::DumpStyleSectionNameOffset);
                                             }
                                         }
 





More information about the lldb-commits mailing list