More work on missing testcases present in rhel6 GDB; some still FAIL.

This commit is contained in:
Jan Kratochvil 2016-10-23 22:09:55 +02:00
parent 29d49d9491
commit 43d7d2a8eb
5 changed files with 509 additions and 709 deletions

View File

@ -1,187 +0,0 @@
2005-02-11 Jeff Johnston <jjohnstn@redhat.com>
* testsuite/gdb.threads/step-thread-exit.c: New testcase.
* testsuite/gdb.threads/step-thread-exit.exp: Ditto.
Index: gdb-7.12/gdb/testsuite/gdb.threads/step-thread-exit.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.threads/step-thread-exit.c 2016-10-20 21:36:17.288651989 +0200
@@ -0,0 +1,49 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2005 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <pthread.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+void *thread_function (void *ptr)
+{
+ int *x = (int *)ptr;
+ printf("In thread_function, *x is %d\n", *x);
+} /* thread_function_end */
+
+volatile int repeat = 0;
+
+int
+main (void)
+{
+ int ret;
+ pthread_t th;
+ int i = 3;
+
+ ret = pthread_create (&th, NULL, thread_function, &i);
+ do
+ {
+ repeat = 0;
+ sleep (3); /* sleep */
+ }
+ while (repeat);
+ pthread_join (th, NULL);
+ return 0;
+}
Index: gdb-7.12/gdb/testsuite/gdb.threads/step-thread-exit.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.threads/step-thread-exit.exp 2016-10-20 21:38:17.672579153 +0200
@@ -0,0 +1,123 @@
+# This testcase is part of GDB, the GNU debugger.
+
+# Copyright 2005 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+# Check that GDB can step over a thread exit.
+
+set testfile "step-thread-exit"
+set srcfile ${testfile}.c
+set binfile [standard_output_file ${testfile}]
+if {[gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable [list debug "incdir=[standard_output_file .]"]] != "" } {
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Reset the debug file directory so we can't debug within the C library
+gdb_test "set debug-file-directory ." "" ""
+
+#
+# Run to `main' where we begin our tests.
+#
+
+if ![runto_main] then {
+ gdb_suppress_tests
+}
+
+# FIXME: Currently the main thread will escape/exit before our thread finishes
+# without this setting.
+gdb_test "set scheduler-locking step"
+gdb_test "show scheduler-locking" "Mode for locking scheduler during execution is \"step\"." "check scheduler-locking first"
+
+set sleep_line [expr [gdb_get_line_number "sleep"]]
+set end_line [expr [gdb_get_line_number "thread_function_end"]]
+
+gdb_breakpoint "$end_line"
+gdb_test "continue" "Break.*thread_function.*" "continue to thread_function 1"
+
+# Keep nexting until we cause the thread to exit. We expect the main
+# thread to be stopped and a message printed to tell us we have stepped
+# over the thread exit.
+set test "step over thread exit 1"
+gdb_test_multiple "next" "$test" {
+ -re "\}.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+ -re "\[Thread .* exited\].*Program received signal SIGSTOP.*$gdb_prompt $" {
+ pass "$test"
+ }
+ -re "start_thread.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+}
+
+# Without this fixup we could end up in:
+# #0 0x00110416 in __kernel_vsyscall ()
+# #1 0x0011de26 in __lll_unlock_wake_private () from /lib/libpthread.so.0
+# #2 0x001179f4 in _L_unlock_3164 () from /lib/libpthread.so.0
+# #3 0x00116f01 in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
+# #4 0x08048531 in main () at ../.././gdb/testsuite/gdb.threads/step-thread-exit.c:39
+gdb_breakpoint "$sleep_line"
+gdb_test "set repeat=1" "" "Get to the sleep function prepare 1"
+gdb_test "continue" "Break.*$sleep_line.*" "Get to the sleep function 1"
+
+gdb_test "bt" "main.*$sleep_line.*" "backtrace after step 1"
+
+runto_main
+gdb_test "show scheduler-locking" "Mode for locking scheduler during execution is \"step\"." "check scheduler-locking second"
+
+gdb_breakpoint "$sleep_line"
+gdb_breakpoint "$end_line"
+set test "continue to thread_function 2"
+gdb_test_multiple "continue" "$test" {
+ -re "Break.*thread_function.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Break.*$sleep_line.*$gdb_prompt $" {
+ gdb_test "set repeat=1" "" ""
+ send_gdb "continue\n"
+ exp_continue
+ }
+}
+
+# Keep nexting until we cause the thread to exit. In this case, we
+# expect the breakpoint in the main thread to have already triggered
+# and so we should stop there with a message that we stepped over
+# the thread exit.
+set test "step over thread exit 2"
+gdb_test_multiple "next" "$test" {
+ -re "\}.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+ -re "\[Thread .* exited\].*Break.*$sleep_line.*$gdb_prompt $" {
+ pass "$test (breakpoint hit)"
+ }
+ -re "\[Thread .* exited\].*$gdb_prompt $" {
+ pass "$test (breakpoint not hit)"
+ }
+ -re "start_thread.*$gdb_prompt $" {
+ send_gdb "next\n"
+ exp_continue
+ }
+}
+

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c 2016-10-20 21:03:09.558272492 +0200
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c 2016-10-22 22:10:13.262634144 +0200
@@ -0,0 +1,30 @@
+/* Testcase for recursive dlopen calls.
+
@ -36,7 +36,7 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libbar.c
Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c 2016-10-20 21:03:09.558272492 +0200
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c 2016-10-22 22:10:13.262634144 +0200
@@ -0,0 +1,30 @@
+/* Testcase for recursive dlopen calls.
+
@ -71,7 +71,7 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen-libfoo.c
Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c 2016-10-20 21:03:09.558272492 +0200
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c 2016-10-22 22:10:13.262634144 +0200
@@ -0,0 +1,124 @@
+/* Testcase for recursive dlopen calls.
+
@ -200,8 +200,8 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.c
Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp 2016-10-20 21:06:01.073613545 +0200
@@ -0,0 +1,118 @@
+++ gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp 2016-10-23 21:56:43.815767639 +0200
@@ -0,0 +1,119 @@
+# Copyright 2014 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
@ -231,7 +231,7 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+set binfile_lib2 [standard_output_file ${libname2}.so]
+
+set testfile "gdb-rhbz1156192-recursive-dlopen"
+set srcfile ${srcdir}/${subdir}/${testfile}.c
+set srcfile ${testfile}.c
+set executable ${testfile}
+set binfile [standard_output_file ${executable}]
+
@ -261,28 +261,28 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+
+ with_test_prefix "pass #$pass" {
+ gdb_test_multiple "info shared" "info shared" {
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing.*\)?\r\n${gdb_prompt} $" {
+ -re ".*$libfoo_match\r\n.*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libfoo && $has_libbar } {
+ pass "matched libfoo and libbar"
+ } else {
+ fail "matched libfoo and libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ -re ".*$libfoo_match\(\r\n.*Shared library is missing.*\)?\r\n${gdb_prompt} $" {
+ -re ".*$libfoo_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libfoo && !$has_libbar } {
+ pass "matched libfoo"
+ } else {
+ fail "matched libfoo (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ -re ".*$libbar_match\(\r\n.*Shared library is missing.*\)?\r\n${gdb_prompt} $" {
+ -re ".*$libbar_match\(\r\n.*Shared library is missing\)?.*\r\n${gdb_prompt} $" {
+ if { $has_libbar && !$has_libfoo } {
+ pass "matched libbar"
+ } else {
+ fail "matched libbar (has_libfoo = $has_libfoo, has_libbar = $has_libbar)"
+ }
+ }
+ "${gdb_prompt} $" {
+ "\r\n${gdb_prompt} $" {
+ if { !$has_libfoo && !$has_libbar } {
+ pass "did not match libfoo nor libbar"
+ } else {
@ -297,12 +297,13 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+ set pass 0
+ # This variable holds the information about whether libfoo and
+ # libbar (respectively) are expected in the "info shared" output.
+ set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+ { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+ { 0 1 } { 0 0 } { 1 0 } { 1 1 } \
+ { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
+ { 1 1 } { 1 0 } { 1 0 } { 1 0 } }
+# set solib_event_order { { 0 0 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 0 0 } { 0 1 } \
+# { 0 1 } { 0 0 } { 1 0 } { 1 1 } \
+# { 1 1 } { 1 0 } { 1 0 } { 1 1 } \
+# { 1 1 } { 1 0 } { 1 0 } { 1 0 } }
+ set solib_event_order { { 0 0 } { 1 1 } }
+
+ with_test_prefix "stop-on-solib-events" {
+ gdb_test_no_output "set stop-on-solib-events 1" "setting stop-on-solib-events"
@ -311,7 +312,7 @@ Index: gdb-7.12/gdb/testsuite/gdb.base/gdb-rhbz1156192-recursive-dlopen.exp
+ foreach l $solib_event_order {
+ incr pass
+ do_test [lindex $l 0] [lindex $l 1] $pass
+ gdb_test "continue" "\(Called \(foo\|bar\)\r\n\)?Stopped due to shared library event"
+ gdb_test "continue" "\(Called \(foo\|bar\)\r\n\)?Stopped due to shared library event.*"
+ }
+ # In the last pass we do not expect to see libfoo or libbar.
+ incr pass

View File

@ -0,0 +1,83 @@
http://sourceware.org/ml/gdb-patches/2016-10/msg00652.html
Subject: [testsuite patch] Fix false FAIL for gdb.base/morestack.exp
--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
since
[commit] [testsuite patch] Fix gcc_compiled for gcc 6 & 7
https://sourceware.org/ml/gdb-patches/2016-10/msg00620.html
there has started running again
Running gdb/testsuite/gdb.base/morestack.exp ...
+FAIL: gdb.base/morestack.exp: continue
+PASS: gdb.base/morestack.exp: up 3000
but as you can see it FAILs now - on Fedora 24 x86_64 (although for example it
still PASSes on CentOS-7.2 x86_64).
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 <main_arena>) at malloc.c:4181
4181 unlink(av, nextchunk, bck, fwd);
(gdb) bt
#0 0x00007ffff787c7bb in malloc_consolidate (av=av@entry=0x7ffff7bbcb00 <main_arena>) at malloc.c:4181
#1 0x00007ffff787f235 in _int_malloc (av=av@entry=0x7ffff7bbcb00 <main_arena>, bytes=bytes@entry=1024) at malloc.c:3448
[...]
#8 0x00007ffff784c5ac in _IO_vfprintf_internal (s=0x7ffff7bbd600 <_IO_2_1_stdout_>, format=<optimized out>, ap=ap@entry=0x7ffff77fd7f8) at vfprintf.c:1631
#9 0x00007ffff7853939 in __printf (format=<optimized out>) at printf.c:33
#10 0x0000000000400d6b in down ()
#11 0x0000000000400f2c in __morestack ()
#12 0x0000000000400dda in down ()
[...]
This apparently is due to - man gcc - -fsplit-stack:
When code compiled with -fsplit-stack calls code compiled without
-fsplit-stack, there may not be much stack space available for the
latter code to run. If compiling all code, including library code,
with -fsplit-stack is not an option, then the linker can fix up these
calls so that the code compiled without -fsplit-stack always has
a large stack. Support for this is implemented in the gold linker in
GNU binutils release 2.21 and later.
Personally I do not understand why gold is not the default linker as GNU ld is
unusably slow (6x) for C++ but that is off-topic here.
OK for check-in?
Thanks,
Jan
--HlL+5n6rz5pIUxbD
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline; filename=1
gdb/testsuite/ChangeLog
2016-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/morestack.exp: Try to build it using -fuse-ld=gold first.
diff --git a/gdb/testsuite/gdb.base/morestack.exp b/gdb/testsuite/gdb.base/morestack.exp
index 12f5d28..caa85b8 100644
--- a/gdb/testsuite/gdb.base/morestack.exp
+++ b/gdb/testsuite/gdb.base/morestack.exp
@@ -23,7 +23,11 @@ if {$gcc_compiled == 0} {
standard_testfile
-if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile {additional_flags=-fsplit-stack}] } {
+# -fuse-ld=gold is used for calling printf code built without -fsplit-stack
+# which could crash otherise. See GCC documentation of -fsplit-stack.
+set opts "additional_flags=-fsplit-stack"
+if { [prepare_for_testing ${testfile}.exp ${testfile} $srcfile [list $opts additional_flags=-fuse-ld=gold]] \
+ && [prepare_for_testing ${testfile}.exp ${testfile} $srcfile $opts] } {
return -1
}
--HlL+5n6rz5pIUxbD--

View File

@ -26,7 +26,7 @@ Version: 7.12
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 26%{?dist}
Release: 27%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
Group: Development/Debuggers
@ -289,9 +289,6 @@ Patch254: gdb-6.6-testsuite-timeouts.patch
#=fedoratest
Patch258: gdb-6.6-bz237572-ppc-atomic-sequence-test.patch
# Stop while intentionally stepping and the thread exit is met.
Patch259: gdb-6.3-step-thread-exit-20050211-test.patch
# Test kernel VDSO decoding while attaching to an i386 process.
#=fedoratest
Patch263: gdb-6.3-attach-see-vdso-test.patch
@ -639,6 +636,9 @@ Patch1148: gdb-aarch64-nextoverthrow.patch
Patch1149: gdb-tls-1of2.patch
Patch1150: gdb-tls-2of2.patch
# [testsuite] Fix false FAIL for gdb.base/morestack.exp.
Patch1151: gdb-testsuite-morestack-gold.patch
%if 0%{!?rhel:1} || 0%{?rhel} > 6
# RL_STATE_FEDORA_GDB would not be found for:
# Patch642: gdb-readline62-ask-more-rh.patch
@ -903,7 +903,6 @@ find -name "*.info*"|xargs rm -f
%patch247 -p1
%patch254 -p1
%patch258 -p1
%patch259 -p1
%patch260 -p1
%patch263 -p1
%patch271 -p1
@ -1010,6 +1009,7 @@ done
%patch1148 -p1
%patch1149 -p1
%patch1150 -p1
%patch1151 -p1
%patch1075 -p1
%if 0%{?rhel:1} && 0%{?rhel} <= 7
@ -1572,6 +1572,9 @@ then
fi
%changelog
* Sun Oct 23 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-27.fc25
- More work on missing testcases present in rhel6 GDB; some still FAIL.
* Thu Oct 20 2016 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.12-26.fc25
- Add missing testcases present in rhel6 GDB; some still FAIL.