[Lldb-commits] [lldb] r264909 - When support for DWO files was added, there were two ways to pass lldb::user_id_t out to the rest of LLDB:
Chaoren Lin via lldb-commits
lldb-commits at lists.llvm.org
Wed Mar 30 16:05:21 PDT 2016
> May I revert your change in the mean time if it's gonna take a while to
fix?
> If there are any regressions in DWARF with DWO, we will need to fix any
issues that arise since the original patch wasn't functional for the much
more widely used DWARF in .o files with debug map.
Okay, just saw that, never mind. :/
On Wed, Mar 30, 2016 at 3:48 PM, Chaoren Lin <chaorenl at google.com> wrote:
> Hi Greg, I think this change broke expression evaluation on Linux with
> split dwarf if the variable is located outside of the main translation unit.
> Could you please look at this?
> May I revert your change in the mean time if it's gonna take a while to
> fix?
>
> $ cat a.c
> int foo();
>
> int main() {
> return foo();
> }
> $ cat b.c
> int foo() {
> int i = 0;
> return i;
> }
> $ clang a.c b.c -gsplit-dwarf
> $ ./build/bin/lldb a.out -o 'b b.c:3' -o r -o 'p i'
> (lldb) target create "a.out"
> Current executable set to 'a.out' (x86_64).
> (lldb) b b.c:3
> Breakpoint 1: where = a.out`foo + 11 at b.c:3, address = 0x000000000040051b
> (lldb) r
> Process 26993 stopped
> * thread #1: tid = 26993, 0x000000000040051b a.out`foo + 11 at b.c:3, name
> = 'a.out', stop reason = breakpoint 1.1
> frame #0: 0x000000000040051b a.out`foo + 11 at b.c:3
> 1 int foo() {
> 2 int i = 0;
> -> 3 return i;
> 4 }
>
> Process 26993 launched: '/path/to/a.out' (x86_64)
> (lldb) p i
> Segmentation fault (core dumped)
>
>
> On Wed, Mar 30, 2016 at 1:14 PM, Greg Clayton via lldb-commits <
> lldb-commits at lists.llvm.org> wrote:
>
>> Author: gclayton
>> Date: Wed Mar 30 15:14:35 2016
>> New Revision: 264909
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=264909&view=rev
>> Log:
>> When support for DWO files was added, there were two ways to pass
>> lldb::user_id_t out to the rest of LLDB:
>> 1 - DWARF in .o files with debug map in executable: we would place the
>> compile unit index in the upper 32 bits of the 64 bit value and the lower
>> 32 bits would be the DIE offset
>> 2 - DWO: we would place the compile unit offset in the upper 32 bits of
>> the 64 bit value and the lower 32 bits would be the DIE offset
>>
>> There was a mixing and matching of this and it wasn't done consistently.
>>
>> Major changes include:
>>
>> The DIERef constructor that takes a lldb::user_id_t now requires a
>> SymbolFileDWARF:
>>
>> DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf)
>>
>> It is needed so that it can be decoded correctly. If it is DWARF in .o
>> files with debug map in executable, then we get the right compile unit from
>> the SymbolFileDWARFDebugMap, otherwise, we use the compile unit offset and
>> DIE offset for DWO or normal DWARF.
>>
>> The function:
>>
>> lldb::user_id_t DIERef::GetUID() const;
>>
>> Now becomes
>>
>> lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const;
>>
>> Again, we need the DWARF file to encode it correctly.
>>
>> This removes the need for "lldb::user_id_t SymbolFileDWARF::MakeUserID()
>> const" and for bool SymbolFileDWARF::UserIDMatches (lldb::user_id_t uid)
>> const". There were also many places were doing things inneficiently like:
>>
>> 1 - encode a dw_offset_t into a lldb::user_id_t
>> 2 - call the public SymbolFile interface to resolve types using the
>> lldb::user_id_t
>> 3 - This would then decode the lldb::user_id_t into a DIERef, and then
>> try to find that type.
>>
>> There are many places that are now doing this more efficiently by storing
>> DW_AT_type form values as DWARFFormValue objects and then making a DIERef
>> from them and directly calling the underlying function to resolve the
>> lldb_private::Type, lldb_private::CompilerType, lldb_private::CompilerDecl,
>> lldb_private::CompilerDeclContext.
>>
>> If there are any regressions in DWARF with DWO, we will need to fix any
>> issues that arise since the original patch wasn't functional for the much
>> more widely used DWARF in .o files with debug map.
>>
>> <rdar://problem/25200976>
>>
>>
>> Modified:
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.cpp Wed Mar 30
>> 15:14:35 2016
>> @@ -10,26 +10,49 @@
>> #include "DIERef.h"
>> #include "DWARFCompileUnit.h"
>> #include "DWARFFormValue.h"
>> +#include "DWARFDebugInfo.h"
>> +#include "SymbolFileDWARF.h"
>> +#include "SymbolFileDWARFDebugMap.h"
>>
>> DIERef::DIERef() :
>> cu_offset(DW_INVALID_OFFSET),
>> die_offset(DW_INVALID_OFFSET)
>> {}
>>
>> -DIERef::DIERef(dw_offset_t d) :
>> - cu_offset(DW_INVALID_OFFSET),
>> - die_offset(d)
>> -{}
>> -
>> DIERef::DIERef(dw_offset_t c, dw_offset_t d) :
>> cu_offset(c),
>> die_offset(d)
>> {}
>>
>> -DIERef::DIERef(lldb::user_id_t uid) :
>> - cu_offset(uid>>32),
>> +DIERef::DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf) :
>> + cu_offset(DW_INVALID_OFFSET),
>> die_offset(uid&0xffffffff)
>> -{}
>> +{
>> + SymbolFileDWARFDebugMap *debug_map = dwarf->GetDebugMapSymfile();
>> + if (debug_map)
>> + {
>> + const uint32_t oso_idx = debug_map->GetOSOIndexFromUserID(uid);
>> + SymbolFileDWARF *actual_dwarf =
>> debug_map->GetSymbolFileByOSOIndex(oso_idx);
>> + if (actual_dwarf)
>> + {
>> + DWARFDebugInfo *debug_info = actual_dwarf->DebugInfo();
>> + if (debug_info)
>> + {
>> + DWARFCompileUnit *dwarf_cu =
>> debug_info->GetCompileUnitContainingDIEOffset(die_offset);
>> + if (dwarf_cu)
>> + {
>> + cu_offset = dwarf_cu->GetOffset();
>> + return;
>> + }
>> + }
>> + }
>> + die_offset = DW_INVALID_OFFSET;
>> + }
>> + else
>> + {
>> + cu_offset = uid>>32;
>> + }
>> +}
>>
>> DIERef::DIERef(const DWARFFormValue& form_value) :
>> cu_offset(DW_INVALID_OFFSET),
>> @@ -50,7 +73,19 @@ DIERef::DIERef(const DWARFFormValue& for
>> }
>>
>> lldb::user_id_t
>> -DIERef::GetUID() const
>> +DIERef::GetUID(SymbolFileDWARF *dwarf) const
>> {
>> - return ((lldb::user_id_t)cu_offset) << 32 | die_offset;
>> +
>> //----------------------------------------------------------------------
>> + // Each SymbolFileDWARF will set its ID to what is expected.
>> + //
>> + // SymbolFileDWARF, when used for DWARF with .o files on MacOSX, has
>> the
>> + // ID set to the compile unit index.
>> + //
>> + // SymbolFileDWARFDwo sets the ID to the compile unit offset.
>> +
>> //----------------------------------------------------------------------
>> + if (dwarf)
>> + return dwarf->GetID() | die_offset;
>> + else
>> + return LLDB_INVALID_UID;
>> }
>> +
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DIERef.h Wed Mar 30
>> 15:14:35 2016
>> @@ -14,24 +14,34 @@
>> #include "lldb/lldb-defines.h"
>>
>> class DWARFFormValue;
>> +class SymbolFileDWARF;
>>
>> struct DIERef
>> {
>> DIERef();
>>
>> - explicit
>> - DIERef(dw_offset_t d);
>> -
>> DIERef(dw_offset_t c, dw_offset_t d);
>>
>> +
>> //----------------------------------------------------------------------
>> + // In order to properly decode a lldb::user_id_t back into a DIERef
>> we
>> + // need the DWARF file since it knows if DWARF in .o files is being
>> used
>> + // (MacOSX) or if DWO files are being used. The encoding of the user
>> ID
>> + // differs between the two types of DWARF.
>> +
>> //----------------------------------------------------------------------
>> explicit
>> - DIERef(lldb::user_id_t uid);
>> + DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf);
>>
>> explicit
>> DIERef(const DWARFFormValue& form_value);
>>
>> +
>> //----------------------------------------------------------------------
>> + // In order to properly encode a DIERef unto a lldb::user_id_t we
>> need
>> + // the DWARF file since it knows if DWARF in .o files is being used
>> + // (MacOSX) or if DWO files are being used. The encoding of the user
>> ID
>> + // differs between the two types of DWARF.
>> +
>> //----------------------------------------------------------------------
>> lldb::user_id_t
>> - GetUID() const;
>> + GetUID(SymbolFileDWARF *dwarf) const;
>>
>> bool
>> operator< (const DIERef &ref) const
>>
>> Modified:
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
>> Wed Mar 30 15:14:35 2016
>> @@ -293,7 +293,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>>
>> const size_t num_attributes = die.GetAttributes
>> (attributes);
>> uint32_t encoding = 0;
>> - lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
>> + DWARFFormValue encoding_uid;
>>
>> if (num_attributes > 0)
>> {
>> @@ -323,7 +323,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> break;
>> case DW_AT_byte_size: byte_size =
>> form_value.Unsigned(); break;
>> case DW_AT_encoding: encoding =
>> form_value.Unsigned(); break;
>> - case DW_AT_type: encoding_uid
>> = DIERef(form_value).GetUID(); break;
>> + case DW_AT_type: encoding_uid
>> = form_value; break;
>> default:
>> case DW_AT_sibling:
>> break;
>> @@ -332,7 +332,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> }
>> }
>>
>> - DEBUG_PRINTF ("0x%8.8" PRIx64 ": %s (\"%s\") type =>
>> 0x%8.8lx\n", die.GetID(), DW_TAG_value_to_name(tag), type_name_cstr,
>> encoding_uid);
>> + DEBUG_PRINTF ("0x%8.8" PRIx64 ": %s (\"%s\") type =>
>> 0x%8.8lx\n", die.GetID(), DW_TAG_value_to_name(tag), type_name_cstr,
>> encoding_uid.Reference());
>>
>> switch (tag)
>> {
>> @@ -388,7 +388,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>>
>> die.GetName());
>> clang_type =
>> m_ast.GetBasicType(eBasicTypeObjCID);
>> encoding_data_type =
>> Type::eEncodingIsUID;
>> - encoding_uid = LLDB_INVALID_UID;
>> + encoding_uid.Clear();
>> resolve_state =
>> Type::eResolveStateFull;
>>
>> }
>> @@ -402,7 +402,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>>
>> die.GetName());
>> clang_type =
>> m_ast.GetBasicType(eBasicTypeObjCClass);
>> encoding_data_type =
>> Type::eEncodingIsUID;
>> - encoding_uid = LLDB_INVALID_UID;
>> + encoding_uid.Clear();
>> resolve_state =
>> Type::eResolveStateFull;
>> }
>> else if (type_name_const_str ==
>> g_objc_type_name_selector)
>> @@ -415,15 +415,15 @@ DWARFASTParserClang::ParseTypeFromDWARF
>>
>> die.GetName());
>> clang_type =
>> m_ast.GetBasicType(eBasicTypeObjCSel);
>> encoding_data_type =
>> Type::eEncodingIsUID;
>> - encoding_uid = LLDB_INVALID_UID;
>> + encoding_uid.Clear();
>> resolve_state =
>> Type::eResolveStateFull;
>> }
>> }
>> - else if (encoding_data_type ==
>> Type::eEncodingIsPointerUID && encoding_uid != LLDB_INVALID_UID)
>> + else if (encoding_data_type ==
>> Type::eEncodingIsPointerUID && encoding_uid.IsValid())
>> {
>> // Clang sometimes erroneously emits id
>> as objc_object*. In that case we fix up the type to "id".
>>
>> - const DWARFDIE encoding_die =
>> die.GetDIE(encoding_uid);
>> + const DWARFDIE encoding_die =
>> dwarf->GetDIE(DIERef(encoding_uid));
>>
>> if (encoding_die && encoding_die.Tag()
>> == DW_TAG_structure_type)
>> {
>> @@ -439,7 +439,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>>
>> die.GetName());
>> clang_type =
>> m_ast.GetBasicType(eBasicTypeObjCID);
>> encoding_data_type =
>> Type::eEncodingIsUID;
>> - encoding_uid =
>> LLDB_INVALID_UID;
>> + encoding_uid.Clear();
>> resolve_state =
>> Type::eResolveStateFull;
>> }
>> }
>> @@ -453,7 +453,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> type_name_const_str,
>> byte_size,
>> NULL,
>> - encoding_uid,
>> +
>> DIERef(encoding_uid).GetUID(dwarf),
>> encoding_data_type,
>> &decl,
>> clang_type,
>> @@ -732,7 +732,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> // a complete type for this die
>> dwarf->GetDIEToType()[die.GetDIE()] =
>> type_sp.get();
>> clang::DeclContext *defn_decl_ctx =
>> GetCachedClangDeclContextForDIE(
>> -
>> dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID())));
>> +
>> dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID(), dwarf)));
>> if (defn_decl_ctx)
>> LinkDeclContextToDIE(defn_decl_ctx, die);
>> return type_sp;
>> @@ -895,8 +895,6 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> "Type already in the forward
>> declaration map!");
>> // Can't assume m_ast.GetSymbolFile() is
>> actually a SymbolFileDWARF, it can be a
>> // SymbolFileDWARFDebugMap for Apple
>> binaries.
>> -
>> //assert(((SymbolFileDWARF*)m_ast.GetSymbolFile())->UserIDMatches(die.GetDIERef().GetUID())
>> &&
>> - // "Adding incorrect type to forward
>> declaration map");
>>
>> dwarf->GetForwardDeclDieToClangType()[die.GetDIE()] =
>> clang_type.GetOpaqueQualType();
>>
>> dwarf->GetForwardDeclClangTypeToDie()[ClangUtil::RemoveFastQualifiers(clang_type)
>>
>> .GetOpaqueQualType()] = die.GetDIERef();
>> @@ -992,8 +990,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> // so lets use it and cache the fact
>> that we found
>> // a complete type for this die
>> dwarf->GetDIEToType()[die.GetDIE()] =
>> type_sp.get();
>> - clang::DeclContext *defn_decl_ctx =
>> GetCachedClangDeclContextForDIE(
>> -
>>
>> dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID())));
>> + clang::DeclContext *defn_decl_ctx =
>> GetCachedClangDeclContextForDIE(dwarf->DebugInfo()->GetDIE(DIERef(type_sp->GetID(),
>> dwarf)));
>> if (defn_decl_ctx)
>> LinkDeclContextToDIE(defn_decl_ctx,
>> die);
>> return type_sp;
>> @@ -1008,7 +1005,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> {
>> if (encoding_form.IsValid())
>> {
>> - Type *enumerator_type =
>> dwarf->ResolveTypeUID(DIERef(encoding_form).GetUID());
>> + Type *enumerator_type =
>> dwarf->ResolveTypeUID(DIERef(encoding_form));
>> if (enumerator_type)
>> enumerator_clang_type =
>> enumerator_type->GetFullCompilerType ();
>> }
>> @@ -1035,7 +1032,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> type_name_const_str,
>> byte_size,
>> NULL,
>> -
>> DIERef(encoding_form).GetUID(),
>> +
>> DIERef(encoding_form).GetUID(dwarf),
>> Type::eEncodingIsUID,
>> &decl,
>> clang_type,
>> @@ -1176,7 +1173,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> Type *func_type = NULL;
>>
>> if (type_die_form.IsValid())
>> - func_type =
>> dwarf->ResolveTypeUID(DIERef(type_die_form).GetUID());
>> + func_type =
>> dwarf->ResolveTypeUID(DIERef(type_die_form));
>>
>> if (func_type)
>> return_clang_type =
>> func_type->GetForwardCompilerType ();
>> @@ -1311,12 +1308,12 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> if (debug_map_symfile)
>> {
>> class_symfile =
>> debug_map_symfile->GetSymbolFileByOSOIndex(SymbolFileDWARFDebugMap::GetOSOIndexFromUserID(class_type->GetID()));
>> - class_type_die =
>> class_symfile->DebugInfo()->GetDIE (DIERef(class_type->GetID()));
>> + class_type_die =
>> class_symfile->DebugInfo()->GetDIE (DIERef(class_type->GetID(), dwarf));
>> }
>> else
>> {
>> class_symfile = dwarf;
>> - class_type_die =
>> dwarf->DebugInfo()->GetDIE (DIERef(class_type->GetID()));
>> + class_type_die =
>> dwarf->DebugInfo()->GetDIE (DIERef(class_type->GetID(), dwarf));
>> }
>> if (class_type_die)
>> {
>> @@ -1659,7 +1656,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>>
>> DEBUG_PRINTF ("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> die.GetID(), DW_TAG_value_to_name(tag), type_name_cstr);
>>
>> - Type *element_type =
>> dwarf->ResolveTypeUID(DIERef(type_die_form).GetUID());
>> + Type *element_type =
>> dwarf->ResolveTypeUID(DIERef(type_die_form));
>>
>> if (element_type)
>> {
>> @@ -1696,7 +1693,7 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> empty_name,
>>
>> array_element_bit_stride / 8,
>> NULL,
>> -
>> DIERef(type_die_form).GetUID(),
>> +
>> DIERef(type_die_form).GetUID(dwarf),
>>
>> Type::eEncodingIsUID,
>> &decl,
>> clang_type,
>> @@ -1731,8 +1728,8 @@ DWARFASTParserClang::ParseTypeFromDWARF
>> }
>> }
>>
>> - Type *pointee_type =
>> dwarf->ResolveTypeUID(DIERef(type_die_form).GetUID());
>> - Type *class_type =
>> dwarf->ResolveTypeUID(DIERef(containing_type_die_form).GetUID());
>> + Type *pointee_type =
>> dwarf->ResolveTypeUID(DIERef(type_die_form));
>> + Type *class_type =
>> dwarf->ResolveTypeUID(DIERef(containing_type_die_form));
>>
>> CompilerType pointee_clang_type =
>> pointee_type->GetForwardCompilerType ();
>> CompilerType class_clang_type =
>> class_type->GetLayoutCompilerType ();
>> @@ -1902,7 +1899,7 @@ DWARFASTParserClang::ParseTemplateDIE (c
>> case DW_AT_type:
>> if (attributes.ExtractFormValueAtIndex(i,
>> form_value))
>> {
>> - lldb_type =
>> die.ResolveTypeUID(DIERef(form_value).GetUID());
>> + lldb_type =
>> die.ResolveTypeUID(DIERef(form_value));
>> if (lldb_type)
>> clang_type =
>> lldb_type->GetForwardCompilerType ();
>> }
>> @@ -2803,7 +2800,7 @@ DWARFASTParserClang::ParseChildMembers(c
>> // Handle static members
>> if (is_external && member_byte_offset == UINT32_MAX)
>> {
>> - Type *var_type =
>> die.ResolveTypeUID(DIERef(encoding_form).GetUID());
>> + Type *var_type =
>> die.ResolveTypeUID(DIERef(encoding_form));
>>
>> if (var_type)
>> {
>> @@ -2819,7 +2816,7 @@ DWARFASTParserClang::ParseChildMembers(c
>>
>> if (is_artificial == false)
>> {
>> - Type *member_type =
>> die.ResolveTypeUID(DIERef(encoding_form).GetUID());
>> + Type *member_type =
>> die.ResolveTypeUID(DIERef(encoding_form));
>>
>> clang::FieldDecl *field_decl = NULL;
>> if (tag == DW_TAG_member)
>> @@ -3146,7 +3143,7 @@ DWARFASTParserClang::ParseChildMembers(c
>> }
>> }
>>
>> - Type *base_class_type =
>> die.ResolveTypeUID(DIERef(encoding_form).GetUID());
>> + Type *base_class_type =
>> die.ResolveTypeUID(DIERef(encoding_form));
>> if (base_class_type == NULL)
>> {
>> module_sp->ReportError("0x%8.8x:
>> DW_TAG_inheritance failed to resolve the base class at 0x%8.8" PRIx64 "
>> from enclosing type 0x%8.8x. \nPlease file a bug and attach the file at the
>> start of this error message",
>> @@ -3292,7 +3289,7 @@ DWARFASTParserClang::ParseChildParameter
>> // being in the formal parameter
>> DIE...
>> if (name == NULL || ::strcmp(name,
>> "this")==0)
>> {
>> - Type *this_type =
>> die.ResolveTypeUID (DIERef(param_type_die_form).GetUID());
>> + Type *this_type =
>> die.ResolveTypeUID (DIERef(param_type_die_form));
>> if (this_type)
>> {
>> uint32_t encoding_mask =
>> this_type->GetEncodingMask();
>> @@ -3335,7 +3332,7 @@ DWARFASTParserClang::ParseChildParameter
>>
>> if (!skip)
>> {
>> - Type *type =
>> die.ResolveTypeUID(DIERef(param_type_die_form).GetUID());
>> + Type *type =
>> die.ResolveTypeUID(DIERef(param_type_die_form));
>> if (type)
>> {
>> function_param_types.push_back
>> (type->GetForwardCompilerType ());
>> @@ -3482,7 +3479,7 @@ DWARFASTParserClang::GetTypeForDIE (cons
>> DWARFFormValue form_value;
>>
>> if (attr == DW_AT_type &&
>> attributes.ExtractFormValueAtIndex(i, form_value))
>> - return
>> dwarf->ResolveTypeUID(DIERef(form_value).GetUID());
>> + return dwarf->ResolveTypeUID(dwarf->GetDIE
>> (DIERef(form_value)), true);
>> }
>> }
>> }
>> @@ -3538,11 +3535,10 @@ DWARFASTParserClang::GetClangDeclForDIE
>> case DW_TAG_imported_declaration:
>> {
>> SymbolFileDWARF *dwarf = die.GetDWARF();
>> - lldb::user_id_t imported_uid =
>> die.GetAttributeValueAsReference(DW_AT_import, DW_INVALID_OFFSET);
>> -
>> - if (dwarf->UserIDMatches(imported_uid))
>> + DWARFDIE imported_uid =
>> die.GetAttributeValueAsReferenceDIE(DW_AT_import);
>> + if (imported_uid)
>> {
>> - CompilerDecl imported_decl =
>> dwarf->GetDeclForUID(imported_uid);
>> + CompilerDecl imported_decl = imported_uid.GetDecl();
>> if (imported_decl)
>> {
>> clang::DeclContext *decl_context =
>> ClangASTContext::DeclContextGetAsDeclContext(dwarf->GetDeclContextContainingUID(die.GetID()));
>> @@ -3555,15 +3551,15 @@ DWARFASTParserClang::GetClangDeclForDIE
>> case DW_TAG_imported_module:
>> {
>> SymbolFileDWARF *dwarf = die.GetDWARF();
>> - lldb::user_id_t imported_uid =
>> die.GetAttributeValueAsReference(DW_AT_import, DW_INVALID_OFFSET);
>> + DWARFDIE imported_uid =
>> die.GetAttributeValueAsReferenceDIE(DW_AT_import);
>>
>> - if (dwarf->UserIDMatches(imported_uid))
>> + if (imported_uid)
>> {
>> - CompilerDeclContext imported_decl =
>> dwarf->GetDeclContextForUID(imported_uid);
>> - if (imported_decl)
>> + CompilerDeclContext imported_decl_ctx =
>> imported_uid.GetDeclContext();
>> + if (imported_decl_ctx)
>> {
>> clang::DeclContext *decl_context =
>> ClangASTContext::DeclContextGetAsDeclContext(dwarf->GetDeclContextContainingUID(die.GetID()));
>> - if (clang::NamespaceDecl *ns_decl =
>> ClangASTContext::DeclContextGetAsNamespaceDecl(imported_decl))
>> + if (clang::NamespaceDecl *ns_decl =
>> ClangASTContext::DeclContextGetAsNamespaceDecl(imported_decl_ctx))
>> decl =
>> m_ast.CreateUsingDirectiveDeclaration(decl_context, ns_decl);
>> }
>> }
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserGo.cpp Wed
>> Mar 30 15:14:35 2016
>> @@ -144,7 +144,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> }
>> }
>>
>> - DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\") type =>
>> 0x%8.8lx\n", dwarf->MakeUserID(die.GetOffset()),
>> + DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\") type =>
>> 0x%8.8lx\n", die.GetID(),
>> DW_TAG_value_to_name(tag),
>> type_name_cstr, encoding_uid);
>>
>> switch (tag)
>> @@ -183,7 +183,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> break;
>> }
>>
>> - type_sp.reset(new
>> Type(dwarf->MakeUserID(die.GetOffset()), dwarf, type_name_const_str,
>> byte_size,
>> + type_sp.reset(new Type(die.GetID(), dwarf,
>> type_name_const_str, byte_size,
>> NULL, encoding_uid,
>> encoding_data_type, &decl, compiler_type, resolve_state));
>>
>> dwarf->m_die_to_type[die.GetDIE()] = type_sp.get();
>> @@ -254,7 +254,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> }
>> }
>>
>> - DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> dwarf->MakeUserID(die.GetOffset()),
>> + DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> die.GetID(),
>> DW_TAG_value_to_name(tag),
>> type_name_cstr);
>>
>> bool compiler_type_was_created = false;
>> @@ -265,7 +265,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> compiler_type = m_ast.CreateStructType(go_kind,
>> type_name_const_str, byte_size);
>> }
>>
>> - type_sp.reset(new
>> Type(dwarf->MakeUserID(die.GetOffset()), dwarf, type_name_const_str,
>> byte_size,
>> + type_sp.reset(new Type(die.GetID(), dwarf,
>> type_name_const_str, byte_size,
>> NULL, LLDB_INVALID_UID,
>> Type::eEncodingIsUID, &decl, compiler_type,
>> Type::eResolveStateForward));
>>
>> @@ -347,7 +347,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> }
>> }
>>
>> - DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> dwarf->MakeUserID(die.GetOffset()),
>> + DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> die.GetID(),
>> DW_TAG_value_to_name(tag),
>> type_name_cstr);
>>
>> std::vector<CompilerType> function_param_types;
>> @@ -363,7 +363,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> compiler_type =
>> m_ast.CreateFunctionType(type_name_const_str, function_param_types.data(),
>>
>> function_param_types.size(), is_variadic);
>>
>> - type_sp.reset(new
>> Type(dwarf->MakeUserID(die.GetOffset()), dwarf, type_name_const_str, 0,
>> NULL,
>> + type_sp.reset(new Type(die.GetID(), dwarf,
>> type_name_const_str, 0, NULL,
>> LLDB_INVALID_UID,
>> Type::eEncodingIsUID, &decl, compiler_type,
>> Type::eResolveStateFull));
>> assert(type_sp.get());
>> @@ -410,7 +410,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> }
>> }
>>
>> - DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> dwarf->MakeUserID(die.GetOffset()),
>> + DEBUG_PRINTF("0x%8.8" PRIx64 ": %s (\"%s\")\n",
>> die.GetID(),
>> DW_TAG_value_to_name(tag),
>> type_name_cstr);
>>
>> Type *element_type =
>> dwarf->ResolveTypeUID(type_die_offset);
>> @@ -433,7 +433,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> {
>> compiler_type =
>> m_ast.CreateArrayType(type_name_const_str, array_element_type, 0);
>> }
>> - type_sp.reset(new
>> Type(dwarf->MakeUserID(die.GetOffset()), dwarf, type_name_const_str,
>> + type_sp.reset(new Type(die.GetID(), dwarf,
>> type_name_const_str,
>> byte_stride, NULL,
>> type_die_offset, Type::eEncodingIsUID, &decl,
>> compiler_type,
>> Type::eResolveStateFull));
>> type_sp->SetEncodingType(element_type);
>> @@ -463,7 +463,7 @@ DWARFASTParserGo::ParseTypeFromDWARF(con
>> else if (sc.function != NULL && sc_parent_die)
>> {
>> symbol_context_scope =
>> -
>> sc.function->GetBlock(true).FindBlockByID(dwarf->MakeUserID(sc_parent_die.GetOffset()));
>> +
>> sc.function->GetBlock(true).FindBlockByID(sc_parent_die.GetID());
>> if (symbol_context_scope == NULL)
>> symbol_context_scope = sc.function;
>> }
>> @@ -510,7 +510,7 @@ DWARFASTParserGo::ParseChildParameters(c
>> if (num_attributes > 0)
>> {
>> Declaration decl;
>> - dw_offset_t param_type_die_offset =
>> DW_INVALID_OFFSET;
>> + DWARFFormValue param_type_die_offset;
>>
>> uint32_t i;
>> for (i = 0; i < num_attributes; ++i)
>> @@ -525,7 +525,7 @@ DWARFASTParserGo::ParseChildParameters(c
>> // = form_value.AsCString();
>> break;
>> case DW_AT_type:
>> - param_type_die_offset =
>> form_value.Reference();
>> + param_type_die_offset = form_value;
>> break;
>> case DW_AT_location:
>> // if
>> (form_value.BlockData())
>> @@ -547,7 +547,7 @@ DWARFASTParserGo::ParseChildParameters(c
>> }
>> }
>>
>> - Type *type =
>> parent_die.ResolveTypeUID(param_type_die_offset);
>> + Type *type =
>> parent_die.ResolveTypeUID(DIERef(param_type_die_offset));
>> if (type)
>> {
>>
>> function_param_types.push_back(type->GetForwardCompilerType());
>> @@ -628,7 +628,7 @@ DWARFASTParserGo::CompleteTypeFromDWARF(
>> Log *log = nullptr; //
>> (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
>> if (log)
>> dwarf->GetObjectFile()->GetModule()->LogMessageVerboseBacktrace(
>> - log, "0x%8.8" PRIx64 ": %s '%s' resolving forward
>> declaration...", dwarf->MakeUserID(die.GetOffset()),
>> + log, "0x%8.8" PRIx64 ": %s '%s' resolving forward
>> declaration...", die.GetID(),
>> DW_TAG_value_to_name(tag), type->GetName().AsCString());
>> assert(compiler_type);
>> DWARFAttributes attributes;
>> @@ -683,7 +683,7 @@ DWARFASTParserGo::ParseChildMembers(cons
>> Declaration decl;
>> const char *name = NULL;
>>
>> - lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
>> + DWARFFormValue encoding_uid;
>> uint32_t member_byte_offset = UINT32_MAX;
>> uint32_t i;
>> for (i = 0; i < num_attributes; ++i)
>> @@ -698,7 +698,7 @@ DWARFASTParserGo::ParseChildMembers(cons
>> name = form_value.AsCString();
>> break;
>> case DW_AT_type:
>> - encoding_uid =
>> form_value.Reference();
>> + encoding_uid = form_value;
>> break;
>> case DW_AT_data_member_location:
>> if (form_value.BlockData())
>> @@ -735,7 +735,7 @@ DWARFASTParserGo::ParseChildMembers(cons
>> }
>> }
>>
>> - Type *member_type = die.ResolveTypeUID(encoding_uid);
>> + Type *member_type =
>> die.ResolveTypeUID(DIERef(encoding_uid));
>> if (member_type)
>> {
>> CompilerType member_go_type =
>> member_type->GetFullCompilerType();
>> @@ -808,10 +808,12 @@ DWARFASTParserGo::ParseFunctionFromDWARF
>>
>> if (dwarf->FixupAddress(func_range.GetBaseAddress()))
>> {
>> - const user_id_t func_user_id =
>> dwarf->MakeUserID(die.GetOffset());
>> + const user_id_t func_user_id = die.GetID();
>> func_sp.reset(new Function(sc.comp_unit,
>> -
>> dwarf->MakeUserID(func_user_id), // UserID is the DIE offset
>> -
>> dwarf->MakeUserID(func_user_id), func_name, func_type,
>> + func_user_id, // UserID is
>> the DIE offset
>> + func_user_id,
>> + func_name,
>> + func_type,
>> func_range)); // first
>> address range
>>
>> if (func_sp.get() != NULL)
>>
>> Modified:
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserJava.cpp Wed
>> Mar 30 15:14:35 2016
>> @@ -77,7 +77,7 @@ DWARFASTParserJava::ParseArrayTypeFromDI
>> dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;
>>
>> ConstString linkage_name;
>> - lldb::user_id_t type_die_offset = DW_INVALID_OFFSET;
>> + DWARFFormValue type_attr_value;
>> lldb::addr_t data_offset = LLDB_INVALID_ADDRESS;
>> DWARFExpression length_expression(die.GetCU());
>>
>> @@ -95,7 +95,7 @@ DWARFASTParserJava::ParseArrayTypeFromDI
>> linkage_name.SetCString(form_value.AsCString());
>> break;
>> case DW_AT_type:
>> - type_die_offset = form_value.Reference();
>> + type_attr_value = form_value;
>> break;
>> case DW_AT_data_member_location:
>> data_offset = form_value.Unsigned();
>> @@ -140,7 +140,8 @@ DWARFASTParserJava::ParseArrayTypeFromDI
>> }
>> }
>>
>> - Type *element_type = dwarf->ResolveTypeUID(type_die_offset);
>> + DIERef type_die_ref(type_attr_value);
>> + Type *element_type = dwarf->ResolveTypeUID(type_die_ref);
>> if (!element_type)
>> return nullptr;
>>
>> @@ -150,7 +151,7 @@ DWARFASTParserJava::ParseArrayTypeFromDI
>>
>> Declaration decl;
>> TypeSP type_sp(new Type(die.GetID(), dwarf,
>> array_compiler_type.GetTypeName(), -1, nullptr,
>> - dwarf->MakeUserID(type_die_offset),
>> Type::eEncodingIsUID, &decl,
>> + type_die_ref.GetUID(dwarf),
>> Type::eEncodingIsUID, &decl,
>> array_compiler_type,
>> Type::eResolveStateFull));
>> type_sp->SetEncodingType(element_type);
>> return type_sp;
>> @@ -163,7 +164,7 @@ DWARFASTParserJava::ParseReferenceTypeFr
>> dwarf->m_die_to_type[die.GetDIE()] = DIE_IS_BEING_PARSED;
>>
>> Declaration decl;
>> - lldb::user_id_t type_die_offset = DW_INVALID_OFFSET;
>> + DWARFFormValue type_attr_value;
>>
>> DWARFAttributes attributes;
>> const size_t num_attributes = die.GetAttributes(attributes);
>> @@ -176,7 +177,7 @@ DWARFASTParserJava::ParseReferenceTypeFr
>> switch (attr)
>> {
>> case DW_AT_type:
>> - type_die_offset = form_value.Reference();
>> + type_attr_value = form_value;
>> break;
>> default:
>> assert(false && "Unsupported attribute for
>> DW_TAG_array_type");
>> @@ -184,14 +185,15 @@ DWARFASTParserJava::ParseReferenceTypeFr
>> }
>> }
>>
>> - Type *pointee_type = dwarf->ResolveTypeUID(type_die_offset);
>> + DIERef type_die_ref(type_attr_value);
>> + Type *pointee_type = dwarf->ResolveTypeUID(type_die_ref);
>> if (!pointee_type)
>> return nullptr;
>>
>> CompilerType pointee_compiler_type =
>> pointee_type->GetForwardCompilerType();
>> CompilerType reference_compiler_type =
>> m_ast.CreateReferenceType(pointee_compiler_type);
>> TypeSP type_sp(new Type(die.GetID(), dwarf,
>> reference_compiler_type.GetTypeName(), -1, nullptr,
>> - dwarf->MakeUserID(type_die_offset),
>> Type::eEncodingIsUID, &decl,
>> + type_die_ref.GetUID(dwarf),
>> Type::eEncodingIsUID, &decl,
>> reference_compiler_type,
>> Type::eResolveStateFull));
>> type_sp->SetEncodingType(pointee_type);
>> return type_sp;
>> @@ -463,7 +465,7 @@ DWARFASTParserJava::ParseChildMembers(co
>> case DW_TAG_member:
>> {
>> const char *name = nullptr;
>> - lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
>> + DWARFFormValue encoding_uid;
>> uint32_t member_byte_offset = UINT32_MAX;
>> DWARFExpression member_location_expression(dwarf_cu);
>> bool artificial = true;
>> @@ -481,7 +483,7 @@ DWARFASTParserJava::ParseChildMembers(co
>> name = form_value.AsCString();
>> break;
>> case DW_AT_type:
>> - encoding_uid = form_value.Reference();
>> + encoding_uid = form_value;
>> break;
>> case DW_AT_data_member_location:
>> if (form_value.BlockData())
>> @@ -508,7 +510,7 @@ DWARFASTParserJava::ParseChildMembers(co
>> m_ast.SetDynamicTypeId(compiler_type,
>> member_location_expression);
>> else
>> {
>> - if (Type *member_type =
>> die.ResolveTypeUID(encoding_uid))
>> + if (Type *member_type =
>> die.ResolveTypeUID(DIERef(encoding_uid)))
>> m_ast.AddMemberToObject(compiler_type,
>> ConstString(name), member_type->GetFullCompilerType(),
>> member_byte_offset);
>> }
>> @@ -516,7 +518,7 @@ DWARFASTParserJava::ParseChildMembers(co
>> }
>> case DW_TAG_inheritance:
>> {
>> - lldb::user_id_t encoding_uid = LLDB_INVALID_UID;
>> + DWARFFormValue encoding_uid;
>> uint32_t member_byte_offset = UINT32_MAX;
>>
>> DWARFAttributes attributes;
>> @@ -529,7 +531,7 @@ DWARFASTParserJava::ParseChildMembers(co
>> switch (attributes.AttributeAtIndex(i))
>> {
>> case DW_AT_type:
>> - encoding_uid = form_value.Reference();
>> + encoding_uid = form_value;
>> break;
>> case DW_AT_data_member_location:
>> member_byte_offset =
>> form_value.Unsigned();
>> @@ -543,7 +545,7 @@ DWARFASTParserJava::ParseChildMembers(co
>> }
>> }
>> }
>> - if (Type *base_type = die.ResolveTypeUID(encoding_uid))
>> + if (Type *base_type =
>> die.ResolveTypeUID(DIERef(encoding_uid)))
>> m_ast.AddBaseClassToObject(compiler_type,
>> base_type->GetFullCompilerType(), member_byte_offset);
>> break;
>> }
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp Wed
>> Mar 30 15:14:35 2016
>> @@ -433,7 +433,7 @@ DWARFCompileUnit::GetID () const
>> {
>> dw_offset_t local_id = m_base_obj_offset != DW_INVALID_OFFSET ?
>> m_base_obj_offset : m_offset;
>> if (m_dwarf2Data)
>> - return m_dwarf2Data->MakeUserID(local_id);
>> + return DIERef(local_id, local_id).GetUID(m_dwarf2Data);
>> else
>> return local_id;
>> }
>> @@ -631,7 +631,7 @@ DWARFCompileUnit::GetDIE (dw_offset_t di
>> {
>> // Don't specify the compile unit offset as we don't know it
>> because the DIE belongs to
>> // a different compile unit in the same symbol file.
>> - return m_dwarf2Data->DebugInfo()->GetDIE
>> (DIERef(die_offset));
>> + return
>> m_dwarf2Data->DebugInfo()->GetDIEForDIEOffset(die_offset);
>> }
>> }
>> return DWARFDIE(); // Not found
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp Wed Mar 30
>> 15:14:35 2016
>> @@ -9,6 +9,7 @@
>>
>> #include "DWARFDIE.h"
>>
>> +#include "DWARFASTParser.h"
>> #include "DWARFCompileUnit.h"
>> #include "DWARFDebugAbbrev.h"
>> #include "DWARFDebugAranges.h"
>> @@ -127,6 +128,21 @@ DWARFDIE::GetAttributeValueAsSigned (con
>> return fail_value;
>> }
>>
>> +DWARFDIE
>> +DWARFDIE::GetAttributeValueAsReferenceDIE (const dw_attr_t attr) const
>> +{
>> + if (IsValid())
>> + {
>> + DWARFCompileUnit *cu = GetCU();
>> + SymbolFileDWARF *dwarf = cu->GetSymbolFileDWARF();
>> + const bool check_specification_or_abstract_origin = true;
>> + DWARFFormValue form_value;
>> + if (m_die->GetAttributeValue(dwarf, cu, attr, form_value,
>> nullptr, check_specification_or_abstract_origin))
>> + return dwarf->GetDIE(DIERef(form_value));
>> + }
>> + return DWARFDIE();
>> +}
>> +
>> uint64_t
>> DWARFDIE::GetAttributeValueAsReference (const dw_attr_t attr, uint64_t
>> fail_value) const
>> {
>> @@ -166,7 +182,7 @@ DWARFDIE::LookupDeepestBlock (lldb::addr
>> if (cu->ContainsDIEOffset(block_die->GetOffset()))
>> return DWARFDIE(cu, block_die);
>> else
>> - return
>> DWARFDIE(dwarf->DebugInfo()->GetCompileUnitContainingDIE(DIERef(cu->GetOffset(),
>> block_die->GetOffset())), block_die);
>> + return
>> DWARFDIE(dwarf->DebugInfo()->GetCompileUnit(DIERef(cu->GetOffset(),
>> block_die->GetOffset())), block_die);
>> }
>> }
>> }
>> @@ -176,27 +192,7 @@ DWARFDIE::LookupDeepestBlock (lldb::addr
>> lldb::user_id_t
>> DWARFDIE::GetID () const
>> {
>> - const dw_offset_t die_offset = GetOffset();
>> - if (die_offset != DW_INVALID_OFFSET)
>> - {
>> - lldb::user_id_t id = 0;
>> - SymbolFileDWARF *dwarf = GetDWARF();
>> - if (dwarf)
>> - id = dwarf->MakeUserID(die_offset);
>> - else
>> - id = die_offset;
>> -
>> - if (m_cu)
>> - {
>> - lldb::user_id_t cu_id = m_cu->GetID()&0xffffffff00000000ull;
>> - assert ((id&0xffffffff00000000ull) == 0 ||
>> - (cu_id&0xffffffff00000000ll) == 0 ||
>> - (id&0xffffffff00000000ull) ==
>> (cu_id&0xffffffff00000000ll));
>> - id |= cu_id;
>> - }
>> - return id;
>> - }
>> - return LLDB_INVALID_UID;
>> + return GetDIERef().GetUID(GetDWARF());
>> }
>>
>> const char *
>> @@ -274,11 +270,11 @@ DWARFDIE::ResolveType () const
>> }
>>
>> lldb_private::Type *
>> -DWARFDIE::ResolveTypeUID (lldb::user_id_t uid) const
>> +DWARFDIE::ResolveTypeUID (const DIERef &die_ref) const
>> {
>> SymbolFileDWARF *dwarf = GetDWARF();
>> if (dwarf)
>> - return dwarf->ResolveTypeUID(uid);
>> + return dwarf->ResolveTypeUID(dwarf->GetDIE(die_ref), true);
>> else
>> return nullptr;
>> }
>> @@ -530,6 +526,36 @@ DWARFDIE::Dump (lldb_private::Stream *s,
>> }
>>
>>
>> +CompilerDecl
>> +DWARFDIE::GetDecl () const
>> +{
>> + DWARFASTParser *dwarf_ast = GetDWARFParser();
>> + if (dwarf_ast)
>> + return dwarf_ast->GetDeclForUIDFromDWARF(*this);
>> + else
>> + return CompilerDecl();
>> +}
>> +
>> +CompilerDeclContext
>> +DWARFDIE::GetDeclContext () const
>> +{
>> + DWARFASTParser *dwarf_ast = GetDWARFParser();
>> + if (dwarf_ast)
>> + return dwarf_ast->GetDeclContextForUIDFromDWARF(*this);
>> + else
>> + return CompilerDeclContext();
>> +}
>> +
>> +CompilerDeclContext
>> +DWARFDIE::GetContainingDeclContext () const
>> +{
>> + DWARFASTParser *dwarf_ast = GetDWARFParser();
>> + if (dwarf_ast)
>> + return dwarf_ast->GetDeclContextContainingUIDFromDWARF(*this);
>> + else
>> + return CompilerDeclContext();
>> +}
>> +
>> bool operator == (const DWARFDIE &lhs, const DWARFDIE &rhs)
>> {
>> return lhs.GetDIE() == rhs.GetDIE() && lhs.GetCU() == rhs.GetCU();
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIE.h Wed Mar 30
>> 15:14:35 2016
>> @@ -58,7 +58,7 @@ public:
>>
>> //----------------------------------------------------------------------
>> // Tests
>>
>> //----------------------------------------------------------------------
>> - operator bool () const
>> + explicit operator bool () const
>> {
>> return IsValid();
>> }
>> @@ -180,9 +180,11 @@ public:
>> lldb_private::Type *
>> ResolveType () const;
>>
>> +
>> //----------------------------------------------------------------------
>> // Resolve a type by UID using this DIE's DWARF file
>> +
>> //----------------------------------------------------------------------
>> lldb_private::Type *
>> - ResolveTypeUID (lldb::user_id_t uid) const;
>> + ResolveTypeUID (const DIERef &die_ref) const;
>>
>>
>> //----------------------------------------------------------------------
>> // Functions for obtaining DIE relations and references
>> @@ -245,6 +247,9 @@ public:
>> uint64_t
>> GetAttributeValueAsReference (const dw_attr_t attr, uint64_t
>> fail_value) const;
>>
>> + DWARFDIE
>> + GetAttributeValueAsReferenceDIE (const dw_attr_t attr) const;
>> +
>> uint64_t
>> GetAttributeValueAsAddress (const dw_attr_t attr, uint64_t
>> fail_value) const;
>>
>> @@ -270,6 +275,15 @@ public:
>> void
>> Dump (lldb_private::Stream *s, const uint32_t recurse_depth) const;
>>
>> + lldb_private::CompilerDecl
>> + GetDecl () const;
>> +
>> + lldb_private::CompilerDeclContext
>> + GetDeclContext() const;
>> +
>> + lldb_private::CompilerDeclContext
>> + GetContainingDeclContext() const;
>> +
>> protected:
>> DWARFCompileUnit *m_cu;
>> DWARFDebugInfoEntry *m_die;
>>
>> Modified:
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp Wed
>> Mar 30 15:14:35 2016
>> @@ -16,17 +16,6 @@
>> using namespace lldb_private;
>> using namespace std;
>>
>> -bool
>> -DWARFDIECollection::Insert(const DWARFDIE &die)
>> -{
>> - iterator end_pos = m_dies.end();
>> - iterator insert_pos = upper_bound(m_dies.begin(), end_pos, die);
>> - if (insert_pos != end_pos && (*insert_pos == die))
>> - return false;
>> - m_dies.insert(insert_pos, die);
>> - return true;
>> -}
>> -
>> void
>> DWARFDIECollection::Append (const DWARFDIE &die)
>> {
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.h Wed
>> Mar 30 15:14:35 2016
>> @@ -33,9 +33,6 @@ public:
>> DWARFDIE
>> GetDIEAtIndex (uint32_t idx) const;
>>
>> - bool
>> - Insert(const DWARFDIE &die);
>> -
>> size_t
>> Size() const;
>>
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp Wed Mar
>> 30 15:14:35 2016
>> @@ -209,48 +209,51 @@ DWARFDebugInfo::GetCompileUnit(dw_offset
>> }
>>
>> DWARFCompileUnit *
>> -DWARFDebugInfo::GetCompileUnitContainingDIE (const DIERef& die_ref)
>> +DWARFDebugInfo::GetCompileUnit (const DIERef& die_ref)
>> {
>> - dw_offset_t search_offset = die_ref.die_offset;
>> - bool is_cu_offset = false;
>> - if (m_dwarf2Data->GetID() == 0 && die_ref.cu_offset !=
>> DW_INVALID_OFFSET)
>> - {
>> - is_cu_offset = true;
>> - search_offset = die_ref.cu_offset;
>> - }
>> + if (die_ref.cu_offset == DW_INVALID_OFFSET)
>> + return GetCompileUnitContainingDIEOffset(die_ref.die_offset);
>> + else
>> + return GetCompileUnit(die_ref.cu_offset);
>> +}
>> +
>> +DWARFCompileUnit*
>> +DWARFDebugInfo::GetCompileUnitContainingDIEOffset(dw_offset_t die_offset)
>> +{
>> + ParseCompileUnitHeadersIfNeeded();
>>
>> DWARFCompileUnitSP cu_sp;
>> - if (search_offset != DW_INVALID_OFFSET)
>> - {
>> - ParseCompileUnitHeadersIfNeeded();
>>
>> - // Watch out for single compile unit executable as they are
>> pretty common
>> - const size_t num_cus = m_compile_units.size();
>> - if (num_cus == 1)
>> - {
>> - if ((is_cu_offset && m_compile_units[0]->GetOffset() ==
>> search_offset) ||
>> - (!is_cu_offset &&
>> m_compile_units[0]->ContainsDIEOffset(search_offset)))
>> - {
>> - cu_sp = m_compile_units[0];
>> - }
>> - }
>> - else if (num_cus)
>> + // Watch out for single compile unit executable as they are pretty
>> common
>> + const size_t num_cus = m_compile_units.size();
>> + if (num_cus == 1)
>> + {
>> + if (m_compile_units[0]->ContainsDIEOffset(die_offset))
>> + return m_compile_units[0].get();
>> + }
>> + else if (num_cus)
>> + {
>> + CompileUnitColl::const_iterator end_pos = m_compile_units.end();
>> + CompileUnitColl::const_iterator begin_pos =
>> m_compile_units.begin();
>> + CompileUnitColl::const_iterator pos =
>> std::upper_bound(begin_pos, end_pos, die_offset,
>> OffsetLessThanCompileUnitOffset);
>> + if (pos != begin_pos)
>> {
>> - CompileUnitColl::const_iterator end_pos =
>> m_compile_units.end();
>> - CompileUnitColl::const_iterator begin_pos =
>> m_compile_units.begin();
>> - CompileUnitColl::const_iterator pos =
>> std::upper_bound(begin_pos, end_pos, search_offset,
>> OffsetLessThanCompileUnitOffset);
>> - if (pos != begin_pos)
>> - {
>> - --pos;
>> - if ((is_cu_offset && (*pos)->GetOffset() ==
>> search_offset) ||
>> - (!is_cu_offset &&
>> (*pos)->ContainsDIEOffset(search_offset)))
>> - {
>> - cu_sp = *pos;
>> - }
>> - }
>> + --pos;
>> + if ((*pos)->ContainsDIEOffset(die_offset))
>> + return (*pos).get();
>> }
>> }
>> - return cu_sp.get();
>> +
>> + return nullptr;
>> +}
>> +
>> +DWARFDIE
>> +DWARFDebugInfo::GetDIEForDIEOffset(dw_offset_t die_offset)
>> +{
>> + DWARFCompileUnit* cu = GetCompileUnitContainingDIEOffset(die_offset);
>> + if (cu)
>> + return cu->GetDIE(die_offset);
>> + return DWARFDIE();
>> }
>>
>> //----------------------------------------------------------------------
>> @@ -261,7 +264,7 @@ DWARFDebugInfo::GetCompileUnitContaining
>> DWARFDIE
>> DWARFDebugInfo::GetDIE(const DIERef& die_ref)
>> {
>> - DWARFCompileUnit *cu = GetCompileUnitContainingDIE(die_ref);
>> + DWARFCompileUnit *cu = GetCompileUnit(die_ref);
>> if (cu)
>> return cu->GetDIE (die_ref.die_offset);
>> return DWARFDIE(); // Not found
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h Wed Mar
>> 30 15:14:35 2016
>> @@ -39,9 +39,10 @@ public:
>> size_t GetNumCompileUnits();
>> bool ContainsCompileUnit (const DWARFCompileUnit *cu) const;
>> DWARFCompileUnit* GetCompileUnitAtIndex (uint32_t idx);
>> - DWARFCompileUnit* GetCompileUnit (dw_offset_t cu_offset, uint32_t*
>> idx_ptr = NULL);
>> - DWARFCompileUnit* GetCompileUnitContainingDIE (const DIERef&
>> die_ref);
>> -
>> + DWARFCompileUnit* GetCompileUnit(dw_offset_t cu_offset, uint32_t*
>> idx_ptr = NULL);
>> + DWARFCompileUnit* GetCompileUnitContainingDIEOffset (dw_offset_t
>> die_offset);
>> + DWARFCompileUnit* GetCompileUnit(const DIERef& die_ref);
>> + DWARFDIE GetDIEForDIEOffset(dw_offset_t die_offset);
>> DWARFDIE GetDIE (const DIERef& die_ref);
>>
>> void Dump(lldb_private::Stream *s, const uint32_t die_offset, const
>> uint32_t recurse_depth);
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h Wed
>> Mar 30 15:14:35 2016
>> @@ -115,6 +115,13 @@ public:
>> DWARFAttributes& attrs,
>> uint32_t curr_depth = 0) const; // "curr_depth" for
>> internal use only, don't set this yourself!!!
>>
>> + dw_offset_t GetAttributeValue(SymbolFileDWARF* dwarf2Data,
>> + const DWARFCompileUnit* cu,
>> + const dw_attr_t attr,
>> + DWARFFormValue& formValue,
>> + dw_offset_t* end_attr_offset_ptr =
>> nullptr,
>> + bool
>> check_specification_or_abstract_origin = false) const;
>> +
>> const char* GetAttributeValueAsString(
>> SymbolFileDWARF* dwarf2Data,
>> const DWARFCompileUnit* cu,
>> @@ -382,12 +389,6 @@ public:
>> DWARFDebugInfoEntry::collection &die_collection);
>>
>> protected:
>> - dw_offset_t GetAttributeValue(SymbolFileDWARF* dwarf2Data,
>> - const DWARFCompileUnit* cu,
>> - const dw_attr_t attr,
>> - DWARFFormValue& formValue,
>> - dw_offset_t* end_attr_offset_ptr =
>> nullptr,
>> - bool
>> check_specification_or_abstract_origin = false) const;
>>
>> dw_offset_t m_offset; // Offset within the .debug_info of
>> the start of this entry
>> uint32_t m_parent_idx; // How many to subtract from "this"
>> to get the parent. If zero this die has no parent
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp Wed Mar
>> 30 15:14:35 2016
>> @@ -167,6 +167,14 @@ DWARFFormValue::DWARFFormValue(const DWA
>> {
>> }
>>
>> +void
>> +DWARFFormValue::Clear()
>> +{
>> + m_cu = nullptr;
>> + m_form = 0;
>> + memset(&m_value, 0, sizeof(m_value));
>> +}
>> +
>> bool
>> DWARFFormValue::ExtractValue(const DWARFDataExtractor& data,
>> lldb::offset_t* offset_ptr)
>> {
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFFormValue.h Wed Mar
>> 30 15:14:35 2016
>> @@ -101,6 +101,7 @@ public:
>> static FixedFormSizes GetFixedFormSizesForAddressSize (uint8_t
>> addr_size, bool is_dwarf64);
>> static int Compare (const DWARFFormValue& a,
>> const DWARFFormValue& b);
>> + void Clear();
>> protected:
>> const DWARFCompileUnit* m_cu; // Compile unit for this form
>> dw_form_t m_form; // Form for this value
>>
>> 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=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Wed
>> Mar 30 15:14:35 2016
>> @@ -279,9 +279,11 @@ SymbolFileDWARF::CreateInstance (ObjectF
>> TypeList *
>> SymbolFileDWARF::GetTypeList ()
>> {
>> - if (GetDebugMapSymfile ())
>> - return m_debug_map_symfile->GetTypeList();
>> - return m_obj_file->GetModule()->GetTypeList();
>> + SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
>> + if (debug_map_symfile)
>> + return debug_map_symfile->GetTypeList();
>> + else
>> + return m_obj_file->GetModule()->GetTypeList();
>>
>> }
>> void
>> @@ -485,15 +487,17 @@ GetDWARFMachOSegmentName ()
>> UniqueDWARFASTTypeMap &
>> SymbolFileDWARF::GetUniqueDWARFASTTypeMap ()
>> {
>> - if (GetDebugMapSymfile ())
>> - return m_debug_map_symfile->GetUniqueDWARFASTTypeMap ();
>> - return m_unique_ast_type_map;
>> + SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
>> + if (debug_map_symfile)
>> + return debug_map_symfile->GetUniqueDWARFASTTypeMap ();
>> + else
>> + return m_unique_ast_type_map;
>> }
>>
>> TypeSystem *
>> SymbolFileDWARF::GetTypeSystemForLanguage (LanguageType language)
>> {
>> - SymbolFileDWARFDebugMap * debug_map_symfile = GetDebugMapSymfile ();
>> + SymbolFileDWARFDebugMap *debug_map_symfile = GetDebugMapSymfile();
>> TypeSystem *type_system;
>> if (debug_map_symfile)
>> {
>> @@ -825,30 +829,13 @@ SymbolFileDWARF::GetDWARFCompileUnit(lld
>> DWARFDebugInfo* info = DebugInfo();
>> if (info)
>> {
>> - if (GetDebugMapSymfile ())
>> - {
>> - // The debug map symbol file made the compile units for this
>> DWARF
>> - // file which is .o file with DWARF in it, and we should have
>> - // only 1 compile unit which is at offset zero in the DWARF.
>> - // TODO: modify to support LTO .o files where each .o file
>> might
>> - // have multiple DW_TAG_compile_unit tags.
>> -
>> - DWARFCompileUnit *dwarf_cu = info->GetCompileUnit(0);
>> - if (dwarf_cu && dwarf_cu->GetUserData() == NULL)
>> - dwarf_cu->SetUserData(comp_unit);
>> - return dwarf_cu;
>> - }
>> - else
>> - {
>> - // Just a normal DWARF file whose user ID for the compile
>> unit is
>> - // the DWARF offset itself
>> -
>> - DWARFCompileUnit *dwarf_cu =
>> info->GetCompileUnit((dw_offset_t)comp_unit->GetID());
>> - if (dwarf_cu && dwarf_cu->GetUserData() == NULL)
>> - dwarf_cu->SetUserData(comp_unit);
>> - return dwarf_cu;
>> + // Just a normal DWARF file whose user ID for the compile unit is
>> + // the DWARF offset itself
>>
>> - }
>> + DWARFCompileUnit *dwarf_cu =
>> info->GetCompileUnit((dw_offset_t)comp_unit->GetID());
>> + if (dwarf_cu && dwarf_cu->GetUserData() == NULL)
>> + dwarf_cu->SetUserData(comp_unit);
>> + return dwarf_cu;
>> }
>> return NULL;
>> }
>> @@ -895,7 +882,7 @@ SymbolFileDWARF::ParseCompileUnit (DWARF
>> {
>> return
>> dwarf_cu->GetSymbolFileDWARF()->ParseCompileUnit(dwarf_cu, cu_idx);
>> }
>> - else if (GetDebugMapSymfile ())
>> + else if (dwarf_cu->GetOffset() == 0 && GetDebugMapSymfile ())
>> {
>> // Let the debug map create the compile unit
>> cu_sp = m_debug_map_symfile->GetCompileUnit(this);
>> @@ -1009,7 +996,7 @@ SymbolFileDWARF::ParseCompileUnitFunctio
>> bool
>> SymbolFileDWARF::FixupAddress (Address &addr)
>> {
>> - SymbolFileDWARFDebugMap * debug_map_symfile = GetDebugMapSymfile ();
>> + SymbolFileDWARFDebugMap * debug_map_symfile = GetDebugMapSymfile();
>> if (debug_map_symfile)
>> {
>> return debug_map_symfile->LinkOSOAddress(addr);
>> @@ -1230,13 +1217,14 @@ SymbolFileDWARF::ParseCompileUnitLineTab
>>
>> lldb::offset_t offset = cu_line_offset;
>>
>> DWARFDebugLine::ParseStatementTable(get_debug_line_data(), &offset,
>> ParseDWARFLineTableCallback, &info);
>> - if (m_debug_map_symfile)
>> + SymbolFileDWARFDebugMap *debug_map_symfile =
>> GetDebugMapSymfile();
>> + if (debug_map_symfile)
>> {
>> // We have an object file that has a line table
>> with addresses
>> // that are not linked. We need to link the line
>> table and convert
>> // the addresses that are relative to the .o
>> file into addresses
>> // for the main executable.
>> - sc.comp_unit->SetLineTable
>> (m_debug_map_symfile->LinkOSOLineTable (this, line_table_ap.get()));
>> + sc.comp_unit->SetLineTable
>> (debug_map_symfile->LinkOSOLineTable (this, line_table_ap.get()));
>> }
>> else
>> {
>> @@ -1474,60 +1462,27 @@ SymbolFileDWARF::ParseDeclsForContext (C
>> CompilerDecl
>> SymbolFileDWARF::GetDeclForUID (lldb::user_id_t type_uid)
>> {
>> - if (UserIDMatches(type_uid))
>> - {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> - if (debug_info)
>> - {
>> - DWARFDIE die = debug_info->GetDIE(DIERef(type_uid));
>> - if (die)
>> - {
>> - DWARFASTParser *dwarf_ast = die.GetDWARFParser();
>> - if (dwarf_ast)
>> - return dwarf_ast->GetDeclForUIDFromDWARF(die);
>> - }
>> - }
>> - }
>> + DWARFDIE die = GetDIE(DIERef(type_uid, this));
>> + if (die)
>> + return die.GetDecl();
>> return CompilerDecl();
>> }
>>
>> CompilerDeclContext
>> SymbolFileDWARF::GetDeclContextForUID (lldb::user_id_t type_uid)
>> {
>> - if (UserIDMatches(type_uid))
>> - {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> - if (debug_info)
>> - {
>> - DWARFDIE die = debug_info->GetDIE(DIERef(type_uid));
>> - if (die)
>> - {
>> - DWARFASTParser *dwarf_ast = die.GetDWARFParser();
>> - if (dwarf_ast)
>> - return dwarf_ast->GetDeclContextForUIDFromDWARF(die);
>> - }
>> - }
>> - }
>> + DWARFDIE die = GetDIE(DIERef(type_uid, this));
>> + if (die)
>> + return die.GetDeclContext();
>> return CompilerDeclContext();
>> }
>>
>> CompilerDeclContext
>> SymbolFileDWARF::GetDeclContextContainingUID (lldb::user_id_t type_uid)
>> {
>> - if (UserIDMatches(type_uid))
>> - {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> - if (debug_info)
>> - {
>> - DWARFDIE die = debug_info->GetDIE(DIERef(type_uid));
>> - if (die)
>> - {
>> - DWARFASTParser *dwarf_ast = die.GetDWARFParser();
>> - if (dwarf_ast)
>> - return
>> dwarf_ast->GetDeclContextContainingUIDFromDWARF(die);
>> - }
>> - }
>> - }
>> + DWARFDIE die = GetDIE (DIERef(type_uid, this));
>> + if (die)
>> + return die.GetContainingDeclContext();
>> return CompilerDeclContext();
>> }
>>
>> @@ -1535,23 +1490,22 @@ SymbolFileDWARF::GetDeclContextContainin
>> Type*
>> SymbolFileDWARF::ResolveTypeUID (lldb::user_id_t type_uid)
>> {
>> - if (UserIDMatches(type_uid))
>> + DWARFDIE type_die = GetDIE (DIERef(type_uid, this));
>> + if (type_die)
>> {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> - if (debug_info)
>> - {
>> - DWARFDIE type_die = debug_info->GetDIE (DIERef(type_uid));
>> - if (type_die)
>> - {
>> - const bool assert_not_being_parsed = true;
>> - return ResolveTypeUID (type_die,
>> assert_not_being_parsed);
>> - }
>> - }
>> + const bool assert_not_being_parsed = true;
>> + return ResolveTypeUID (type_die, assert_not_being_parsed);
>> }
>> return NULL;
>> }
>>
>> Type*
>> +SymbolFileDWARF::ResolveTypeUID (const DIERef &die_ref)
>> +{
>> + return ResolveType (GetDIE(die_ref), true);
>> +}
>> +
>> +Type*
>> SymbolFileDWARF::ResolveTypeUID (const DWARFDIE &die, bool
>> assert_not_being_parsed)
>> {
>> if (die)
>> @@ -1642,30 +1596,29 @@ SymbolFileDWARF::CompleteType (CompilerT
>> return true;
>> }
>>
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> - DWARFDIE dwarf_die = debug_info->GetDIE(die_it->getSecond());
>> -
>> - assert(UserIDMatches(die_it->getSecond().GetUID()) && "CompleteType
>> called on the wrong SymbolFile");
>> -
>> - // Once we start resolving this type, remove it from the forward
>> declaration
>> - // map in case anyone child members or other types require this type
>> to get resolved.
>> - // The type will get resolved when all of the calls to
>> SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
>> - // are done.
>> - GetForwardDeclClangTypeToDie().erase (die_it);
>> + DWARFDIE dwarf_die = GetDIE(die_it->getSecond());
>> + if (dwarf_die)
>> + {
>> + // Once we start resolving this type, remove it from the forward
>> declaration
>> + // map in case anyone child members or other types require this
>> type to get resolved.
>> + // The type will get resolved when all of the calls to
>> SymbolFileDWARF::ResolveClangOpaqueTypeDefinition
>> + // are done.
>> + GetForwardDeclClangTypeToDie().erase (die_it);
>>
>> - Type *type = GetDIEToType().lookup (dwarf_die.GetDIE());
>> + Type *type = GetDIEToType().lookup (dwarf_die.GetDIE());
>>
>> - Log *log
>> (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
>> - if (log)
>> - GetObjectFile()->GetModule()->LogMessageVerboseBacktrace (log,
>> -
>> "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...",
>> -
>> dwarf_die.GetID(),
>> -
>> dwarf_die.GetTagAsCString(),
>> -
>> type->GetName().AsCString());
>> - assert (compiler_type);
>> - DWARFASTParser *dwarf_ast = dwarf_die.GetDWARFParser();
>> - if (dwarf_ast)
>> - return dwarf_ast->CompleteTypeFromDWARF (dwarf_die, type,
>> compiler_type);
>> + Log *log
>> (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION));
>> + if (log)
>> + GetObjectFile()->GetModule()->LogMessageVerboseBacktrace
>> (log,
>> +
>> "0x%8.8" PRIx64 ": %s '%s' resolving forward declaration...",
>> +
>> dwarf_die.GetID(),
>> +
>> dwarf_die.GetTagAsCString(),
>> +
>> type->GetName().AsCString());
>> + assert (compiler_type);
>> + DWARFASTParser *dwarf_ast = dwarf_die.GetDWARFParser();
>> + if (dwarf_ast)
>> + return dwarf_ast->CompleteTypeFromDWARF (dwarf_die, type,
>> compiler_type);
>> + }
>> return false;
>> }
>>
>> @@ -1674,10 +1627,7 @@ SymbolFileDWARF::ResolveType (const DWAR
>> {
>> if (die)
>> {
>> - Type *type = GetDIEToType().lookup (die.GetDIE());
>> -
>> - if (type == NULL)
>> - type = GetTypeForDIE (die, resolve_function_context).get();
>> + Type *type = GetTypeForDIE (die, resolve_function_context).get();
>>
>> if (assert_not_being_parsed)
>> {
>> @@ -1763,6 +1713,17 @@ SymbolFileDWARF::GetDWOModule (ConstStri
>> return lldb::ModuleSP();
>> }
>>
>> +DWARFDIE
>> +SymbolFileDWARF::GetDIE (const DIERef &die_ref)
>> +{
>> + DWARFDebugInfo * debug_info = DebugInfo();
>> + if (debug_info)
>> + return debug_info->GetDIE(die_ref);
>> + else
>> + return DWARFDIE();
>> +}
>> +
>> +
>> std::unique_ptr<SymbolFileDWARFDwo>
>> SymbolFileDWARF::GetDwoSymbolFileForCompileUnit(DWARFCompileUnit
>> &dwarf_cu, const DWARFDebugInfoEntry &cu_die)
>> {
>> @@ -2330,12 +2291,11 @@ SymbolFileDWARF::FindGlobalVariables (co
>> sc.module_sp = m_obj_file->GetModule();
>> assert (sc.module_sp);
>>
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> bool done = false;
>> for (size_t i=0; i<num_die_matches && !done; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE die = debug_info->GetDIE (die_ref);
>> + DWARFDIE die = GetDIE (die_ref);
>>
>> if (die)
>> {
>> @@ -2448,11 +2408,10 @@ SymbolFileDWARF::FindGlobalVariables(con
>> const size_t num_matches = die_offsets.size();
>> if (num_matches)
>> {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE die = debug_info->GetDIE (die_ref);
>> + DWARFDIE die = GetDIE (die_ref);
>>
>> if (die)
>> {
>> @@ -3098,11 +3057,10 @@ SymbolFileDWARF::FindTypes (const Symbol
>> if (num_die_matches)
>> {
>> const uint32_t initial_types_size = types.GetSize();
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_die_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE die = debug_info->GetDIE (die_ref);
>> + DWARFDIE die = GetDIE (die_ref);
>>
>> if (die)
>> {
>> @@ -3221,11 +3179,10 @@ SymbolFileDWARF::FindTypes (const std::v
>> if (num_die_matches)
>> {
>> size_t num_matches = 0;
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_die_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE die = debug_info->GetDIE (die_ref);
>> + DWARFDIE die = GetDIE (die_ref);
>>
>> if (die)
>> {
>> @@ -3304,11 +3261,10 @@ SymbolFileDWARF::FindNamespace (const Sy
>> const size_t num_matches = die_offsets.size();
>> if (num_matches)
>> {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE die = debug_info->GetDIE (die_ref);
>> + DWARFDIE die = GetDIE (die_ref);
>>
>> if (die)
>> {
>> @@ -3523,11 +3479,10 @@ SymbolFileDWARF::FindCompleteObjCDefinit
>>
>> if (num_matches)
>> {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE type_die = debug_info->GetDIE (die_ref);
>> + DWARFDIE type_die = GetDIE (die_ref);
>>
>> if (type_die)
>> {
>> @@ -3747,11 +3702,10 @@ SymbolFileDWARF::FindDefinitionTypeForDW
>>
>> if (num_matches)
>> {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE type_die = debug_info->GetDIE (die_ref);
>> + DWARFDIE type_die = GetDIE (die_ref);
>>
>> if (type_die)
>> {
>> @@ -3995,7 +3949,7 @@ SymbolFileDWARF::ParseVariablesForContex
>>
>> if (sc.function)
>> {
>> - DWARFDIE function_die =
>> info->GetDIE(DIERef(sc.function->GetID()));
>> + DWARFDIE function_die =
>> info->GetDIE(DIERef(sc.function->GetID(), this));
>>
>> const dw_addr_t func_lo_pc =
>> function_die.GetAttributeValueAsAddress (DW_AT_low_pc,
>> LLDB_INVALID_ADDRESS);
>> if (func_lo_pc != LLDB_INVALID_ADDRESS)
>> @@ -4050,11 +4004,10 @@ SymbolFileDWARF::ParseVariablesForContex
>> const size_t num_matches = die_offsets.size();
>> if (num_matches)
>> {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> for (size_t i=0; i<num_matches; ++i)
>> {
>> const DIERef& die_ref = die_offsets[i];
>> - DWARFDIE die = debug_info->GetDIE (die_ref);
>> + DWARFDIE die = GetDIE (die_ref);
>> if (die)
>> {
>> VariableSP var_sp (ParseVariableDIE(sc, die,
>> LLDB_INVALID_ADDRESS));
>> @@ -4233,11 +4186,7 @@ SymbolFileDWARF::ParseVariableDIE
>> }
>> break;
>> case DW_AT_specification:
>> - {
>> - DWARFDebugInfo* debug_info = DebugInfo();
>> - if (debug_info)
>> - spec_die =
>> debug_info->GetDIE(DIERef(form_value));
>> - }
>> + spec_die = GetDIE(DIERef(form_value));
>> break;
>> case DW_AT_start_scope:
>> {
>> @@ -4350,7 +4299,7 @@ SymbolFileDWARF::ParseVariableDIE
>> scope = eValueTypeVariableStatic;
>>
>>
>> - SymbolFileDWARFDebugMap *debug_map_symfile =
>> GetDebugMapSymfile ();
>> + SymbolFileDWARFDebugMap *debug_map_symfile =
>> GetDebugMapSymfile();
>>
>> if (debug_map_symfile)
>> {
>> @@ -4456,7 +4405,7 @@ SymbolFileDWARF::ParseVariableDIE
>>
>> if (symbol_context_scope)
>> {
>> - SymbolFileTypeSP type_sp(new SymbolFileType(*this,
>> DIERef(type_die_form).GetUID()));
>> + SymbolFileTypeSP type_sp(new SymbolFileType(*this,
>> DIERef(type_die_form).GetUID(this)));
>>
>> if (const_value.Form() && type_sp && type_sp->GetType())
>> location.CopyOpcodeData(const_value.Unsigned(),
>> type_sp->GetType()->GetByteSize(), die.GetCU()->GetAddressByteSize());
>> @@ -4615,7 +4564,7 @@ SymbolFileDWARF::ParseVariables (const S
>> // a concrete block counterpart in
>> the current function. We need
>> // to find the concrete block so we
>> can correctly add the
>> // variable to it
>> - const DWARFDIE concrete_block_die =
>> FindBlockContainingSpecification (DIERef(sc.function->GetID()),
>> + const DWARFDIE concrete_block_die =
>> FindBlockContainingSpecification (DIERef(sc.function->GetID(), this),
>>
>> sc_parent_die.GetOffset());
>> if (concrete_block_die)
>> block =
>> sc.function->GetBlock(true).FindBlockByID(concrete_block_die.GetID());
>> @@ -4706,7 +4655,7 @@ SymbolFileDWARF::DumpIndexes ()
>>
>>
>> SymbolFileDWARFDebugMap *
>> -SymbolFileDWARF::GetDebugMapSymfile ()
>> +SymbolFileDWARF::GetDebugMapSymfile()
>> {
>> if (m_debug_map_symfile == NULL && !m_debug_map_module_wp.expired())
>> {
>>
>> Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h Wed Mar
>> 30 15:14:35 2016
>> @@ -68,7 +68,9 @@ public:
>> friend class SymbolFileDWARFDebugMap;
>> friend class SymbolFileDWARFDwo;
>> friend class DebugMapModule;
>> + friend class DIERef;
>> friend class DWARFCompileUnit;
>> + friend class DWARFDIE;
>> friend class DWARFASTParserClang;
>> friend class DWARFASTParserGo;
>> friend class DWARFASTParserJava;
>> @@ -302,12 +304,6 @@ public:
>> GetCompUnitForDWARFCompUnit(DWARFCompileUnit* dwarf_cu,
>> uint32_t cu_idx = UINT32_MAX);
>>
>> - lldb::user_id_t
>> - MakeUserID (dw_offset_t die_offset) const
>> - {
>> - return GetID() | die_offset;
>> - }
>> -
>> size_t
>> GetObjCMethodDIEOffsets (lldb_private::ConstString class_name,
>> DIEArray &method_die_offsets);
>> @@ -330,6 +326,9 @@ public:
>> lldb::ModuleSP
>> GetDWOModule (lldb_private::ConstString name);
>>
>> + DWARFDIE
>> + GetDIE(const DIERef &die_ref);
>> +
>> virtual std::unique_ptr<SymbolFileDWARFDwo>
>> GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu, const
>> DWARFDebugInfoEntry &cu_die);
>>
>> @@ -393,8 +392,10 @@ protected:
>> bool *type_is_new);
>>
>> lldb_private::Type *
>> - ResolveTypeUID (const DWARFDIE &die,
>> - bool assert_not_being_parsed);
>> + ResolveTypeUID(const DWARFDIE &die, bool assert_not_being_parsed);
>> +
>> + lldb_private::Type *
>> + ResolveTypeUID(const DIERef &die_ref);
>>
>> lldb::VariableSP
>> ParseVariableDIE(const lldb_private::SymbolContext& sc,
>> @@ -489,15 +490,6 @@ protected:
>> GetUniqueDWARFASTTypeMap ();
>>
>> bool
>> - UserIDMatches (lldb::user_id_t uid) const
>> - {
>> - const lldb::user_id_t high_uid = uid & 0xffffffff00000000ull;
>> - if (high_uid != 0 && GetID() != 0)
>> - return high_uid == GetID();
>> - return true;
>> - }
>> -
>> - bool
>> DIEDeclContextsMatch (const DWARFDIE &die1,
>> const DWARFDIE &die2);
>>
>>
>> Modified:
>> lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h?rev=264909&r1=264908&r2=264909&view=diff
>>
>> ==============================================================================
>> --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
>> (original)
>> +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
>> Wed Mar 30 15:14:35 2016
>> @@ -107,10 +107,11 @@ protected:
>> kNumFlags
>> };
>>
>> - friend class DWARFCompileUnit;
>> - friend class SymbolFileDWARF;
>> friend class DebugMapModule;
>> + friend class DIERef;
>> friend class DWARFASTParserClang;
>> + friend class DWARFCompileUnit;
>> + friend class SymbolFileDWARF;
>> struct OSOInfo
>> {
>> lldb::ModuleSP module_sp;
>>
>>
>> _______________________________________________
>> lldb-commits mailing list
>> lldb-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160330/2eeb0033/attachment-0001.html>
More information about the lldb-commits
mailing list