jankratochvil created this revision.
jankratochvil added reviewers: labath, clayborg.
Herald added subscribers: JDevlieghere, aprantl.
As suggested by Pavel Labath in https://reviews.llvm.org/D46810
`DWARFUnit::GetUnitDIEOnly()` returning a pointer to `m_first_die` should not
permit using methods like `GetFirstChild()`.
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 DWARFBasicDIE 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 DWARFBasicDIE 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 DWARFBasicDIE 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 DWARFBasicDIE 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()); }
+ DWARFBasicDIE 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();
+ DWARFBasicDIE 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 DWARFBasicDIE 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();
+ DWARFBasicDIE dwo_cu_die = dwo_cu->GetUnitDIEOnly();
if (!dwo_cu_die.IsValid())
return 0;
_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits