diff options
-rw-r--r-- | lldb/include/lldb/Core/Module.h | 2 | ||||
-rw-r--r-- | lldb/include/lldb/lldb-enumerations.h | 22 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 59 | ||||
-rw-r--r-- | lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 11 |
4 files changed, 34 insertions, 60 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h index 9c596e11fe7..73b79b94823 100644 --- a/lldb/include/lldb/Core/Module.h +++ b/lldb/include/lldb/Core/Module.h @@ -758,6 +758,8 @@ public: SetSymbolFileFileSpec (const FileSpec &file) { m_symfile_spec = file; + m_symfile_ap.reset(); + m_did_load_symbol_vendor = false; } const TimeValue & diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 6960cacb408..6447f9d398a 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -250,21 +250,21 @@ namespace lldb { //------------------------------------------------------------------ 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 diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 2d0014a3897..17d5fd53b1c 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -3559,55 +3559,16 @@ public: 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 diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 7ccd6f24d86..899928c38a5 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2311,6 +2311,17 @@ SymbolFileDWARF::ResolveSymbolContext (const Address& so_addr, uint32_t resolve_ 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) { |