1#! /bin/sh 2# Copyright (C) 2023 Red Hat, Inc. 3# This file is part of elfutils. 4# 5# This file is free software; you can redistribute it and/or modify 6# it under the terms of the GNU General Public License as published by 7# the Free Software Foundation; either version 3 of the License, or 8# (at your option) any later version. 9# 10# elfutils is distributed in the hope that it will be useful, but 11# WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18. $srcdir/test-subr.sh 19 20# Test whether libdwfl can handle corefiles containing non-contiguous 21# segments where multiple modules are contained within the address 22# space of some other module. 23 24# testcore-noncontig was generated from the following program with 25# systemd-coredump on RHEL 7.9 Workstation, kernel 26# 3.10.0-1160.105.1.el7.x86_64. liblgpllibs.so was packaged with 27# firefox-115.4.0-1.el7_9.x86_64.rpm. 28 29# #include <unistd.h> 30# #include <dlfcn.h> 31# 32# int main () { 33# dlopen ("/usr/lib64/firefox/liblgpllibs.so", RTLD_GLOBAL | RTLD_NOW); 34# sleep (60); 35# return 0; 36# } 37# 38# gcc -ldl -o test test.c 39 40tempfiles out 41testfiles testcore-noncontig 42 43testrun ${abs_builddir}/dwfl-core-noncontig testcore-noncontig 44 45# Remove parts of the output that could change depending on which 46# libraries are locally installed. 47testrun ${abs_top_builddir}/src/unstrip -n --core testcore-noncontig \ 48 | sed 's/+/ /g' | cut -d " " -f1,3 | sort > out 49 50testrun_compare cat out <<\EOF 510x400000 3a1748a544b40a38b3be3d2d13ffa34a2a5a71c0@0x400284 520x7f14e357e000 edf51350c7f71496149d064aa8b1441f786df88a@0x7f14e357e1d8 530x7f14e3794000 7615604eaf4a068dfae5085444d15c0dee93dfbd@0x7f14e37941d8 540x7f14e3a96000 09cfb171310110bc7ea9f4476c9fa044d85baff4@0x7f14e3a96210 550x7f14e3d9e000 e10cc8f2b932fc3daeda22f8dac5ebb969524e5b@0x7f14e3d9e248 560x7f14e3fba000 fc4fa58e47a5acc137eadb7689bce4357c557a96@0x7f14e3fba280 570x7f14e4388000 7f2e9cb0769d7e57bd669b485a74b537b63a57c4@0x7f14e43881d8 580x7f14e458c000 62c449974331341bb08dcce3859560a22af1e172@0x7f14e458c1d8 590x7f14e4795000 175efdcef445455872a86a6fbee7567ca16a513e@0x7f14e4795248 600x7ffcfe59f000 80d79b32785868a2dc10047b39a80d1daec8923d@0x7ffcfe59f328 61EOF 62 63exit 0 64