[Lldb-commits] [lldb] r153693 - in /lldb/trunk: include/lldb/Core/Module.h include/lldb/lldb-enumerations.h source/Commands/CommandObjectTarget.cpp source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Greg Clayton gclayton at apple.com
Thu Mar 29 14:43:25 PDT 2012


Author: gclayton
Date: Thu Mar 29 16:43:25 2012
New Revision: 153693

URL: http://llvm.org/viewvc/llvm-project?rev=153693&view=rev
Log:
<rdar://problem/10103468>

Symbol files (dSYM files on darwin) can now be specified during program execution:

(lldb) target symbols add /path/to/symfile/a.out.dSYM/Contents/Resources/DWARF/a.out

This command can be used when you have a debug session in progress and want to add symbols to get better debug info fidelity.


Modified:
    lldb/trunk/include/lldb/Core/Module.h
    lldb/trunk/include/lldb/lldb-enumerations.h
    lldb/trunk/source/Commands/CommandObjectTarget.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

Modified: lldb/trunk/include/lldb/Core/Module.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/Module.h?rev=153693&r1=153692&r2=153693&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/Module.h (original)
+++ lldb/trunk/include/lldb/Core/Module.h Thu Mar 29 16:43:25 2012
@@ -758,6 +758,8 @@
     SetSymbolFileFileSpec (const FileSpec &file)
     {
         m_symfile_spec = file;
+        m_symfile_ap.reset();
+        m_did_load_symbol_vendor = false;
     }
 
     const TimeValue &

Modified: lldb/trunk/include/lldb/lldb-enumerations.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/lldb-enumerations.h?rev=153693&r1=153692&r2=153693&view=diff
==============================================================================
--- lldb/trunk/include/lldb/lldb-enumerations.h (original)
+++ lldb/trunk/include/lldb/lldb-enumerations.h Thu Mar 29 16:43:25 2012
@@ -250,21 +250,21 @@
     //------------------------------------------------------------------
     typedef enum SymbolContextItem
     {
-        eSymbolContextTarget     = (1 << 0), ///< Set when \a target is requested from a query, or was located in query results
-        eSymbolContextModule     = (1 << 1), ///< Set when \a module is requested from a query, or was located in query results
-        eSymbolContextCompUnit   = (1 << 2), ///< Set when \a comp_unit is requested from a query, or was located in query results
-        eSymbolContextFunction   = (1 << 3), ///< Set when \a function is requested from a query, or was located in query results
-        eSymbolContextBlock      = (1 << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
-        eSymbolContextLineEntry  = (1 << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
-        eSymbolContextSymbol     = (1 << 6), ///< Set when \a symbol is requested from a query, or was located in query results
-        eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1)  ///< Indicates to try and lookup everything up during a query.
+        eSymbolContextTarget     = (1u << 0), ///< Set when \a target is requested from a query, or was located in query results
+        eSymbolContextModule     = (1u << 1), ///< Set when \a module is requested from a query, or was located in query results
+        eSymbolContextCompUnit   = (1u << 2), ///< Set when \a comp_unit is requested from a query, or was located in query results
+        eSymbolContextFunction   = (1u << 3), ///< Set when \a function is requested from a query, or was located in query results
+        eSymbolContextBlock      = (1u << 4), ///< Set when the deepest \a block is requested from a query, or was located in query results
+        eSymbolContextLineEntry  = (1u << 5), ///< Set when \a line_entry is requested from a query, or was located in query results
+        eSymbolContextSymbol     = (1u << 6), ///< Set when \a symbol is requested from a query, or was located in query results
+        eSymbolContextEverything = ((eSymbolContextSymbol << 1) - 1u)  ///< Indicates to try and lookup everything up during a query.
     } SymbolContextItem;
 
     typedef enum Permissions
     {
-        ePermissionsWritable = (1 << 0),
-        ePermissionsReadable = (1 << 1),
-        ePermissionsExecutable = (1 << 2)
+        ePermissionsWritable    = (1u << 0),
+        ePermissionsReadable    = (1u << 1),
+        ePermissionsExecutable  = (1u << 2)
     } Permissions;
 
     typedef enum InputReaderAction

Modified: lldb/trunk/source/Commands/CommandObjectTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectTarget.cpp?rev=153693&r1=153692&r2=153693&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectTarget.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectTarget.cpp Thu Mar 29 16:43:25 2012
@@ -3559,55 +3559,16 @@
                                 ModuleSP old_module_sp (target->GetImages().FindModule (symfile_module_sp->GetUUID()));
                                 if (old_module_sp)
                                 {
-                                    const bool can_create = false;
-                                    if (old_module_sp->GetSymbolVendor (can_create))
-                                    {
-                                        // The current module already has a symbol file, so we need
-                                        // need to unload the existing references to this module,
-                                        // and reload with the new one.
-                                        
-                                        ModuleSP target_exe_module_sp (target->GetExecutableModule());
-                                        const bool adding_symbols_to_executable = target_exe_module_sp.get() == old_module_sp.get();
-                                        ModuleSpec module_spec (old_module_sp->GetFileSpec(), old_module_sp->GetArchitecture());
-                                        module_spec.GetSymbolFileSpec() = symfile_spec;
-                                        // Unload the old module
-                                        ModuleList module_list;
-                                        module_list.Append (old_module_sp);
-                                        target->ModulesDidUnload (module_list);
-
-                                        // Remove the module from the shared list
-                                        ModuleList::RemoveSharedModule (old_module_sp);
-
-                                        // Now create the new module and load it
-                                        module_list.Clear();
-                                        //ModuleSP new_module_sp (new Module (target_module_file, target_module_arch));
-                                        ModuleSP new_module_sp;
-                                                                
-                                        new_module_sp = target->GetSharedModule (module_spec);
-                                                        
-                                        if (new_module_sp)
-                                        {
-                                            new_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
-                                            
-                                            if (adding_symbols_to_executable)
-                                            {
-                                                bool get_dependent_files = true;
-                                                target->SetExecutableModule(new_module_sp, get_dependent_files);
-                                            }
-                                            else
-                                            {
-                                                module_list.Append (new_module_sp);
-                                                target->ModulesDidLoad(module_list);
-                                            }
-                                        }
-                                    }
-                                    else
-                                    {
-                                        // The module has not yet created its symbol vendor, we can just
-                                        // give the existing target module the symfile path to use for
-                                        // when it decides to create it!
-                                        old_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
-                                    }
+                                    // The module has not yet created its symbol vendor, we can just
+                                    // give the existing target module the symfile path to use for
+                                    // when it decides to create it!
+                                    old_module_sp->SetSymbolFileFileSpec (symfile_module_sp->GetFileSpec());
+
+                                    // Let clients know something changed in the module
+                                    // if it is currently loaded
+                                    ModuleList module_list;
+                                    module_list.Append (old_module_sp);
+                                    target->ModulesDidLoad (module_list);
                                 }
                             }
                             else

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=153693&r1=153692&r2=153693&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu Mar 29 16:43:25 2012
@@ -2311,6 +2311,17 @@
                             if (sc.function == NULL)
                                 sc.function = ParseCompileUnitFunction(sc, curr_cu, function_die);
                         }
+                        else
+                        {
+                            // We might have had a compile unit that had discontiguous
+                            // address ranges where the gaps are symbols that don't have
+                            // any debug info. Discontiguous compile unit address ranges
+                            // should only happen when there aren't other functions from
+                            // other compile units in these gaps. This helps keep the size
+                            // of the aranges down.
+                            sc.comp_unit = NULL;
+                            resolved &= ~eSymbolContextCompUnit;
+                        }
 
                         if (sc.function != NULL)
                         {





More information about the lldb-commits mailing list