Fixed an issue that would happen when using debug map with DWARF in the .o files where we wouldn't ever track down the actual definition for a type when things were in namespaces. We now serialize the decl context information into an intermediate format which allows us to track down the correct definition for a type regardless of which DWARF symbol file it comes from. We do this by creating a "DWARFDeclContext" object that contains the DW_TAG + name for each item in a decl context which we can then use to veto potential accelerator table matches. For example, the accelerator tables store the basename of the type, so if you have "std::vector<int>", we would end up with an accelerator table entry for the type that contained "vector<int>", which we would then search for using a DWARFDeclContext object that contained:
[0] DW_TAG_class_type "vector<int>"
[1] DW_TAG_namespace "std"
This is currently used to track down forward declarations for things like "class a:🅱️:Foo;".
llvm-svn: 155488
90 lines
3.5 KiB
C++
90 lines
3.5 KiB
C++
//===-- DWARFDebugInfo.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_DWARFDebugInfo_h_
|
|
#define SymbolFileDWARF_DWARFDebugInfo_h_
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
|
|
#include "lldb/lldb-private.h"
|
|
#include "lldb/lldb-private.h"
|
|
#include "SymbolFileDWARF.h"
|
|
|
|
typedef std::multimap<const char*, dw_offset_t, CStringCompareFunctionObject> CStringToDIEMap;
|
|
typedef CStringToDIEMap::iterator CStringToDIEMapIter;
|
|
typedef CStringToDIEMap::const_iterator CStringToDIEMapConstIter;
|
|
|
|
typedef STD_SHARED_PTR(DWARFCompileUnit) DWARFCompileUnitSP;
|
|
|
|
class DWARFDebugInfo
|
|
{
|
|
public:
|
|
typedef dw_offset_t (*Callback)(
|
|
SymbolFileDWARF* dwarf2Data,
|
|
DWARFCompileUnitSP& cu_shared_ptr,
|
|
DWARFDebugInfoEntry* die,
|
|
const dw_offset_t next_offset,
|
|
const uint32_t depth,
|
|
void* userData);
|
|
|
|
DWARFDebugInfo();
|
|
void SetDwarfData(SymbolFileDWARF* dwarf2Data);
|
|
|
|
bool LookupAddress(
|
|
const dw_addr_t address,
|
|
const dw_offset_t cu_offset, // Can be valid (find in .debug_aranges), or DW_INVALID_OFFSET if we need to search manually
|
|
DWARFCompileUnitSP& cu_shared_ptr,
|
|
DWARFDebugInfoEntry** function_die,
|
|
DWARFDebugInfoEntry** block_die);
|
|
|
|
void AddCompileUnit(DWARFCompileUnitSP& cu);
|
|
uint32_t GetNumCompileUnits();
|
|
bool ContainsCompileUnit (const DWARFCompileUnit *cu) const;
|
|
DWARFCompileUnit* GetCompileUnitAtIndex(uint32_t idx);
|
|
DWARFCompileUnitSP GetCompileUnit(dw_offset_t cu_offset, uint32_t* idx_ptr = NULL);
|
|
DWARFCompileUnitSP GetCompileUnitContainingDIE(dw_offset_t die_offset);
|
|
|
|
DWARFDebugInfoEntry* GetDIEPtr(dw_offset_t die_offset, DWARFCompileUnitSP* cu_sp_ptr);
|
|
DWARFDebugInfoEntry* GetDIEPtrWithCompileUnitHint (dw_offset_t die_offset, DWARFCompileUnit**cu_handle);
|
|
|
|
const DWARFDebugInfoEntry* GetDIEPtrContainingOffset(dw_offset_t die_offset, DWARFCompileUnitSP* cu_sp_ptr);
|
|
|
|
void Dump(lldb_private::Stream *s, const uint32_t die_offset, const uint32_t recurse_depth);
|
|
static void Parse(SymbolFileDWARF* parser, Callback callback, void* userData);
|
|
static void Verify(lldb_private::Stream *s, SymbolFileDWARF* dwarf2Data);
|
|
static void Dump(lldb_private::Stream *s, SymbolFileDWARF* dwarf2Data, const uint32_t die_offset, const uint32_t recurse_depth);
|
|
bool Find(const char* name, bool ignore_case, std::vector<dw_offset_t>& die_offsets) const;
|
|
bool Find(lldb_private::RegularExpression& re, std::vector<dw_offset_t>& die_offsets) const;
|
|
|
|
enum
|
|
{
|
|
eDumpFlag_Verbose = (1<<0), // Verbose dumping
|
|
eDumpFlag_ShowForm = (1<<1), // Show the DW_form type
|
|
eDumpFlag_ShowAncestors = (1<<2) // Show all parent DIEs when dumping single DIEs
|
|
};
|
|
|
|
DWARFDebugAranges &
|
|
GetCompileUnitAranges ();
|
|
|
|
protected:
|
|
SymbolFileDWARF* m_dwarf2Data;
|
|
typedef std::vector<DWARFCompileUnitSP> CompileUnitColl;
|
|
CompileUnitColl m_compile_units;
|
|
std::auto_ptr<DWARFDebugAranges> m_cu_aranges_ap; // A quick address to compile unit table
|
|
|
|
private:
|
|
// All parsing needs to be done partially any managed by this class as accessors are called.
|
|
void ParseCompileUnitHeadersIfNeeded();
|
|
|
|
DISALLOW_COPY_AND_ASSIGN (DWARFDebugInfo);
|
|
};
|
|
|
|
#endif // SymbolFileDWARF_DWARFDebugInfo_h_
|