[PATCH] D86545: [DWARFYAML] Abbrev codes in a new abbrev table should start from 1 (by default).

Xing GUO via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 28 06:18:44 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rGf20e6c725385: [DWARFYAML] Abbrev codes in a new abbrev table should start from 1 (by default). (authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86545

Files:
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml


Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
===================================================================
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
@@ -277,9 +277,12 @@
 ##                                            ^-            abbreviation code (ULEB128) 0x04
 ##                                                       ^- abbreviation code (ULEB128) 0x04
 ##
-# CODE-NEXT: 0x00000010 2e000000 052e0000 00062e00 0000
-##                               ^-                     abbreviation code ULEB128
-##                                          ^-          abbreviation code ULEB128
+# CODE-NEXT: 0x00000010 2e000000 052e0000 00062e00 00000001
+##                               ^-                         abbreviation code ULEB128
+##                                          ^-              abbreviation code ULEB128
+##                                                       ^- abbreviation code ULEB128
+# CODE-NEXT: 0x00000020 11000000 022e0000 0000
+##                               ^-                         abbreviation code ULEB128
 
 --- !ELF
 FileHeader:
@@ -303,6 +306,12 @@
           Children:   DW_CHILDREN_no
         - Tag:        DW_TAG_subprogram
           Children:   DW_CHILDREN_no
+    - Table:
+        ## Test that the abbrev codes in a new table start from 1 by default.
+        - Tag:        DW_TAG_compile_unit
+          Children:   DW_CHILDREN_no
+        - Tag:        DW_TAG_subprogram
+          Children:   DW_CHILDREN_no
 
 ## i) Test that yaml2obj emits an error message when there are non-empty compilation units
 ## and multiple abbrev tables are assigned the same ID.
Index: llvm/lib/ObjectYAML/DWARFEmitter.cpp
===================================================================
--- llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -95,8 +95,8 @@
 }
 
 Error DWARFYAML::emitDebugAbbrev(raw_ostream &OS, const DWARFYAML::Data &DI) {
-  uint64_t AbbrevCode = 0;
   for (const DWARFYAML::AbbrevTable &AbbrevTable : DI.DebugAbbrev) {
+    uint64_t AbbrevCode = 0;
     for (const DWARFYAML::Abbrev &AbbrevDecl : AbbrevTable.Table) {
       AbbrevCode =
           AbbrevDecl.Code ? (uint64_t)*AbbrevDecl.Code : AbbrevCode + 1;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86545.288592.patch
Type: text/x-patch
Size: 2290 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200828/df921f0d/attachment.bin>


More information about the llvm-commits mailing list