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

2020-09-18 Thread James Henderson via Phabricator via lldb-commits
jhenderson added a comment.

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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87878

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


[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 James Henderson via Phabricator via lldb-commits
jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

LGTM!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D87878

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


[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] [lldb] 2d35092 - [DWARFYAML] Make the include_directories, file_names and opcodes fields of the line table optional.

2020-09-18 Thread Xing GUO via lldb-commits

Author: Xing GUO
Date: 2020-09-18T20:21:11+08:00
New Revision: 2d35092cd2589dffbca1e34a3dc68f6df75818a9

URL: 
https://github.com/llvm/llvm-project/commit/2d35092cd2589dffbca1e34a3dc68f6df75818a9
DIFF: 
https://github.com/llvm/llvm-project/commit/2d35092cd2589dffbca1e34a3dc68f6df75818a9.diff

LOG: [DWARFYAML] Make the include_directories, file_names and opcodes fields of 
the line table optional.

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

Reviewed By: jhenderson

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

Added: 


Modified: 
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

Removed: 




diff  --git a/lldb/unittests/Symbol/Inputs/inlined-functions.yaml 
b/lldb/unittests/Symbol/Inputs/inlined-functions.yaml
index 050ee869d3c0..8498cf7f6d31 100644
--- a/lldb/unittests/Symbol/Inputs/inlined-functions.yaml
+++ b/lldb/unittests/Symbol/Inputs/inlined-functions.yaml
@@ -711,7 +711,6 @@ DWARF:
   LineRange:   14
   OpcodeBase:  13
   StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-  IncludeDirs: []
   Files:   
 - Name:inlined-functions.cpp
   DirIdx:  0

diff  --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp 
b/llvm/lib/ObjectYAML/DWARFYAML.cpp
index 975b9b40b6b1..067423e2e7a2 100644
--- a/llvm/lib/ObjectYAML/DWARFYAML.cpp
+++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp
@@ -246,9 +246,9 @@ void MappingTraits::mapping(
   IO.mapRequired("LineRange", LineTable.LineRange);
   IO.mapRequired("OpcodeBase", LineTable.OpcodeBase);
   IO.mapRequired("StandardOpcodeLengths", LineTable.StandardOpcodeLengths);
-  IO.mapRequired("IncludeDirs", LineTable.IncludeDirs);
-  IO.mapRequired("Files", LineTable.Files);
-  IO.mapRequired("Opcodes", LineTable.Opcodes);
+  IO.mapOptional("IncludeDirs", LineTable.IncludeDirs);
+  IO.mapOptional("Files", LineTable.Files);
+  IO.mapOptional("Opcodes", LineTable.Opcodes);
 }
 
 void MappingTraits::mapping(

diff  --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml 
b/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
index 7b9d5fa19894..d6bcaf0d754b 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_info.yaml
@@ -478,7 +478,6 @@ DWARF:
 - 0
 - 0
 - 1
-  IncludeDirs: 
   Files:   
 - Name:hello_world.c
   DirIdx:  0

diff  --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml 
b/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
index 6643e2d5f75a..6ac577f9c83a 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_line.yaml
@@ -499,7 +499,6 @@ DWARF:
   LineRange:   14
   OpcodeBase:  13
   StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-  IncludeDirs: 
   Files:   
 - Name:hello_world.c
   DirIdx:  0
@@ -540,7 +539,6 @@ DWARF:
 # CHECK-NEXT: LineRange:   14
 # CHECK-NEXT: OpcodeBase:  13
 # CHECK-NEXT: StandardOpcodeLengths: [ 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 1 ]
-# CHECK-NEXT: IncludeDirs:
 # CHECK-NEXT: Files:
 # CHECK-NEXT:   - Name:hello_world.c
 # CHECK-NEXT: DirIdx:  0

diff  --git a/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml 
b/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
index d016b8c485ee..e0f82e862c8b 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF5-debug_info.yaml
@@ -479,7 +479,6 @@ DWARF:
 - 0
 - 0
 - 1
-  IncludeDirs: 
   Files:   
 - Name:hello_world.c
   DirIdx:  0

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml 
b/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
index 19d9a6943589..3e1e1ee2e00d 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
+++ b/llvm/test/tools/llvm-dwarfdump/X86/verify_attr_file_indexes.yaml
@@ -118,5 +118,4 @@ DWARF:
   DirIdx:  1
   ModTime: 0
   Length:  0
-  Opcodes: []
 ...

d

[Lldb-commits] [PATCH] D85705: Add a "Trace" plug-in to LLDB to add process trace support in stages.

2020-09-18 Thread walter erquinigo via Phabricator via lldb-commits
wallace updated this revision to Diff 292922.
wallace added a comment.

Based on the discussion from D87335 , I'm 
moving all the JSON utilities as non-member functions to the settings parser 
file. Eventually this can be refactored if that patch moves forward.

There aren't any other pending issues.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D85705

Files:
  lldb/include/lldb/Core/PluginManager.h
  lldb/include/lldb/Target/Trace.h
  lldb/include/lldb/Target/TraceSettingsParser.h
  lldb/include/lldb/lldb-forward.h
  lldb/include/lldb/lldb-private-interfaces.h
  lldb/source/Commands/CMakeLists.txt
  lldb/source/Commands/CommandObjectTrace.cpp
  lldb/source/Commands/CommandObjectTrace.h
  lldb/source/Commands/Options.td
  lldb/source/Core/PluginManager.cpp
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Plugins/CMakeLists.txt
  lldb/source/Plugins/Trace/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/CMakeLists.txt
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPT.h
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSettingsParser.cpp
  lldb/source/Plugins/Trace/intel-pt/TraceIntelPTSettingsParser.h
  lldb/source/Target/CMakeLists.txt
  lldb/source/Target/Trace.cpp
  lldb/source/Target/TraceSettingsParser.cpp
  lldb/source/Utility/StructuredData.cpp
  lldb/test/API/commands/trace/TestTraceLoad.py
  lldb/test/API/commands/trace/TestTraceSchema.py
  lldb/test/API/commands/trace/intelpt-trace/3842849.trace
  lldb/test/API/commands/trace/intelpt-trace/a.out
  lldb/test/API/commands/trace/intelpt-trace/main.cpp
  lldb/test/API/commands/trace/intelpt-trace/trace.json
  lldb/test/API/commands/trace/intelpt-trace/trace_bad.json
  lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
  lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json

Index: lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
===
--- /dev/null
+++ lldb/test/API/commands/trace/intelpt-trace/trace_bad3.json
@@ -0,0 +1,32 @@
+{
+  "trace": {
+"type": "intel-pt",
+"pt_cpu": {
+  "vendor": "intel",
+  "family": 6,
+  "model": 79,
+  "stepping": 1
+}
+  },
+  "processes": [
+{
+  "pid": 1234,
+  "triple": "x86_64-*-linux",
+  "threads": [
+{
+  "tid": 5678,
+  "traceFile": "3842849.trace"
+}
+  ],
+  "modules": [
+{
+  "file": "a.out",
+  "systemPath": "a.out",
+  "loadAddress": "0x0040",
+  "uuid": "6AA9A4E2-6F28-2F33-377D-59FECE874C71-5B41261A"
+}
+  ]
+},
+{}
+  ]
+}
Index: lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
===
--- /dev/null
+++ lldb/test/API/commands/trace/intelpt-trace/trace_bad2.json
@@ -0,0 +1,41 @@
+{
+  "trace": {
+"type": "intel-pt",
+"pt_cpu": {
+  "vendor": "intel",
+  "family": 6,
+  "model": 79,
+  "stepping": 1
+}
+  },
+  "processes": [
+{
+  "pid": 1234,
+  "triple": "x86_64-*-linux",
+  "threads": [
+{
+  "tid": 5678,
+  "traceFile": "3842849.trace"
+}
+  ],
+  "modules": [
+{
+  "file": "a.out",
+  "systemPath": "a.out",
+  "loadAddress": "0x0040",
+  "uuid": "6AA9A4E2-6F28-2F33-377D-59FECE874C71-5B41261A"
+}
+  ]
+},
+{
+  "pid": 12345,
+  "threads": [
+{
+  "tid": 56789,
+  "traceFile": "3842849.trace"
+}
+  ],
+  "modules": []
+}
+  ]
+}
Index: lldb/test/API/commands/trace/intelpt-trace/trace_bad.json
===
--- /dev/null
+++ lldb/test/API/commands/trace/intelpt-trace/trace_bad.json
@@ -0,0 +1,14 @@
+{
+  "trace": {
+"type": "intel-pt",
+"pt_cpu": {
+  "vendor": "intel",
+  "family": 6,
+  "model": 79,
+  "stepping": 1
+}
+  },
+  "processes": [
+123
+  ]
+}
Index: lldb/test/API/commands/trace/intelpt-trace/trace.json
===
--- /dev/null
+++ lldb/test/API/commands/trace/intelpt-trace/trace.json
@@ -0,0 +1,31 @@
+{
+  "trace": {
+"type": "intel-pt",
+"pt_cpu": {
+  "vendor": "intel",
+  "family": 6,
+  "model": 79,
+  "stepping": 1
+}
+  },
+  "processes": [
+{
+  "pid": 1234,
+  "triple": "x86_64-*-linux",
+  "threads": [
+{
+  "tid": 3842849,
+  "traceFile": "3842849.trace"
+}
+  ],
+  "modules": [
+{
+  "file": "a.out",
+  "systemPath": "a.out",
+  "loadAddress": "0x0040",
+  "uuid": "6AA9A4E2-6F28-2F33-377D-59FECE874C71-5B41261A