diff options
author | António Afonso <antonio.afonso@gmail.com> | 2020-11-08 18:09:32 -0800 |
---|---|---|
committer | António Afonso <antonio.afonso@gmail.com> | 2020-11-08 18:11:50 -0800 |
commit | 32d239a75882ece768b431a3ea44b4dba7070551 (patch) | |
tree | 584f308b41768940822a13884f83591aacd99c92 /llvm/test/ObjectYAML | |
parent | 08c1a0dda4b81ee0a0cedd46095c8f83d56ee71a (diff) | |
download | llvm-32d239a75882ece768b431a3ea44b4dba7070551.zip llvm-32d239a75882ece768b431a3ea44b4dba7070551.tar.gz llvm-32d239a75882ece768b431a3ea44b4dba7070551.tar.bz2 |
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
Diffstat (limited to 'llvm/test/ObjectYAML')
-rw-r--r-- | llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml b/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml index d6bcaf0..9dba060 100644 --- a/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml +++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml @@ -699,6 +699,12 @@ DWARF: # MULTI-TABLES-NEXT: Attributes: # MULTI-TABLES-NEXT: - Attribute: DW_AT_low_pc # MULTI-TABLES-NEXT: Form: DW_FORM_data4 +# MULTI-TABLES-NEXT: - Code: 0x0000000000000002 +# MULTI-TABLES-NEXT: Tag: DW_TAG_compile_unit +# MULTI-TABLES-NEXT: Children: DW_CHILDREN_no +# MULTI-TABLES-NEXT: Attributes: +# MULTI-TABLES-NEXT: - Attribute: DW_AT_low_pc +# MULTI-TABLES-NEXT: Form: DW_FORM_data4 # MULTI-TABLES-NEXT: - ID: 2 # MULTI-TABLES-NEXT: Table: # MULTI-TABLES-NEXT: - Code: 0x0000000000000001 @@ -707,6 +713,7 @@ DWARF: # MULTI-TABLES-NEXT: Attributes: # MULTI-TABLES-NEXT: - Attribute: DW_AT_low_pc # MULTI-TABLES-NEXT: Form: DW_FORM_udata +# MULTI-TABLES-NEXT: - ID: 3 # MULTI-TABLES-NEXT: debug_info: # MULTI-TABLES-NEXT: - Length: 0x000000000000000C # MULTI-TABLES-NEXT: Version: 4 @@ -738,7 +745,7 @@ DWARF: # MULTI-TABLES-NEXT: - Length: 0x000000000000000B # MULTI-TABLES-NEXT: Version: 4 # MULTI-TABLES-NEXT: AbbrevTableID: 2 -# MULTI-TABLES-NEXT: AbbrOffset: 0x0000000000000010 +# MULTI-TABLES-NEXT: AbbrOffset: 0x0000000000000017 # MULTI-TABLES-NEXT: AddrSize: 8 # MULTI-TABLES-NEXT: Entries: # MULTI-TABLES-NEXT: - AbbrCode: 0x00000001 @@ -772,7 +779,7 @@ LoadCommands: - sectname: __debug_abbrev segname: __DWARF addr: 0x00 - size: 24 + size: 32 offset: 528 align: 0 reloff: 0x00000000 @@ -810,6 +817,12 @@ DWARF: Attributes: - Attribute: DW_AT_low_pc Form: DW_FORM_data4 + - Code: 2 + Tag: DW_TAG_compile_unit + Children: DW_CHILDREN_no + Attributes: + - Attribute: DW_AT_low_pc + Form: DW_FORM_data4 - ID: 1 Table: - Code: 1 @@ -818,31 +831,28 @@ DWARF: Attributes: - Attribute: DW_AT_low_pc Form: DW_FORM_udata + - ID: 3 debug_info: - Version: 4 AbbrevTableID: 2 - AbbrOffset: 8 Entries: - AbbrCode: 1 Values: - Value: 0x1234 - Version: 4 AbbrevTableID: 2 - AbbrOffset: 8 Entries: - AbbrCode: 1 Values: - Value: 0x4321 - Version: 4 AbbrevTableID: 0 - AbbrOffset: 0 Entries: - AbbrCode: 1 Values: - Value: 0x5678 - Version: 4 AbbrevTableID: 1 - AbbrOffset: 16 Entries: - AbbrCode: 1 Values: |