[PATCH] D66901: [ObjectYAML] Fix lifetime issue in dumpDebugLines

Chris Bieneman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 28 13:20:38 PDT 2019


beanz added inline comments.


================
Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:290
       while (Offset < LineEnd) {
-        DWARFYAML::LineTableOpcode NewOp;
         NewOp.Opcode = (dwarf::LineNumberOps)LineData.getU8(&Offset);
----------------
vitalybuka wrote:
> On a first look it should be safe just
> ```
> DWARFYAML::LineTableOpcode NewOp = {};
> ```
> 
> However after that we fail tests:
> ```
> ******************** TEST 'LLVM :: ObjectYAML/MachO/DWARF-debug_line.yaml' FAILED ********************
> Script:
> --
> : 'RUN: at line 1';   /usr/local/google/home/vitalybuka/src/llvm.git/out/a/bin/yaml2obj /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml | /usr/local/google/home/vitalybuka/src/llvm.git/out/a/bin/obj2yaml | /usr/local/google/home/vitalybuka/src/llvm.git/out/a/bin/FileCheck /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
> --
> Exit Code: 1
> Command Output (stderr):
> --
> /usr/local/google/home/vitalybuka/src/llvm.git/llvm-project/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml:560:9: error: CHECK: expected string not found in input
> #CHECK: Data: 4294971216
>         ^
> <stdin>:534:2: note: scanning from here
>  Data: 0
>  ^
> <stdin>:546:2: note: possible intended match here
>  Data: 11
>  ^
> ```
> 
> So looks like code expects data from the previos iteration.
> 
This looks to me like an error in the test case, but I could be wrong. It has been a long time since I dug in DWARF, but I'm pretty sure our YAML is attaching data to opcodes that don't have data fields, and the old code was re-using the values from the previous iteration of the loop, which seems wrong.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D66901





More information about the llvm-commits mailing list