[llvm] [lldb][llvm] Return an error instead of crashing when parsing a line table prologue. (PR #80769)

via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 5 16:25:15 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 9258f3e692493a69e0f4755bb129a5391ef10b50 81a093cf7d42bbde6302d8300031a3673e24817d -- llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp llvm/unittests/DebugInfo/DWARF/DWARFDebugLineTest.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
index 60513f0993..1a9b33758e 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp
@@ -396,11 +396,11 @@ Error DWARFDebugLine::Prologue::parse(
     // Treat this error as unrecoverable - we cannot be sure what any of
     // the data represents including the length field, so cannot skip it or make
     // any reasonable assumptions.
-    return ReportErrorOrCursor(createStringError(
-        errc::not_supported,
-        "parsing line table prologue at offset 0x%8.8" PRIx64
-        ": unsupported version %" PRIu16,
-        PrologueOffset, getVersion()));
+    return ReportErrorOrCursor(
+        createStringError(errc::not_supported,
+                          "parsing line table prologue at offset 0x%8.8" PRIx64
+                          ": unsupported version %" PRIu16,
+                          PrologueOffset, getVersion()));
   }
 
   if (getVersion() >= 5) {
@@ -412,8 +412,8 @@ Error DWARFDebugLine::Prologue::parse(
         return ReportErrorOrCursor(createStringError(
             errc::not_supported,
             "parsing line table prologue at offset 0x%8.8" PRIx64
-            ": invalid address size %" PRIu8, PrologueOffset,
-            PrologueAddrSize));
+            ": invalid address size %" PRIu8,
+            PrologueOffset, PrologueAddrSize));
       }
     } else if (DataAddrSize != getAddressSize()) {
       return ReportErrorOrCursor(createStringError(

``````````

</details>


https://github.com/llvm/llvm-project/pull/80769


More information about the llvm-commits mailing list