diff options
Diffstat (limited to 'lldb/source/Target')
| -rw-r--r-- | lldb/source/Target/SectionLoadList.cpp | 120 | ||||
| -rw-r--r-- | lldb/source/Target/Target.cpp | 20 |
2 files changed, 89 insertions, 51 deletions
diff --git a/lldb/source/Target/SectionLoadList.cpp b/lldb/source/Target/SectionLoadList.cpp index af5636555ae..96713c6ea79 100644 --- a/lldb/source/Target/SectionLoadList.cpp +++ b/lldb/source/Target/SectionLoadList.cpp @@ -61,70 +61,88 @@ SectionLoadList::SetSectionLoadAddress (const lldb::SectionSP §ion, addr_t l { Log *log(lldb_private::GetLogIfAnyCategoriesSet (LIBLLDB_LOG_DYNAMIC_LOADER | LIBLLDB_LOG_VERBOSE)); - if (log) + ModuleSP module_sp (section->GetModule()); + + if (module_sp) { - const FileSpec &module_file_spec (section->GetModule()->GetFileSpec()); - log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ")", - __FUNCTION__, - section.get(), - module_file_spec.GetPath().c_str(), - section->GetName().AsCString(), - load_addr); - } + if (log) + { + const FileSpec &module_file_spec (module_sp->GetFileSpec()); + log->Printf ("SectionLoadList::%s (section = %p (%s.%s), load_addr = 0x%16.16" PRIx64 ") module = %p", + __FUNCTION__, + section.get(), + module_file_spec.GetPath().c_str(), + section->GetName().AsCString(), + load_addr, + module_sp.get()); + } - if (section->GetByteSize() == 0) - return false; // No change + if (section->GetByteSize() == 0) + return false; // No change - // Fill in the section -> load_addr map - Mutex::Locker locker(m_mutex); - sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section.get()); - if (sta_pos != m_sect_to_addr.end()) - { - if (load_addr == sta_pos->second) - return false; // No change... + // Fill in the section -> load_addr map + Mutex::Locker locker(m_mutex); + sect_to_addr_collection::iterator sta_pos = m_sect_to_addr.find(section.get()); + if (sta_pos != m_sect_to_addr.end()) + { + if (load_addr == sta_pos->second) + return false; // No change... + else + sta_pos->second = load_addr; + } else - sta_pos->second = load_addr; - } - else - m_sect_to_addr[section.get()] = load_addr; + m_sect_to_addr[section.get()] = load_addr; - // Fill in the load_addr -> section map - addr_to_sect_collection::iterator ats_pos = m_addr_to_sect.find(load_addr); - if (ats_pos != m_addr_to_sect.end()) - { - // Some sections are ok to overlap, and for others we should warn. When - // we have multiple load addresses that correspond to a section, we will - // allways attribute the section to the be last section that claims it - // exists at that address. Sometimes it is ok for more that one section - // to be loaded at a specific load address, and other times it isn't. - // The "warn_multiple" parameter tells us if we should warn in this case - // or not. The DynamicLoader plug-in subclasses should know which - // sections should warn and which shouldn't (darwin shared cache modules - // all shared the same "__LINKEDIT" sections, so the dynamic loader can - // pass false for "warn_multiple"). - if (warn_multiple && section != ats_pos->second) + // Fill in the load_addr -> section map + addr_to_sect_collection::iterator ats_pos = m_addr_to_sect.find(load_addr); + if (ats_pos != m_addr_to_sect.end()) { - ModuleSP module_sp (section->GetModule()); - if (module_sp) + // Some sections are ok to overlap, and for others we should warn. When + // we have multiple load addresses that correspond to a section, we will + // allways attribute the section to the be last section that claims it + // exists at that address. Sometimes it is ok for more that one section + // to be loaded at a specific load address, and other times it isn't. + // The "warn_multiple" parameter tells us if we should warn in this case + // or not. The DynamicLoader plug-in subclasses should know which + // sections should warn and which shouldn't (darwin shared cache modules + // all shared the same "__LINKEDIT" sections, so the dynamic loader can + // pass false for "warn_multiple"). + if (warn_multiple && section != ats_pos->second) { - ModuleSP curr_module_sp (ats_pos->second->GetModule()); - if (curr_module_sp) + ModuleSP module_sp (section->GetModule()); + if (module_sp) { - module_sp->ReportWarning ("address 0x%16.16" PRIx64 " maps to more than one section: %s.%s and %s.%s", - load_addr, - module_sp->GetFileSpec().GetFilename().GetCString(), - section->GetName().GetCString(), - curr_module_sp->GetFileSpec().GetFilename().GetCString(), - ats_pos->second->GetName().GetCString()); + ModuleSP curr_module_sp (ats_pos->second->GetModule()); + if (curr_module_sp) + { + module_sp->ReportWarning ("address 0x%16.16" PRIx64 " maps to more than one section: %s.%s and %s.%s", + load_addr, + module_sp->GetFileSpec().GetFilename().GetCString(), + section->GetName().GetCString(), + curr_module_sp->GetFileSpec().GetFilename().GetCString(), + ats_pos->second->GetName().GetCString()); + } } } + ats_pos->second = section; } - ats_pos->second = section; + else + m_addr_to_sect[load_addr] = section; + return true; // Changed + } else - m_addr_to_sect[load_addr] = section; - - return true; // Changed + { + if (log) + { + log->Printf ("SectionLoadList::%s (section = %p (%s), load_addr = 0x%16.16" PRIx64 ") error: module has been deleted", + __FUNCTION__, + section.get(), + section->GetName().AsCString(), + load_addr); + } + } + return false; } size_t diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 70ff0469b2c..9f3352536be 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2313,6 +2313,16 @@ g_load_script_from_sym_file_values[] = { 0, NULL, NULL } }; + +static OptionEnumValueElement +g_memory_module_load_level_values[] = +{ + { eMemoryModuleLoadLevelMinimal, "minimal" , "Load minimal information when loading modules from memory which currently loads sections only, no symbols."}, + { eMemoryModuleLoadLevelPartial, "partial" , "Load partial information when loading modules from memory. Currently this setting loads sections and function bounds."}, + { eMemoryModuleLoadLevelComplete, "complete", "Load complete information when loading modules from memory. Currently this setting loads sections and all symbols."}, + { 0, NULL, NULL } +}; + static PropertyDefinition g_properties[] = { @@ -2354,6 +2364,7 @@ g_properties[] = { "hex-immediate-style" , OptionValue::eTypeEnum , false, Disassembler::eHexStyleC, NULL, g_hex_immediate_style_values, "Which style to use for printing hexadecimal disassembly values." }, { "use-fast-stepping" , OptionValue::eTypeBoolean , false, true, NULL, NULL, "Use a fast stepping algorithm based on running from branch to branch rather than instruction single-stepping." }, { "load-script-from-symbol-file" , OptionValue::eTypeEnum , false, eLoadScriptFromSymFileWarn, NULL, g_load_script_from_sym_file_values, "Allow LLDB to load scripting resources embedded in symbol files when available." }, + { "memory-module-load-level" , OptionValue::eTypeEnum , false, eMemoryModuleLoadLevelComplete, NULL, g_memory_module_load_level_values, "Control how much information gets loaded when loading modules from memory. The less information that is gathered, the faster memory modules will be loaded." }, { NULL , OptionValue::eTypeInvalid , false, 0 , NULL, NULL, NULL } }; enum @@ -2385,6 +2396,7 @@ enum ePropertyHexImmediateStyle, ePropertyUseFastStepping, ePropertyLoadScriptFromSymbolFile, + ePropertyMemoryModuleLoadLevel }; @@ -2774,6 +2786,14 @@ TargetProperties::GetHexImmediateStyle () const return (Disassembler::HexImmediateStyle)m_collection_sp->GetPropertyAtIndexAsEnumeration(NULL, idx, g_properties[idx].default_uint_value); } +MemoryModuleLoadLevel +TargetProperties::GetMemoryModuleLoadLevel() const +{ + const uint32_t idx = ePropertyMemoryModuleLoadLevel; + return (MemoryModuleLoadLevel)m_collection_sp->GetPropertyAtIndexAsEnumeration(NULL, idx, g_properties[idx].default_uint_value); +} + + const TargetPropertiesSP & Target::GetGlobalProperties() { |

