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> llvm-svn: 264909
65 lines
1.9 KiB
C++
65 lines
1.9 KiB
C++
//===-- DIERef.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_DIERef_h_
|
|
#define SymbolFileDWARF_DIERef_h_
|
|
|
|
#include "lldb/Core/dwarf.h"
|
|
#include "lldb/lldb-defines.h"
|
|
|
|
class DWARFFormValue;
|
|
class SymbolFileDWARF;
|
|
|
|
struct DIERef
|
|
{
|
|
DIERef();
|
|
|
|
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, 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(SymbolFileDWARF *dwarf) const;
|
|
|
|
bool
|
|
operator< (const DIERef &ref) const
|
|
{
|
|
return die_offset < ref.die_offset;
|
|
}
|
|
|
|
bool
|
|
operator< (const DIERef &ref)
|
|
{
|
|
return die_offset < ref.die_offset;
|
|
}
|
|
|
|
dw_offset_t cu_offset;
|
|
dw_offset_t die_offset;
|
|
};
|
|
|
|
typedef std::vector<DIERef> DIEArray;
|
|
|
|
#endif // SymbolFileDWARF_DIERef_h_
|