[PATCH] D87179: Fix debug_abbrev emitter to only assign table id once

António Afonso via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 4 22:03:30 PDT 2020


aadsm created this revision.
aadsm added reviewers: Higuoxing, jhenderson, labath.
Herald added subscribers: llvm-commits, aprantl.
Herald added a project: LLVM.
aadsm requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added a subscriber: sstefan1.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87179

Files:
  llvm/test/tools/obj2yaml/MachO/debug-abbrev.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87179.290062.patch
Type: text/x-patch
Size: 3523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200905/2dea7039/attachment.bin>


More information about the llvm-commits mailing list