[all-commits] [llvm/llvm-project] 32d239: Fix debug_abbrev emitter to only assign table id once

António Afonso via All-commits all-commits at lists.llvm.org
Sun Nov 8 18:12:47 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 32d239a75882ece768b431a3ea44b4dba7070551
      https://github.com/llvm/llvm-project/commit/32d239a75882ece768b431a3ea44b4dba7070551
  Author: António Afonso <antonio.afonso at gmail.com>
  Date:   2020-11-08 (Sun, 08 Nov 2020)

  Changed paths:
    M llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
    M llvm/tools/obj2yaml/dwarf2yaml.cpp

  Log Message:
  -----------
  Fix debug_abbrev emitter to only assign table id once

While generating yamls for my tests I noticed that the new debug_abbrev format (with multiple table support) was incorrectly assigning id's to the table because it was generating one per abbrev entry in the table. For instance, the first table would get id 4 when 5 abbrev entries existed in the table. By itself this is not a problem but the corresponding debug_info sections were still referencing id 0. This was introduced here: https://reviews.llvm.org/D83116.

Maybe a better fix is to actually correctly calculate the table id when emitting debug info? From a quick glance it seems to me the ID is just being calculated as the distance between the first DWARFAbbreviationDeclarationSet and the one the debug info entry points to, which means it's just its index and not the actual table id that was generated when emitting the debug_abbrev tables. With my fix I guess this is fine but on the diff that introduced this Pavel mentioned that he would like to have some sort of unique id between them but not necessarily +1 increasing, but for that to work we need to actually find the table ID, I guess by going directly to Y.DebugAbbrev but to honest I have no idea how to link the DWARFAbbreviationDeclarationSet and the Y.DebugAbbrev, so I just did this simple fix.

I also realized there's barely any tests for MachO so it might useful to invest on that if the tool is being reworked on.

Reviewed By: Higuoxing, jhenderson

Differential Revision: https://reviews.llvm.org/D87179




More information about the All-commits mailing list