Move DIE location reporting into the DWARFDebugInfo class, use it from there in SymbolFileDWARF::ParseType (and eventually in other interesting places as well.)

llvm-svn: 138644
This commit is contained in:
Jim Ingham 2011-08-26 19:44:13 +00:00
parent 5658b49f64
commit 318c9f2240
3 changed files with 36 additions and 15 deletions

View File

@ -1129,6 +1129,30 @@ DWARFDebugInfoEntry::Dump
}
}
void
DWARFDebugInfoEntry::DumpLocation
(
SymbolFileDWARF* dwarf2Data,
DWARFCompileUnit* cu,
Stream *s
) const
{
const DWARFDebugInfoEntry *cu_die = cu->GetCompileUnitDIEOnly();
const char *cu_name = NULL;
if (cu_die != NULL)
cu_name = cu_die->GetName (dwarf2Data, cu);
const char *obj_file_name = NULL;
ObjectFile *obj_file = dwarf2Data->GetObjectFile();
if (obj_file)
obj_file_name = obj_file->GetFileSpec().GetFilename().AsCString();
const char *die_name = GetName (dwarf2Data, cu);
s->Printf ("CU: %s OBJFILE: %s DIE: %s (0x%llx).",
cu_name ? cu_name : "<UNKNOWN>",
obj_file_name ? obj_file_name : "<UNKNOWN>",
die_name ? die_name : "<NO NAME>",
GetOffset());
}
//----------------------------------------------------------------------
// DumpAttribute
//

View File

@ -256,7 +256,12 @@ public:
lldb_private::Stream *s,
dw_attr_t attr,
dw_form_t form);
// This one dumps the comp unit name, objfile name and die offset for this die so the stream S.
void DumpLocation(
SymbolFileDWARF* dwarf2Data,
DWARFCompileUnit* cu,
lldb_private::Stream *s) const;
bool GetDIENamesAndRanges(
SymbolFileDWARF* dwarf2Data,
const DWARFCompileUnit* cu,

View File

@ -30,6 +30,7 @@
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
@ -2288,6 +2289,7 @@ SymbolFileDWARF::FindFunctions(const RegularExpression& regex, bool append, Symb
// Return the number of variable that were appended to the list
return sc_list.GetSize() - original_size;
}
void
SymbolFileDWARF::ReportError (const char *format, ...)
{
@ -3075,20 +3077,10 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
if (log && dwarf_cu)
{
const DWARFDebugInfoEntry *cu_die = dwarf_cu->GetCompileUnitDIEOnly();
const char *cu_name = NULL;
if (cu_die != NULL)
cu_name = cu_die->GetName (this, dwarf_cu);
const char *obj_file_name = NULL;
if (m_obj_file)
obj_file_name = m_obj_file->GetFileSpec().GetFilename().AsCString();
const char *die_name = die->GetName (this, dwarf_cu);
log->Printf ("SymbolFileDWARF::%s: CU: %s OBJFILE: %s DIE: %s (0x%llx).",
__FUNCTION__,
cu_name ? cu_name : "<UNKNOWN>",
obj_file_name ? obj_file_name : "<UNKNOWN>",
die_name ? die_name : "<NO NAME>",
die->GetOffset());
StreamString s;
die->DumpLocation (this, dwarf_cu, &s);
log->Printf ("SymbolFileDwarf::%s %s", __FUNCTION__, s.GetData());
}
Type *type_ptr = m_die_to_type.lookup (die);