[Lldb-commits] [PATCH] D59381: Change CompileUnit and ARanges interfaces to propagate errors

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 14 16:24:41 PDT 2019


clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Must fix logic error as mentioned in inlined comments.



================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp:25
+                          lldb::offset_t *offset_ptr) {
+  assert(debug_info.ValidOffset(*offset_ptr));
+
----------------
We have error checking now, use it instead of asserting? We are checking it with the assert anyways, so might as well check and return an error?


================
Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp:46
+llvm::Expected<DWARFDebugAranges &> DWARFDebugInfo::GetCompileUnitAranges() {
+  assert(m_cu_aranges_up && m_dwarf2Data);
+
----------------
This logic is wrong. We cache the m_cu_arange_up. If it is NULL then we build. If not, we return what we have. Maybe change this to:

```
if (m_cu_aranges_up)
  return *m_cu_aranges_up;
```


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59381/new/

https://reviews.llvm.org/D59381





More information about the lldb-commits mailing list