[Lldb-commits] [PATCH] D142552: [lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines

2023-03-06 Thread David Stenberg via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG98c3dc3fa748: [lldb] Make GetDIENamesAndRanges() allow 
0-valued decl and call lines (authored by dstenb).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142552

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/Shell/SymbolFile/DWARF/Inputs/inlined-file0-line0-col0.yaml
  lldb/test/Shell/SymbolFile/DWARF/inlined-file0-line0-col0.test

Index: lldb/test/Shell/SymbolFile/DWARF/inlined-file0-line0-col0.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/inlined-file0-line0-col0.test
@@ -0,0 +1,34 @@
+# RUN: yaml2obj %S/Inputs/inlined-file0-line0-col0.yaml -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+#  1 void abort(void);
+#  2 int g1 = 4, g2 = 6;
+#  3
+#  4 inline __attribute__((always_inline)) void bar(int q) {
+#  5   if (q > 5)
+#  6 abort();
+#  7 }
+#  8
+#  9 inline __attribute__((always_inline)) void foo(int q) {
+# 10   bar(q);
+# 11 }
+# 12
+# 13 int main() {
+# 14   foo(g1);
+# 15   foo(g2);
+# 16   return 0;
+# 17 }
+
+# The input object file contains a single abort invocation for the two inlined
+# instances of foo() in main() at line 0. As the file, line and column numbers
+# are all 0, file and line number information would be missing for foo and main
+# in the lookup information.
+#
+# A line number 0 is not printed for main in this case, but the same holds
+# for a non-inlined location with line number 0.
+
+# CHECK: Summary: inlined-file0-line0-col0.test.tmp`main + 30 [inlined] bar + 4 at inlined-file0-line0-col0.c:6:5
+# CHECK-NEXT: inlined-file0-line0-col0.test.tmp`main + 26 [inlined] foo at inlined-file0-line0-col0.c:10:3
+# CHECK-NEXT: inlined-file0-line0-col0.test.tmp`main + 26 at inlined-file0-line0-col0.c
+
+image lookup -a 0x1e
Index: lldb/test/Shell/SymbolFile/DWARF/Inputs/inlined-file0-line0-col0.yaml
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/Inputs/inlined-file0-line0-col0.yaml
@@ -0,0 +1,699 @@
+--- !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x107
+  cpusubtype:  0x3
+  filetype:0x1
+  ncmds:   3
+  sizeofcmds:  736
+  flags:   0x2000
+  reserved:0x0
+LoadCommands:
+  - cmd: LC_SEGMENT_64
+cmdsize: 632
+segname: ''
+vmaddr:  0
+vmsize:  814
+fileoff: 768
+filesize:814
+maxprot: 7
+initprot:7
+nsects:  7
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x0
+size:31
+offset:  0x300
+align:   4
+reloff:  0x630
+nreloc:  3
+flags:   0x8400
+reserved1:   0x0
+reserved2:   0x0
+reserved3:   0x0
+content: 554889E5833D067D0D833D067D0431C05DC3E8
+relocations:
+  - address: 0x1B
+symbolnum:   3
+pcrel:   true
+length:  2
+extern:  true
+type:2
+scattered:   false
+value:   0
+  - address: 0xF
+symbolnum:   1
+pcrel:   true
+length:  2
+extern:  true
+type:6
+scattered:   false
+value:   0
+  - address: 0x6
+symbolnum:   0
+pcrel:   true
+length:  2
+extern:  true
+type:6
+scattered:   false
+value:   0
+  - sectname:__data
+segname: __DATA
+addr:0x20
+size:8
+offset:  0x320
+align:   2
+reloff:  0x0
+nreloc:  0
+flags:   0x0
+reserved1:   0x0
+reserved2:   0x0
+reserved3:   0x0
+content: '04000600'
+  - sectname:__debug_abbrev
+segname: __DWARF
+addr:0x28
+size:182
+offset:  0x328
+align:   0
+reloff:  0x0
+

[Lldb-commits] [PATCH] D142552: [lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines

2023-03-06 Thread David Stenberg via Phabricator via lldb-commits
dstenb added a comment.

In D142552#4083939 , @clayborg wrote:

> As long as there are no regressions in the test suite this looks good to me

Thanks, and sorry for the delay with landing this! I have ran check-lldb. I 
will land this shortly.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142552

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


[Lldb-commits] [PATCH] D142552: [lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines

2023-01-26 Thread Greg Clayton via Phabricator via lldb-commits
clayborg accepted this revision.
clayborg added a comment.
This revision is now accepted and ready to land.

As long as there are no regressions in the test suite this looks good to me


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142552

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


[Lldb-commits] [PATCH] D142552: [lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines

2023-01-25 Thread David Stenberg via Phabricator via lldb-commits
dstenb added a comment.

First time looking at LLDB, so I had trouble finding a suitable way to create a 
reproducer for this. I would be happy to change to another type of lit test if 
that is more suitable.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D142552

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


[Lldb-commits] [PATCH] D142552: [lldb] Make GetDIENamesAndRanges() allow 0-valued decl and call lines

2023-01-25 Thread David Stenberg via Phabricator via lldb-commits
dstenb created this revision.
dstenb added reviewers: jasonmolenda, clayborg, aeubanks, ayermolo.
dstenb added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a reviewer: shafik.
Herald added a project: All.
dstenb requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: lldb-commits, sstefan1.

In an upcoming patch Clang is proposed to be changed to emit
line locations that are inlined at line 0. This clashed with the behavior of
GetDIENamesAndRanges() which used 0 as a default value to determine if
file, line or column numbers had been set. Users of that function then
checked for any non-0 values when setting up the call site:

  if (call_file != 0 || call_line != 0 || call_column != 0)
[...]

which did not work with the Clang change since all three values then
could be 0.

This changes the function to use std::optional to catch non-set values
instead.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D142552

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDIE.h
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/test/Shell/SymbolFile/DWARF/Inputs/inlined-file0-line0-col0.yaml
  lldb/test/Shell/SymbolFile/DWARF/inlined-file0-line0-col0.test

Index: lldb/test/Shell/SymbolFile/DWARF/inlined-file0-line0-col0.test
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/inlined-file0-line0-col0.test
@@ -0,0 +1,34 @@
+# RUN: yaml2obj %S/Inputs/inlined-file0-line0-col0.yaml -o %t
+# RUN: %lldb %t -s %s -o exit | FileCheck %s
+
+#  1 void abort(void);
+#  2 int g1 = 4, g2 = 6;
+#  3
+#  4 inline __attribute__((always_inline)) void bar(int q) {
+#  5   if (q > 5)
+#  6 abort();
+#  7 }
+#  8
+#  9 inline __attribute__((always_inline)) void foo(int q) {
+# 10   bar(q);
+# 11 }
+# 12
+# 13 int main() {
+# 14   foo(g1);
+# 15   foo(g2);
+# 16   return 0;
+# 17 }
+
+# The input object file contains a single abort invocation for the two inlined
+# instances of foo() in main() at line 0. As the file, line and column numbers
+# are all 0, file and line number information would be missing for foo and main
+# in the lookup information.
+#
+# A line number 0 is not printed for main in this case, but the same holds
+# for a non-inlined location with line number 0.
+
+# CHECK: Summary: inlined-file0-line0-col0.test.tmp`main + 30 [inlined] bar + 4 at inlined-file0-line0-col0.c:6:5
+# CHECK-NEXT: inlined-file0-line0-col0.test.tmp`main + 26 [inlined] foo at inlined-file0-line0-col0.c:10:3
+# CHECK-NEXT: inlined-file0-line0-col0.test.tmp`main + 26 at inlined-file0-line0-col0.c
+
+image lookup -a 0x1e
Index: lldb/test/Shell/SymbolFile/DWARF/Inputs/inlined-file0-line0-col0.yaml
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/Inputs/inlined-file0-line0-col0.yaml
@@ -0,0 +1,699 @@
+--- !mach-o
+FileHeader:
+  magic:   0xFEEDFACF
+  cputype: 0x107
+  cpusubtype:  0x3
+  filetype:0x1
+  ncmds:   3
+  sizeofcmds:  736
+  flags:   0x2000
+  reserved:0x0
+LoadCommands:
+  - cmd: LC_SEGMENT_64
+cmdsize: 632
+segname: ''
+vmaddr:  0
+vmsize:  814
+fileoff: 768
+filesize:814
+maxprot: 7
+initprot:7
+nsects:  7
+flags:   0
+Sections:
+  - sectname:__text
+segname: __TEXT
+addr:0x0
+size:31
+offset:  0x300
+align:   4
+reloff:  0x630
+nreloc:  3
+flags:   0x8400
+reserved1:   0x0
+reserved2:   0x0
+reserved3:   0x0
+content: 554889E5833D067D0D833D067D0431C05DC3E8
+relocations:
+  - address: 0x1B
+symbolnum:   3
+pcrel:   true
+length:  2
+extern:  true
+type:2
+scattered:   false
+value:   0
+  - address: 0xF
+symbolnum:   1
+pcrel:   true
+length:  2
+extern:  true
+type:6
+scattered:   false
+value:   0
+  - address: 0x6
+symbolnum:   0
+pcrel:   true
+length:  2
+extern:  true
+type:6
+scattered:   false
+