This revision was automatically updated to reflect the committed changes.
Closed by commit rGbddd28882644: [lldb/DWARF] Add support for pre-standard GNU 
call site attributes (authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80519

Files:
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  
lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py
  lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp
  
lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile
  
lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py
  
lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile
  
lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py
  lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile
  lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk
  lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk
  lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile
  lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/Makefile
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
  lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
  
lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp
  
lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile
  
lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
  
lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp
  lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile
  
lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/Makefile
  
lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
  
lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp
  
lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile
  lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/Makefile
  
lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py
  lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp

Index: lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp
+++ lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp
@@ -2,11 +2,13 @@
 
 void __attribute__((noinline)) sink() {
   x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial")
-  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt]
-  // CHECK-NEXT: frame #1: 0x{{[0-9a-f]+}} a.out`func3() at main.cpp:14:3 [opt] [artificial]
-  // CHECK-NEXT: frame #2: 0x{{[0-9a-f]+}} a.out`func2() {{.*}} [opt]
-  // CHECK-NEXT: frame #3: 0x{{[0-9a-f]+}} a.out`func1() at main.cpp:23:3 [opt] [artificial]
-  // CHECK-NEXT: frame #4: 0x{{[0-9a-f]+}} a.out`main{{.*}} [opt]
+  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4
+  // CHECK-NEXT: frame #1: 0x{{[0-9a-f]+}} a.out`func3() at main.cpp:16:3
+  // CHECK-SAME: [artificial]
+  // CHECK-NEXT: frame #2: 0x{{[0-9a-f]+}} a.out`func2()
+  // CHECK-NEXT: frame #3: 0x{{[0-9a-f]+}} a.out`func1() at main.cpp:25:3
+  // CHECK-SAME: [artificial]
+  // CHECK-NEXT: frame #4: 0x{{[0-9a-f]+}} a.out`main
 }
 
 void __attribute__((noinline)) func3() {
Index: lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py
+++ lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py
@@ -1,6 +1,9 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
+lldbinline.MakeInlineTest(__file__, globals(), name="UnambiguousTailCalls_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(), name="UnambiguousTailCalls_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile
+++ lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile
@@ -1,4 +1,4 @@
 CXX_SOURCES := main.cpp
 
-CXXFLAGS_EXTRAS := -g -O2 -glldb
+CXXFLAGS_EXTRAS := -O2
 include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp
+++ lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp
@@ -3,8 +3,8 @@
 void __attribute__((noinline)) sink() {
   x++; //% self.filecheck("finish", "main.cpp", "-implicit-check-not=artificial")
   // CHECK: stop reason = step out
-  // CHECK-NEXT: Stepped out past: frame #1: 0x{{[0-9a-f]+}} a.out`func3{{.*}} [opt] [artificial]
-  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`func2{{.*}} [opt]
+  // CHECK-NEXT: Stepped out past: frame #1: 0x{{[0-9a-f]+}} a.out`func3{{.*}} [artificial]
+  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`func2{{.*}}
 }
 
 void __attribute__((noinline)) func3() { sink(); /* tail */ }
Index: lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
+++ lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py
@@ -1,6 +1,11 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
 lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+        name="ArtificialFrameStepOutMessage_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(),
+        name="ArtificialFrameStepOutMessage_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile
+++ lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile
@@ -1,4 +1,4 @@
 CXX_SOURCES := main.cpp
 
-CXXFLAGS_EXTRAS := -g -O2 -glldb
+CXXFLAGS_EXTRAS := -O2
 include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp
+++ lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp
@@ -2,9 +2,9 @@
 
 void __attribute__((noinline)) tail_call_sink() {
   x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=TAIL-CALL-SINK")
-  // TAIL-CALL-SINK: frame #0: 0x{{[0-9a-f]+}} a.out`tail_call_sink() at main.cpp:[[@LINE-1]]:4 [opt]
-  // TAIL-CALL-SINK-NEXT: func3{{.*}} [opt] [artificial]
-  // TAIL-CALL-SINK-NEXT: main{{.*}} [opt]
+  // TAIL-CALL-SINK: frame #0: 0x{{[0-9a-f]+}} a.out`tail_call_sink() at main.cpp:[[@LINE-1]]:4
+  // TAIL-CALL-SINK-NEXT: func3{{.*}} [artificial]
+  // TAIL-CALL-SINK-NEXT: main{{.*}}
 
   // TODO: The backtrace should include inlinable_function_which_tail_calls.
 }
@@ -19,10 +19,10 @@
 
 void __attribute__((always_inline)) inline_sink() {
   x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=INLINE-SINK")
-  // INLINE-SINK: frame #0: 0x{{[0-9a-f]+}} a.out`func2() [inlined] inline_sink() at main.cpp:[[@LINE-1]]:4 [opt]
-  // INLINE-SINK-NEXT: func2{{.*}} [opt]
-  // INLINE-SINK-NEXT: func1{{.*}} [opt] [artificial]
-  // INLINE-SINK-NEXT: main{{.*}} [opt]
+  // INLINE-SINK: frame #0: 0x{{[0-9a-f]+}} a.out`func2() [inlined] inline_sink() at main.cpp:[[@LINE-1]]:4
+  // INLINE-SINK-NEXT: func2{{.*}}
+  // INLINE-SINK-NEXT: func1{{.*}} [artificial]
+  // INLINE-SINK-NEXT: main{{.*}}
 }
 
 void __attribute__((noinline)) func2() { inline_sink(); /* inlined */ }
Index: lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
+++ lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py
@@ -1,6 +1,9 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
+lldbinline.MakeInlineTest(__file__, globals(), name="InliningAndTailCalls_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(), name="InliningAndTailCalls_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp
+++ lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp
@@ -2,10 +2,10 @@
 
 void __attribute__((noinline)) sink() {
   x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial")
-  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt]
-  // CHECK-NEXT: func3{{.*}} [opt] [artificial]
-  // CHECK-NEXT: func1{{.*}} [opt] [artificial]
-  // CHECK-NEXT: main{{.*}} [opt]
+  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4
+  // CHECK-NEXT: func3{{.*}} [artificial]
+  // CHECK-NEXT: func1{{.*}} [artificial]
+  // CHECK-NEXT: main{{.*}}
 }
 
 void __attribute__((noinline)) func3() { sink(); /* tail */ }
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
+++ lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py
@@ -1,6 +1,9 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
+lldbinline.MakeInlineTest(__file__, globals(), name="DisambiguateTailCallSeq_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(), name="DisambiguateTailCallSeq_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp
+++ lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp
@@ -2,17 +2,18 @@
 
 void __attribute__((noinline)) sink2() {
   x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=FROM-FUNC1")
-  // FROM-FUNC1: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]:{{.*}} [opt]
-  // FROM-FUNC1-NEXT: sink({{.*}} [opt]
-  // FROM-FUNC1-NEXT: func1{{.*}} [opt] [artificial]
-  // FROM-FUNC1-NEXT: main{{.*}} [opt]
+  // FROM-FUNC1: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]
+  // FROM-FUNC1-NEXT: sink
+  // FROM-FUNC1-NEXT: func1
+  // FROM-FUNC1-SAME: [artificial]
+  // FROM-FUNC1-NEXT: main
 }
 
 void __attribute__((noinline)) sink(bool called_from_main) {
   if (called_from_main) {
     x++; //% self.filecheck("bt", "main.cpp", "-check-prefix=FROM-MAIN")
-    // FROM-MAIN: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]:{{.*}} [opt]
-    // FROM-MAIN-NEXT: main{{.*}} [opt]
+    // FROM-MAIN: frame #0: 0x{{[0-9a-f]+}} a.out`sink{{.*}} at main.cpp:[[@LINE-1]]
+    // FROM-MAIN-NEXT: main
   } else {
     sink2();
   }
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
+++ lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py
@@ -1,6 +1,11 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
 lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+        name="DisambiguatePathsToCommonSink_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(),
+        name="DisambiguatePathsToCommonSink_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp
+++ lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp
@@ -2,9 +2,9 @@
 
 void __attribute__((noinline)) sink() {
   x++; //% self.filecheck("bt", "main.cpp", "-implicit-check-not=artificial")
-  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4 [opt]
-  // CHECK-NEXT: func2{{.*}} [opt] [artificial]
-  // CHECK-NEXT: main{{.*}} [opt]
+  // CHECK: frame #0: 0x{{[0-9a-f]+}} a.out`sink() at main.cpp:[[@LINE-1]]:4
+  // CHECK-NEXT: func2{{.*}} [artificial]
+  // CHECK-NEXT: main{{.*}}
 }
 
 void __attribute__((noinline)) func2() {
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
+++ lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py
@@ -1,6 +1,9 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
+lldbinline.MakeInlineTest(__file__, globals(), name="DisambiguateCallSite_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(), name="DisambiguateCallSite_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile
+++ lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile
@@ -1,4 +1,4 @@
 C_SOURCES := main.c One.c Two.c
 
-CFLAGS_EXTRAS := -g -O2 -glldb
+CFLAGS_EXTRAS := -O2
 include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk
+++ lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk
@@ -1,6 +1,6 @@
 DYLIB_NAME := Two
 DYLIB_C_SOURCES := Two.c
 DYLIB_ONLY := YES
-CFLAGS_EXTRAS := -g -O2 -glldb
+CFLAGS_EXTRAS := -O2
 
 include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk
+++ lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk
@@ -1,7 +1,7 @@
 DYLIB_NAME := One
 DYLIB_C_SOURCES := One.c
 DYLIB_ONLY := YES
-CFLAGS_EXTRAS := -g -O2 -glldb
+CFLAGS_EXTRAS := -O2
 LD_EXTRAS := -L. -lTwo
 
 include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile
+++ lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile
@@ -1,6 +1,6 @@
 LD_EXTRAS := -L. -l$(LIB_PREFIX)One -l$(LIB_PREFIX)Two
 C_SOURCES := main.c
-CFLAGS_EXTRAS := -g -O2 -glldb
+CFLAGS_EXTRAS := -O2
 
 include Makefile.rules
 
Index: lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py
+++ lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py
@@ -1,6 +1,9 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
+lldbinline.MakeInlineTest(__file__, globals(), name="AmbiguousTailCallSeq2_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(), name="AmbiguousTailCallSeq2_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py
+++ lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py
@@ -1,6 +1,9 @@
 from lldbsuite.test import lldbinline
 from lldbsuite.test import decorators
 
-lldbinline.MakeInlineTest(__file__, globals(),
-        [decorators.skipUnlessHasCallSiteInfo,
-         decorators.skipIf(dwarf_version=['<', '4'])])
+decorators = [decorators.skipUnlessHasCallSiteInfo,
+         decorators.skipIf(dwarf_version=['<', '4'])]
+lldbinline.MakeInlineTest(__file__, globals(), name="AmbiguousTailCallSeq1_V5",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -glldb"), decorators=decorators)
+lldbinline.MakeInlineTest(__file__, globals(), name="AmbiguousTailCallSeq1_GNU",
+        build_dict=dict(CFLAGS_EXTRAS="-O2 -ggdb"), decorators=decorators)
Index: lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile
===================================================================
--- lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
-CXX_SOURCES := main.cpp
-
-CXXFLAGS_EXTRAS := -g -O2 -glldb
-include Makefile.rules
Index: lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp
===================================================================
--- lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp
+++ lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp
@@ -18,8 +18,10 @@
   use<int &>(dummy);
 
   ++global;
-  //% self.filecheck("image lookup -v -a $pc", "main.cpp", "-check-prefix=FUNC1-DESC")
-  // FUNC1-DESC: name = "sink", type = "int &", location = DW_OP_entry_value
+  //% prefix = "FUNC1-GNU" if "GNU" in self.name else "FUNC1-V5"
+  //% self.filecheck("image lookup -v -a $pc", "main.cpp", "-check-prefix="+prefix)
+  // FUNC1-GNU: name = "sink", type = "int &", location = DW_OP_GNU_entry_value
+  // FUNC1-V5: name = "sink", type = "int &", location = DW_OP_entry_value
 }
 
 __attribute__((noinline)) void func2(int &sink, int x) {
Index: lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py
===================================================================
--- lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py
+++ lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py
@@ -11,3 +11,7 @@
 lldbinline.MakeInlineTest(__file__, globals(), decorators=decorators,
         name="BasicEntryValues_V5",
         build_dict=dict(CXXFLAGS_EXTRAS="-O2 -glldb"))
+
+lldbinline.MakeInlineTest(__file__, globals(), decorators=decorators,
+        name="BasicEntryValues_GNU",
+        build_dict=dict(CXXFLAGS_EXTRAS="-O2 -ggdb"))
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3601,7 +3601,8 @@
   CallSiteParameterArray parameters;
   for (DWARFDIE child = call_site_die.GetFirstChild(); child.IsValid();
        child = child.GetSibling()) {
-    if (child.Tag() != DW_TAG_call_site_parameter)
+    if (child.Tag() != DW_TAG_call_site_parameter &&
+        child.Tag() != DW_TAG_GNU_call_site_parameter)
       continue;
 
     llvm::Optional<DWARFExpression> LocationInCallee;
@@ -3631,7 +3632,7 @@
       dw_attr_t attr = attributes.AttributeAtIndex(i);
       if (attr == DW_AT_location)
         LocationInCallee = parse_simple_location(i);
-      if (attr == DW_AT_call_value)
+      if (attr == DW_AT_call_value || attr == DW_AT_GNU_call_site_value)
         LocationInCaller = parse_simple_location(i);
     }
 
@@ -3648,8 +3649,9 @@
 SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) {
   // Check if the function has a supported call site-related attribute.
   // TODO: In the future it may be worthwhile to support call_all_source_calls.
-  uint64_t has_call_edges =
-      function_die.GetAttributeValueAsUnsigned(DW_AT_call_all_calls, 0);
+  bool has_call_edges =
+      function_die.GetAttributeValueAsUnsigned(DW_AT_call_all_calls, 0) ||
+      function_die.GetAttributeValueAsUnsigned(DW_AT_GNU_all_call_sites, 0);
   if (!has_call_edges)
     return {};
 
@@ -3665,13 +3667,15 @@
   std::vector<std::unique_ptr<CallEdge>> call_edges;
   for (DWARFDIE child = function_die.GetFirstChild(); child.IsValid();
        child = child.GetSibling()) {
-    if (child.Tag() != DW_TAG_call_site)
+    if (child.Tag() != DW_TAG_call_site && child.Tag() != DW_TAG_GNU_call_site)
       continue;
 
     llvm::Optional<DWARFDIE> call_origin;
     llvm::Optional<DWARFExpression> call_target;
     addr_t return_pc = LLDB_INVALID_ADDRESS;
     addr_t call_inst_pc = LLDB_INVALID_ADDRESS;
+    addr_t low_pc = LLDB_INVALID_ADDRESS;
+    bool tail_call = false;
 
     DWARFAttributes attributes;
     const size_t num_attributes = child.GetAttributes(attributes);
@@ -3684,8 +3688,11 @@
 
       dw_attr_t attr = attributes.AttributeAtIndex(i);
 
+      if (attr == DW_AT_call_tail_call || attr == DW_AT_GNU_tail_call)
+        tail_call = form_value.Boolean();
+
       // Extract DW_AT_call_origin (the call target's DIE).
-      if (attr == DW_AT_call_origin) {
+      if (attr == DW_AT_call_origin || attr == DW_AT_abstract_origin) {
         call_origin = form_value.Reference();
         if (!call_origin->IsValid()) {
           LLDB_LOG(log, "CollectCallEdges: Invalid call origin in {0}",
@@ -3694,6 +3701,9 @@
         }
       }
 
+      if (attr == DW_AT_low_pc)
+        low_pc = form_value.Address();
+
       // Extract DW_AT_call_return_pc (the PC the call returns to) if it's
       // available. It should only ever be unavailable for tail call edges, in
       // which case use LLDB_INVALID_ADDRESS.
@@ -3708,7 +3718,7 @@
 
       // Extract DW_AT_call_target (the location of the address of the indirect
       // call).
-      if (attr == DW_AT_call_target) {
+      if (attr == DW_AT_call_target || attr == DW_AT_GNU_call_site_target) {
         if (!DWARFFormValue::IsBlockForm(form_value.Form())) {
           LLDB_LOG(log,
                    "CollectCallEdges: AT_call_target does not have block form");
@@ -3723,6 +3733,16 @@
             child.GetCU());
       }
     }
+    if (child.Tag() == DW_TAG_GNU_call_site) {
+      // In DWARF v4 DW_AT_low_pc is always the address of the instruction after
+      // the call. For tail calls, approximate the address of the call
+      // instruction by subtracting 1.
+      if (tail_call)
+        call_inst_pc = low_pc - 1;
+      else
+        return_pc = low_pc;
+    }
+
     if (!call_origin && !call_target) {
       LLDB_LOG(log, "CollectCallEdges: call site without any call target");
       continue;
Index: lldb/source/Expression/DWARFExpression.cpp
===================================================================
--- lldb/source/Expression/DWARFExpression.cpp
+++ lldb/source/Expression/DWARFExpression.cpp
@@ -396,6 +396,7 @@
     return offset - data_offset;
   }
 
+  case DW_OP_GNU_entry_value:
   case DW_OP_entry_value: // 0xa3 ULEB128 size + variable-length block
   {
     uint64_t subexpr_len = data.GetULEB128(&offset);
@@ -2522,6 +2523,7 @@
       stack.push_back(Scalar(value));
     } break;
 
+    case DW_OP_GNU_entry_value:
     case DW_OP_entry_value: {
       if (!Evaluate_DW_OP_entry_value(stack, exe_ctx, reg_ctx, opcodes, offset,
                                       error_ptr, log)) {
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to