Author: Pavel Labath Date: 2020-06-02T12:57:51+02:00 New Revision: bddd2888264492a6deb0d447ee6ac042d3fb44e4
URL: https://github.com/llvm/llvm-project/commit/bddd2888264492a6deb0d447ee6ac042d3fb44e4 DIFF: https://github.com/llvm/llvm-project/commit/bddd2888264492a6deb0d447ee6ac042d3fb44e4.diff LOG: [lldb/DWARF] Add support for pre-standard GNU call site attributes Summary: The code changes are very straight-forward -- just handle both DW_AT_GNU and DW_AT_call versions of all tags and attributes. There is just one small gotcha: in the GNU version, DW_AT_low_pc was used both for the "return pc" and the "call pc" values, depending on whether the tag was describing a tail call, while the official scheme uses different attributes for the two things. Reviewers: vsk, dblaikie Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D80519 Added: Modified: 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/TestAmbiguousTailCallSeq1.py 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/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/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/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/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/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/TestUnambiguousTailCalls.py lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/main.cpp Removed: lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq1/Makefile lldb/test/API/functionalities/tail_call_frames/ambiguous_tail_call_seq2/Makefile lldb/test/API/functionalities/tail_call_frames/disambiguate_call_site/Makefile lldb/test/API/functionalities/tail_call_frames/disambiguate_paths_to_common_sink/Makefile lldb/test/API/functionalities/tail_call_frames/disambiguate_tail_call_seq/Makefile lldb/test/API/functionalities/tail_call_frames/inlining_and_tail_calls/Makefile lldb/test/API/functionalities/tail_call_frames/thread_step_out_message/Makefile lldb/test/API/functionalities/tail_call_frames/unambiguous_sequence/Makefile ################################################################################ diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index f8fc1db7ec29..94b36e8b18bd 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -396,6 +396,7 @@ static offset_t GetOpcodeDataSize(const DataExtractor &data, 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 @@ bool DWARFExpression::Evaluate( 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 index 6d22fbe2e2ee..71a01947da26 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -3601,7 +3601,8 @@ CollectCallSiteParameters(ModuleSP module, DWARFDIE call_site_die) { 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 @@ CollectCallSiteParameters(ModuleSP module, DWARFDIE call_site_die) { 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 @@ std::vector<std::unique_ptr<lldb_private::CallEdge>> 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 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { 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 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { 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 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { } } + 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 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { // 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 @@ SymbolFileDWARF::CollectCallEdges(ModuleSP module, DWARFDIE function_die) { 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 index 0d6c5e32948e..ccc737ca24de 100644 --- 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 index 83f622cadf14..a1804254931c 100644 --- 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 @@ __attribute__((noinline)) void func1(int &sink) { 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) { 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..ef7480eceaa9 100644 --- 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..7b873327fa20 100644 --- 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 index dee13db1f716..42c010be9a03 100644 --- 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 index 0d5f26fc31d7..910ec53d73db 100644 --- 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 index c6020e0c298e..45dac0912187 100644 --- 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 index aa3958bb4e98..9de14f5a0741 100644 --- 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..99a2e762caa4 100644 --- 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 index 3a2811c9d052..3d1567e87e46 100644 --- 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 @@ volatile int x; 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..815b5852d95c 100644 --- 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 index 7297a694d5ca..7ed187667d5e 100644 --- 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 @@ volatile int x; 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..3fc89201d9fd 100644 --- 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 index b673e3487b5e..1350a29a0063 100644 --- 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 @@ volatile int x; 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..2cdb49ee2b11 100644 --- 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 index 5f035e773e11..9829e0246fc2 100644 --- 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 @@ volatile int x; 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__((noinline)) func3() { 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 index 666a6c365546..26ff9e686533 100644 --- 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..2fbc6aea0601 100644 --- 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 index 8ec960523944..a08a91fc1ed6 100644 --- 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 @@ volatile int x; 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 index 666a6c365546..26ff9e686533 100644 --- 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 index 666a6c365546..000000000000 --- 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 index fbd629672be0..8179e944947e 100644 --- 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 index 559f8a6d66aa..4b92a34709e0 100644 --- 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 @@ volatile int x; 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() { _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits