From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Cc: jan.kratochvil@redhat.com
Subject: [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup
Date: Fri, 17 Feb 2012 19:38:00 -0000 [thread overview]
Message-ID: <20120217193648.10029.26589.stgit@hit-nxdomain.opendns.com> (raw)
In-Reply-To: <20120217193546.10029.74207.stgit@hit-nxdomain.opendns.com>
This patch does a bit of general cleanup to
gdb.threads/attach-into-signal.exp file.
- build different executable files for the non-threaded and threaded
cases. This was my motivation. I wanted to test the non-threaded
case manually, but the threaded variant always clobbered the
non-threaded executable.
- unique-fy test messages (gdb.sum output)
- Use build_executable/clean_restart.
2012-02-17 Pedro Alves <palves@redhat.com>
General cleanup, make output test messages unique, and build
different executable files for the non-threaded and threaded
cases.
* gdb.threads/attach-into-signal.exp (binfile, escapedbinfile):
Delete.
(executable_nothr, executable_thr): New globals.
(top level): Adjust to delete both executables.
(corefunc): New parameter $executable. Set $pf_prefix instead of
hand writing a prefix in tests. Issue a clean_restart and enable
lin-lwp debug output here.
(top level): Adjust. Use build_executable. Don't start gdb here,
and don't enable lin-lwp debug output here.
* gdb.threads/Makefile.in (EXECUTABLES): Adjust.
---
gdb/testsuite/gdb.threads/Makefile.in | 3 +
gdb/testsuite/gdb.threads/attach-into-signal.exp | 50 +++++++++++-----------
2 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/gdb/testsuite/gdb.threads/Makefile.in b/gdb/testsuite/gdb.threads/Makefile.in
index 954d547..79e4c4c 100644
--- a/gdb/testsuite/gdb.threads/Makefile.in
+++ b/gdb/testsuite/gdb.threads/Makefile.in
@@ -1,7 +1,8 @@
VPATH = @srcdir@
srcdir = @srcdir@
-EXECUTABLES = attach-into-signal attach-stopped attachstop-mt \
+EXECUTABLES = attach-into-signal-nothr attach-into-signal-thr \
+ attach-stopped attachstop-mt \
bp_in_thread current-lwp-dead execl execl1 fork-child-threads \
fork-thread-pending gcore-pthreads hand-call-in-threads \
ia64-sigill interrupted-hand-call killed linux-dp \
diff --git a/gdb/testsuite/gdb.threads/attach-into-signal.exp b/gdb/testsuite/gdb.threads/attach-into-signal.exp
index db88222..bf4b8a0 100644
--- a/gdb/testsuite/gdb.threads/attach-into-signal.exp
+++ b/gdb/testsuite/gdb.threads/attach-into-signal.exp
@@ -24,23 +24,36 @@ if { ![isnative] || [is_remote host] || [target_info exists use_gdb_stub]
set testfile "attach-into-signal"
set srcfile ${testfile}.c
-set binfile ${objdir}/${subdir}/${testfile}
-set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}]
+set executable_nothr ${testfile}-nothr
+set executable_thr ${testfile}-thr
-remote_exec build "rm -f ${binfile}"
+remote_exec build "rm -f ${objdir}/${subdir}/${executable_nothr}"
+remote_exec build "rm -f ${objdir}/${subdir}/${executable_thr}"
# For debugging this test
#
#log_user 1
-proc corefunc { threadtype } {
+proc corefunc { threadtype executable } {
global srcfile
global binfile
global escapedbinfile
global srcdir
+ global objdir
global subdir
global gdb_prompt
+ global pf_prefix
+
+ set save_pf_prefix $pf_prefix
+ lappend pf_prefix "$threadtype:"
+
+ clean_restart ${executable}
+ gdb_test_no_output "set debug lin-lwp 1" ""
+
+ set binfile ${objdir}/${subdir}/${executable}
+ set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${executable}]
if [get_compiler_info ${binfile}] {
+ set pf_prefix $save_pf_prefix
return -1
}
@@ -79,12 +92,12 @@ proc corefunc { threadtype } {
}
if { $stoppedtry >= 10 } {
verbose -log $line2
- set test "$threadtype: process is still running on the attempt # $attempt of $attempts"
+ set test "process is still running on the attempt # $attempt of $attempts"
break
}
# Main test:
- set test "$threadtype: attach (pass $passes), pending signal catch"
+ set test "attach (pass $passes), pending signal catch"
if {[gdb_test_multiple "attach $testpid" $test {
-re "Attaching to program.*`?$escapedbinfile'?, process $testpid.*Received Alarm clock.*$gdb_prompt $" {
# nonthreaded:
@@ -136,35 +149,24 @@ proc corefunc { threadtype } {
remote_exec build "kill -s CONT ${testpid}"
remote_exec build "kill -9 ${testpid}"
-}
-# Start with clean gdb
-gdb_exit
+ set pf_prefix $save_pf_prefix
+}
# build the test case first without threads
#
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
- untested "attach-into-signal.exp (unthreaded)"
+if {[build_executable $testfile $executable_nothr $srcfile] == -1} {
+ untested "attach-into-signal.exp (nonthreaded)"
return -1
}
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-gdb_test_no_output "set debug lin-lwp 1" ""
-
-corefunc nonthreaded
+corefunc nonthreaded ${executable_nothr}
# build the test case also with threads
#
-if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
+if { [gdb_compile_pthreads "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable_thr}" executable {debug additional_flags=-DUSE_THREADS}] != "" } {
untested "attach-into-signal.exp (threaded)"
return -1
}
-gdb_start
-gdb_reinitialize_dir $srcdir/$subdir
-gdb_load ${binfile}
-gdb_test_no_output "set debug lin-lwp 1" ""
-
-corefunc threaded
+corefunc threaded ${executable_thr}
next prev parent reply other threads:[~2012-02-17 19:37 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-17 19:37 [PATCH 0/2] gdb.threads/attach-into-signal.exp: prepare for gdbserver Pedro Alves
2012-02-17 19:38 ` Pedro Alves [this message]
2012-02-17 20:55 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Tom Tromey
2012-02-17 21:00 ` Pedro Alves
2012-02-17 22:04 ` Tom Tromey
2012-02-20 13:27 ` Pedro Alves
2012-02-21 16:05 ` testsuite: prefix handling Pedro Alves
2012-02-21 18:18 ` Jan Kratochvil
2012-02-21 19:28 ` Pedro Alves
2012-02-21 19:54 ` Tom Tromey
2012-02-21 19:17 ` Tom Tromey
2012-02-21 20:08 ` Pedro Alves
2012-02-21 20:59 ` Pedro Alves
2012-02-21 21:02 ` Tom Tromey
2012-02-21 22:08 ` Pedro Alves
2012-02-21 21:00 ` Tom Tromey
2012-02-21 22:03 ` Pedro Alves
2012-02-17 21:31 ` [PATCH 1/2] gdb.threads/attach-into-signal.exp: cleanup Pedro Alves
2012-03-01 11:47 ` Pedro Alves
2012-02-17 23:55 ` Joel Brobecker
2012-02-20 8:57 ` Jan Kratochvil
2012-02-17 19:52 ` [PATCH 2/2] gdb.threads/attach-into-signal.exp: don't rely on linux native target's internal debug output Pedro Alves
2012-02-20 9:41 ` Jan Kratochvil
2012-02-20 12:32 ` Pedro Alves
2012-02-20 12:34 ` Jan Kratochvil
2012-02-20 12:37 ` Pedro Alves
2012-02-21 18:17 ` Edjunior Barbosa Machado
2012-02-21 19:11 ` Pedro Alves
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120217193648.10029.26589.stgit@hit-nxdomain.opendns.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox