[Lldb-commits] [PATCH] D84008: [DWARFYAML][WIP] Refactor emitDebugInfo() to make the length be inferred.

2020-07-22 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 279756.
Higuoxing added a comment.
Herald added subscribers: sstefan1, ormris, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: jdoerfert.

Address comments & Rebase & Add one test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008

Files:
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
  llvm/include/llvm/ObjectYAML/DWARFEmitter.h
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/CMakeLists.txt
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.h
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -48,7 +48,7 @@
   - Value:   25
   )";
   Expected>> Sections =
-  DWARFYAML::emitDebugSections(StringRef(yamldata), /*ApplyFixups=*/true,
+  DWARFYAML::emitDebugSections(StringRef(yamldata),
/*IsLittleEndian=*/true);
   ASSERT_THAT_EXPECTED(Sections, Succeeded());
   std::vector Loclists{
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1377,7 +1377,7 @@
  "  - AbbrCode:0x\n"
  "Values:\n";
 
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata), true);
+  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
   ASSERT_TRUE((bool)ErrOrSections);
   std::unique_ptr DwarfContext =
   DWARFContext::create(*ErrOrSections, 8);
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -735,3 +735,107 @@
   AbbrOffset: 0x1234
   AddrSize:   8
   Entries:[]
+
+## k) Test that yaml2obj is able to emit a correct length for compilation units.
+
+# RUN: yaml2obj --docnum=13 %s -o %t13.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t13.o | \
+# RUN:   FileCheck %s --check-prefix=LENGTH
+
+#  INFER-LENGTH: Hex dump of section '.debug_info':
+# INFER-LENGTH-NEXT: 0x 3700 0400 0801  7...
+##  ^---unit_length (0x37)
+##   ^---   4-byte (accumulated length 0x04)
+##^---  4-byte (accumulated length 0x08)
+## ^--- 4-byte (accumulated length 0x0c)
+# INFER-LENGTH-NEXT: 0x0010 0c001600  1e00 2011 .. .
+##  ^---4-byte (accumulated length 0x10)
+##   ^---   4-byte (accumulated length 0x14)
+##^---  4-byte (accumulated length 0x18)
+## ^--- 4-byte (accumulated length 0x1c)
+# INFER-LENGTH-NEXT: 0x0020  3300 0220 1100 ..3 
+##  ^---4-byte (accumulated length 0x20)
+##   ^---   4-byte (accumulated length 0x24)
+##^---  4-byte (accumulated length 0x28)
+## ^--- 4-byte (accumulated length 0x2c)
+# INFER-LENGTH-NEXT: 0x0030 0006 0038 00...8...
+##  ^---4-byte (accumulated length 0x30)
+##   ^---   4-byte (accumulated length 0x34)
+##^-3-byte (accumulated length 0x37)
+
+## The handwritten DIEs should look like:
+
+## 0x000b: DW_TAG_compile_unit [1] *
+##   DW_AT_producer [DW_FORM_strp]( .debug_str[0x] = "clang version 10.0.0 ")
+##   DW_AT_language [DW_FORM_data2]   (DW_LANG_C99)
+##   DW_AT_name [DW_FORM_strp]( .debug_str[0x0016] = "hello.c")
+##   DW_AT_stmt_list [DW_FORM_s

[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-22 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 280020.
Higuoxing marked 3 inline comments as done.
Higuoxing added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008

Files:
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
  llvm/include/llvm/ObjectYAML/DWARFEmitter.h
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/CMakeLists.txt
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.h
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -48,7 +48,7 @@
   - Value:   25
   )";
   Expected>> Sections =
-  DWARFYAML::emitDebugSections(StringRef(yamldata), /*ApplyFixups=*/true,
+  DWARFYAML::emitDebugSections(StringRef(yamldata),
/*IsLittleEndian=*/true);
   ASSERT_THAT_EXPECTED(Sections, Succeeded());
   std::vector Loclists{
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1377,7 +1377,7 @@
  "  - AbbrCode:0x\n"
  "Values:\n";
 
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata), true);
+  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
   ASSERT_TRUE((bool)ErrOrSections);
   std::unique_ptr DwarfContext =
   DWARFContext::create(*ErrOrSections, 8);
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -735,3 +735,110 @@
   AbbrOffset: 0x1234
   AddrSize:   8
   Entries:[]
+
+## k) Test that yaml2obj is able to emit a correct length for compilation units.
+
+# RUN: yaml2obj --docnum=13 %s -o %t13.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t13.o | \
+# RUN:   FileCheck %s --check-prefix=INFER-LENGTH
+
+#  INFER-LENGTH: Hex dump of section '.debug_info':
+# INFER-LENGTH-NEXT: 0x 3700 0400 0801  7...
+##  ^---unit_length (0x37)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev code (ULEB128) 0x01
+## ^--- Form: DW_FORM_strp (4-byte)
+# INFER-LENGTH-NEXT: 0x0010 0c001600  1e00 2011 .. .
+##  ^---Form: DW_FORM_data2 (2-byte)
+##  ^   Form: DW_FORM_strp (4-byte)
+##   ^  Form: DW_FORM_sec_offset (4-byte)
+##^ Form: DW_FORM_strp (4-byte)
+## ^--- Form: DW_FORM_addr (8-byte)
+# INFER-LENGTH-NEXT: 0x0020  3300 0220 1100 ..3 
+##  -
+##   ^  Form: DW_FORM_data4 (4-byte)
+##^-abbrev code (ULEB128) 0x02
+##  ^-- Form: DW_FORM_addr (8-byte)
+# INFER-LENGTH-NEXT: 0x0030 0006 0038 00...8...
+##  --
+##^ Form: DW_FORM_data4 (4-byte)
+## ^Form: DW_FORM_strp (4-byte)
+
+## The handwritten DIEs should look like:
+
+## 0x000b: DW_TAG_compile_unit [1] *
+##   DW_AT_producer [DW_FORM_strp]( .debug_str[0x] = "clang version 10.0.0 ")
+##   DW_AT_language [DW_FORM_data2]   (DW_LANG_C99)
+##   DW_AT_name [DW_FORM_strp]( .debug_str[0x0016] = "hello.c")
+##   DW_AT_stmt_list [DW

[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-22 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml:743
+# RUN: llvm-readelf --hex-dump=.debug_info %t13.o | \
+# RUN:   FileCheck %s --check-prefix=LENGTH
+

jhenderson wrote:
> Should this be INFER-LENGTH? (The test is currently failing...)
Oops, sorry, I forget to modify this line.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-23 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 280116.
Higuoxing marked 3 inline comments as done.
Higuoxing added a comment.

Address comments. Thanks for reviewing!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008

Files:
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
  llvm/include/llvm/ObjectYAML/DWARFEmitter.h
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/CMakeLists.txt
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.h
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -48,7 +48,7 @@
   - Value:   25
   )";
   Expected>> Sections =
-  DWARFYAML::emitDebugSections(StringRef(yamldata), /*ApplyFixups=*/true,
+  DWARFYAML::emitDebugSections(StringRef(yamldata),
/*IsLittleEndian=*/true);
   ASSERT_THAT_EXPECTED(Sections, Succeeded());
   std::vector Loclists{
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1377,7 +1377,7 @@
  "  - AbbrCode:0x\n"
  "Values:\n";
 
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata), true);
+  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
   ASSERT_TRUE((bool)ErrOrSections);
   std::unique_ptr DwarfContext =
   DWARFContext::create(*ErrOrSections, 8);
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -735,3 +735,110 @@
   AbbrOffset: 0x1234
   AddrSize:   8
   Entries:[]
+
+## k) Test that yaml2obj is able to emit a correct length for compilation units.
+
+# RUN: yaml2obj --docnum=13 %s -o %t13.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t13.o | \
+# RUN:   FileCheck %s --check-prefix=INFER-LENGTH
+
+#  INFER-LENGTH: Hex dump of section '.debug_info':
+# INFER-LENGTH-NEXT: 0x 3700 0400 0801  7...
+##  ^---unit_length (0x37)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev code (ULEB128) 0x01
+## ^--- Form: DW_FORM_strp (4-byte)
+# INFER-LENGTH-NEXT: 0x0010 0c001600  1e00 2011 .. .
+##  ^---Form: DW_FORM_data2 (2-byte)
+##  ^   Form: DW_FORM_strp (4-byte)
+##   ^  Form: DW_FORM_sec_offset (4-byte)
+##^ Form: DW_FORM_strp (4-byte)
+## ^--- Form: DW_FORM_addr (8-byte)
+# INFER-LENGTH-NEXT: 0x0020  3300 0220 1100 ..3 
+##  -
+##   ^  Form: DW_FORM_data4 (4-byte)
+##^-abbrev code (ULEB128) 0x02
+##  ^-- Form: DW_FORM_addr (8-byte)
+# INFER-LENGTH-NEXT: 0x0030 0006 0038 00...8...
+##  --
+##^ Form: DW_FORM_data4 (4-byte)
+## ^Form: DW_FORM_strp (4-byte)
+
+## The handwritten DIEs should look like:
+
+## 0x000b: DW_TAG_compile_unit [1] *
+##   DW_AT_producer [DW_FORM_strp]( .debug_str[0x] = "clang version 10.0.0 ")
+##   DW_AT_language [DW_FORM_data2]   (DW_LANG_C99)
+##   DW_AT_name [DW_FORM_strp]( .debug_str[0x0016] = "hello.c")
+##

[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-23 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:207-215
+static unsigned getOffsetSize(const DWARFYAML::Unit &Unit) {
+  return Unit.Format == dwarf::DWARF64 ? 8 : 4;
+}
 
-  void onValue(const uint16_t U) override {
-writeInteger(U, OS, DebugInfo.IsLittleEndian);
-  }
+static unsigned getRefSize(const DWARFYAML::Unit &Unit) {
+  if (Unit.Version == 2)
+return Unit.AddrSize;

labath wrote:
> Maybe this is for a separate patch, since you're just moving these, but this 
> code already exists in BinaryFormat/Dwarf.h. It would be nice if 
> DWARFYaml::Unit had a dwarf::FormParams field or a getter, and then these 
> things could be retrieved by querying that object...
Thanks! I'll do it in a separate patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-23 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing marked an inline comment as done.
Higuoxing added inline comments.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:380-382
+  cantFail(writeVariableSizedInteger(Unit.AbbrOffset,
+ Unit.Format == dwarf::DWARF64 ? 8 : 4,
+ OS, DI.IsLittleEndian));

jhenderson wrote:
> labath wrote:
> > a writeDwarfOffset function might be handy.
> I'm guessing the new function can be used elsewhere too (I expect in places 
> like .debug_aranges for example). In another patch, please consider looking 
> at that.
Yeah, it can be used in the 
.debug_str_offsets/debug_rnglists/debug_loclists/debug_aranges sections, etc. 
I've applied it in this patch and will apply it to other sections in a 
follow-up patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-23 Thread Xing GUO via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG92874d286695: [DWARFYAML] Refactor emitDebugInfo() to make 
the length be inferred. (authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008

Files:
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
  llvm/include/llvm/ObjectYAML/DWARFEmitter.h
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/CMakeLists.txt
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.h
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -48,7 +48,7 @@
   - Value:   25
   )";
   Expected>> Sections =
-  DWARFYAML::emitDebugSections(StringRef(yamldata), /*ApplyFixups=*/true,
+  DWARFYAML::emitDebugSections(StringRef(yamldata),
/*IsLittleEndian=*/true);
   ASSERT_THAT_EXPECTED(Sections, Succeeded());
   std::vector Loclists{
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1377,7 +1377,7 @@
  "  - AbbrCode:0x\n"
  "Values:\n";
 
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata), true);
+  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
   ASSERT_TRUE((bool)ErrOrSections);
   std::unique_ptr DwarfContext =
   DWARFContext::create(*ErrOrSections, 8);
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -735,3 +735,110 @@
   AbbrOffset: 0x1234
   AddrSize:   8
   Entries:[]
+
+## k) Test that yaml2obj is able to emit a correct length for compilation units.
+
+# RUN: yaml2obj --docnum=13 %s -o %t13.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t13.o | \
+# RUN:   FileCheck %s --check-prefix=INFER-LENGTH
+
+#  INFER-LENGTH: Hex dump of section '.debug_info':
+# INFER-LENGTH-NEXT: 0x 3700 0400 0801  7...
+##  ^---unit_length (0x37)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev code (ULEB128) 0x01
+## ^--- Form: DW_FORM_strp (4-byte)
+# INFER-LENGTH-NEXT: 0x0010 0c001600  1e00 2011 .. .
+##  ^---Form: DW_FORM_data2 (2-byte)
+##  ^   Form: DW_FORM_strp (4-byte)
+##   ^  Form: DW_FORM_sec_offset (4-byte)
+##^ Form: DW_FORM_strp (4-byte)
+## ^--- Form: DW_FORM_addr (8-byte)
+# INFER-LENGTH-NEXT: 0x0020  3300 0220 1100 ..3 
+##  -
+##   ^  Form: DW_FORM_data4 (4-byte)
+##^-abbrev code (ULEB128) 0x02
+##  ^-- Form: DW_FORM_addr (8-byte)
+# INFER-LENGTH-NEXT: 0x0030 0006 0038 00...8...
+##  --
+##^ Form: DW_FORM_data4 (4-byte)
+## ^Form: DW_FORM_strp (4-byte)
+
+## The handwritten DIEs should look like:
+
+## 0x000b: DW_TAG_compile_unit [1] *
+##   DW_AT_producer [DW_FORM_strp]( .debug_str[0x] = "clang version 10.0.0 ")
+##   DW_AT_language [DW_FORM_data2]   (DW_LANG_C99)
+##   DW_AT_name [DW_FORM_strp]( .debug_str

[Lldb-commits] [PATCH] D85289: [DWARFYAML][debug_info] Rename some mapping keys. NFC.

2020-08-05 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar, MaskRay.
Herald added subscribers: llvm-commits, lldb-commits, cmtice, hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added projects: LLDB, LLVM.
Higuoxing requested review of this revision.
Herald added a subscriber: JDevlieghere.

This patch renames some mapping keys:

AbbrOffset -> DebugAbbrevOffset
AddrSize   -> AddressSize
AbbrCode   -> AbbrevCode


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D85289

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_ranges.yaml
  llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1437,23 +1437,23 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:  52
-  Version: 4
-  AbbrOffset:  0
-  AddrSize:8
+- Length:52
+  Version:   4
+  DebugAbbrevOffset: 0
+  AddressSize:   8
   Entries:
-- AbbrCode:0x0001
+- AbbrevCode: 0x0001
   Values:
 - Value:   0x0001
 - Value:   0x1000
 - Value:   0x2000
 - Value:   0x0004
-- AbbrCode:0x0002
+- AbbrevCode: 0x0002
   Values:
 - Value:   0x000D
 - Value:   0x1000
 - Value:   0x2000
-- AbbrCode:0x
+- AbbrevCode: 0x
   Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
@@ -1516,23 +1516,23 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:  44
-  Version: 4
-  AbbrOffset:  0
-  AddrSize:8
+- Length:44
+  Version:   4
+  DebugAbbrevOffset: 0
+  AddressSize:   8
   Entries:
-- AbbrCode:0x0001
+- AbbrevCode: 0x0001
   Values:
 - Value:   0x0001
 - Value:   0x1000
 - Value:   0x1000
 - Value:   0x0004
-- AbbrCode:0x0002
+- AbbrevCode: 0x0002
   Values:
 - Value:   0x000D
 - Value:   0x1000
 - Value:   0x1000
-- AbbrCode:0x
+- AbbrevCode: 0x
   Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
@@ -1615,35 +1615,35 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:  68
-  Version: 4
-  AbbrOffset:  0
-  AddrSize:8
+- Length:68
+  Version:   4
+  DebugAbbrevOffset: 0
+  AddressSize:   8
   Entries:
-- AbbrCode:0x0001
+- AbbrevCode: 0x0001
   Values:
 - Value:   0x0001
 - Value:   0x1000
 - Value:   0x2000
 - Value:   0x0004
-- AbbrCode:0x0002
+- AbbrevCode: 0x0002
   Values:
 - Value:   0x000D
-- AbbrCode:0x0003
+- AbbrevCode: 0x0003
   Values:
 - Value:   0x0011
 - Value:   0x1000
 - Valu

[Lldb-commits] [PATCH] D85289: [DWARFYAML][debug_info] Rename some mapping keys. NFC.

2020-08-05 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D85289#2195954 , @jhenderson wrote:

> What's the motivation for doing this?

We should make these mapping keys' name consistent with the spec.
The spec uses 'address_size', 'debug_abbrev_offset', 'abbreviation code' to 
refer these fields.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85289

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85289: [DWARFYAML][debug_info] Rename some mapping keys. NFC.

2020-08-05 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D85289#2196062 , @jhenderson wrote:

> I see the point, but we don't do it for all fields in other contexts, and I 
> have some mild concerns that `DebugAbbrevOffset` is unnecessarily verbose 
> (I'd think `AbbrevOffset` would be sufficient. Perhaps it would be best to 
> draw in one or two others? @JDevlieghere / @labath, any thoughts?

Yeah, I'm ok with these names. I would like to hear more people's ideas!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85289

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D85289: [DWARFYAML][debug_info] Rename some mapping keys. NFC.

2020-08-06 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a subscriber: jankratochvil.
Higuoxing added a comment.

CC @jankratochvil who might also have thoughts on this topic :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85289

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D86194: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-18 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

Modified tests:

test/tools/yaml2obj/ELF/debug-abbrev.yaml: Add one more abbrev table in test 
case (a).
test/tools/yaml2obj/ELF/debug-info.yaml: Add test case (n). Test that yaml2obj 
emits an error message when a compilation unit has values but there is no 
associated abbrev tables.

The generated abbrev tables are verified using llvm-dwarfdump.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86194

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D86194: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-18 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:259-265
+  if (AbbrevTable.empty())
+return createStringError(
+errc::invalid_argument,
+"non-empty compilation unit should have an associated abbrev table");
+
+  ArrayRef AbbrevDecls(AbbrevTable[0].Table);
+

>>! Comments from [D83116](https://reviews.llvm.org/D83116#inline-795444)
> @jhenderson : It might make more sense to do this work in the caller of this 
> function, and to maintain this function's interface.

Some DIEs only have abbrev codes and do not have values. If we do this work in 
the caller of this function, yaml2obj will reject empty DIEs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86194

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D86194: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-08-19 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:26-43
+  DWARFYAML::AbbrevTable AbbrevTable;
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
 DWARFYAML::Abbrev Abbrv;
 Abbrv.Code = AbbrvDecl.getCode();
 Abbrv.Tag = AbbrvDecl.getTag();
 Abbrv.Children = AbbrvDecl.hasChildren() ? dwarf::DW_CHILDREN_yes
  : dwarf::DW_CHILDREN_no;

jhenderson wrote:
> Does this work?
Yes, I think it works.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86194

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-19 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.






Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:34
+private:
+  Data &DWARF;
+  std::map AbbrevID2Index;

labath wrote:
> jhenderson wrote:
> > Would it make any sense to merge the `DWARFYAML::Data` class and 
> > `DWARFYAML::DWARFState` class at all?
> That would definitely be nice.
>>! @jhenderson :
> Would it make any sense to merge the `DWARFYAML::Data` class and 
> `DWARFYAML::DWARFState` class at all?

>>! @labath :
> That would definitely be nice.

I think they can be merged. But is there any particular reason to merge them? 
Personally, I would like to keep the `DWARFYAML::DWARFState` class. Here are a 
few concerns I would like to address:

- If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we will 
need to add some helper variables, e.g. `AbbrevTableID2Index` and a method like 
`Error DWARFYAML::link()` to `DWARFYAML::Data` class to link DWARF sections. We 
will have to call this special method before DWARF sections being emitted. If 
we port DWARF support to other binary format in the future, e.g., wasm, we 
might forget to call this method. If we make DWARF emitters accept 
`DWARFYAML::DWARFState`, it's easy to figure out that we need a `DWARFState` 
before emitting DWARF sections.

- Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have different 
functions. `DWARFYAML::Data` is used to contain original DWARF section 
descriptions and `DWARFYAML::DWARFState` contains helper structs and methods 
which helps link DWARF sections. It might be good not to merge them so that we 
can easily figure out when and where are those sections get linked?

I can be persuaded :-)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 286755.
Higuoxing marked 10 inline comments as done.
Higuoxing added a comment.

Merge `DWARFYAML::Data` and `DWARFYAML::DWARFState`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFEmitter.h
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -207,11 +207,12 @@
 - Attribute: 0x01
   Form:  DW_FORM_addrx4 ## 0x2c
   debug_info:
-- Length: 0x1234
-  Version:5
-  UnitType:   DW_UT_type
-  AbbrOffset: 0x1234
-  AddrSize:   4
+- Length:0x1234
+  Version:   5
+  UnitType:  DW_UT_type
+  AbbrevTableID: 0
+  AbbrOffset:0x1234
+  AddrSize:  4
   Entries:
 - AbbrCode: 1
   Values:
@@ -272,6 +273,7 @@
   Version:   5
   ## Test another unit type.
   UnitType:  DW_UT_compile
+  AbbrevTableID: 0
   AbbrOffset:0x1234
   AddrSize:  4
   Entries:
@@ -280,6 +282,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -901,7 +904,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0
 
 --- !ELF
 FileHeader:
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
@@ -314,3 +314,28 @@
 - Tag:DW_TAG_subprogram
   Children:   DW_CHILDREN_no
   Attributes: []
+
+## i) Test that yaml2obj emits an error message when there are non-empty compilation units
+## and multiple abbrev tables are assigned the same ID.
+
+## RUN: not yaml2obj --docnum=9 %s 2>&1 | FileCheck %s --check-prefix=ID-COLLISION
+
+# ID-COLLISION: yaml2obj: error: the ID (1) of abbrev table with index 1 has been used by abbrev table with index 0
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machi

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/include/llvm/ObjectYAML/DWARFEmitter.h:34
+private:
+  Data &DWARF;
+  std::map AbbrevID2Index;

jhenderson wrote:
> Higuoxing wrote:
> > labath wrote:
> > > jhenderson wrote:
> > > > Would it make any sense to merge the `DWARFYAML::Data` class and 
> > > > `DWARFYAML::DWARFState` class at all?
> > > That would definitely be nice.
> > >>! @jhenderson :
> > > Would it make any sense to merge the `DWARFYAML::Data` class and 
> > > `DWARFYAML::DWARFState` class at all?
> > 
> > >>! @labath :
> > > That would definitely be nice.
> > 
> > I think they can be merged. But is there any particular reason to merge 
> > them? Personally, I would like to keep the `DWARFYAML::DWARFState` class. 
> > Here are a few concerns I would like to address:
> > 
> > - If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we 
> > will need to add some helper variables, e.g. `AbbrevTableID2Index` and a 
> > method like `Error DWARFYAML::link()` to `DWARFYAML::Data` class to link 
> > DWARF sections. We will have to call this special method before DWARF 
> > sections being emitted. If we port DWARF support to other binary format in 
> > the future, e.g., wasm, we might forget to call this method. If we make 
> > DWARF emitters accept `DWARFYAML::DWARFState`, it's easy to figure out that 
> > we need a `DWARFState` before emitting DWARF sections.
> > 
> > - Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have 
> > different functions. `DWARFYAML::Data` is used to contain original DWARF 
> > section descriptions and `DWARFYAML::DWARFState` contains helper structs 
> > and methods which helps link DWARF sections. It might be good not to merge 
> > them so that we can easily figure out when and where are those sections get 
> > linked?
> > 
> > I can be persuaded :-)
> > I think they can be merged. But is there any particular reason to merge 
> > them?
> As things stand, it mostly seems like `DWARFState` merely gets in the way of 
> accessing the `Data` class. It seems to me like it would be easier to use if 
> the two were one class, as you wouldn't have to keep going through an extra 
> function call/member access.
> 
> 
> > - If we merge the `DWARFYAML::DWARFState` and `DWARFYAML::Data` at all, we 
> > will need to add some helper variables, e.g. `AbbrevTableID2Index` and a 
> > method like `Error DWARFYAML::link()` to `DWARFYAML::Data` class to link 
> > DWARF sections. We will have to call this special method before DWARF 
> > sections being emitted. If we port DWARF support to other binary format in 
> > the future, e.g., wasm, we might forget to call this method. If we make 
> > DWARF emitters accept `DWARFYAML::DWARFState`, it's easy to figure out that 
> > we need a `DWARFState` before emitting DWARF sections.
> If, rather than do all the calculations up front (e.g. mapping tables to 
> IDs), you put the `Data` members behind getters, you could then add the 
> "linking" code there. For example, with the AbbrevTable ID mapping, you could 
> have the `getAbbrevTableIndexByID` method, which is the only way of getting 
> an abbrev table from outside the class.  The first time this is called (or 
> optionally every time), it works out the mapping between ID(s) and table(s). 
> This avoids the need for an explicit `link` or `finalize` method.
> 
> > - Besides, I think `DWARFYAML::Data` and `DWARFYAML::DWARFState` have 
> > different functions. `DWARFYAML::Data` is used to contain original DWARF 
> > section descriptions and `DWARFYAML::DWARFState` contains helper structs 
> > and methods which helps link DWARF sections. It might be good not to merge 
> > them so that we can easily figure out when and where are those sections get 
> > linked?
> I'm not sure I agree they have different functions. The `AbbrevID2Index` map 
> is just a helper variable that is directly derived from the `Data` struct's 
> members. We could get rid of it entirely, and just move the 
> `getAbbrevTableIndexByID` method into `Data`, rewriting it to just run 
> through the list of tables each time to find the right ID. This is obviously 
> less efficient than instantiating a mapping up front, if done repeatedly, but 
> I think it indicates that this extra layer is not actually doing anything 
> distinct. Similar principles apply probably for other things, although 
> without further concrete examples, it's hard to discuss them!
Thanks for the explanation!



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:89
+DWARFYAML::DWARFState::DWARFState(DWARFYAML::Data &DI, Error &Err) : DWARF(DI) 
{
+  ErrorAsOutParameter EAO(&Err);
+

labath wrote:
> If you'd do all this work in the factory function and then just pass in a 
> finished map to the constructor, there'd be no need for the 
> `ErrorAsOutParameter` thingy.
`DWARFYAML::DWARFState` is merged into `DWARFYAML::Data`, so we don't need 
`ErrorAsOutParameter` any more.

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml:426
 #CHECK:   Form:DW_FORM_ref4
+
+

I will remove this blank line later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added inline comments.



Comment at: llvm/lib/ObjectYAML/DWARFEmitter.cpp:306-313
+  Optional AbbrevTableIndex =
+  DS.getAbbrevTableIndexByID(AbbrevTableID);
+  if (!AbbrevTableIndex)
+return createStringError(errc::invalid_argument,
+ "cannot find abbrev table whose ID is " +
+ utostr(AbbrevTableID));
+  ArrayRef AbbrevDecls(

jhenderson wrote:
> It might make more sense to do this work in the caller of this function, and 
> to maintain this function's interface.
This is discussed in [D86194](https://reviews.llvm.org/D86194#inline-796173)



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:679-681
+## c) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID' and 
obj2yaml
+## is able to convert it back.

jhenderson wrote:
> Is there any particular reason you don't have something equivalent to this in 
> the ELF testing, to show you can have tables out-of-order etc.
Added in test/tools/yaml2obj/ELF/DWARF/debug-info.yaml (o)



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:711
+# MULTI-TABLES-NEXT:   Form:  DW_FORM_udata
+# MULTI-TABLES-NEXT:   debug_info:
+# MULTI-TABLES-NEXT: - Length:0x000C

jhenderson wrote:
> Something's not right here - the YAML below has four debug_info tables, but 
> only three have check lines. What happened to the one that should be 
> referencing abbrev table 2?
Sorry, the length and offsets are calculated by myself, and the __debug_info 
section's length is miscalculated to be 60, which should be 67. I've corrected 
it.



Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml:658
+
+# NOTABLE: yaml2obj: error: abbrev table index must be less than or equal to 
the number of abbrev tables
+

jhenderson wrote:
> Perhaps worth including the index and table count values in this error 
> message to make it easier for people to identify the problem.
I've included the abbrev table ID and compilation unit count values in test 
case (n). Can we prettify the error message in test case (i) in a follow-up 
patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 286780.
Higuoxing marked 11 inline comments as done.
Higuoxing added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -207,11 +207,12 @@
 - Attribute: 0x01
   Form:  DW_FORM_addrx4 ## 0x2c
   debug_info:
-- Length: 0x1234
-  Version:5
-  UnitType:   DW_UT_type
-  AbbrOffset: 0x1234
-  AddrSize:   4
+- Length:0x1234
+  Version:   5
+  UnitType:  DW_UT_type
+  AbbrevTableID: 0
+  AbbrOffset:0x1234
+  AddrSize:  4
   Entries:
 - AbbrCode: 1
   Values:
@@ -272,6 +273,7 @@
   Version:   5
   ## Test another unit type.
   UnitType:  DW_UT_compile
+  AbbrevTableID: 0
   AbbrOffset:0x1234
   AddrSize:  4
   Entries:
@@ -280,6 +282,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -901,7 +904,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
 
 --- !ELF
 FileHeader:
@@ -917,3 +920,102 @@
 - AbbrCode: 1
   Values:
 - Value: 0x1234
+
+## o) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID'.
+
+# RUN: yaml2obj --docnum=17 %s -o %t17.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
+
+#  MULTI-TABLES: Hex dump of section '.debug_info':
+# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4...
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-  

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 286945.
Higuoxing added a comment.

Rebase.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -206,11 +206,12 @@
 - Attribute: 0x01
   Form:  DW_FORM_addrx4 ## 0x2c
   debug_info:
-- Length: 0x1234
-  Version:5
-  UnitType:   DW_UT_type
-  AbbrOffset: 0x1234
-  AddrSize:   4
+- Length:0x1234
+  Version:   5
+  UnitType:  DW_UT_type
+  AbbrevTableID: 0
+  AbbrOffset:0x1234
+  AddrSize:  4
   Entries:
 - AbbrCode: 1
   Values:
@@ -271,6 +272,7 @@
   Version:   5
   ## Test another unit type.
   UnitType:  DW_UT_compile
+  AbbrevTableID: 0
   AbbrOffset:0x1234
   AddrSize:  4
   Entries:
@@ -279,6 +281,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -886,7 +889,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
 
 --- !ELF
 FileHeader:
@@ -903,11 +906,43 @@
   Values:
 - Value: 0x1234
 
-## n) Test that yaml2obj emits an error message when a compilation unit has values but there is no associated abbrev table.
+## o) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID'.
 
-## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
+# RUN: yaml2obj --docnum=17 %s -o %t17.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+#  MULTI-TABLES: Hex dump of section '.debug_info':
+# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4...
+##  ^---unit_length (4-byte)
+##  

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf7ff0ace96db: [DWARFYAML] Add support for referencing 
different abbrev tables. (authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/lib/ObjectYAML/ELFEmitter.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -206,11 +206,12 @@
 - Attribute: 0x01
   Form:  DW_FORM_addrx4 ## 0x2c
   debug_info:
-- Length: 0x1234
-  Version:5
-  UnitType:   DW_UT_type
-  AbbrOffset: 0x1234
-  AddrSize:   4
+- Length:0x1234
+  Version:   5
+  UnitType:  DW_UT_type
+  AbbrevTableID: 0
+  AbbrOffset:0x1234
+  AddrSize:  4
   Entries:
 - AbbrCode: 1
   Values:
@@ -271,6 +272,7 @@
   Version:   5
   ## Test another unit type.
   UnitType:  DW_UT_compile
+  AbbrevTableID: 0
   AbbrOffset:0x1234
   AddrSize:  4
   Entries:
@@ -279,6 +281,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -886,7 +889,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
 
 --- !ELF
 FileHeader:
@@ -903,11 +906,43 @@
   Values:
 - Value: 0x1234
 
-## n) Test that yaml2obj emits an error message when a compilation unit has values but there is no associated abbrev table.
+## o) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID'.
 
-## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
+# RUN: yaml2obj --docnum=17 %s -o %t17.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+#  MULTI-TABLES: Hex dump of section '.debug_info':
+# MULTI-TABLES-NEXT: 0x

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing reopened this revision.
Higuoxing added a comment.
This revision is now accepted and ready to land.

This change is causing build failure, I'm going to revise this change.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-21 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 286985.
Higuoxing added a comment.

Fix incorrect format string.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -279,6 +279,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -886,7 +887,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
 
 --- !ELF
 FileHeader:
@@ -902,3 +903,101 @@
 - AbbrCode: 1
   Values:
 - Value: 0x1234
+
+## o) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID'.
+
+# RUN: yaml2obj --docnum=17 %s -o %t17.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
+
+#  MULTI-TABLES: Hex dump of section '.debug_info':
+# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4...
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev_code (ULEB128) 0x01
+## ^--- Form: DW_FORM_data4 (4-byte) 0x1234
+# MULTI-TABLES-NEXT: 0x0010 0c00 04000800 0801 2143 !C..
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev_code (ULEB128) 0x01
+##

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-21 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 286987.
Higuoxing added a comment.

Add missing test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -279,6 +279,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -886,7 +887,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
 
 --- !ELF
 FileHeader:
@@ -902,3 +903,101 @@
 - AbbrCode: 1
   Values:
 - Value: 0x1234
+
+## o) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID'.
+
+# RUN: yaml2obj --docnum=17 %s -o %t17.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
+
+#  MULTI-TABLES: Hex dump of section '.debug_info':
+# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4...
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev_code (ULEB128) 0x01
+## ^--- Form: DW_FORM_data4 (4-byte) 0x1234
+# MULTI-TABLES-NEXT: 0x0010 0c00 04000800 0801 2143 !C..
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev_code (U

[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-21 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing requested review of this revision.
Higuoxing added a comment.

Hi @jhenderson

This change is causing build failure on armv7 platform and I've fixed it.

See: 
http://lab.llvm.org:8011/builders/clang-cmake-armv7-global-isel/builds/10400 
and http://lab.llvm.org:8011/builders/clang-cmake-armv7-quick/builds/20261

Could you please review this change again? Thanks a lot!




Comment at: llvm/lib/ObjectYAML/DWARFYAML.cpp:69
+errc::invalid_argument,
+"the ID (%" PRIu64 ") of abbrev table with index %zu has been used 
"
+"by abbrev table with index %" PRIu64,

The build failure is caused by the incorrect format string. 
`AbbrevTable.index()` returns `size_t` and it was formatted as `%u`. We should 
use `%zu` here.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for referencing different abbrev tables.

2020-08-21 Thread Xing GUO via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf5643dc3dce2: Recommit: [DWARFYAML] Add support for 
referencing different abbrev tables. (authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116

Files:
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_abbrev.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -2487,6 +2487,7 @@
   - Value:   0x
   - Length:  16
 Version: 4
+AbbrevTableID:   0
 AbbrOffset:  0
 AddrSize:8
 Entries:
Index: llvm/tools/obj2yaml/dwarf2yaml.cpp
===
--- llvm/tools/obj2yaml/dwarf2yaml.cpp
+++ llvm/tools/obj2yaml/dwarf2yaml.cpp
@@ -23,6 +23,7 @@
 void dumpDebugAbbrev(DWARFContext &DCtx, DWARFYAML::Data &Y) {
   auto AbbrevSetPtr = DCtx.getDebugAbbrev();
   if (AbbrevSetPtr) {
+uint64_t AbbrevTableID = 0;
 for (auto AbbrvDeclSet : *AbbrevSetPtr) {
   Y.DebugAbbrev.emplace_back();
   for (auto AbbrvDecl : AbbrvDeclSet.second) {
@@ -39,6 +40,7 @@
 AttAbrv.Value = Attribute.getImplicitConstValue();
   Abbrv.Attributes.push_back(AttAbrv);
 }
+Y.DebugAbbrev.back().ID = AbbrevTableID++;
 Y.DebugAbbrev.back().Table.push_back(Abbrv);
   }
 }
@@ -172,6 +174,14 @@
 NewUnit.Version = CU->getVersion();
 if (NewUnit.Version >= 5)
   NewUnit.Type = (dwarf::UnitType)CU->getUnitType();
+const DWARFDebugAbbrev *DebugAbbrev = DCtx.getDebugAbbrev();
+NewUnit.AbbrevTableID = std::distance(
+DebugAbbrev->begin(),
+std::find_if(
+DebugAbbrev->begin(), DebugAbbrev->end(),
+[&](const std::pair &P) {
+  return P.first == CU->getAbbreviations()->getOffset();
+}));
 NewUnit.AbbrOffset = CU->getAbbreviations()->getOffset();
 NewUnit.AddrSize = CU->getAddressByteSize();
 for (auto DIE : CU->dies()) {
Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -279,6 +279,7 @@
 - Length:0x5678
   ## Test DWARFv4
   Version:   4
+  AbbrevTableID: 0
   AbbrOffset:0x5678
   AddrSize:  4
   Entries:
@@ -886,7 +887,7 @@
 
 ## RUN: not yaml2obj --docnum=16 %s 2>&1 | FileCheck %s --check-prefix=NO-ABBREV
 
-# NO-ABBREV: yaml2obj: error: non-empty compilation unit should have an associated abbrev table
+# NO-ABBREV: yaml2obj: error: cannot find abbrev table whose ID is 0 for compilation unit with index 0
 
 --- !ELF
 FileHeader:
@@ -902,3 +903,101 @@
 - AbbrCode: 1
   Values:
 - Value: 0x1234
+
+## o) Test that yaml2obj is able to generate compilation units according to the
+## associated abbrev table that is referenced by the 'AbbrevTableID'.
+
+# RUN: yaml2obj --docnum=17 %s -o %t17.o
+# RUN: llvm-readelf --hex-dump=.debug_info %t17.o | FileCheck %s --check-prefix=MULTI-TABLES
+
+#  MULTI-TABLES: Hex dump of section '.debug_info':
+# MULTI-TABLES-NEXT: 0x 0c00 04000800 0801 3412 4...
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-address_size (1-byte)
+##  ^-  abbrev_code (ULEB128) 0x01
+## ^--- Form: DW_FORM_data4 (4-byte) 0x1234
+# MULTI-TABLES-NEXT: 0x0010 0c00 04000800 0801 2143 !C..
+##  ^---unit_length (4-byte)
+##   ^---   version (2-byte)
+##   ^  debug_abbrev_offset (4-byte)
+##^-

[Lldb-commits] [PATCH] D86857: [Test] Simplify DWARF test cases. NFC.

2020-08-30 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar, MaskRay.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added subscribers: llvm-commits, lldb-commits, cmtice, danielkiss.
Herald added projects: LLDB, LLVM.
Higuoxing requested review of this revision.
Herald added a subscriber: JDevlieghere.

The Length, AbbrOffset and Values fields of the debug_info section are
optional. This patch helps remove them and simplify test cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D86857

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1438,9 +1438,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:  52
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1455,7 +1453,6 @@
 - Value:   0x1000
 - Value:   0x2000
 - AbbrCode:0x
-  Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1518,9 +1515,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:  44
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1535,7 +1530,6 @@
 - Value:   0x1000
 - Value:   0x1000
 - AbbrCode:0x
-  Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1618,9 +1612,7 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:  68
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1643,11 +1635,8 @@
 - Value:   0x0022
 - Value:   0x0001
 - AbbrCode:0x
-  Values:
 - AbbrCode:0x
-  Values:
 - AbbrCode:0x
-  Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1723,9 +1712,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:  78
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1750,8 +1737,6 @@
 - Value:   0x
 - Value:   0x0040
 - AbbrCode:0x
-  Values:
-
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1837,9 +1822,7 @@
 - Attribute:   DW_AT_call_line
   Form:DW_FORM_data4
   debug_info:
-- Length:  74
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1862,9 +1845,7 @@
 - Value:   0x0001
 - Value:   0x000A
 - AbbrCode:0x
-  Values:
 - AbbrCode:0x
-  Values:
   debug_line:
 - Length:  96
   Version: 2
@@ -2093,9 +2074,7 @@
 - Attribute:   DW_AT_decl_line
   Form:DW_FORM_data1
   debug_info:
-- Length:  103
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - A

[Lldb-commits] [PATCH] D86857: [Test] Simplify DWARF test cases. NFC.

2020-08-30 Thread Xing GUO via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d01fc100bb5: [Test] Simplify DWARF test cases. NFC. 
(authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86857

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/SymbolFile/DWARF/XcodeSDKModuleTests.cpp
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1438,9 +1438,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:  52
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1455,7 +1453,6 @@
 - Value:   0x1000
 - Value:   0x2000
 - AbbrCode:0x
-  Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1518,9 +1515,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:  44
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1535,7 +1530,6 @@
 - Value:   0x1000
 - Value:   0x1000
 - AbbrCode:0x
-  Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1618,9 +1612,7 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:  68
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1643,11 +1635,8 @@
 - Value:   0x0022
 - Value:   0x0001
 - AbbrCode:0x
-  Values:
 - AbbrCode:0x
-  Values:
 - AbbrCode:0x
-  Values:
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1723,9 +1712,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:  78
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1750,8 +1737,6 @@
 - Value:   0x
 - Value:   0x0040
 - AbbrCode:0x
-  Values:
-
   )";
   auto ErrOrSections = DWARFYAML::emitDebugSections(yamldata);
   ASSERT_THAT_EXPECTED(ErrOrSections, Succeeded());
@@ -1837,9 +1822,7 @@
 - Attribute:   DW_AT_call_line
   Form:DW_FORM_data4
   debug_info:
-- Length:  74
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -1862,9 +1845,7 @@
 - Value:   0x0001
 - Value:   0x000A
 - AbbrCode:0x
-  Values:
 - AbbrCode:0x
-  Values:
   debug_line:
 - Length:  96
   Version: 2
@@ -2093,9 +2074,7 @@
 - Attribute:   DW_AT_decl_line
   Form:DW_FORM_data1
   debug_info:
-- Length:  103
-  Version: 4
-  AbbrOffset:  0
+- Version: 4
   AddrSize:8
   Entries:
 - AbbrCode:0x0001
@@ -2130,7 +2109,6 @@
 - Value:   0x0001
 - Value:   0x0028
 - AbbrCode:0x
-   

[Lldb-commits] [PATCH] D87878: [DWARFYAML] Make the include_directories, file_names and opcodes fields of the line table optional.

2020-09-17 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar, MaskRay.
Herald added subscribers: llvm-commits, lldb-commits, cmtice, arphaman, 
hiraditya, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added projects: LLDB, LLVM.
Higuoxing requested review of this revision.
Herald added a subscriber: JDevlieghere.

This patch makes the include_directories, file_names and opcodes fields
of the line table optional. This helps us simplify some tests.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87878

Files:
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml

Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
@@ -92,7 +92,6 @@
   DirIdx:  2
   ModTime: 3
   Length:  4
-  Opcodes: []
 
 ## Generate and verify a big endian DWARF32 .debug_line section.
 
@@ -211,9 +210,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## e) Test that yaml2obj emits an error message when both the "Content" and the
 ## "debug_line" entry are specified at the same time.
@@ -240,9 +236,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## f) Test that all the properties can be overridden by the section header when
 ## the "debug_line" entry doesn't exist.
@@ -307,9 +300,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## h) Test that the address size is inferred from the target machine.
 
@@ -355,8 +345,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
   Opcodes:
 - Opcode:DW_LNS_extended_op
   ExtLen:9
@@ -439,8 +427,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
   Opcodes:
 - Opcode:DW_LNS_copy
 - Opcode:DW_LNS_advance_pc
Index: llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
===
--- llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
+++ llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
@@ -469,7 +469,6 @@
   LineRange:   14
   OpcodeBase:  13
   StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-  IncludeDirs: []
   Files:
 - Name:strip-test.c
   DirIdx:  0
Index: llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
===
--- llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
+++ llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
@@ -688,7 +688,6 @@
   LineRange:   14
   OpcodeBase:  13
   StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-  IncludeDirs: []
   Files:
 - Name:main.cpp
   DirIdx:  0
Index: llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
===
--- llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
+++ llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
@@ -472,7 +472,6 @@
   LineRange:   14
   OpcodeBase:  13
   StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-  IncludeDirs: []
   Files:
 - Name:main.cpp
   DirIdx:  0
@@ -941,7 +940,6 @@
   LineRange:   14
   OpcodeBase:  13
   StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-  IncludeDirs: []
   Files:
 - Name:  

[Lldb-commits] [PATCH] D87878: [DWARFYAML] Make the include_directories, file_names and opcodes fields of the line table optional.

2020-09-18 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 292719.
Higuoxing added a comment.

In D87878#2281189 , @jhenderson wrote:

> I might be missing it, but do you have direct testing showing that the 
> default for `IncludeDirs`\`Files`\`Opcodes` is an empty output, when the 
> output is written? I think it's important that this is tested.

Sorry, I didn't test it.

Add test case (k) in llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87878

Files:
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml

Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
@@ -92,7 +92,6 @@
   DirIdx:  2
   ModTime: 3
   Length:  4
-  Opcodes: []
 
 ## Generate and verify a big endian DWARF32 .debug_line section.
 
@@ -211,9 +210,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## e) Test that yaml2obj emits an error message when both the "Content" and the
 ## "debug_line" entry are specified at the same time.
@@ -240,9 +236,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## f) Test that all the properties can be overridden by the section header when
 ## the "debug_line" entry doesn't exist.
@@ -307,9 +300,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## h) Test that the address size is inferred from the target machine.
 
@@ -355,8 +345,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
   Opcodes:
 - Opcode:DW_LNS_extended_op
   ExtLen:9
@@ -439,8 +427,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
   Opcodes:
 - Opcode:DW_LNS_copy
 - Opcode:DW_LNS_advance_pc
@@ -591,3 +577,42 @@
 - Opcode:DW_LNS_extended_op
   ExtLen:1
   SubOpcode: DW_LNE_end_sequence
+
+## k) Test that we can omit the include_directories, file_names and opcodes
+## fields of the line table.
+
+# RUN: yaml2obj --docnum=11 %s -o %t11.o
+# RUN: llvm-readelf --hex-dump=.debug_line %t11.o | \
+# RUN:   FileCheck %s --check-prefix=OMIT-FIELDS
+
+#  OMIT-FIELDS: Hex dump of section '.debug_line':
+# OMIT-FIELDS-NEXT: 0x 1100 04000b00 0101 01fb0e04 
+## ^---unit_length (4-byte)
+##  ^---   version (2-byte)
+##  ^  header_length (4-byte)
+##   ^-minimum_instruction_length (1-byte)
+## ^-  maximum_operations_per_instruction (1-byte)
+##^-   default_is_stmt (1-byte)
+##  ^- line_base (1-byte) -5
+##^-   line_range (1-byte)
+##  ^- opcode_base (1-byte)
+# OMIT-FIELDS-NEXT: 0x0010 00010100 00 .
+## ^-  standard_opcode_lengths (3-byte)
+##   ^-include_directories null byte (1-byte)
+##  ^- file_names null byte (1-byte)
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFD

[Lldb-commits] [PATCH] D87878: [DWARFYAML] Make the include_directories, file_names and opcodes fields of the line table optional.

2020-09-18 Thread Xing GUO via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG2d35092cd258: [DWARFYAML] Make the include_directories, 
file_names and opcodes fields of the… (authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87878

Files:
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes_no_files.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml

Index: llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
===
--- llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
+++ llvm/test/tools/yaml2obj/ELF/DWARF/debug-line.yaml
@@ -92,7 +92,6 @@
   DirIdx:  2
   ModTime: 3
   Length:  4
-  Opcodes: []
 
 ## Generate and verify a big endian DWARF32 .debug_line section.
 
@@ -211,9 +210,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## e) Test that yaml2obj emits an error message when both the "Content" and the
 ## "debug_line" entry are specified at the same time.
@@ -240,9 +236,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## f) Test that all the properties can be overridden by the section header when
 ## the "debug_line" entry doesn't exist.
@@ -307,9 +300,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
-  Opcodes:   []
 
 ## h) Test that the address size is inferred from the target machine.
 
@@ -355,8 +345,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
   Opcodes:
 - Opcode:DW_LNS_extended_op
   ExtLen:9
@@ -439,8 +427,6 @@
   LineRange: 14
   OpcodeBase:13
   StandardOpcodeLengths: []
-  IncludeDirs:   []
-  Files: []
   Opcodes:
 - Opcode:DW_LNS_copy
 - Opcode:DW_LNS_advance_pc
@@ -591,3 +577,42 @@
 - Opcode:DW_LNS_extended_op
   ExtLen:1
   SubOpcode: DW_LNE_end_sequence
+
+## k) Test that we can omit the include_directories, file_names and opcodes
+## fields of the line table.
+
+# RUN: yaml2obj --docnum=11 %s -o %t11.o
+# RUN: llvm-readelf --hex-dump=.debug_line %t11.o | \
+# RUN:   FileCheck %s --check-prefix=OMIT-FIELDS
+
+#  OMIT-FIELDS: Hex dump of section '.debug_line':
+# OMIT-FIELDS-NEXT: 0x 1100 04000b00 0101 01fb0e04 
+## ^---unit_length (4-byte)
+##  ^---   version (2-byte)
+##  ^  header_length (4-byte)
+##   ^-minimum_instruction_length (1-byte)
+## ^-  maximum_operations_per_instruction (1-byte)
+##^-   default_is_stmt (1-byte)
+##  ^- line_base (1-byte) -5
+##^-   line_range (1-byte)
+##  ^- opcode_base (1-byte)
+# OMIT-FIELDS-NEXT: 0x0010 00010100 00 .
+## ^-  standard_opcode_lengths (3-byte)
+##   ^-include_directories null byte (1-byte)
+##  ^- file_names null byte (1-byte)
+
+--- !ELF
+FileHeader:
+  Class: ELFCLASS64
+  Data:  ELFDATA2LSB
+  Type:  ET_EXEC
+DWARF:
+  debug_line:
+- Version:   4
+  MinInstLength: 1
+  MaxOpsPerInst: 1
+  DefaultIsStmt: 1
+  LineBase:  251
+  LineRange: 14
+  OpcodeBas

[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-25 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar, MaskRay.
Herald added subscribers: llvm-commits, lldb-commits, cmtice, hiraditya, 
aprantl, emaste.
Herald added a reviewer: espindola.
Herald added a reviewer: alexshap.
Herald added a reviewer: rupprecht.
Herald added projects: LLDB, LLVM.
Higuoxing added a parent revision: D82621: [DWARFYAML][debug_info] Teach 
yaml2obj emit correct DWARF64 unit header..
Higuoxing edited the summary of this revision.

'InitialLength' is replaced with 'Format' (DWARF32 by default) and 'Length' in 
this patch.
Besides, test cases for DWARFv4 and DWARFv5, DWARF32 and DWARF64 is
added.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D82622

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_ranges.yaml
  llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1437,8 +1437,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 52
+- Length:  52
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1517,8 +1516,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 44
+- Length:  44
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1617,8 +1615,7 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:
-TotalLength: 68
+- Length:  68
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1722,8 +1719,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 78
+- Length:  78
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1836,8 +1832,7 @@
 - Attribute:   DW_AT_call_line
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 74
+- Length:  74
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2092,8 +2087,7 @@
 - Attribute:   DW_AT_decl_line
   Form:DW_FORM_data1
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2299,7 +2293,6 @@
   //
   // 0x004e:   NULL
 
-
   StringRef yamldata = R"(
   debug_str:
 - ''
@@ -2342,8 +2335,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 75
+- Length:  75
   Version: 4
   AbbrOffset:  0
   AddrSize:4
@@ -2485,8 +2477,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -34,8 +34,7 @@
   - Attribute:   DW_AT_call_data_location
 Form:DW_FORM_sec_offset
 debug_info:
-  - Length:
-  TotalLength: 0
+  - Length:  0
 Version: 5
 UnitType:DW_UT_compile
 AbbrOffset:  0
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp

[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-25 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 273584.
Higuoxing added a comment.

Prettify test cases.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82622

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_ranges.yaml
  llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1437,8 +1437,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 52
+- Length:  52
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1517,8 +1516,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 44
+- Length:  44
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1617,8 +1615,7 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:
-TotalLength: 68
+- Length:  68
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1722,8 +1719,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 78
+- Length:  78
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1836,8 +1832,7 @@
 - Attribute:   DW_AT_call_line
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 74
+- Length:  74
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2092,8 +2087,7 @@
 - Attribute:   DW_AT_decl_line
   Form:DW_FORM_data1
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2342,8 +2336,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 75
+- Length:  75
   Version: 4
   AbbrOffset:  0
   AddrSize:4
@@ -2485,8 +2478,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -34,8 +34,7 @@
   - Attribute:   DW_AT_call_data_location
 Form:DW_FORM_sec_offset
 debug_info:
-  - Length:
-  TotalLength: 0
+  - Length:  0
 Version: 5
 UnitType:DW_UT_compile
 AbbrOffset:  0
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1368,8 +1368,7 @@
  "Children:DW_CHILDREN_yes\n"
  "Attributes:\n"
  "debug_info:\n"
- "  - Length:\n"
- "  TotalLength:  0\n"
+ "  - Length:  0\n"
  "Version: 4\n"
  "AbbrOffset:  0\n"
   

[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-26 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing marked an inline comment as done.
Higuoxing added a comment.

Thanks for reviewing!




Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:515
 
-#CHECK: DWARF:   
-#CHECK:   debug_info:  
-#CHECK: - Length:  
-#CHECK: TotalLength: 117
-#CHECK:   Version: 4
-#CHECK:   AbbrOffset:  0
-#CHECK:   AddrSize:8
-#CHECK:   Entries: 
-#CHECK: - AbbrCode:0x0001
-#CHECK:   Values:  
-#CHECK: - Value:   0x0001
-#CHECK: - Value:   0x000C
-#CHECK: - Value:   0x0038
-#CHECK: - Value:   0x
-#CHECK: - Value:   0x0046
-#CHECK: - Value:   0x00010F50
-#CHECK: - Value:   0x0034
-#CHECK: - AbbrCode:0x0002
-#CHECK:   Values:  
-#CHECK: - Value:   0x00010F50
-#CHECK: - Value:   0x0034
-#CHECK: - Value:   0x0001
-#CHECK:   BlockData:   [ 0x56 ]
-#CHECK: - Value:   0x0076
-#CHECK: - Value:   0x0001
-#CHECK: - Value:   0x0003
-#CHECK: - Value:   0x0001
-#CHECK: - Value:   0x0060
-#CHECK: - Value:   0x0001
-#CHECK: - AbbrCode:0x0003
-#CHECK:   Values:  
-#CHECK: - Value:   0x0002
-#CHECK:   BlockData:   [ 0x91, 0x78 ]
-#CHECK: - Value:   0x007B
-#CHECK: - Value:   0x0001
-#CHECK: - Value:   0x0003
-#CHECK: - Value:   0x0060
-#CHECK: - AbbrCode:0x0003
-#CHECK:   Values:  
-#CHECK: - Value:   0x0002
-#CHECK:   BlockData:   [ 0x91, 0x70 ]
-#CHECK: - Value:   0x0080
-#CHECK: - Value:   0x0001
-#CHECK: - Value:   0x0003
-#CHECK: - Value:   0x0067
-#CHECK: - AbbrCode:0x
-#CHECK:   Values:  
-#CHECK: - AbbrCode:0x0004
-#CHECK:   Values:  
-#CHECK: - Value:   0x0085
-#CHECK: - Value:   0x0005
-#CHECK: - Value:   0x0004
-#CHECK: - AbbrCode:0x0005
-#CHECK:   Values:  
-#CHECK: - Value:   0x006C
-#CHECK: - AbbrCode:0x0005
-#CHECK:   Values:  
-#CHECK: - Value:   0x0071
-#CHECK: - AbbrCode:0x0004
-#CHECK:   Values:  
-#CHECK: - Value:   0x0089
-#CHECK: - Value:   0x0006
-#CHECK: - Value:   0x0001
-#CHECK: - AbbrCode:0x
-#CHECK:   Values:  
+#  DWARF32: debug_info:
+# DWARF32-NEXT:   - Length: 117

jhenderson wrote:
> Any particular reason you've dropped the `DWARF:` tag? Having it back would 
> help make the diff a little simpler, I'd hope.
Because the first tag after "DWARF:" is "debug_abbrev". I will bring it back 
later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82622



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-26 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing updated this revision to Diff 273632.
Higuoxing marked 2 inline comments as done.
Higuoxing added a comment.

Address comments.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82622

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_ranges.yaml
  llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1437,8 +1437,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 52
+- Length:  52
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1517,8 +1516,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 44
+- Length:  44
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1617,8 +1615,7 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:
-TotalLength: 68
+- Length:  68
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1722,8 +1719,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 78
+- Length:  78
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1836,8 +1832,7 @@
 - Attribute:   DW_AT_call_line
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 74
+- Length:  74
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2092,8 +2087,7 @@
 - Attribute:   DW_AT_decl_line
   Form:DW_FORM_data1
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2342,8 +2336,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 75
+- Length:  75
   Version: 4
   AbbrOffset:  0
   AddrSize:4
@@ -2485,8 +2478,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -34,8 +34,7 @@
   - Attribute:   DW_AT_call_data_location
 Form:DW_FORM_sec_offset
 debug_info:
-  - Length:
-  TotalLength: 0
+  - Length:  0
 Version: 5
 UnitType:DW_UT_compile
 AbbrOffset:  0
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1368,8 +1368,7 @@
  "Children:DW_CHILDREN_yes\n"
  "Attributes:\n"
  "debug_info:\n"
- "  - Length:\n"
- "  TotalLength:  0\n"
+ "  - Length:  0\n"
  "Version: 4\n"
   

[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-30 Thread Xing GUO via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGfe08ab542bd6: [DWARFYAML][debug_info] Replace 
'InitialLength' with 'Format' and 'Length'. 
(authored by Higuoxing).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82622

Files:
  lldb/test/API/functionalities/source-map/a.yaml
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/Symbol/Inputs/inlined-functions.yaml
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
  llvm/test/ObjectYAML/MachO/DWARF-debug_ranges.yaml
  llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/test/tools/llvm-dwarfdump/X86/verify_overlapping_cu_ranges.yaml
  llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml
  llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml
  llvm/test/tools/llvm-objcopy/MachO/Inputs/strip-all-with-dwarf.yaml
  llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
  llvm/tools/obj2yaml/dwarf2yaml.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
  llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp

Index: llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
===
--- llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
+++ llvm/unittests/DebugInfo/GSYM/GSYMTest.cpp
@@ -1437,8 +1437,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 52
+- Length:  52
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1517,8 +1516,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 44
+- Length:  44
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1617,8 +1615,7 @@
 - Attribute:   DW_AT_artificial
   Form:DW_FORM_flag_present
   debug_info:
-- Length:
-TotalLength: 68
+- Length:  68
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1722,8 +1719,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 78
+- Length:  78
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -1836,8 +1832,7 @@
 - Attribute:   DW_AT_call_line
   Form:DW_FORM_data4
   debug_info:
-- Length:
-TotalLength: 74
+- Length:  74
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2092,8 +2087,7 @@
 - Attribute:   DW_AT_decl_line
   Form:DW_FORM_data1
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
@@ -2342,8 +2336,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 75
+- Length:  75
   Version: 4
   AbbrOffset:  0
   AddrSize:4
@@ -2485,8 +2478,7 @@
 - Attribute:   DW_AT_high_pc
   Form:DW_FORM_addr
   debug_info:
-- Length:
-TotalLength: 103
+- Length:  103
   Version: 4
   AbbrOffset:  0
   AddrSize:8
Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -34,8 +34,7 @@
   - Attribute:   DW_AT_call_data_location
 Form:DW_FORM_sec_offset
 debug_info:
-  - Length:
-  TotalLength: 0
+  - Length:  0
 Version: 5
 UnitType:DW_UT_compile
 AbbrOffset:  0
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1368,8 +1368,7 @@
  "Children:DW_CHILDREN_yes\n"
  "Attributes:\n"
  "debug_info:\n"
- "  - Length:\n"
- "  TotalLength:  0\n"
+ "  - Length:  0\

[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-30 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D82622#2122562 , @uweigand wrote:

> This commit causes test case failures on s390x (unfortunately hidden as the 
> build bot was already red due to an unrelated issue):
>  http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33624
>
> http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33624/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3ADWARF-debug_info.yaml
>
> At first glance, seems like this could be endian-related?


Yes, if we don't specify the endianness in YAML, yaml2macho will emit binaries 
that have the same endianness as the host machine. I'll fix it. Thanks a lot!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82622



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D82622: [DWARFYAML][debug_info] Replace 'InitialLength' with 'Format' and 'Length'.

2020-06-30 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D82622#2122562 , @uweigand wrote:

> This commit causes test case failures on s390x (unfortunately hidden as the 
> build bot was already red due to an unrelated issue):
>  http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33624
>
> http://lab.llvm.org:8011/builders/clang-s390x-linux/builds/33624/steps/ninja%20check%201/logs/FAIL%3A%20LLVM%3A%3ADWARF-debug_info.yaml
>
> At first glance, seems like this could be endian-related?


The failed tests are removed in 8032727a43ca678b0b923abaa04638f500a060d6 
. Thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82622



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-07-03 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing marked 3 inline comments as done.
Higuoxing added a comment.

Newly added tests are marked by inline comments since too many tests are 
updated 😂.




Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:685
+
+## c) Test that yaml2obj emits correct DWARF sections when 2 compilation units
+## reference the same abbrev table and then obj2yaml is able to convert them 
back.

Added test.



Comment at: llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml:798
+
+## d) Test that yaml2obj emits correct DWARF sections when one compilation unit
+## with lower offet references an abbrev table with higher offset and another 
one

Added test.



Comment at: llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml:651
 
 ## i) Test that yaml2obj reports an error when 'debug_info' has values in its
+## compilation unit entries but 'debug_abbrev' doesn't have the associated 
abbrev

Added test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-07-03 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D83116#2130019 , @labath wrote:

> What would you say if, instead of `AbbrevTableIndex`, we had a field like 
> `AbbrevTableID`. The main difference would be that this "ID" field can be 
> explicitly specified on the Abbrev table, and it does not have to be a 
> sequentially increasing number (though it could of course be that by default).


I think it works. I'm fine with this approach, let's see what others thinking. 
Thanks a lot for sharing your ideas!

  debug_abbrev:
- ID: 1
  Table:
- Code: 1
  Tag:  DW_TAG_something
  Children: DW_CHILDREN_yes
  Attributes:
- Attribute: DW_AT_something
  Form:  DW_FORM_something
- ID: 2
  Table:
- Code: 1
  Tag:  DW_TAG_something
  Children: DW_CHILDREN_yes
  Attributes:
- Attribute: DW_AT_something
  Form:  DW_FORM_something
- ID: 3
  Table:
- Code: 1
  Tag:  DW_TAG_something
  Children: DW_CHILDREN_yes
  Attributes:
- Attribute: DW_AT_something
  Form:  DW_FORM_something
  
  debug_info:
- Length:0x1234
  Version:   4
  AbbrevTableID: 3 ## references table 3
  ...
  Entries:
- AbbrevCode: 1
  Values:
- Value: 0x1234
- Length:0x1234
  Version:   4
  AbbrevTableID: 2 ## references table 2
  ...
  Entries:
- AbbrevCode: 1
  Values:
- Value: 0x1234
- Length:0x1234
  Version:   4
  AbbrevTableID: 1 ## references table 1
  ...
  Entries:
- AbbrevCode: 1
  Values:
- Value: 0x1234




Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D83116: [DWARFYAML] Add support for emitting multiple abbrev tables.

2020-07-03 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing marked an inline comment as done.
Higuoxing added inline comments.



Comment at: llvm/tools/obj2yaml/dwarf2yaml.cpp:19
 #include 
+#include 
 

jhenderson wrote:
> I'm slightly surprised you needed to add this. Did this not compile without 
> it?
I guess it was automatically added by the code completion tool.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D83116



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-17 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing created this revision.
Higuoxing added reviewers: jhenderson, grimar, MaskRay.
Herald added subscribers: llvm-commits, lldb-commits, hiraditya, mgorny.
Herald added projects: LLDB, LLVM.

This patch refactors `emitDebugInfo()` to make the length field be
inferred from its content. Besides, the `Visitor` class is removed in
this patch. The original `Visitor` class helps us determine an
appropriate length and emit the .debug_info section. These two
processes can be merged into one process. Besides, the length field
should be inferred when it's missing rather than when it's zero.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D84008

Files:
  lldb/unittests/Expression/DWARFExpressionTest.cpp
  lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
  lldb/unittests/TestingSupport/Symbol/YAMLModuleTester.cpp
  llvm/include/llvm/ObjectYAML/DWARFEmitter.h
  llvm/include/llvm/ObjectYAML/DWARFYAML.h
  llvm/lib/ObjectYAML/CMakeLists.txt
  llvm/lib/ObjectYAML/DWARFEmitter.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.cpp
  llvm/lib/ObjectYAML/DWARFVisitor.h
  llvm/lib/ObjectYAML/DWARFYAML.cpp
  llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
  llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
  llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
  llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
  llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp

Index: llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDieTest.cpp
@@ -34,8 +34,7 @@
   - Attribute:   DW_AT_call_data_location
 Form:DW_FORM_sec_offset
 debug_info:
-  - Length:  0
-Version: 5
+  - Version: 5
 UnitType:DW_UT_compile
 AbbrOffset:  0
 AddrSize:4
@@ -49,7 +48,7 @@
   - Value:   25
   )";
   Expected>> Sections =
-  DWARFYAML::emitDebugSections(StringRef(yamldata), /*ApplyFixups=*/true,
+  DWARFYAML::emitDebugSections(StringRef(yamldata),
/*IsLittleEndian=*/true);
   ASSERT_THAT_EXPECTED(Sections, Succeeded());
   std::vector Loclists{
Index: llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
===
--- llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1368,8 +1368,7 @@
  "Children:DW_CHILDREN_yes\n"
  "Attributes:\n"
  "debug_info:\n"
- "  - Length:  0\n"
- "Version: 4\n"
+ "  - Version: 4\n"
  "AbbrOffset:  0\n"
  "AddrSize:8\n"
  "Entries:\n"
@@ -1378,7 +1377,7 @@
  "  - AbbrCode:0x\n"
  "Values:\n";
 
-  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata), true);
+  auto ErrOrSections = DWARFYAML::emitDebugSections(StringRef(yamldata));
   ASSERT_TRUE((bool)ErrOrSections);
   std::unique_ptr DwarfContext =
   DWARFContext::create(*ErrOrSections, 8);
Index: llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
===
--- llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
+++ llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
@@ -513,7 +513,7 @@
 
 #  DWARF32: DWARF:
 #  DWARF32:   debug_info:
-# DWARF32-NEXT: - Length: 118
+# DWARF32-NEXT: - Length: 0x0076
 # DWARF32-NEXT:   Version:5
 # DWARF32-NEXT:   UnitType:   DW_UT_compile
 # DWARF32-NEXT:   AbbrOffset: 0
@@ -585,7 +585,7 @@
 # RUN:   obj2yaml | FileCheck %s --check-prefix=DWARF32-YAML
 
 #  DWARF32-YAML: debug_info:
-# DWARF32-YAML-NEXT:   - Length: 12
+# DWARF32-YAML-NEXT:   - Length: 0x000C
 # DWARF32-YAML-NEXT: Version:5
 # DWARF32-YAML-NEXT: UnitType:   DW_UT_compile
 # DWARF32-YAML-NEXT: AbbrOffset: 0x
@@ -669,7 +669,7 @@
 
 #  DWARF64-YAML: debug_info:
 # DWARF64-YAML-NEXT:   - Format: DWARF64
-# DWARF64-YAML-NEXT: Length: 20
+# DWARF64-YAML-NEXT: Length: 0x0014
 # DWARF64-YAML-NEXT: Version:5
 # DWARF64-YAML-NEXT: UnitType:   DW_UT_compile
 # DWARF64-YAML-NEXT: AbbrOffset: 0x
Index: llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
===
--- llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
+++ llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
@@ -415,7 +415,7 @@
 ...
 
 #CHECK:   debug_info:  

[Lldb-commits] [PATCH] D84008: [DWARFYAML] Refactor emitDebugInfo() to make the length be inferred.

2020-07-17 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

I'll add some tests later.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84008: [DWARFYAML][WIP] Refactor emitDebugInfo() to make the length be inferred.

2020-07-19 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D84008#2160426 , @MaskRay wrote:

> The number of changed tests is large. Is it worth moving the 
> `IO.mapOptional("Length", Unit.Length);` change to a separate patch to make 
> the refactoring more focused? Thanks


This patch is intended to make the length field be inferred when emitting the 
.debug_info section. If we move the `IO.mapOption("Length", Unit.Length);` 
change to a separate change, we might not be able to know when to infer the 
length? There are two visitors, `DumpVisitor` which is used to emit the 
.debug_info section and `DIEFixupVisitor` which is used to calculate the length 
field for us. Do you mean that we keep the `DIEFixupVisitor` class and remove 
the `DumpVisitor` class in this patch?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D84008: [DWARFYAML][WIP] Refactor emitDebugInfo() to make the length be inferred.

2020-07-20 Thread Xing GUO via Phabricator via lldb-commits
Higuoxing added a comment.

In D84008#2161461 , @labath wrote:

> In D84008#2161243 , @Higuoxing wrote:
>
> > In D84008#2160426 , @MaskRay wrote:
> >
> > > The number of changed tests is large. Is it worth moving the 
> > > `IO.mapOptional("Length", Unit.Length);` change to a separate patch to 
> > > make the refactoring more focused? Thanks
> >
> >
> > This patch is intended to make the length field be inferred when emitting 
> > the .debug_info section. If we move the `IO.mapOption("Length", 
> > Unit.Length);` change to a separate change, we might not be able to know 
> > when to infer the length? There are two visitors, `DumpVisitor` which is 
> > used to emit the .debug_info section and `DIEFixupVisitor` which is used to 
> > calculate the length field for us. Do you mean that we keep the 
> > `DIEFixupVisitor` class and remove the `DumpVisitor` class in this patch?
>
>
> I think that should work if you make it so that this other patch comes before 
> the functional change in this patch. That other patch could change the 
> encoding to hex (`uint64_t Length;` -> `yaml::Hex64 Length;`) and make it 
> default to zero (`IO.mapRequired("Length", Unit.Length);` -> 
> `IO.mapOptional("Length", Unit.Length, 0);`). That should have no functional 
> change (I think), but allow you to make the changes in all the yaml files. 
> The visitation stuff could come after that.


Thank you @labath, It sounds good to me!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84008



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits