[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
jankratochvil marked 5 inline comments as done. jankratochvil added a comment. In https://reviews.llvm.org/D47275#1110065, @clayborg wrote: > Marked things that don't belong in DWARFBasicDIE. OK, sorry, thanks for reviewing it. > Also DWARFBasicDIE doesn't really explain what it actually is. Maybe we > should rename this DWARFUnitDIE? DWARFTopDIE? DWARFRootDIE? I do not mind any name but if you do not like Pavel's `DWARFBasicDIE` and you are not sure with the name yourself I have chosen `DWARFFirstDIE`. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
jankratochvil updated this revision to Diff 148360. https://reviews.llvm.org/D47275 Files: source/Plugins/SymbolFile/DWARF/CMakeLists.txt source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp source/Plugins/SymbolFile/DWARF/DWARFDIE.h source/Plugins/SymbolFile/DWARF/DWARFFirstDIE.cpp source/Plugins/SymbolFile/DWARF/DWARFFirstDIE.h Index: source/Plugins/SymbolFile/DWARF/DWARFFirstDIE.h === --- /dev/null +++ source/Plugins/SymbolFile/DWARF/DWARFFirstDIE.h @@ -0,0 +1,157 @@ +//===-- DWARFFirstDIE.h -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef SymbolFileDWARF_DWARFFirstDIE_h_ +#define SymbolFileDWARF_DWARFFirstDIE_h_ + +#include "lldb/Core/dwarf.h" +#include "lldb/lldb-types.h" + +struct DIERef; +class DWARFASTParser; +class DWARFAttributes; +class DWARFUnit; +class DWARFDebugInfoEntry; +class DWARFDeclContext; +class DWARFDIECollection; +class SymbolFileDWARF; + +class DWARFFirstDIE { +public: + DWARFFirstDIE() : m_cu(nullptr), m_die(nullptr) {} + + DWARFFirstDIE(DWARFUnit *cu, DWARFDebugInfoEntry *die) + : m_cu(cu), m_die(die) {} + + DWARFFirstDIE(const DWARFUnit *cu, DWARFDebugInfoEntry *die) + : m_cu(const_cast(cu)), m_die(die) {} + + DWARFFirstDIE(DWARFUnit *cu, const DWARFDebugInfoEntry *die) + : m_cu(cu), m_die(const_cast(die)) {} + + DWARFFirstDIE(const DWARFUnit *cu, const DWARFDebugInfoEntry *die) + : m_cu(const_cast(cu)), +m_die(const_cast(die)) {} + + //-- + // Tests + //-- + explicit operator bool() const { return IsValid(); } + + bool IsValid() const { return m_cu && m_die; } + + bool HasChildren() const; + + bool Supports_DW_AT_APPLE_objc_complete_type() const; + + //-- + // Accessors + //-- + SymbolFileDWARF *GetDWARF() const; + + DWARFUnit *GetCU() const { return m_cu; } + + DWARFDebugInfoEntry *GetDIE() const { return m_die; } + + DIERef GetDIERef() const; + + lldb_private::TypeSystem *GetTypeSystem() const; + + DWARFASTParser *GetDWARFParser() const; + + void Set(DWARFUnit *cu, DWARFDebugInfoEntry *die) { +if (cu && die) { + m_cu = cu; + m_die = die; +} else { + Clear(); +} + } + + void Clear() { +m_cu = nullptr; +m_die = nullptr; + } + + //-- + // Get the data that contains the attribute values for this DIE. Support + // for .debug_types means that any DIE can have its data either in the + // .debug_info or the .debug_types section; this method will return the + // correct section data. + // + // Clients must validate that this object is valid before calling this. + //-- + const lldb_private::DWARFDataExtractor &GetData() const; + + //-- + // Accessing information about a DIE + //-- + dw_tag_t Tag() const; + + const char *GetTagAsCString() const; + + dw_offset_t GetOffset() const; + + dw_offset_t GetCompileUnitRelativeOffset() const; + + //-- + // Get the LLDB user ID for this DIE. This is often just the DIE offset, + // but it might have a SymbolFileDWARF::GetID() in the high 32 bits if + // we are doing Darwin DWARF in .o file, or DWARF stand alone debug + // info. + //-- + lldb::user_id_t GetID() const; + + const char *GetName() const; + + lldb::LanguageType GetLanguage() const; + + lldb::ModuleSP GetModule() const; + + lldb_private::CompileUnit *GetLLDBCompileUnit() const; + + //-- + // Getting attribute values from the DIE. + // + // GetAttributeValueAsXXX() functions should only be used if you are + // looking for one or two attributes on a DIE. If you are trying to + // parse all attributes, use GetAttributes (...) instead + //-- + const char *GetAttributeValueAsString(const dw_attr_t attr, +const char *fail_value) const; + + uint64_t GetAttributeValueAsUnsigned(const dw_attr_t attr, + uint64_t fail_value) const; + + int64_t GetAttri
[Lldb-commits] [PATCH] D47276: 2/3: Use DWARFBasicDIE as compile-time protection
jankratochvil updated this revision to Diff 148362. https://reviews.llvm.org/D47276 Files: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -748,7 +748,7 @@ } else { ModuleSP module_sp(m_obj_file->GetModule()); if (module_sp) { - const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFDIE cu_die = dwarf_cu->DIE(); if (cu_die) { FileSpec cu_file_spec{cu_die.GetName(), false}; if (cu_file_spec) { @@ -883,7 +883,7 @@ assert(sc.comp_unit); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFFirstDIE cu_die = dwarf_cu->GetUnitDIEOnly(); if (cu_die) { FileSpec cu_comp_dir = resolveCompDir( @@ -922,7 +922,7 @@ UpdateExternalModuleListIfNeeded(); if (sc.comp_unit) { -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFDIE die = dwarf_cu->DIE(); if (die) { for (DWARFDIE child_die = die.GetFirstChild(); child_die; @@ -997,7 +997,7 @@ DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFFirstDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); if (dwarf_cu_die) { const dw_offset_t cu_line_offset = dwarf_cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list, @@ -1082,7 +1082,7 @@ if (dwarf_cu == nullptr) return false; - const DWARFDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFFirstDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); if (!dwarf_cu_die) return false; @@ -1578,7 +1578,7 @@ for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) { DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFFirstDIE die = dwarf_cu->GetUnitDIEOnly(); if (die && die.HasChildren() == false) { const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr); Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -110,7 +110,7 @@ void SetBaseAddress(dw_addr_t base_addr); - DWARFDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } + DWARFFirstDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); } Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -209,7 +209,7 @@ if (!dwo_cu) return; // Can't fetch the compile unit from the dwo file. - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFFirstDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return; // Can't fetch the compile unit DIE from the dwo file. Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -638,7 +638,7 @@ void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, Stream &s) const { - const DWARFDIE cu_die = cu->GetUnitDIEOnly(); + const DWARFFirstDIE cu_die = cu->GetUnitDIEOnly(); const char *cu_name = NULL; if (cu_die) cu_name = cu_die.GetName(); @@ -912,7 +912,7 @@ if (!dwo_cu) return 0; - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFFirstDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return 0; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
labath added a reviewer: aprantl. labath added a comment. I don't think a name like `DWARFUnitDIE` is a good one bacause it would make a weird `is-a` relationship (a DWARFDIE represetning a DW_TAG_variable is certainly **not** a "unit DIE" yet you could assign it to a `DWARFUnitDIE&`). We could have a DWARFUnitDIE type if we wanted to, but that would have to be a special type in addition to DWARFBasicDIE. However, I think that would be overkill. That said, if everyone who is going to be calling `IsStructOrClass` and friends will see the type as `DWARFDIE` then keeping those methods on that class makes sense. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47278: Remove lldb-private headers when building LLDB.framework with CMake
labath added a comment. From a layering perspective, it makes sense for SystemInitializerFull to live in the outermost layer, as it's the thing which makes sure liblldb pulls in all required components. Since it is only included from files in `source/API` (which is as it should be), maybe we could just make it a private header and move the file to `source/API/SystemInitializerFull.h` ? https://reviews.llvm.org/D47278 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
labath added a comment. Looks like we missed each other, but all I said about DWARFUnitDIE applies to DWARFFirstDIE as well. I doesn't have to be called "basic" die, but the reason I proposed that name is that it does not sound weird when you say that any die "is a" basic die. Other possibility would be to keep DWARFDIE as the "basic" die, and have a something like a "navigatable" die for those that allow you to access children and stuff. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333173 - Add PPC64le support information
Author: labath Date: Thu May 24 04:17:02 2018 New Revision: 333173 URL: http://llvm.org/viewvc/llvm-project?rev=333173&view=rev Log: Add PPC64le support information Summary: Add PPC64le support information on LLDB site Reviewers: clayborg Reviewed By: clayborg Subscribers: labath, lldb-commits, lbianc, clayborg Differential Revision: https://reviews.llvm.org/D47285 Patch by Alexandre Yukio Yamashita . Modified: lldb/trunk/www/features.html lldb/trunk/www/index.html lldb/trunk/www/status.html Modified: lldb/trunk/www/features.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/features.html?rev=333173&r1=333172&r2=333173&view=diff == --- lldb/trunk/www/features.html (original) +++ lldb/trunk/www/features.html Thu May 24 04:17:02 2018 @@ -38,7 +38,7 @@ for an executable object. Disassembly plug-ins for each architecture. Support currently includes an LLVM disassembler for http://blog.llvm.org/2010/01/x86-disassembler.html";>i386, x86-64 - , & ARM/Thumb. + , ARM/Thumb, and PPC64le Debugger plug-ins implement the host and target specific functions required to debug. @@ -57,4 +57,4 @@ - \ No newline at end of file + Modified: lldb/trunk/www/index.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/index.html?rev=333173&r1=333172&r2=333173&view=diff == --- lldb/trunk/www/index.html (original) +++ lldb/trunk/www/index.html Thu May 24 04:17:02 2018 @@ -92,7 +92,7 @@ Mac OS X desktop user space debugging for i386 and x86-64 iOS simulator debugging on i386 iOS device debugging on ARM - Linux local user-space debugging for i386 and x86-64 + Linux local user-space debugging for i386, x86-64 and PPC64le FreeBSD local user-space debugging for i386 and x86-64 Windows local user-space debugging for i386 (*) Modified: lldb/trunk/www/status.html URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/www/status.html?rev=333173&r1=333172&r2=333173&view=diff == --- lldb/trunk/www/status.html (original) +++ lldb/trunk/www/status.html Thu May 24 04:17:02 2018 @@ -60,7 +60,7 @@ Feature FreeBSD(x86_64) -Linux(x86_64) +Linux(x86_64 and PPC64le) Mac OS X (i386/x86_64 and ARM/Thumb) Windows (i386) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47285: Add PPC64le support information
This revision was automatically updated to reflect the committed changes. Closed by commit rL333173: Add PPC64le support information (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D47285 Files: lldb/trunk/www/features.html lldb/trunk/www/index.html lldb/trunk/www/status.html Index: lldb/trunk/www/features.html === --- lldb/trunk/www/features.html +++ lldb/trunk/www/features.html @@ -38,7 +38,7 @@ for an executable object. Disassembly plug-ins for each architecture. Support currently includes an LLVM disassembler for http://blog.llvm.org/2010/01/x86-disassembler.html";>i386, x86-64 - , & ARM/Thumb. + , ARM/Thumb, and PPC64le Debugger plug-ins implement the host and target specific functions required to debug. @@ -57,4 +57,4 @@ - \ No newline at end of file + Index: lldb/trunk/www/index.html === --- lldb/trunk/www/index.html +++ lldb/trunk/www/index.html @@ -92,7 +92,7 @@ Mac OS X desktop user space debugging for i386 and x86-64 iOS simulator debugging on i386 iOS device debugging on ARM - Linux local user-space debugging for i386 and x86-64 + Linux local user-space debugging for i386, x86-64 and PPC64le FreeBSD local user-space debugging for i386 and x86-64 Windows local user-space debugging for i386 (*) Index: lldb/trunk/www/status.html === --- lldb/trunk/www/status.html +++ lldb/trunk/www/status.html @@ -60,7 +60,7 @@ Feature FreeBSD(x86_64) -Linux(x86_64) +Linux(x86_64 and PPC64le) Mac OS X (i386/x86_64 and ARM/Thumb) Windows (i386) Index: lldb/trunk/www/features.html === --- lldb/trunk/www/features.html +++ lldb/trunk/www/features.html @@ -38,7 +38,7 @@ for an executable object. Disassembly plug-ins for each architecture. Support currently includes an LLVM disassembler for http://blog.llvm.org/2010/01/x86-disassembler.html";>i386, x86-64 - , & ARM/Thumb. + , ARM/Thumb, and PPC64le Debugger plug-ins implement the host and target specific functions required to debug. @@ -57,4 +57,4 @@ - \ No newline at end of file + Index: lldb/trunk/www/index.html === --- lldb/trunk/www/index.html +++ lldb/trunk/www/index.html @@ -92,7 +92,7 @@ Mac OS X desktop user space debugging for i386 and x86-64 iOS simulator debugging on i386 iOS device debugging on ARM - Linux local user-space debugging for i386 and x86-64 + Linux local user-space debugging for i386, x86-64 and PPC64le FreeBSD local user-space debugging for i386 and x86-64 Windows local user-space debugging for i386 (*) Index: lldb/trunk/www/status.html === --- lldb/trunk/www/status.html +++ lldb/trunk/www/status.html @@ -60,7 +60,7 @@ Feature FreeBSD(x86_64) -Linux(x86_64) +Linux(x86_64 and PPC64le) Mac OS X (i386/x86_64 and ARM/Thumb) Windows (i386) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333178 - DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex
Author: labath Date: Thu May 24 05:12:49 2018 New Revision: 333178 URL: http://llvm.org/viewvc/llvm-project?rev=333178&view=rev Log: DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex Summary: I think this makes sense for several reasons: - better separation of concerns: DWARFUnit's job should be to provide a nice interface to its users to access the unit contents. ManualDWARFIndex can then use this interface to build an index and provide it to its users. - closer alignment with llvm parsers: there is no indexing equivalent in llvm, and there probably never will be, as the index is very centered around how lldb wants to access debug info. If we ever switch to llvm's parser, this will allow us swap out DWARFUnit implementations and keep indexing as-is. - closer proximity of the indexing code to AppleDWARFIndex will make it easier to keep the two in sync (e.g. right now the two use very different algorithms to determine whether a DW_TAG_subroutine represents a "method"). This is my primary motivation for making this change now, but I am leaving this work to a separate patch. The only interface change to DWARFUnit I needed to make was to add an efficient way to iterate over the list of all DIEs. Adding this also aligns us closer to the llvm parser. Reviewers: JDevlieghere, clayborg, aprantl Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D47253 Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333178&r1=333177&r2=333178&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Thu May 24 05:12:49 2018 @@ -9,20 +9,18 @@ #include "DWARFUnit.h" -#include "Plugins/Language/ObjC/ObjCLanguage.h" #include "lldb/Core/Module.h" #include "lldb/Host/StringConvert.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "DWARFDIECollection.h" -#include "DWARFDebugAbbrev.h" #include "DWARFDebugAranges.h" #include "DWARFDebugInfo.h" #include "LogChannelDWARF.h" -#include "NameToDIE.h" #include "SymbolFileDWARFDebugMap.h" #include "SymbolFileDWARFDwo.h" @@ -627,332 +625,6 @@ SymbolFileDWARFDwo *DWARFUnit::GetDwoSym dw_offset_t DWARFUnit::GetBaseObjOffset() const { return m_base_obj_offset; } -void DWARFUnit::Index(NameToDIE &func_basenames, NameToDIE &func_fullnames, - NameToDIE &func_methods, NameToDIE &func_selectors, - NameToDIE &objc_class_selectors, NameToDIE &globals, - NameToDIE &types, NameToDIE &namespaces) { - assert(!m_dwarf->GetBaseCompileUnit() && - "DWARFUnit associated with .dwo or .dwp " - "should not be indexed directly"); - - Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); - - if (log) { -m_dwarf->GetObjectFile()->GetModule()->LogMessage( -log, "DWARFUnit::Index() for compile unit at .debug_info[0x%8.8x]", -GetOffset()); - } - - const LanguageType cu_language = GetLanguageType(); - DWARFFormValue::FixedFormSizes fixed_form_sizes = - DWARFFormValue::GetFixedFormSizesForAddressSize(GetAddressByteSize(), - IsDWARF64()); - - IndexPrivate(this, cu_language, fixed_form_sizes, GetOffset(), func_basenames, - func_fullnames, func_methods, func_selectors, - objc_class_selectors, globals, types, namespaces); - - SymbolFileDWARFDwo *dwo_symbol_file = GetDwoSymbolFile(); - if (dwo_symbol_file) { -IndexPrivate( -dwo_symbol_file->GetCompileUnit(), cu_language, fixed_form_sizes, -GetOffset(), func_basenames, func_fullnames, func_methods, -func_selectors, objc_class_selectors, globals, types, namespaces); - } -} - -void DWARFUnit::IndexPrivate( -DWARFUnit *dwarf_cu, const LanguageType cu_language, -const DWARFFormValue::FixedFormSizes &fixed_form_sizes, -const dw_offset_t cu_offset, NameToDIE &func_basenames, -NameToDIE &func_fullnames, NameToDIE &func_methods, -NameToDIE &func_selectors, NameToDIE &objc_class_selectors, -NameToDIE &globals, NameToDIE &types, NameToDIE &namespaces) { - DWARFDebugInfoEntry::const_iterator pos; - DWARFDebugInfoEntry::const_iterator begin = dwarf_cu->m_die_array.begin(); - DWARFDebugInfoEntry::const_iterator end = dwarf_cu->m_die_array.end(); - for (pos = begin; pos != end;
[Lldb-commits] [PATCH] D47253: DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex
This revision was automatically updated to reflect the committed changes. Closed by commit rL333178: DWARF: Move indexing code from DWARFUnit to ManualDWARFIndex (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D47253 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -33,6 +33,9 @@ class DWARFUnit { friend class DWARFCompileUnit; + using die_iterator_range = + llvm::iterator_range; + public: virtual ~DWARFUnit(); @@ -134,11 +137,6 @@ bool Supports_unnamed_objc_bitfields(); - void Index(NameToDIE &func_basenames, NameToDIE &func_fullnames, - NameToDIE &func_methods, NameToDIE &func_selectors, - NameToDIE &objc_class_selectors, NameToDIE &globals, - NameToDIE &types, NameToDIE &namespaces); - SymbolFileDWARF *GetSymbolFileDWARF() const; DWARFProducer GetProducer(); @@ -161,6 +159,11 @@ dw_offset_t GetBaseObjOffset() const; + die_iterator_range dies() { +ExtractDIEsIfNeeded(false); +return die_iterator_range(m_die_array.begin(), m_die_array.end()); + } + protected: DWARFUnit(SymbolFileDWARF *dwarf); @@ -190,14 +193,6 @@ // in the main object file dw_offset_t m_base_obj_offset = DW_INVALID_OFFSET; - static void - IndexPrivate(DWARFUnit *dwarf_cu, const lldb::LanguageType cu_language, - const DWARFFormValue::FixedFormSizes &fixed_form_sizes, - const dw_offset_t cu_offset, NameToDIE &func_basenames, - NameToDIE &func_fullnames, NameToDIE &func_methods, - NameToDIE &func_selectors, NameToDIE &objc_class_selectors, - NameToDIE &globals, NameToDIE &types, NameToDIE &namespaces); - // Offset of the initial length field. dw_offset_t m_offset; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.h @@ -53,6 +53,18 @@ private: void Index(); + void IndexUnit(DWARFUnit &unit, NameToDIE &func_basenames, + NameToDIE &func_fullnames, NameToDIE &func_methods, + NameToDIE &func_selectors, NameToDIE &objc_class_selectors, + NameToDIE &globals, NameToDIE &types, NameToDIE &namespaces); + + static void + IndexUnitImpl(DWARFUnit &unit, const lldb::LanguageType cu_language, +const DWARFFormValue::FixedFormSizes &fixed_form_sizes, +const dw_offset_t cu_offset, NameToDIE &func_basenames, +NameToDIE &func_fullnames, NameToDIE &func_methods, +NameToDIE &func_selectors, NameToDIE &objc_class_selectors, +NameToDIE &globals, NameToDIE &types, NameToDIE &namespaces); /// Non-null value means we haven't built the index yet. DWARFDebugInfo *m_debug_info; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -9,20 +9,18 @@ #include "DWARFUnit.h" -#include "Plugins/Language/ObjC/ObjCLanguage.h" #include "lldb/Core/Module.h" #include "lldb/Host/StringConvert.h" #include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Utility/StreamString.h" #include "lldb/Utility/Timer.h" #include "DWARFDIECollection.h" -#include "DWARFDebugAbbrev.h" #include "DWARFDebugAranges.h" #include "DWARFDebugInfo.h" #include "LogChannelDWARF.h" -#include "NameToDIE.h" #include "SymbolFileDWARFDebugMap.h" #include "SymbolFileDWARFDwo.h" @@ -627,332 +625,6 @@ dw_offset_t DWARFUnit::GetBaseObjOffset() const { return m_base_obj_offset; } -void DWARFUnit::Index(NameToDIE &func_basenames, NameToDIE &func_fullnames, - NameToDIE &func_methods, NameToDIE &func_selectors, - NameToDIE &objc_class_selectors, NameToDIE &globals, - NameToDIE &types, NameToDIE &namespaces) { - assert(!m_dwarf->GetBaseCompileUnit() && - "DWARFUnit associated with .dwo or .dwp " - "should not be indexed directly"); - - Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS)); - - if (log) { -m_dwarf->GetObjectFile()->GetModule()->LogMessage( -log, "DWARFUnit::Index
[Lldb-commits] [lldb] r333182 - Move ObjectFile initialization out of SystemInitializerCommon
Author: labath Date: Thu May 24 05:44:18 2018 New Revision: 333182 URL: http://llvm.org/viewvc/llvm-project?rev=333182&view=rev Log: Move ObjectFile initialization out of SystemInitializerCommon Summary: For lldb-server, it is sufficient to parse only the native object file format for its target OS (no other file can be loaded into a running process). This moves the object file initialization code into specific initializer classes: lldb-test and liblldb get all object files; lldb-server gets only one of them. For this to work, I've needed to create a special SystemInitializer for use in lldb-server, instead of it calling directly into the common one. This reduces the size of lldb-server by about 2%, which is not earth-shattering, but it's an easy win, and it helps. Reviewers: zturner, clayborg Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D47250 Added: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h Modified: lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Initialization/CMakeLists.txt lldb/trunk/source/Initialization/SystemInitializerCommon.cpp lldb/trunk/tools/lldb-server/CMakeLists.txt lldb/trunk/tools/lldb-server/lldb-server.cpp lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp Modified: lldb/trunk/source/API/SystemInitializerFull.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SystemInitializerFull.cpp?rev=333182&r1=333181&r2=333182&view=diff == --- lldb/trunk/source/API/SystemInitializerFull.cpp (original) +++ lldb/trunk/source/API/SystemInitializerFull.cpp Thu May 24 05:44:18 2018 @@ -70,6 +70,9 @@ #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" +#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" #include "Plugins/OperatingSystem/Go/OperatingSystemGo.h" #include "Plugins/OperatingSystem/Python/OperatingSystemPython.h" #include "Plugins/Platform/Android/PlatformAndroid.h" @@ -251,6 +254,11 @@ SystemInitializerFull::~SystemInitialize void SystemInitializerFull::Initialize() { SystemInitializerCommon::Initialize(); + + ObjectFileELF::Initialize(); + ObjectFileMachO::Initialize(); + ObjectFilePECOFF::Initialize(); + ScriptInterpreterNone::Initialize(); #ifndef LLDB_DISABLE_PYTHON @@ -514,6 +522,10 @@ void SystemInitializerFull::Terminate() PlatformDarwinKernel::Terminate(); #endif + ObjectFileELF::Terminate(); + ObjectFileMachO::Terminate(); + ObjectFilePECOFF::Terminate(); + // Now shutdown the common parts, in reverse order. SystemInitializerCommon::Terminate(); } Modified: lldb/trunk/source/Initialization/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/CMakeLists.txt?rev=333182&r1=333181&r2=333182&view=diff == --- lldb/trunk/source/Initialization/CMakeLists.txt (original) +++ lldb/trunk/source/Initialization/CMakeLists.txt Thu May 24 05:44:18 2018 @@ -19,9 +19,6 @@ add_lldb_library(lldbInitialization lldbPluginInstructionMIPS64 lldbPluginObjectContainerBSDArchive lldbPluginObjectContainerMachOArchive -lldbPluginObjectFileELF -lldbPluginObjectFileMachO -lldbPluginObjectFilePECOFF lldbPluginProcessGDBRemote ${EXTRA_PLUGINS} ${LLDB_SYSTEM_LIBS} Modified: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Initialization/SystemInitializerCommon.cpp?rev=333182&r1=333181&r2=333182&view=diff == --- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp (original) +++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp Thu May 24 05:44:18 2018 @@ -14,14 +14,11 @@ #include "Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.h" #include "Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.h" #include "Plugins/ObjectContainer/Universal-Mach-O/ObjectContainerUniversalMachO.h" -#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" -#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" #include "Plugins/Process/gdb-remote/ProcessGDBRemoteLog.h" #include "lldb/Host/Host.h" #include "lldb/Host/HostInfo.h" #include "lldb/Utility/Log.h" #include "lldb/Utility/Timer.h" -#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" #if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) #include "Plugins/Process/POSIX/ProcessPOSIXLog.h" @@ -78,9 +75,6 @@ void SystemInitializerCommon::Initialize // In
[Lldb-commits] [PATCH] D47250: Move ObjectFile initialization out of SystemInitializerCommon
This revision was automatically updated to reflect the committed changes. Closed by commit rL333182: Move ObjectFile initialization out of SystemInitializerCommon (authored by labath, committed by ). Herald added a subscriber: llvm-commits. Repository: rL LLVM https://reviews.llvm.org/D47250 Files: lldb/trunk/source/API/SystemInitializerFull.cpp lldb/trunk/source/Initialization/CMakeLists.txt lldb/trunk/source/Initialization/SystemInitializerCommon.cpp lldb/trunk/tools/lldb-server/CMakeLists.txt lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h lldb/trunk/tools/lldb-server/lldb-server.cpp lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp Index: lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp === --- lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp +++ lldb/trunk/tools/lldb-test/SystemInitializerTest.cpp @@ -60,6 +60,9 @@ #include "Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h" #include "Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h" #include "Plugins/MemoryHistory/asan/MemoryHistoryASan.h" +#include "Plugins/ObjectFile/ELF/ObjectFileELF.h" +#include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" +#include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" #include "Plugins/OperatingSystem/Go/OperatingSystemGo.h" #include "Plugins/Platform/Android/PlatformAndroid.h" #include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h" @@ -119,6 +122,11 @@ void SystemInitializerTest::Initialize() { SystemInitializerCommon::Initialize(); + + ObjectFileELF::Initialize(); + ObjectFileMachO::Initialize(); + ObjectFilePECOFF::Initialize(); + ScriptInterpreterNone::Initialize(); OperatingSystemGo::Initialize(); @@ -345,6 +353,10 @@ PlatformDarwinKernel::Terminate(); #endif + ObjectFileELF::Terminate(); + ObjectFileMachO::Terminate(); + ObjectFilePECOFF::Terminate(); + // Now shutdown the common parts, in reverse order. SystemInitializerCommon::Terminate(); } Index: lldb/trunk/tools/lldb-server/lldb-server.cpp === --- lldb/trunk/tools/lldb-server/lldb-server.cpp +++ lldb/trunk/tools/lldb-server/lldb-server.cpp @@ -7,7 +7,7 @@ // //===--===// -#include "lldb/Initialization/SystemInitializerCommon.h" +#include "SystemInitializerLLGS.h" #include "lldb/Initialization/SystemLifetimeManager.h" #include "lldb/lldb-private.h" @@ -35,8 +35,8 @@ int main_platform(int argc, char *argv[]); static void initialize() { - g_debugger_lifetime->Initialize( - llvm::make_unique(), nullptr); + g_debugger_lifetime->Initialize(llvm::make_unique(), + nullptr); } static void terminate() { g_debugger_lifetime->Terminate(); } Index: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h === --- lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h +++ lldb/trunk/tools/lldb-server/SystemInitializerLLGS.h @@ -0,0 +1,21 @@ +//===-- SystemInitializerLLGS.h -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#ifndef LLDB_SYSTEMINITIALIZERLLGS_H +#define LLDB_SYSTEMINITIALIZERLLGS_H + +#include "lldb/Initialization/SystemInitializerCommon.h" + +class SystemInitializerLLGS : public lldb_private::SystemInitializerCommon { +public: + void Initialize() override; + void Terminate() override; +}; + +#endif // LLDB_SYSTEMINITIALIZERLLGS_H Index: lldb/trunk/tools/lldb-server/CMakeLists.txt === --- lldb/trunk/tools/lldb-server/CMakeLists.txt +++ lldb/trunk/tools/lldb-server/CMakeLists.txt @@ -34,12 +34,21 @@ list(APPEND LLDB_PLUGINS lldbPluginProcessNetBSD) endif() +if(CMAKE_SYSTEM_NAME MATCHES "Darwin") + list(APPEND LLDB_PLUGINS lldbPluginObjectFileMachO) +elseif(CMAKE_SYSTEM_NAME MATCHES "Windows") + list(APPEND LLDB_PLUGINS lldbPluginObjectFilePECOFF) +else() + list(APPEND LLDB_PLUGINS lldbPluginObjectFileELF) +endif() + add_lldb_tool(lldb-server INCLUDE_IN_FRAMEWORK Acceptor.cpp lldb-gdbserver.cpp lldb-platform.cpp lldb-server.cpp LLDBServerUtilities.cpp +SystemInitializerLLGS.cpp LINK_LIBS lldbBase Index: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp === --- lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp +++ lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp @@ -0,0 +1,33 @@ +//===-- SystemInitializerLLGS.cpp --
[Lldb-commits] [lldb] r333183 - Fix windows/mac builds broken by r333182.
Author: labath Date: Thu May 24 06:12:07 2018 New Revision: 333183 URL: http://llvm.org/viewvc/llvm-project?rev=333183&view=rev Log: Fix windows/mac builds broken by r333182. I should've known that something was wrong when only one of my plugins was prefixed by the lldb_private namespace. Modified: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp Modified: lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp?rev=333183&r1=333182&r2=333183&view=diff == --- lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp (original) +++ lldb/trunk/tools/lldb-server/SystemInitializerLLGS.cpp Thu May 24 06:12:07 2018 @@ -11,10 +11,10 @@ #if defined(__APPLE__) #include "Plugins/ObjectFile/Mach-O/ObjectFileMachO.h" -using HostObjectFile = lldb_private::ObjectFileMachO; +using HostObjectFile = ObjectFileMachO; #elif defined(_WIN32) #include "Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h" -using HostObjectFile = lldb_private::ObjectFilePECOFF; +using HostObjectFile = ObjectFilePECOFF; #else #include "Plugins/ObjectFile/ELF/ObjectFileELF.h" using HostObjectFile = ObjectFileELF; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. It might make sense to create a new SBTargetSettings class that has accessors. Then we can have to accessors on SBTarget: class SBTarget { static SBTargetSettings GetGlobalSettings(); SBTargetSettings GetSettings(); }; This allows us to expose settings in a way that would allow us to serialize the settings and then load them again later. class SBTargetSettings { // Accessors for "target" setting void AppendImageSearchPath(const char *from, const char *to); size_t GetNumImageSearchPaths(); const char *GetImageSearchPathAtIndex(size_t i); // Save and load all settings void Load(SBStream &s); void Save(SBStream &s); }; Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D47232: Break dependency from Expression -> Commands
> On May 23, 2018, at 7:21 PM, Zachary Turner wrote: > > > On Wed, May 23, 2018 at 7:04 PM Jim Ingham via Phabricator > wrote: > jingham added a comment. > > I worry when concerns of layering which seem a little artificial to me would > make us add a shadow class for something that is already well expressed as it > is. If you pass them as arguments, and then I add another useful one and > want to use it in both the regular and the REPL versions of the expression > parser, it would be ugly to have to add another argument to this function > when I should have been able to share the structure. > > I don’t think the concerns are artificial. Layering violations prevent lldb > from being used as a library and pulling in only the parts you need. In > addition, they actually prevent a lot of our internal tooling from working > well so it’s a high priority for us to fix all of them. Finally, resolving > them and achieving proper layering improves build parallelism which benefits > all developers, not to mention the build infrastructure and bots > > I see the point of having the code that is being shared between independent entities like lldb-server and lldb proper bring in as little of lldb as possible, since lldb-server needs to be a light-weight tool that isn't trying to be a debugger. And there are other clearly separable bits like the DWARF parser of object file readers that could be shared. But for instance I don't think we are interested in providing a generic command interpreter. That's a potentially interesting job but not one that we have the resources to take on. And I don't thing we would want a Debugger that might or might not have a command interpreter. So teasing apart dependencies there seem more a formal than an actual concern. > > Seems like the thing you are actually objecting to is the use of > CommandObjectExpression::CommandOptions in REPL.h. REPL.h also use > OptionGroupValueObjectDisplay or OptionGroupFormat. They live in > Interpreter, which this and other files in Expression have to use for other > reasons as well as to get these option groups. Their usage doesn't change > your graph. So another way to address your concerns would be to make an > OptionGroupExpressionOptions in source/Interpreter and have > CommandObjectExpression and REPL.h use that. There's no reason other than > convenience that the option group for expression specific options live in the > CommandObjectExpression class. > > That would be fine, and then you could leave REPL.cpp where it is. > > Isn’t that quite a bit more complicated than just creating a new structure as > I’ve done? I think the original patch is pretty simple and straightforward. > I’d prefer a simple solution that has low impact and gets the job done over > one that tacks on a bunch of additional machinery that YAGN. But your new structure adds an impedance layer where there needn't be one, and I don't think the principle of adding odd little shims to achieve your goal of layering separation is a good one. Jim ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. I like DWARFFirstDIE. Pavel should ok this too. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
labath added a comment. In https://reviews.llvm.org/D47275#215, @clayborg wrote: > I like DWARFFirstDIE. Pavel should ok this too. I said what I think of DWARFFirstDIE. I'd like to hear from you what you think about the is-a issue I mentioned. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333205 - [lldb-mi] Add possibility to set breakpoints without selecting a target.
Author: adrian Date: Thu May 24 09:45:59 2018 New Revision: 333205 URL: http://llvm.org/viewvc/llvm-project?rev=333205&view=rev Log: [lldb-mi] Add possibility to set breakpoints without selecting a target. Now it's possible to set breakpoints before selecting a target, they will be set to the dummy target and then copied to an each added one. Patch by Alexander Polyakov! Differential Revision: https://reviews.llvm.org/D46588 Added: lldb/trunk/lit/tools/ lldb/trunk/lit/tools/lldb-mi/ lldb/trunk/lit/tools/lldb-mi/breakpoint/ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/ lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg Modified: lldb/trunk/lit/lit.cfg lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp Modified: lldb/trunk/lit/lit.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/lit.cfg?rev=333205&r1=333204&r2=333205&view=diff == --- lldb/trunk/lit/lit.cfg (original) +++ lldb/trunk/lit/lit.cfg Thu May 24 09:45:59 2018 @@ -58,6 +58,8 @@ debugserver = lit.util.which('debugserve lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', lldb_tools_dir), config.test_source_root) +lldbmi = lit.util.which('lldb-mi', lldb_tools_dir) + if not os.path.exists(config.cc): config.cc = lit.util.which(config.cc, config.environment['PATH']) @@ -79,6 +81,7 @@ if platform.system() in ['Darwin']: config.substitutions.append(('%cc', config.cc)) config.substitutions.append(('%cxx', config.cxx)) +config.substitutions.append(('%lldbmi', lldbmi + " --synchronous")) config.substitutions.append(('%lldb', lldb)) if debugserver is not None: Added: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test?rev=333205&view=auto == --- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test (added) +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test Thu May 24 09:45:59 2018 @@ -0,0 +1,15 @@ +# RUN: %cc %p/inputs/break-insert.c -g +# RUN: %lldbmi < %s | FileCheck %s + +# Test that a breakpoint can be inserted before creating a target. + +-break-insert breakpoint +# CHECK: ^done,bkpt={number="1" + +-file-exec-and-symbols a.out +# CHECK: ^done + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + Added: lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c?rev=333205&view=auto == --- lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c (added) +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c Thu May 24 09:45:59 2018 @@ -0,0 +1,7 @@ +int breakpoint() { // Breakpoint will be set here. + return 0; +} + +int main() { + return breakpoint(); +} Added: lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg?rev=333205&view=auto == --- lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg (added) +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg Thu May 24 09:45:59 2018 @@ -0,0 +1 @@ +config.suffixes = ['.test'] Modified: lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp?rev=333205&r1=333204&r2=333205&view=diff == --- lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp Thu May 24 09:45:59 2018 @@ -148,6 +148,11 @@ bool CMICmdCmdBreakInsert::Execute() { CMICMDBASE_GETOPTION(pArgRestrictBrkPtToThreadId, OptionShort, m_constStrArgNamedRestrictBrkPtToThreadId); + // Ask LLDB for the target to check if we have valid or dummy one. + CMICmnLLDBDebugSessionInfo &rSessionInfo( + CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBTarget sbTarget = rSessionInfo.GetTarget(); + m_bBrkPtEnabled = !pArgDisableBrkPt->GetFound(); m_bBrkPtIsTemp = pArgTempBrkPt->GetFound(); m_bHaveArgOptionThreadGrp = pArgThreadGroup->GetFound(); @@ -157,7 +162,12 @@ bool CMICmdCmdBreakInsert::Execute() { nThreadGrp); m_strArgOptionThreadGrp = CMIUtilString::Format("i%d", nThreadGrp); } - m_bBrkPtIsPending = pArgPendingBrkPt->GetFound(); + + if (sbTarget == rSessionInfo.GetDebugger().GetDummyTarget()) +m_bBrkPtIsPending = true; + else +m_bBrkPtIsPending = pArgPen
[Lldb-commits] [PATCH] D46588: [LLDB][lldb-mi] Add possibility to set breakpoints without selecting a target.
This revision was automatically updated to reflect the committed changes. Closed by commit rL333205: [lldb-mi] Add possibility to set breakpoints without selecting a target. (authored by adrian, committed by ). Changed prior to commit: https://reviews.llvm.org/D46588?vs=148323&id=148436#toc Repository: rL LLVM https://reviews.llvm.org/D46588 Files: lldb/trunk/lit/lit.cfg lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp Index: lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp === --- lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp +++ lldb/trunk/tools/lldb-mi/MICmdCmdBreak.cpp @@ -148,6 +148,11 @@ CMICMDBASE_GETOPTION(pArgRestrictBrkPtToThreadId, OptionShort, m_constStrArgNamedRestrictBrkPtToThreadId); + // Ask LLDB for the target to check if we have valid or dummy one. + CMICmnLLDBDebugSessionInfo &rSessionInfo( + CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBTarget sbTarget = rSessionInfo.GetTarget(); + m_bBrkPtEnabled = !pArgDisableBrkPt->GetFound(); m_bBrkPtIsTemp = pArgTempBrkPt->GetFound(); m_bHaveArgOptionThreadGrp = pArgThreadGroup->GetFound(); @@ -157,7 +162,12 @@ nThreadGrp); m_strArgOptionThreadGrp = CMIUtilString::Format("i%d", nThreadGrp); } - m_bBrkPtIsPending = pArgPendingBrkPt->GetFound(); + + if (sbTarget == rSessionInfo.GetDebugger().GetDummyTarget()) +m_bBrkPtIsPending = true; + else +m_bBrkPtIsPending = pArgPendingBrkPt->GetFound(); + if (pArgLocation->GetFound()) m_brkName = pArgLocation->GetValue(); else if (m_bBrkPtIsPending) { @@ -225,9 +235,6 @@ // Ask LLDB to create a breakpoint bool bOk = MIstatus::success; - CMICmnLLDBDebugSessionInfo &rSessionInfo( - CMICmnLLDBDebugSessionInfo::Instance()); - lldb::SBTarget sbTarget = rSessionInfo.GetTarget(); switch (eBrkPtType) { case eBreakPoint_ByAddress: m_brkPt = sbTarget.BreakpointCreateByAddress(nAddress); Index: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp === --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp @@ -871,7 +871,10 @@ // Throws: None. //-- lldb::SBTarget CMICmnLLDBDebugSessionInfo::GetTarget() const { - return GetDebugger().GetSelectedTarget(); + auto target = GetDebugger().GetSelectedTarget(); + if (target.IsValid()) +return target; + return GetDebugger().GetDummyTarget(); } //++ Index: lldb/trunk/lit/lit.cfg === --- lldb/trunk/lit/lit.cfg +++ lldb/trunk/lit/lit.cfg @@ -58,6 +58,8 @@ lldb = "%s -S %s/lit-lldb-init" % (lit.util.which('lldb', lldb_tools_dir), config.test_source_root) +lldbmi = lit.util.which('lldb-mi', lldb_tools_dir) + if not os.path.exists(config.cc): config.cc = lit.util.which(config.cc, config.environment['PATH']) @@ -79,6 +81,7 @@ config.substitutions.append(('%cc', config.cc)) config.substitutions.append(('%cxx', config.cxx)) +config.substitutions.append(('%lldbmi', lldbmi + " --synchronous")) config.substitutions.append(('%lldb', lldb)) if debugserver is not None: Index: lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test === --- lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/break-insert.test @@ -0,0 +1,15 @@ +# RUN: %cc %p/inputs/break-insert.c -g +# RUN: %lldbmi < %s | FileCheck %s + +# Test that a breakpoint can be inserted before creating a target. + +-break-insert breakpoint +# CHECK: ^done,bkpt={number="1" + +-file-exec-and-symbols a.out +# CHECK: ^done + +-exec-run +# CHECK: ^running +# CHECK: *stopped,reason="breakpoint-hit" + Index: lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c === --- lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/inputs/break-insert.c @@ -0,0 +1,7 @@ +int breakpoint() { // Breakpoint will be set here. + return 0; +} + +int main() { + return breakpoint(); +} Index: lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg === --- lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg +++ lldb/trunk/lit/tools/lldb-mi/breakpoint/lit.local.cfg @@ -0,0 +1 @@ +config.suffixes = ['.test'] ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333208 - pc's should be printed in hex...
Author: jingham Date: Thu May 24 10:06:48 2018 New Revision: 333208 URL: http://llvm.org/viewvc/llvm-project?rev=333208&view=rev Log: pc's should be printed in hex... Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Modified: lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp?rev=333208&r1=333207&r2=333208&view=diff == --- lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp (original) +++ lldb/trunk/source/Target/ThreadPlanStepOverBreakpoint.cpp Thu May 24 10:06:48 2018 @@ -99,7 +99,7 @@ bool ThreadPlanStepOverBreakpoint::DoPla if (pc_addr == m_breakpoint_addr) { if (log) -log->Printf("Got breakpoint stop reason but pc: %" PRIu64 +log->Printf("Got breakpoint stop reason but pc: %x" PRIx64 "hasn't changed.", pc_addr); return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333207 - Add SystemInitializerLLGS to the lldb-server target.
Author: jingham Date: Thu May 24 10:06:11 2018 New Revision: 333207 URL: http://llvm.org/viewvc/llvm-project?rev=333207&view=rev Log: Add SystemInitializerLLGS to the lldb-server target. This should unbreak the xcode build. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=333207&r1=333206&r2=333207&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu May 24 10:06:11 2018 @@ -756,6 +756,7 @@ 4CD44CFB20B37C440003557C /* DWARFIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44CF820B37C440003557C /* DWARFIndex.cpp */; }; 4CD44CFC20B37C440003557C /* ManualDWARFIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44CF920B37C440003557C /* ManualDWARFIndex.cpp */; }; 4CD44CFD20B37C440003557C /* AppleDWARFIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44CFA20B37C440003557C /* AppleDWARFIndex.cpp */; }; + 4CD44D2220B725DA0003557C /* SystemInitializerLLGS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44D2020B725DA0003557C /* SystemInitializerLLGS.cpp */; }; 4CDB8D6D1DBA91B6006C5B13 /* LibStdcppUniquePointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */; }; 4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp */; }; 4CE4EFAA1E8999B900A80C06 /* PlatformOpenBSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp */; }; @@ -2589,7 +2590,7 @@ 4C4EB7821E6A4DE7002035C0 /* DumpDataExtractor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DumpDataExtractor.h; path = include/lldb/Core/DumpDataExtractor.h; sourceTree = ""; }; 4C54B2781F61CE1200D469CA /* SBBreakpointName.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBBreakpointName.h; path = include/lldb/API/SBBreakpointName.h; sourceTree = ""; }; 4C54B27C1F61CE5300D469CA /* SBBreakpointName.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SBBreakpointName.cpp; path = source/API/SBBreakpointName.cpp; sourceTree = ""; }; - 4C54B2811F62081300D469CA /* SBBreakpointOptionCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBBreakpointOptionCommon.h; path = include/lldb/API/SBBreakpointOptionCommon.h; sourceTree = ""; }; + 4C54B2811F62081300D469CA /* SBBreakpointOptionCommon.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBBreakpointOptionCommon.h; path = source/API/SBBreakpointOptionCommon.h; sourceTree = ""; }; 4C562CC21CC07DDD00C52EAC /* PDBASTParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PDBASTParser.cpp; path = PDB/PDBASTParser.cpp; sourceTree = ""; }; 4C562CC31CC07DDD00C52EAC /* PDBASTParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDBASTParser.h; path = PDB/PDBASTParser.h; sourceTree = ""; }; 4C56543019D1EFAA002E9C44 /* ThreadPlanPython.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanPython.cpp; path = source/Target/ThreadPlanPython.cpp; sourceTree = ""; }; @@ -2662,6 +2663,8 @@ 4CD44CFE20B37C570003557C /* DWARFIndex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DWARFIndex.h; sourceTree = ""; }; 4CD44CFF20B37C580003557C /* AppleDWARFIndex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppleDWARFIndex.h; sourceTree = ""; }; 4CD44D0020B37C580003557C /* ManualDWARFIndex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ManualDWARFIndex.h; sourceTree = ""; }; + 4CD44D2020B725DA0003557C /* SystemInitializerLLGS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemInitializerLLGS.cpp; path = "tools/lldb-server/SystemInitializerLLGS.cpp"; sourceTree = ""; }; + 4CD44D2320B725F60003557C /* SystemInitializerLLGS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SystemInitializerLLGS.h; path = "tools/lldb-server/SystemInitializerLLGS.h"; sourceTree = ""; }; 4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType =
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. The main reason for the split up in SBTargetSettings is we have both global settings and the target specific settings. If you modify the global settings, you are modifying the target settings for all future targets. As they get created, they will copy the global settings. LLDB has global settings in a global variable, and then each new lldb_private::Target objects that are created have their own. So this new interface would mirror that setup. It also keeps all accessors from having a "bool apply_to_global" for each setting accessor. Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
polyakov.alex added a comment. In https://reviews.llvm.org/D47302#078, @clayborg wrote: > It might make sense to create a new SBTargetSettings class that has > accessors. Then we can have to accessors on SBTarget: > > class SBTarget { > static SBTargetSettings GetGlobalSettings(); > SBTargetSettings GetSettings(); > }; > What global settings should be in your opinion? I guess that they should be stored in the `SBDebugger`, and a typical use case for them would be: SBTarget target; target.HookUpGlobalSettings; > This allows us to expose settings in a way that would allow us to serialize > the settings and then load them again later. > > class SBTargetSettings { > // Accessors for "target" setting > void AppendImageSearchPath(const char *from, const char *to); > size_t GetNumImageSearchPaths(); > const char *GetImageSearchPathAtIndex(size_t i); > // Save and load all settings > void Load(SBStream &s); > void Save(SBStream &s); > }; Serialization sounds good, but, to accurately understand you, do you mean "classic" serialization with saving data into the file or serialization just for the time when debugger is run? Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
clayborg added a comment. In https://reviews.llvm.org/D47275#1110772, @labath wrote: > I don't think a name like `DWARFUnitDIE` is a good one bacause it would make > a weird `is-a` relationship (a DWARFDIE represetning a DW_TAG_variable is > certainly **not** a "unit DIE" yet you could assign it to a > `DWARFUnitDIE&`). We could have a DWARFUnitDIE type if we wanted to, but that > would have to be a special type in addition to DWARFBasicDIE. However, I > think that would be overkill. Yeah, we just need to be able to tell the difference between the top level DIE we hand out with no children and the one that has all the abilities. > That said, if everyone who is going to be calling `IsStructOrClass` and > friends will see the type as `DWARFDIE` then keeping those methods on that > class makes sense. Yes, that is the case. No top level DIE can be a struct, union or class. Only a compile unit, type unit or partial unit. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
labath added a comment. In https://reviews.llvm.org/D47275#254, @clayborg wrote: > In https://reviews.llvm.org/D47275#1110772, @labath wrote: > > > I don't think a name like `DWARFUnitDIE` is a good one bacause it would > > make a weird `is-a` relationship (a DWARFDIE represetning a DW_TAG_variable > > is certainly **not** a "unit DIE" yet you could assign it to a > > `DWARFUnitDIE&`). We could have a DWARFUnitDIE type if we wanted to, but > > that would have to be a special type in addition to DWARFBasicDIE. However, > > I think that would be overkill. > > > Yeah, we just need to be able to tell the difference between the top level > DIE we hand out with no children and the one that has all the abilities. Yes, but this is not what this patch is doing. The class inheritance makes is such that any "die with all abilities" we hand out, also is-a "top level die with no children". This is where my problem comes from. If I rephrase your comment a bit > we just need to be able to tell the difference between a **DIE that has no > ability to access children** and the one that has all the abilities. then it is fine because a "die which has all abilities" is also a "die which has only a certain smaller set of abilities". However in this case a name like `DWARFUnitDIE` is not appropriate. If we wanted to have a type called DwarfUnitDIE die then it should be a special type inheriting from DWARFBasicDIE (or whatever it's called). Then again it would be fine, because then it would be a "DIE that has no ability to access children **and** is a root DIE", which is a refinement of "DIE that has no ability to access children". https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. In https://reviews.llvm.org/D47302#249, @polyakov.alex wrote: > In https://reviews.llvm.org/D47302#078, @clayborg wrote: > > > It might make sense to create a new SBTargetSettings class that has > > accessors. Then we can have to accessors on SBTarget: > > > > class SBTarget { > > static SBTargetSettings GetGlobalSettings(); > > SBTargetSettings GetSettings(); > > }; > > > > > What global settings should be in your opinion? I guess that they should be > stored in the `SBDebugger`, and a typical use case for them would be: > > SBTarget target; > target.HookUpGlobalSettings; > I would code it exactly as I specified above. Ask the SBTarget for its settings. We would only expose the "target.*" settings through the SBTargetSettings class. SBDebugger could have its own settings for everything that is stored in the Debugger.cpp g_properties variable, those would be in SBDebuggerSettings if we need access to those: class SBDebugger { static SBDebuggerSettings GetGlobalSettings(); SBDebuggerSettings GetSettings(); }; >> This allows us to expose settings in a way that would allow us to serialize >> the settings and then load them again later. >> >> class SBTargetSettings { >> // Accessors for "target" setting >> void AppendImageSearchPath(const char *from, const char *to); >> size_t GetNumImageSearchPaths(); >> const char *GetImageSearchPathAtIndex(size_t i); >> // Save and load all settings >> void Load(SBStream &s); >> void Save(SBStream &s); >> }; > > Serialization sounds good, but, to accurately understand you, do you mean > "classic" serialization with saving data into the file or serialization just > for the time when debugger is run? SBStream can be a string buffer or a file. We should probably save to JSON and load from JSON. But that doesn't need to be done in this patch. Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
clayborg added a comment. In https://reviews.llvm.org/D47275#285, @labath wrote: > In https://reviews.llvm.org/D47275#254, @clayborg wrote: > > > In https://reviews.llvm.org/D47275#1110772, @labath wrote: > > > > > I don't think a name like `DWARFUnitDIE` is a good one bacause it would > > > make a weird `is-a` relationship (a DWARFDIE represetning a > > > DW_TAG_variable is certainly **not** a "unit DIE" yet you could assign it > > > to a `DWARFUnitDIE&`). We could have a DWARFUnitDIE type if we wanted > > > to, but that would have to be a special type in addition to > > > DWARFBasicDIE. However, I think that would be overkill. > > > > > > Yeah, we just need to be able to tell the difference between the top level > > DIE we hand out with no children and the one that has all the abilities. > > > Yes, but this is not what this patch is doing. The class inheritance makes is > such that any "die with all abilities" we hand out, also is-a "top level die > with no children". This is where my problem comes from. Yeah, I see where the name doesn't fit now. DWARFBaseDIE maybe? > If I rephrase your comment a bit > >> we just need to be able to tell the difference between a **DIE that has no >> ability to access children** and the one that has all the abilities. > > then it is fine because a "die which has all abilities" is also a "die which > has only a certain smaller set of abilities". However in this case a name > like `DWARFUnitDIE` is not appropriate. > > If we wanted to have a type called DwarfUnitDIE die then it should be a > special type inheriting from DWARFBasicDIE (or whatever it's called). Then > again it would be fine, because then it would be a "DIE that has no ability > to access children **and** is a root DIE", which is a refinement of "DIE that > has no ability to access children". DWARFBaseDIE might work then. Name doesn't violate any of the assumptions you mention above. All of your issues revolve around the naming right? https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
polyakov.alex added a comment. In https://reviews.llvm.org/D47302#351, @clayborg wrote: > In https://reviews.llvm.org/D47302#249, @polyakov.alex wrote: > > > In https://reviews.llvm.org/D47302#078, @clayborg wrote: > > > > > It might make sense to create a new SBTargetSettings class that has > > > accessors. Then we can have to accessors on SBTarget: > > > > > > class SBTarget { > > > static SBTargetSettings GetGlobalSettings(); > > > SBTargetSettings GetSettings(); > > > }; > > > > > > > > > What global settings should be in your opinion? I guess that they should be > > stored in the `SBDebugger`, and a typical use case for them would be: > > > > SBTarget target; > > target.HookUpGlobalSettings; > > > > > I would code it exactly as I specified above. Ask the SBTarget for its > settings. We would only expose the "target.*" settings through the > SBTargetSettings class. SBDebugger could have its own settings for everything > that is stored in the Debugger.cpp g_properties variable, those would be in > SBDebuggerSettings if we need access to those: > > class SBDebugger { > static SBDebuggerSettings GetGlobalSettings(); > SBDebuggerSettings GetSettings(); > }; > > > > > >> This allows us to expose settings in a way that would allow us to > >> serialize the settings and then load them again later. > >> > >> class SBTargetSettings { > >> // Accessors for "target" setting > >> void AppendImageSearchPath(const char *from, const char *to); > >> size_t GetNumImageSearchPaths(); > >> const char *GetImageSearchPathAtIndex(size_t i); > >> // Save and load all settings > >> void Load(SBStream &s); > >> void Save(SBStream &s); > >> }; > > > > Serialization sounds good, but, to accurately understand you, do you mean > > "classic" serialization with saving data into the file or serialization > > just for the time when debugger is run? > > SBStream can be a string buffer or a file. We should probably save to JSON > and load from JSON. But that doesn't need to be done in this patch. So, for now we'll just save settings to a string buffer? Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. In https://reviews.llvm.org/D47302#372, @polyakov.alex wrote: > In https://reviews.llvm.org/D47302#351, @clayborg wrote: > > > In https://reviews.llvm.org/D47302#249, @polyakov.alex wrote: > > > > > In https://reviews.llvm.org/D47302#078, @clayborg wrote: > > > > > > > It might make sense to create a new SBTargetSettings class that has > > > > accessors. Then we can have to accessors on SBTarget: > > > > > > > > class SBTarget { > > > > static SBTargetSettings GetGlobalSettings(); > > > > SBTargetSettings GetSettings(); > > > > }; > > > > > > > > > > > > > What global settings should be in your opinion? I guess that they should > > > be stored in the `SBDebugger`, and a typical use case for them would be: > > > > > > SBTarget target; > > > target.HookUpGlobalSettings; > > > > > > > > > I would code it exactly as I specified above. Ask the SBTarget for its > > settings. We would only expose the "target.*" settings through the > > SBTargetSettings class. SBDebugger could have its own settings for > > everything that is stored in the Debugger.cpp g_properties variable, those > > would be in SBDebuggerSettings if we need access to those: > > > > class SBDebugger { > > static SBDebuggerSettings GetGlobalSettings(); > > SBDebuggerSettings GetSettings(); > > }; > > > > > > > > > > >> This allows us to expose settings in a way that would allow us to > > >> serialize the settings and then load them again later. > > >> > > >> class SBTargetSettings { > > >> // Accessors for "target" setting > > >> void AppendImageSearchPath(const char *from, const char *to); > > >> size_t GetNumImageSearchPaths(); > > >> const char *GetImageSearchPathAtIndex(size_t i); > > >> // Save and load all settings > > >> void Load(SBStream &s); > > >> void Save(SBStream &s); > > >> }; > > > > > > Serialization sounds good, but, to accurately understand you, do you mean > > > "classic" serialization with saving data into the file or serialization > > > just for the time when debugger is run? > > > > SBStream can be a string buffer or a file. We should probably save to JSON > > and load from JSON. But that doesn't need to be done in this patch. > > > So, for now we'll just save settings to a string buffer? Don't worry about saving/loading in this patch. That was just a proposed future direction we can easily do once we have the SBTargetOptions class split out into its own class. So concentrate on making a SBTargetOptions and optionally the SBDebuggerOptions class if you need access to debugger settings as well. Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
labath added a comment. Yes, Base is fine. Thank you. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
clayborg requested changes to this revision. clayborg added a comment. This revision now requires changes to proceed. ok, just rename DWARFFirstDIE to DWARFBaseDIE and this is good to go. https://reviews.llvm.org/D47275 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47342: Move SystemInitializerFull header to source/API
xiaobai created this revision. xiaobai added reviewers: labath, clayborg. It seems to me that files in include/lldb/API/ are headers that should be exposed to liblldb users. Because SystemInitializerFull.h exposes details of lldb_private, I think having it there is not the right thing to do. Since it's only included from files in source/API, we should move it there and treat it as private. https://reviews.llvm.org/D47342 Files: include/lldb/API/SystemInitializerFull.h source/API/SBDebugger.cpp source/API/SystemInitializerFull.cpp source/API/SystemInitializerFull.h Index: include/lldb/API/SystemInitializerFull.h === --- /dev/null +++ include/lldb/API/SystemInitializerFull.h @@ -1,38 +0,0 @@ -//===-- SystemInitializerFull.h -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#ifndef LLDB_API_SYSTEM_INITIALIZER_FULL_H -#define LLDB_API_SYSTEM_INITIALIZER_FULL_H - -#include "lldb/Initialization/SystemInitializerCommon.h" - -namespace lldb_private { -//-- -/// Initializes lldb. -/// -/// This class is responsible for initializing all of lldb system -/// services needed to use the full LLDB application. This class is -/// not intended to be used externally, but is instead used -/// internally by SBDebugger to initialize the system. -//-- -class SystemInitializerFull : public SystemInitializerCommon { -public: - SystemInitializerFull(); - ~SystemInitializerFull() override; - - void Initialize() override; - void Terminate() override; - -private: - void InitializeSWIG(); -}; - -} // namespace lldb_private - -#endif // LLDB_API_SYSTEM_INITIALIZER_FULL_H Index: source/API/SystemInitializerFull.cpp === --- source/API/SystemInitializerFull.cpp +++ source/API/SystemInitializerFull.cpp @@ -11,7 +11,7 @@ #include "Plugins/ScriptInterpreter/Python/lldb-python.h" #endif -#include "lldb/API/SystemInitializerFull.h" +#include "SystemInitializerFull.h" #include "lldb/API/SBCommandInterpreter.h" Index: source/API/SBDebugger.cpp === --- source/API/SBDebugger.cpp +++ source/API/SBDebugger.cpp @@ -11,6 +11,9 @@ // C++ Includes // Other libraries and framework includes // Project includes + +#include "SystemInitializerFull.h" + #include "lldb/API/SBDebugger.h" #include "lldb/lldb-private.h" @@ -35,7 +38,6 @@ #include "lldb/API/SBTypeNameSpecifier.h" #include "lldb/API/SBTypeSummary.h" #include "lldb/API/SBTypeSynthetic.h" -#include "lldb/API/SystemInitializerFull.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/PluginManager.h" Index: include/lldb/API/SystemInitializerFull.h === --- /dev/null +++ include/lldb/API/SystemInitializerFull.h @@ -1,38 +0,0 @@ -//===-- SystemInitializerFull.h -*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===--===// - -#ifndef LLDB_API_SYSTEM_INITIALIZER_FULL_H -#define LLDB_API_SYSTEM_INITIALIZER_FULL_H - -#include "lldb/Initialization/SystemInitializerCommon.h" - -namespace lldb_private { -//-- -/// Initializes lldb. -/// -/// This class is responsible for initializing all of lldb system -/// services needed to use the full LLDB application. This class is -/// not intended to be used externally, but is instead used -/// internally by SBDebugger to initialize the system. -//-- -class SystemInitializerFull : public SystemInitializerCommon { -public: - SystemInitializerFull(); - ~SystemInitializerFull() override; - - void Initialize() override; - void Terminate() override; - -private: - void InitializeSWIG(); -}; - -} // namespace lldb_private - -#endif // LLDB_API_SYSTEM_INITIALIZER_FULL_H Index: source/API/SystemInitializerFull.cpp === --- source/API/SystemInitializerFull.cpp +++ source/API/SystemInitializerFull.cpp @@ -11,7 +11,7 @@ #include "Plugins/ScriptInterpreter/Python/lldb-python.h" #endif -#include "lldb/API/SystemInitializerFull.h" +#include "SystemInitializerFull.h" #include "lldb/API/SBCommandInterpreter.h" Index: source/API/SBDebugger.cpp ===
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
polyakov.alex added a comment. In https://reviews.llvm.org/D47302#377, @clayborg wrote: > In https://reviews.llvm.org/D47302#372, @polyakov.alex wrote: > > > In https://reviews.llvm.org/D47302#351, @clayborg wrote: > > > > > In https://reviews.llvm.org/D47302#249, @polyakov.alex wrote: > > > > > > > In https://reviews.llvm.org/D47302#078, @clayborg wrote: > > > > > > > > > It might make sense to create a new SBTargetSettings class that has > > > > > accessors. Then we can have to accessors on SBTarget: > > > > > > > > > > class SBTarget { > > > > > static SBTargetSettings GetGlobalSettings(); > > > > > SBTargetSettings GetSettings(); > > > > > }; > > > > > > > > > > > > > > > > > What global settings should be in your opinion? I guess that they > > > > should be stored in the `SBDebugger`, and a typical use case for them > > > > would be: > > > > > > > > SBTarget target; > > > > target.HookUpGlobalSettings; > > > > > > > > > > > > > I would code it exactly as I specified above. Ask the SBTarget for its > > > settings. We would only expose the "target.*" settings through the > > > SBTargetSettings class. SBDebugger could have its own settings for > > > everything that is stored in the Debugger.cpp g_properties variable, > > > those would be in SBDebuggerSettings if we need access to those: > > > > > > class SBDebugger { > > > static SBDebuggerSettings GetGlobalSettings(); > > > SBDebuggerSettings GetSettings(); > > > }; > > > > > > > > > > > > > > > >> This allows us to expose settings in a way that would allow us to > > > >> serialize the settings and then load them again later. > > > >> > > > >> class SBTargetSettings { > > > >> // Accessors for "target" setting > > > >> void AppendImageSearchPath(const char *from, const char *to); > > > >> size_t GetNumImageSearchPaths(); > > > >> const char *GetImageSearchPathAtIndex(size_t i); > > > >> // Save and load all settings > > > >> void Load(SBStream &s); > > > >> void Save(SBStream &s); > > > >> }; > > > > > > > > Serialization sounds good, but, to accurately understand you, do you > > > > mean "classic" serialization with saving data into the file or > > > > serialization just for the time when debugger is run? > > > > > > SBStream can be a string buffer or a file. We should probably save to > > > JSON and load from JSON. But that doesn't need to be done in this patch. > > > > > > So, for now we'll just save settings to a string buffer? > > > Don't worry about saving/loading in this patch. That was just a proposed > future direction we can easily do once we have the SBTargetOptions class > split out into its own class. So concentrate on making a SBTargetOptions and > optionally the SBDebuggerOptions class if you need access to debugger > settings as well. If I understood you right, the approach is to have a separated class `SBTargetSettings` with own data structures consisting of the settings. Also each instance of `SBTarget` will have a field `SBTargetSettings sb_settings;`. If so, we still need a `SBTarget::AddSharedObjectPath`. Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47278: Remove lldb-private headers when building LLDB.framework with CMake
xiaobai added a comment. In https://reviews.llvm.org/D47278#1110777, @labath wrote: > From a layering perspective, it makes sense for SystemInitializerFull to live > in the outermost layer, as it's the thing which makes sure liblldb pulls in > all required components. Since it is only included from files in `source/API` > (which is as it should be), maybe we could just make it a private header and > move the file to `source/API/SystemInitializerFull.h`? This makes the most sense to me. I've uploaded https://reviews.llvm.org/D47342 which I believe does what you've suggested. In https://reviews.llvm.org/D47278#1110333, @clayborg wrote: > The issue is actually that SystemInitializerFull.h and > SystemInitializerFull.cpp are in the wrong directories. They belong in the > "lldb/Initialization" and "Source//Initialization". We should fix this and > then some/all of your changes won't be needed? Some of them for sure. It's a mistake to add `${LLDB_SOURCE_DIR}/include/lldb/lldb-*.h` to `public_headers`, so that should still be changed. https://reviews.llvm.org/D47278 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47342: Move SystemInitializerFull header to source/API
clayborg added a comment. Looks good to me. Pavel, you ok with the file location? https://reviews.llvm.org/D47342 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. no. Create a new SBTargetSettings class. SBTarget will hand one out for global and for target instance settings, Add all settings accessors to SBTargetSettings class Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47342: Move SystemInitializerFull header to source/API
labath accepted this revision. labath added a comment. This revision is now accepted and ready to land. Fine by me. https://reviews.llvm.org/D47342 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333222 - DWARFDIE split out to DWARFBaseDIE
Author: jankratochvil Date: Thu May 24 13:44:48 2018 New Revision: 333222 URL: http://llvm.org/viewvc/llvm-project?rev=333222&view=rev Log: DWARFDIE split out to DWARFBaseDIE This new DWARFBaseDIE is going to be used for DWARFUnit::GetUnitDIEOnly() as other DIEs are unavailable that time so the caller should not have methods available to access them. This patch is only a mechanical split without any use of it. Differential revision: https://reviews.llvm.org/D47275 Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt?rev=333222&r1=333221&r2=333222&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt Thu May 24 13:44:48 2018 @@ -7,6 +7,7 @@ add_lldb_library(lldbPluginSymbolFileDWA DWARFASTParserJava.cpp DWARFASTParserOCaml.cpp DWARFAttribute.cpp + DWARFBaseDIE.cpp DWARFCompileUnit.cpp DWARFDataExtractor.cpp DWARFDebugAbbrev.cpp Added: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp?rev=333222&view=auto == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp (added) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp Thu May 24 13:44:48 2018 @@ -0,0 +1,193 @@ +//===-- DWARFBaseDIE.cpp ---*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===--===// + +#include "DWARFBaseDIE.h" + +#include "DWARFUnit.h" +#include "DWARFDebugInfoEntry.h" +#include "SymbolFileDWARF.h" + +#include "lldb/Core/Module.h" +#include "lldb/Symbol/ObjectFile.h" + +using namespace lldb_private; + +DIERef DWARFBaseDIE::GetDIERef() const { + if (!IsValid()) +return DIERef(); + + dw_offset_t cu_offset = m_cu->GetOffset(); + if (m_cu->GetBaseObjOffset() != DW_INVALID_OFFSET) +cu_offset = m_cu->GetBaseObjOffset(); + return DIERef(cu_offset, m_die->GetOffset()); +} + +dw_tag_t DWARFBaseDIE::Tag() const { + if (m_die) +return m_die->Tag(); + else +return 0; +} + +const char *DWARFBaseDIE::GetTagAsCString() const { + return lldb_private::DW_TAG_value_to_name(Tag()); +} + +const char *DWARFBaseDIE::GetAttributeValueAsString(const dw_attr_t attr, +const char *fail_value) const { + if (IsValid()) +return m_die->GetAttributeValueAsString(GetDWARF(), GetCU(), attr, +fail_value); + else +return fail_value; +} + +uint64_t DWARFBaseDIE::GetAttributeValueAsUnsigned(const dw_attr_t attr, + uint64_t fail_value) const { + if (IsValid()) +return m_die->GetAttributeValueAsUnsigned(GetDWARF(), GetCU(), attr, + fail_value); + else +return fail_value; +} + +int64_t DWARFBaseDIE::GetAttributeValueAsSigned(const dw_attr_t attr, +int64_t fail_value) const { + if (IsValid()) +return m_die->GetAttributeValueAsSigned(GetDWARF(), GetCU(), attr, +fail_value); + else +return fail_value; +} + +uint64_t DWARFBaseDIE::GetAttributeValueAsReference(const dw_attr_t attr, +uint64_t fail_value) const { + if (IsValid()) +return m_die->GetAttributeValueAsReference(GetDWARF(), GetCU(), attr, + fail_value); + else +return fail_value; +} + +uint64_t DWARFBaseDIE::GetAttributeValueAsAddress(const dw_attr_t attr, + uint64_t fail_value) const { + if (IsValid()) +return m_die->GetAttributeValueAsAddress(GetDWARF(), GetCU(), attr, + fail_value); + else +return fail_value; +} + +lldb::user_id_t DWARFBaseDIE::GetID() const { + return GetDIERef().GetUID(GetDWARF()); +} + +const char *DWARFBaseDIE::GetName() const { + if (IsValid()) +return m_die->GetName(GetDWARF(), m_cu); + else +return nullptr; +} + +lldb::LanguageType DWARFBaseDIE::GetLanguage() const { + if (IsValid()) +
[Lldb-commits] [PATCH] D47275: 1/3: DWARFDIE split out to DWARFBasicDIE
This revision was not accepted when it landed; it landed in state "Needs Revision". This revision was automatically updated to reflect the committed changes. Closed by commit rL333222: DWARFDIE split out to DWARFBaseDIE (authored by jankratochvil, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47275?vs=148360&id=148472#toc Repository: rL LLVM https://reviews.llvm.org/D47275 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/CMakeLists.txt lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp @@ -12,43 +12,13 @@ #include "DWARFASTParser.h" #include "DWARFUnit.h" #include "DWARFDIECollection.h" -#include "DWARFDebugAbbrev.h" -#include "DWARFDebugAranges.h" #include "DWARFDebugInfo.h" -#include "DWARFDebugInfoEntry.h" -#include "DWARFDebugRanges.h" #include "DWARFDeclContext.h" -#include "DWARFFormValue.h" -#include "SymbolFileDWARF.h" -#include "lldb/Core/Module.h" -#include "lldb/Symbol/ObjectFile.h" -#include "lldb/Symbol/Type.h" -#include "lldb/Symbol/TypeSystem.h" +#include "DWARFDebugInfoEntry.h" using namespace lldb_private; -DIERef DWARFDIE::GetDIERef() const { - if (!IsValid()) -return DIERef(); - - dw_offset_t cu_offset = m_cu->GetOffset(); - if (m_cu->GetBaseObjOffset() != DW_INVALID_OFFSET) -cu_offset = m_cu->GetBaseObjOffset(); - return DIERef(cu_offset, m_die->GetOffset()); -} - -dw_tag_t DWARFDIE::Tag() const { - if (m_die) -return m_die->Tag(); - else -return 0; -} - -const char *DWARFDIE::GetTagAsCString() const { - return lldb_private::DW_TAG_value_to_name(Tag()); -} - DWARFDIE DWARFDIE::GetParent() const { if (IsValid()) @@ -91,33 +61,6 @@ return DWARFDIE(); } -const char *DWARFDIE::GetAttributeValueAsString(const dw_attr_t attr, -const char *fail_value) const { - if (IsValid()) -return m_die->GetAttributeValueAsString(GetDWARF(), GetCU(), attr, -fail_value); - else -return fail_value; -} - -uint64_t DWARFDIE::GetAttributeValueAsUnsigned(const dw_attr_t attr, - uint64_t fail_value) const { - if (IsValid()) -return m_die->GetAttributeValueAsUnsigned(GetDWARF(), GetCU(), attr, - fail_value); - else -return fail_value; -} - -int64_t DWARFDIE::GetAttributeValueAsSigned(const dw_attr_t attr, -int64_t fail_value) const { - if (IsValid()) -return m_die->GetAttributeValueAsSigned(GetDWARF(), GetCU(), attr, -fail_value); - else -return fail_value; -} - DWARFDIE DWARFDIE::GetAttributeValueAsReferenceDIE(const dw_attr_t attr) const { if (IsValid()) { @@ -132,24 +75,6 @@ return DWARFDIE(); } -uint64_t DWARFDIE::GetAttributeValueAsReference(const dw_attr_t attr, -uint64_t fail_value) const { - if (IsValid()) -return m_die->GetAttributeValueAsReference(GetDWARF(), GetCU(), attr, - fail_value); - else -return fail_value; -} - -uint64_t DWARFDIE::GetAttributeValueAsAddress(const dw_attr_t attr, - uint64_t fail_value) const { - if (IsValid()) -return m_die->GetAttributeValueAsAddress(GetDWARF(), GetCU(), attr, - fail_value); - else -return fail_value; -} - DWARFDIE DWARFDIE::LookupDeepestBlock(lldb::addr_t file_addr) const { if (IsValid()) { @@ -171,17 +96,6 @@ return DWARFDIE(); } -lldb::user_id_t DWARFDIE::GetID() const { - return GetDIERef().GetUID(GetDWARF()); -} - -const char *DWARFDIE::GetName() const { - if (IsValid()) -return m_die->GetName(GetDWARF(), m_cu); - else -return nullptr; -} - const char *DWARFDIE::GetMangledName() const { if (IsValid()) return m_die->GetMangledName(GetDWARF(), m_cu); @@ -203,28 +117,6 @@ return nullptr; } -lldb::LanguageType DWARFDIE::GetLanguage() const { - if (IsValid()) -return m_cu->GetLanguageType(); - else -return lldb::eLanguageTypeUnknown; -} - -lldb::ModuleSP DWARFDIE::GetModule() const { - SymbolFileDWARF *dwarf = GetDWARF(); - if (dwarf) -return dwarf->GetObjectFile()->GetModule(); - else -return lldb::ModuleSP(); -} - -lldb_private::CompileUnit *DWARFDIE::GetLLDBCompileUnit() const { - if (IsValid()) -return GetDWARF()->GetCompUnitForDWARFCompUnit
[Lldb-commits] [PATCH] D47276: 2/3: Use DWARFBasicDIE as compile-time protection
clayborg added a comment. Rename to DWARFBaseDIE and this is good to go. https://reviews.llvm.org/D47276 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47276: 2/3: Use DWARFBaseDIE as compile-time protection
jankratochvil updated this revision to Diff 148474. jankratochvil retitled this revision from "2/3: Use DWARFBasicDIE as compile-time protection" to "2/3: Use DWARFBaseDIE as compile-time protection". https://reviews.llvm.org/D47276 Files: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.h source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -748,7 +748,7 @@ } else { ModuleSP module_sp(m_obj_file->GetModule()); if (module_sp) { - const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFDIE cu_die = dwarf_cu->DIE(); if (cu_die) { FileSpec cu_file_spec{cu_die.GetName(), false}; if (cu_file_spec) { @@ -883,7 +883,7 @@ assert(sc.comp_unit); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE cu_die = dwarf_cu->GetUnitDIEOnly(); if (cu_die) { FileSpec cu_comp_dir = resolveCompDir( @@ -922,7 +922,7 @@ UpdateExternalModuleListIfNeeded(); if (sc.comp_unit) { -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFDIE die = dwarf_cu->DIE(); if (die) { for (DWARFDIE child_die = die.GetFirstChild(); child_die; @@ -997,7 +997,7 @@ DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); if (dwarf_cu_die) { const dw_offset_t cu_line_offset = dwarf_cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list, @@ -1082,7 +1082,7 @@ if (dwarf_cu == nullptr) return false; - const DWARFDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFBaseDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); if (!dwarf_cu_die) return false; @@ -1578,7 +1578,7 @@ for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) { DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly(); if (die && die.HasChildren() == false) { const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr); Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -113,7 +113,7 @@ void SetBaseAddress(dw_addr_t base_addr); - DWARFDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } + DWARFBaseDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); } Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -207,7 +207,7 @@ if (!dwo_cu) return; // Can't fetch the compile unit from the dwo file. - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return; // Can't fetch the compile unit DIE from the dwo file. Index: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -638,7 +638,7 @@ void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, Stream &s) const { - const DWARFDIE cu_die = cu->GetUnitDIEOnly(); + const DWARFBaseDIE cu_die = cu->GetUnitDIEOnly(); const char *cu_name = NULL; if (cu_die) cu_name = cu_die.GetName(); @@ -912,7 +912,7 @@ if (!dwo_cu) return 0; - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return 0; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333224 - Use DWARFBaseDIE as a compile-time protection
Author: jankratochvil Date: Thu May 24 13:51:13 2018 New Revision: 333224 URL: http://llvm.org/viewvc/llvm-project?rev=333224&view=rev Log: Use DWARFBaseDIE as a compile-time protection As suggested by Pavel Labath in D46810 DWARFUnit::GetUnitDIEOnly() returning a pointer to m_first_die should not permit using methods like GetFirstChild(). Differential revision: https://reviews.llvm.org/D47276 Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp?rev=333224&r1=333223&r2=333224&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp Thu May 24 13:51:13 2018 @@ -638,7 +638,7 @@ void DWARFDebugInfoEntry::Dump(SymbolFil void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, Stream &s) const { - const DWARFDIE cu_die = cu->GetUnitDIEOnly(); + const DWARFBaseDIE cu_die = cu->GetUnitDIEOnly(); const char *cu_name = NULL; if (cu_die) cu_name = cu_die.GetName(); @@ -912,7 +912,7 @@ dw_offset_t DWARFDebugInfoEntry::GetAttr if (!dwo_cu) return 0; - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return 0; Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp?rev=333224&r1=333223&r2=333224&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp Thu May 24 13:51:13 2018 @@ -207,7 +207,7 @@ void DWARFUnit::AddUnitDIE(DWARFDebugInf if (!dwo_cu) return; // Can't fetch the compile unit from the dwo file. - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return; // Can't fetch the compile unit DIE from the dwo file. Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h?rev=333224&r1=333223&r2=333224&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h Thu May 24 13:51:13 2018 @@ -113,7 +113,7 @@ public: void SetBaseAddress(dw_addr_t base_addr); - DWARFDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } + DWARFBaseDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); } 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=333224&r1=333223&r2=333224&view=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Thu May 24 13:51:13 2018 @@ -748,7 +748,7 @@ lldb::CompUnitSP SymbolFileDWARF::ParseC } else { ModuleSP module_sp(m_obj_file->GetModule()); if (module_sp) { - const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFDIE cu_die = dwarf_cu->DIE(); if (cu_die) { FileSpec cu_file_spec{cu_die.GetName(), false}; if (cu_file_spec) { @@ -883,7 +883,7 @@ bool SymbolFileDWARF::ParseCompileUnitSu assert(sc.comp_unit); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE cu_die = dwarf_cu->GetUnitDIEOnly(); if (cu_die) { FileSpec cu_comp_dir = resolveCompDir( @@ -922,7 +922,7 @@ bool SymbolFileDWARF::ParseImportedModul UpdateExternalModuleListIfNeeded(); if (sc.comp_unit) { -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFDIE die = dwarf_cu->DIE(); if (die) { for (DWARFDIE child_die = die.GetFirstChild(); child_die; @@ -997,7 +997,7 @@ bool SymbolFileDWARF::ParseCompileUnitLi DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) {
[Lldb-commits] [PATCH] D47276: 2/3: Use DWARFBaseDIE as compile-time protection
This revision was not accepted when it landed; it landed in state "Needs Review". This revision was automatically updated to reflect the committed changes. Closed by commit rL333224: Use DWARFBaseDIE as a compile-time protection (authored by jankratochvil, committed by ). Herald added a subscriber: llvm-commits. Changed prior to commit: https://reviews.llvm.org/D47276?vs=148474&id=148476#toc Repository: rL LLVM https://reviews.llvm.org/D47276 Files: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -113,7 +113,7 @@ void SetBaseAddress(dw_addr_t base_addr); - DWARFDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } + DWARFBaseDIE GetUnitDIEOnly() { return DWARFDIE(this, GetUnitDIEPtrOnly()); } DWARFDIE DIE() { return DWARFDIE(this, DIEPtr()); } Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp @@ -638,7 +638,7 @@ void DWARFDebugInfoEntry::DumpLocation(SymbolFileDWARF *dwarf2Data, DWARFUnit *cu, Stream &s) const { - const DWARFDIE cu_die = cu->GetUnitDIEOnly(); + const DWARFBaseDIE cu_die = cu->GetUnitDIEOnly(); const char *cu_name = NULL; if (cu_die) cu_name = cu_die.GetName(); @@ -912,7 +912,7 @@ if (!dwo_cu) return 0; - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return 0; Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -207,7 +207,7 @@ if (!dwo_cu) return; // Can't fetch the compile unit from the dwo file. - DWARFDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); + DWARFBaseDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly(); if (!dwo_cu_die.IsValid()) return; // Can't fetch the compile unit DIE from the dwo file. Index: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -748,7 +748,7 @@ } else { ModuleSP module_sp(m_obj_file->GetModule()); if (module_sp) { - const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFDIE cu_die = dwarf_cu->DIE(); if (cu_die) { FileSpec cu_file_spec{cu_die.GetName(), false}; if (cu_file_spec) { @@ -883,7 +883,7 @@ assert(sc.comp_unit); DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE cu_die = dwarf_cu->GetUnitDIEOnly(); if (cu_die) { FileSpec cu_comp_dir = resolveCompDir( @@ -922,7 +922,7 @@ UpdateExternalModuleListIfNeeded(); if (sc.comp_unit) { -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFDIE die = dwarf_cu->DIE(); if (die) { for (DWARFDIE child_die = die.GetFirstChild(); child_die; @@ -997,7 +997,7 @@ DWARFUnit *dwarf_cu = GetDWARFCompileUnit(sc.comp_unit); if (dwarf_cu) { -const DWARFDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); if (dwarf_cu_die) { const dw_offset_t cu_line_offset = dwarf_cu_die.GetAttributeValueAsUnsigned(DW_AT_stmt_list, @@ -1082,7 +1082,7 @@ if (dwarf_cu == nullptr) return false; - const DWARFDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); + const DWARFBaseDIE dwarf_cu_die = dwarf_cu->GetUnitDIEOnly(); if (!dwarf_cu_die) return false; @@ -1578,7 +1578,7 @@ for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) { DWARFUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); -const DWARFDIE die = dwarf_cu->GetUnitDIEOnly(); +const DWARFBaseDIE die = dwarf_cu->GetUnitDIEOnly(); if (die && die.HasChildren() == false) { const char *name = die.GetAttributeValueAsString(DW_AT_name, nullptr); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/c
[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer
jankratochvil updated this revision to Diff 148480. https://reviews.llvm.org/D46810 Files: source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp source/Plugins/SymbolFile/DWARF/DWARFUnit.h Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.h === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.h +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.h @@ -173,6 +173,17 @@ void *m_user_data = nullptr; // The compile unit debug information entry item DWARFDebugInfoEntry::collection m_die_array; + // GetUnitDIEPtrOnly() needs to return pointer to the first DIE. + // But the first element of m_die_array after ExtractDIEsIfNeeded(true) + // may move in memory after later ExtractDIEsIfNeeded(false). + // If nothing has been parsed, m_die_array is empty and m_first_die is empty. + // If CU DIE has been parsed, m_die_array is empty and m_first_die is full. + // if everything has been parsed m_first_die and m_die_array are full, + // and the first element of m_die_array contains a copy of m_first_die. + DWARFDebugInfoEntry m_first_die; + // m_die_array_size() is like m_die_array.size() but + // it considers also m_die_array.empty() with m_first_die. + size_t m_die_array_size() const; // A table similar to the .debug_aranges table, but this one points to the // exact DW_TAG_subprogram DIEs std::unique_ptr m_func_aranges_ap; @@ -203,9 +214,9 @@ // if needed. const DWARFDebugInfoEntry *GetUnitDIEPtrOnly() { ExtractDIEsIfNeeded(true); -if (m_die_array.empty()) +if (!m_first_die) return NULL; -return &m_die_array[0]; +return &m_first_die; } // Get all DWARF debug informration entries. Parse all DIEs if needed. Index: source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp === --- source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -40,7 +40,7 @@ // Parses a compile unit and indexes its DIEs if it hasn't already been done. //-- size_t DWARFUnit::ExtractDIEsIfNeeded(bool cu_die_only) { - const size_t initial_die_array_size = m_die_array.size(); + const size_t initial_die_array_size = m_die_array_size(); if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 1) return 0; // Already parsed @@ -92,6 +92,22 @@ if (depth == 0) { if (initial_die_array_size == 0) AddUnitDIE(die); + + if (!cu_die_only) { +assert(m_die_array.empty() && "Compile unit DIE already added"); + +// The average bytes per DIE entry has been seen to be around 14-20 so +// lets pre-reserve half of that since we are now stripping the NULL +// tags. + +// Only reserve the memory if we are adding children of the main +// compile unit DIE. The compile unit DIE is always the first entry, so +// if our size is 1, then we are adding the first compile unit child +// DIE and should reserve the memory. +m_die_array.reserve(GetDebugInfoSize() / 24); +m_die_array.push_back(die); + } + uint64_t base_addr = die.GetAttributeValueAsAddress( m_dwarf, this, DW_AT_low_pc, LLDB_INVALID_ADDRESS); if (base_addr == LLDB_INVALID_ADDRESS) @@ -101,14 +117,17 @@ if (cu_die_only) return 1; } else { + assert(!cu_die_only); if (null_die) { if (prev_die_had_children) { // This will only happen if a DIE says is has children but all it // contains is a NULL tag. Since we are removing the NULL DIEs from // the list (saves up to 25% in C++ code), we need a way to let the // DIE know that it actually doesn't have children. - if (!m_die_array.empty()) + if (!m_die_array.empty()) { m_die_array.back().SetEmptyChildren(true); +m_first_die.SetEmptyChildren(true); + } } } else { die.SetParentIndex(m_die_array.size() - die_index_stack[depth - 1]); @@ -134,7 +153,7 @@ prev_die_had_children = false; } else { - die_index_stack.back() = m_die_array.size() - 1; + die_index_stack.back() = m_die_array_size() - 1; // Normal DIE const bool die_has_children = die.HasChildren(); if (die_has_children) { @@ -168,36 +187,38 @@ if (log && log->GetVerbose()) { StreamString strm; Dump(&strm); -if (m_die_array.empty()) +if (!m_first_die) strm.Printf("error: no DIE for compile unit"); else - m_die_array[0].Dump(m_dwarf, this, strm, UINT32_MAX); + m_first_die.Dump(m_dwarf, this, strm, UINT32_MAX); log->PutString(strm.GetString()); } + assert(m_die_array.empty() || !cu_die_only); + assert(m_die_arr
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
polyakov.alex added a comment. In https://reviews.llvm.org/D47302#497, @clayborg wrote: > no. Create a new SBTargetSettings class. SBTarget will hand one out for > global and for target instance settings, Add all settings accessors to > SBTargetSettings class What is a difference between `SBTargetSettings` and `TargetProperties` classes except API level? Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer
jankratochvil added a comment. In https://reviews.llvm.org/D46810#1098110, @clayborg wrote: > So this problem exists both in the LLDB and LLVM DWARF parsers. I am not sure > this fix is safe. I would rather fix this by fixing DWARFDIE class to "do the > right thing". We should be able to teach the DWARFDIE class to replace its > "m_die" with the updated "m_die" if a method ever causes DWARFDIE to need to > expand all DIEs in a DWARFUnit. That seems like a much safer fix. Having > m_first_die is not safe because it if you call DWARFDIE::GetFirstChild() it > will just add 1 to the "m_die" and we will crash. All parent, sibling and > child code just do pointer arithmetic to find their counterparts. So since > DWARFDIE has the "DWARFUnit *m_cu;" and "DWARFDebugInfoEntry *m_die;" we > should use DWARFDIE to abstract this from users. Anyone playing directly with > DWARFDebugInfoEntry must know the rules and do the right thing or just use > DWARFDIE. Is this statement still valid now with `DWARFBaseDIE`? https://reviews.llvm.org/D46810 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer
clayborg added a comment. A better solution here would be to have two functions: one for parsing the Unit DIE only and one for parsing all DIEs: class DWARFUnit { void ExtractUnitDIEIfNeeded(); size_t ExtractDIEsIfNeeded(); } Then the code becomes much simpler, we don't need the "m_die_array_size" function and logic is much cleaner, DWARFUnit::ExtractUnitDIEIfNeeded() will extract into m_first_die only and won't touch m_die_array at all. DWARFUnit::ExtractDIEsIfNeeded() will extract all DIEs into m_die_array. Then there is no need for worrying about m_die_array.size(). https://reviews.llvm.org/D46810 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. In https://reviews.llvm.org/D47302#569, @polyakov.alex wrote: > In https://reviews.llvm.org/D47302#497, @clayborg wrote: > > > no. Create a new SBTargetSettings class. SBTarget will hand one out for > > global and for target instance settings, Add all settings accessors to > > SBTargetSettings class > > > What is a difference between `SBTargetSettings` and `TargetProperties` > classes except API level? Not much difference except everything in SBTargetSettings will need to be public C++ API safe (no virtual functions, one member variable in the class that is a pointer std::unique_ptr or std::shared_ptr, no inheritance, no STL in args or return values, no lldb_private classes in args or return values. For this class to be API safe, we will actually need to keep a shared pointer to the target properties. So the class in the API header will be something like: namespace lldb { SBTargetSettings { lldb::TargetPropertiesSP m_opaque_sp; }; } Then m_opaque_sp will be filled in by assiging from a TargetSP (since a shared pointer to a target can be converted to a TargetPropertiesSP since Target inherits from TargetProperties) or from a call to Target::GetGlobalProperties(). Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D47302: [lldb, lldb-mi] Add method AddCurrentTargetSharedObjectPath to the SBDebugger.
clayborg added a comment. Be sure to not pass through any experimental settings. Repository: rL LLVM https://reviews.llvm.org/D47302 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D46810: 3/3: Fix DWARFUnit::GetUnitDIEPtrOnly stale pointer
clayborg added a comment. In https://reviews.llvm.org/D46810#570, @jankratochvil wrote: > In https://reviews.llvm.org/D46810#1098110, @clayborg wrote: > > > So this problem exists both in the LLDB and LLVM DWARF parsers. I am not > > sure this fix is safe. I would rather fix this by fixing DWARFDIE class to > > "do the right thing". We should be able to teach the DWARFDIE class to > > replace its "m_die" with the updated "m_die" if a method ever causes > > DWARFDIE to need to expand all DIEs in a DWARFUnit. That seems like a much > > safer fix. Having m_first_die is not safe because it if you call > > DWARFDIE::GetFirstChild() it will just add 1 to the "m_die" and we will > > crash. All parent, sibling and child code just do pointer arithmetic to > > find their counterparts. So since DWARFDIE has the "DWARFUnit *m_cu;" and > > "DWARFDebugInfoEntry *m_die;" we should use DWARFDIE to abstract this from > > users. Anyone playing directly with DWARFDebugInfoEntry must know the rules > > and do the right thing or just use DWARFDIE. > > > Is this statement still valid now with `DWARFBaseDIE`? Statement isn't valid, but we should cleanup the DIE parsing code so we have dedicated parsing for the unit DIE only and for all DIEs and remove the m_die_array_size() function. https://reviews.llvm.org/D46810 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r333238 - Add DWARFBaseDie.{h, cpp} to the Xcode build.
Author: jingham Date: Thu May 24 16:33:27 2018 New Revision: 333238 URL: http://llvm.org/viewvc/llvm-project?rev=333238&view=rev Log: Add DWARFBaseDie.{h,cpp} to the Xcode build. This should unbreak the green dragon bot builds. Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=333238&r1=333237&r2=333238&view=diff == --- lldb/trunk/lldb.xcodeproj/project.pbxproj (original) +++ lldb/trunk/lldb.xcodeproj/project.pbxproj Thu May 24 16:33:27 2018 @@ -757,6 +757,7 @@ 4CD44CFC20B37C440003557C /* ManualDWARFIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44CF920B37C440003557C /* ManualDWARFIndex.cpp */; }; 4CD44CFD20B37C440003557C /* AppleDWARFIndex.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44CFA20B37C440003557C /* AppleDWARFIndex.cpp */; }; 4CD44D2220B725DA0003557C /* SystemInitializerLLGS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44D2020B725DA0003557C /* SystemInitializerLLGS.cpp */; }; + 4CD44D4220B777850003557C /* DWARFBaseDIE.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CD44D4020B777850003557C /* DWARFBaseDIE.cpp */; }; 4CDB8D6D1DBA91B6006C5B13 /* LibStdcppUniquePointer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */; }; 4CDB8D6E1DBA91B6006C5B13 /* LibStdcppTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp */; }; 4CE4EFAA1E8999B900A80C06 /* PlatformOpenBSD.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp */; }; @@ -2665,6 +2666,8 @@ 4CD44D0020B37C580003557C /* ManualDWARFIndex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ManualDWARFIndex.h; sourceTree = ""; }; 4CD44D2020B725DA0003557C /* SystemInitializerLLGS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SystemInitializerLLGS.cpp; path = "tools/lldb-server/SystemInitializerLLGS.cpp"; sourceTree = ""; }; 4CD44D2320B725F60003557C /* SystemInitializerLLGS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SystemInitializerLLGS.h; path = "tools/lldb-server/SystemInitializerLLGS.h"; sourceTree = ""; }; + 4CD44D4020B777850003557C /* DWARFBaseDIE.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DWARFBaseDIE.cpp; sourceTree = ""; }; + 4CD44D4120B777850003557C /* DWARFBaseDIE.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DWARFBaseDIE.h; sourceTree = ""; }; 4CDB8D671DBA91A6006C5B13 /* LibStdcppUniquePointer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibStdcppUniquePointer.cpp; path = Language/CPlusPlus/LibStdcppUniquePointer.cpp; sourceTree = ""; }; 4CDB8D681DBA91A6006C5B13 /* LibStdcppTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LibStdcppTuple.cpp; path = Language/CPlusPlus/LibStdcppTuple.cpp; sourceTree = ""; }; 4CE4EFA61E8999B000A80C06 /* PlatformOpenBSD.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PlatformOpenBSD.cpp; sourceTree = ""; }; @@ -3946,6 +3949,8 @@ 4CC7C6521D5299140076FF94 /* DWARFASTParserOCaml.cpp */, 260C89B610F57C5600BB2B04 /* DWARFAttribute.h */, 266E829C1B8E542C008FCA06 /* DWARFAttribute.cpp */, + 4CD44D4020B777850003557C /* DWARFBaseDIE.cpp */, + 4CD44D4120B777850003557C /* DWARFBaseDIE.h */, 260C89B710F57C5600BB2B04 /* DWARFCompileUnit.cpp */, 260C89B810F57C5600BB2B04 /* DWARFCompileUnit.h */, 26AB92101819D74600E63F3E /* DWARFDataExtractor.cpp */, @@ -7879,6 +7884,7 @@ 4C56543119D1EFAA002E9C44 /* ThreadPlanPython.cpp in Sources */, 26AB92121819D74600E63F3E /* DWARFDataExtractor.cpp in Sources */, 268900E913353E6F00698AC0 /* CPPLanguageRuntime.cpp in Sources */, + 4CD44D4220B777850003557C /* DWARFBaseDIE.cpp in Sources */, 9485545A1DCBAE3B00345FF5 /* RenderScriptScriptGroup.cpp in Sources */, 268900EA13353E6F00698AC0 /* DynamicLoader.cpp in Sources
[Lldb-commits] [lldb] r333248 - HostInfoMacOSX: Support finding the clang resource directory within CLTools.
Author: adrian Date: Thu May 24 17:29:01 2018 New Revision: 333248 URL: http://llvm.org/viewvc/llvm-project?rev=333248&view=rev Log: HostInfoMacOSX: Support finding the clang resource directory within CLTools. rdar://problem/40537961 Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm lldb/trunk/unittests/Host/HostInfoTest.cpp Modified: lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm?rev=333248&r1=333247&r2=333248&view=diff == --- lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm (original) +++ lldb/trunk/source/Host/macosx/HostInfoMacOSX.mm Thu May 24 17:29:01 2018 @@ -271,7 +271,7 @@ bool HostInfoMacOSX::ComputeClangDirecto auto parent = std::next(rev_it); if (parent != r_end && *parent == "SharedFrameworks") { // This is the top-level LLDB in the Xcode.app bundle. -// e.g., "Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A" +// E.g., "Xcode.app/Contents/SharedFrameworks/LLDB.framework/Versions/A" raw_path.resize(parent - r_end); llvm::sys::path::append(clang_path, raw_path, "Developer/Toolchains/XcodeDefault.xctoolchain", @@ -282,17 +282,21 @@ bool HostInfoMacOSX::ComputeClangDirecto } } else if (parent != r_end && *parent == "PrivateFrameworks" && std::distance(parent, r_end) > 2) { -// This is LLDB inside an Xcode toolchain. -// e.g., "Xcode.app/Contents/Developer/Toolchains/" \ -// "My.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework" ++parent; ++parent; -raw_path.resize(parent - r_end); -llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir); -if (!verify || VerifyClangPath(clang_path)) { - file_spec.SetFile(clang_path.c_str(), true); - return true; +if (*parent == "System") { + // This is LLDB inside an Xcode toolchain. + // E.g., "Xcode.app/Contents/Developer/Toolchains/" \ + // "My.xctoolchain/System/Library/PrivateFrameworks/LLDB.framework" + raw_path.resize(parent - r_end); + llvm::sys::path::append(clang_path, raw_path, swift_clang_resource_dir); + if (!verify || VerifyClangPath(clang_path)) { +file_spec.SetFile(clang_path.c_str(), true); +return true; + } + raw_path = lldb_shlib_spec.GetPath(); } +raw_path.resize(rev_it - r_end); } else { raw_path.resize(rev_it - r_end); } Modified: lldb/trunk/unittests/Host/HostInfoTest.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Host/HostInfoTest.cpp?rev=333248&r1=333247&r2=333248&view=diff == --- lldb/trunk/unittests/Host/HostInfoTest.cpp (original) +++ lldb/trunk/unittests/Host/HostInfoTest.cpp Thu May 24 17:29:01 2018 @@ -90,6 +90,14 @@ TEST_F(HostInfoTest, MacOSX) { "Swift-4.1-development-snapshot.xctoolchain/usr/lib/swift/clang"; EXPECT_EQ(HostInfoMacOSXTest::ComputeClangDir(toolchain), toolchain_clang); + std::string cltools = "/Library/Developer/CommandLineTools/Library/" +"PrivateFrameworks/LLDB.framework"; + std::string cltools_clang = + "/Library/Developer/CommandLineTools/Library/PrivateFrameworks/" + "LLDB.framework/Resources/Clang"; + EXPECT_EQ(HostInfoMacOSXTest::ComputeClangDir(cltools), cltools_clang); + + // Test that a bogus path is detected. EXPECT_NE(HostInfoMacOSXTest::ComputeClangDir(GetInputFilePath(xcode), true), HostInfoMacOSXTest::ComputeClangDir(GetInputFilePath(xcode))); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits