diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/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)) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/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 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> 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 call_origin; llvm::Optional 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; diff --git a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py b/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py --- a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/TestBasicEntryValues.py +++ b/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")) diff --git a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp b/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp --- a/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp +++ b/lldb/test/API/functionalities/param_entry_vals/basic_entry_values/main.cpp @@ -18,8 +18,10 @@ use(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) { diff --git a/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile b/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py b/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py --- a/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/TestAmbiguousTailCallSeq1.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile b/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py b/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py --- a/lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/TestAmbiguousTailCallSeq2.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile b/lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile --- a/lldb/test/API/functionalities/tail_call_frames/cross_dso/Makefile +++ b/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk b/lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk --- a/lldb/test/API/functionalities/tail_call_frames/cross_dso/One.mk +++ b/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk b/lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk --- a/lldb/test/API/functionalities/tail_call_frames/cross_dso/Two.mk +++ b/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile b/lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile --- a/lldb/test/API/functionalities/tail_call_frames/cross_object/Makefile +++ b/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/Makefile b/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py b/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py --- a/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/TestDisambiguateCallSite.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp b/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp --- a/lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/main.cpp +++ b/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() { diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile b/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py b/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py --- a/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/TestDisambiguatePathsToCommonSink.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp b/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp --- a/lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/main.cpp +++ b/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(); } diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile b/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py b/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py --- a/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/TestDisambiguateTailCallSeq.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp b/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp --- a/lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/main.cpp +++ b/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 */ } diff --git a/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile b/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py b/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py --- a/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/TestInliningAndTailCalls.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp b/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp --- a/lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/main.cpp +++ b/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 */ } diff --git a/lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile b/lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile --- a/lldb/test/API/functionalities/tail_call_frames/sbapi_support/Makefile +++ b/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/Makefile b/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py b/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py --- a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/TestArtificialFrameStepOutMessage.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp b/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp --- a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/main.cpp +++ b/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 */ } diff --git a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile b/lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile --- a/lldb/test/API/functionalities/tail_call_frames/thread_step_out_or_return/Makefile +++ b/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/Makefile b/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/Makefile deleted file mode 100644 --- a/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 diff --git a/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py b/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py --- a/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/TestUnambiguousTailCalls.py +++ b/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) diff --git a/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp b/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp --- a/lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp +++ b/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() {