1
1
mirror of https://github.com/rui314/mold.git synced 2024-10-04 08:37:28 +03:00

Revert "Remove a test that doesn't work yet"

This reverts commit bd65e0908f
because --gdb-index should now work with DWARF5.
This commit is contained in:
Rui Ueyama 2022-04-21 19:23:51 +08:00
parent b6fb244f14
commit bad0cbc72a

57
test/elf/gdb-index-dwarf5.sh Executable file
View File

@ -0,0 +1,57 @@
#!/bin/bash
export LC_ALL=C
set -e
CC="${CC:-cc}"
CXX="${CXX:-c++}"
GCC="${GCC:-gcc}"
GXX="${GXX:-g++}"
OBJDUMP="${OBJDUMP:-objdump}"
MACHINE="${MACHINE:-$(uname -m)}"
testname=$(basename "$0" .sh)
echo -n "Testing $testname ... "
cd "$(dirname "$0")"/../..
mold="$(pwd)/mold"
t=out/test/elf/$testname
mkdir -p $t
[ $MACHINE = $(uname -m) ] || { echo skipped; exit; }
which gdb >& /dev/null || { echo skipped; exit; }
echo 'int main() {}' | $CC -o /dev/null -xc -gdwarf-5 -g - >& /dev/null ||
{ echo skipped; exit; }
cat <<EOF > $t/a.c
#include <stdio.h>
void hello() {
printf("Hello world\n");
}
void greet() {
hello();
}
EOF
$CC -o $t/b.o -c -ggnu-pubnames -gdwarf-5 -g $t/a.c
$CC -o $t/c.o -c -ggnu-pubnames -gdwarf-5 -g $t/a.c -gz
cat <<EOF | $CC -o $t/d.o -c -xc -ggnu-pubnames -gdwarf-5 -g -
void greet();
int main() {
greet();
}
EOF
$CC -B. -o $t/exe1 $t/b.o $t/d.o -Wl,--gdb-index
$QEMU $t/exe1 | grep -q 'Hello world'
readelf -WS $t/exe1 | fgrep -q .gdb_index
DEBUGINFOD_URLS= gdb $t/exe1 -ex 'b main' -ex run -ex cont -ex quit >& /dev/null
$CC -B. -o $t/exe2 $t/c.o $t/d.o -Wl,--gdb-index
$QEMU $t/exe2 | grep -q 'Hello world'
readelf -WS $t/exe2 | fgrep -q .gdb_index
DEBUGINFOD_URLS= gdb $t/exe2 -ex 'b main' -ex run -ex cont -ex quit >& /dev/null
echo OK