diff options
author | 2020-08-03 14:33:06 +0000 | |
---|---|---|
committer | 2020-08-03 14:33:06 +0000 | |
commit | 061da546b983eb767bad15e67af1174fb0bcf31c (patch) | |
tree | 83c78b820819d70aa40c36d90447978b300078c5 /gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order | |
parent | Import LLVM 10.0.0 release including clang, lld and lldb. (diff) | |
download | wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.tar.xz wireguard-openbsd-061da546b983eb767bad15e67af1174fb0bcf31c.zip |
Import LLVM 10.0.0 release including clang, lld and lldb.
ok hackroom
tested by plenty
Diffstat (limited to 'gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order')
5 files changed, 101 insertions, 0 deletions
diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile new file mode 100644 index 00000000000..ee67988d065 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/Makefile @@ -0,0 +1,5 @@ +C_SOURCES := main.c +LD_EXTRAS = -Xlinker -order_file -Xlinker $(SRCDIR)/order-file +MAKE_DSYM := NO + +include Makefile.rules diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py new file mode 100644 index 00000000000..778d06ddaca --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py @@ -0,0 +1,36 @@ +""" +Test that debug symbols have the correct order as specified by the order file. +""" + + + +import re +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class OrderFileTestCase(TestBase): + + mydir = TestBase.compute_mydir(__file__) + + @skipUnlessDarwin + def test(self): + """Test debug symbols follow the correct order by the order file.""" + self.build() + exe = self.getBuildArtifact("a.out") + self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET) + + # Test that the debug symbols have Function f3 before Function f1. + # Use "-s address" option to sort by address. + self.runCmd("image dump symtab -s address %s" % exe) + output = self.res.GetOutput() + mo_f3 = re.search("Code +.+f3", output) + mo_f1 = re.search("Code +.+f1", output) + + # Match objects for f3 and f1 must exist and f3 must come before f1. + self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start(), + "Symbols have correct order by the order file") + + self.runCmd("run", RUN_COMPLETED) diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/cmds.txt b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/cmds.txt new file mode 100644 index 00000000000..8c51dd763bf --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/cmds.txt @@ -0,0 +1,3 @@ +b main.c:41 +c +lines -shlib a.out main.c diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/main.c b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/main.c new file mode 100644 index 00000000000..18ee77685c9 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/main.c @@ -0,0 +1,53 @@ +//===-- main.c --------------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +#include <stdio.h> + + +int f1 (char *s); +int f2 (char *s); +int f3 (char *s); + + +// We want f1 to start on line 20 +int f1 (char *s) +{ + return printf("f1: %s\n", s); +} + + + + + +// We want f2 to start on line 30 +int f2 (char *s) +{ + return printf("f2: %s\n", s); +} + + + + + +// We want f3 to start on line 40 +int f3 (char *s) +{ + return printf("f3: %s\n", s); +} + + + + + +// We want main to start on line 50 +int main (int argc, const char * argv[]) +{ + f1("carp"); + f2("ding"); + f3("dong"); + return 0; +} diff --git a/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/order-file b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/order-file new file mode 100644 index 00000000000..0cf8ecd2a63 --- /dev/null +++ b/gnu/llvm/lldb/packages/Python/lldbsuite/test/macosx/order/order-file @@ -0,0 +1,4 @@ +main.o:_f3 +main.o:_main +main.o:_f2 +main.o:_f1 |