[PATCH] D74309: [DebugInfo] Add check for zero debug line opcode_base

Paul Robinson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 15:00:56 PST 2020


probinson added inline comments.


================
Comment at: llvm/lib/DebugInfo/DWARF/DWARFDebugLine.cpp:358-367
+  if (OpcodeBase == 0) {
+    // If the opcode base is 0, we cannot read the standard opcode lengths (of
+    // which there are supposed to be one fewer than the opcode base). Assume
+    // there are no standard opcodes and continue parsing.
+    RecoverableErrorCallback(createStringError(
+        errc::invalid_argument,
+        "parsing line table prologue at offset 0x%8.8" PRIx64
----------------
dblaikie wrote:
> I don't /think/ this merits a warning. It seems to be unexceptionally DWARF conformant to have an opcode base of 0:
> 
> "Opcode base is typically one greater than the highest-numbered standard opcode defined for the specified version of the line number information (12 in DWARF Versions 3, 4 and 5, and 9 in Version 2). If opcode_base is less than the typical value, then standard opcode numbers greater than or equal to the opcode base are not used in the line number table of this unit (and the codes are treated as special opcodes)."
> 
> 
That non-normative comment seems to have a reasonable interpretation for an opcode base of 0, but then the normative definition of `standard_opcode_lengths` in the next item isn't really written in a way that supports an opcode base of less than 2.

Opcode base is really "the first special opcode" and zero can't be a special opcode because zero introduces an extended opcode.  So I agree with James, it is reasonable to have this warning.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74309





More information about the llvm-commits mailing list