jankratochvil created this revision.
jankratochvil added reviewers: clayborg, Eric, dblaikie.
jankratochvil added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jankratochvil requested review of this revision.
In D100299 <https://reviews.llvm.org/D100299> I was not sure what can happen if
`dwarf_cu.GetOffset() != 0 && GetDebugMapSymfile()` as there is:
if (dwarf_cu.GetOffset() == 0 && GetDebugMapSymfile()) {
@clayborg added in 2006-03-30
<https://github.com/llvm/llvm-project/commit/2f869fe9d27c3364ba778701c84c4ad964770a1b#diff-edef3a65d5d569bbb75a4158d35b827aa5d42ee03ccd3b0c1d4f354afa12210cR885>
the part `dwarf_cu.GetOffset() == 0 && ` at this line
<https://github.com/llvm/llvm-project/blob/2f869fe9d27c3364ba778701c84c4ad964770a1b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L885>.
Is this patch simplification OK?
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107153
Files:
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -705,7 +705,13 @@
// We already parsed this compile unit, had out a shared pointer to it
cu_sp = comp_unit->shared_from_this();
} else {
- if (dwarf_cu.GetOffset() == 0 && GetDebugMapSymfile()) {
+ if (GetDebugMapSymfile()) {
+ if (dwarf_cu.GetOffset() != 0) {
+ Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+ LLDB_LOG(log, "DebugMap cannot address DWARF file CU offset 0x%x",
+ dwarf_cu.GetOffset());
+ return {};
+ }
// Let the debug map create the compile unit
cu_sp = m_debug_map_symfile->GetCompileUnit(this);
dwarf_cu.SetUserData(cu_sp.get());
@@ -732,8 +738,6 @@
// If there is no DWO, there is no reason to initialize
// lazily; we will do eager initialization in that case.
- if (GetDebugMapSymfile())
- return false;
const DWARFBaseDIE cu_die = dwarf_cu.GetUnitDIEOnly();
if (!cu_die)
return false;
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -705,7 +705,13 @@
// We already parsed this compile unit, had out a shared pointer to it
cu_sp = comp_unit->shared_from_this();
} else {
- if (dwarf_cu.GetOffset() == 0 && GetDebugMapSymfile()) {
+ if (GetDebugMapSymfile()) {
+ if (dwarf_cu.GetOffset() != 0) {
+ Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+ LLDB_LOG(log, "DebugMap cannot address DWARF file CU offset 0x%x",
+ dwarf_cu.GetOffset());
+ return {};
+ }
// Let the debug map create the compile unit
cu_sp = m_debug_map_symfile->GetCompileUnit(this);
dwarf_cu.SetUserData(cu_sp.get());
@@ -732,8 +738,6 @@
// If there is no DWO, there is no reason to initialize
// lazily; we will do eager initialization in that case.
- if (GetDebugMapSymfile())
- return false;
const DWARFBaseDIE cu_die = dwarf_cu.GetUnitDIEOnly();
if (!cu_die)
return false;
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits