[PATCH] D71875: [DWARF] Return Error from DWARFDebugArangeSet::extract().

Greg Clayton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 9 15:24:36 PST 2020


clayborg added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFContext.cpp:458
+      if (Error E = set.extract(arangesData, &offset)) {
+        WithColor::error() << toString(std::move(E)) << '\n';
+        break;
----------------
does "toString()" consume the error?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp:34
+Error DWARFDebugArangeSet::extract(DataExtractor data, uint64_t *offset_ptr) {
+  assert(data.isValidOffset(*offset_ptr));
+  ArangeDescriptors.clear();
----------------
return error instead of crashing the program


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp:23
 
 void DWARFDebugAranges::extract(DataExtractor DebugArangesData) {
   if (!DebugArangesData.isValidOffset(0))
----------------
return llvm::Error here?


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp:29-30
 
-  while (Set.extract(DebugArangesData, &Offset)) {
+  while (DebugArangesData.isValidOffset(Offset) &&
+         !errorToBool(Set.extract(DebugArangesData, &Offset))) {
     uint64_t CUOffset = Set.getCompileUnitDIEOffset();
----------------
return an error if Set.extract fails? Seems weird to add error handling to only convert it to bool and ignore the error?


================
Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:65-66
 
-  while (Set.extract(ArangesData, &Offset)) {
+  while (ArangesData.isValidOffset(Offset) &&
+         !errorToBool(Set.extract(ArangesData, &Offset))) {
     DWARFYAML::ARange Range;
----------------
Dump the error if Set.extract() fails?


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

https://reviews.llvm.org/D71875





More information about the llvm-commits mailing list