Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA]: Test for threads attach/detach
@ 2001-05-06 10:11 Mark Kettenis
       [not found] ` <3B5F4EC3.33CC33D3@cygnus.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Kettenis @ 2001-05-06 10:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: fnasser

Better get aproval for this stuff first :-).

This is supposed to test attaching to a multi-threaded program.  Only
executed on Linux for now.

OK, to check this in?

Mark


Index: testsuite/ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* gdb.threads/attach.exp: New file.

--- /dev/null	Thu Feb 19 16:30:24 1998
+++ testsuite/gdb.threads/attach.exp	Sun May  6 14:30:39 2001
@@ -0,0 +1,119 @@
+# Copyright 2001 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.  
+
+# Please email any bugs, comments, and/or additions to this file to:
+# bug-gdb@gnu.org
+
+if $tracelevel then {
+    strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+# This probably only works with Linux configurations.
+if ![istarget *-*-linux-gnu] then {
+    return
+}
+
+set testfile "linux-dp"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug libs=-lpthread}] != "" } {
+    gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+# Create and source the file that provides information about the compiler
+# used to compile the test case.
+
+if [get_compiler_info ${binfile}] {
+    return -1;
+}
+
+# Start with a fresh gdb.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# Start the program running and then wait for a bit, to be sure that
+# it can be attached to.
+
+set testpid [eval exec $binfile > /dev/null &]
+exec sleep 2
+
+send_gdb "attach $testpid\n"
+gdb_expect {
+    -re "Attaching to program.*$binfile.*\\\[New .*\\\].*$gdb_prompt $" {
+	pass "attach1"
+    }
+    -re ".*$gdb_prompt $" {
+	fail "attach1"
+    }
+    timeout {
+	fail "attach1 (timeout)"
+    }
+}
+
+send_gdb "detach\n"
+gdb_expect {
+    -re "Detaching from program: .*$binfile.*$gdb_prompt $" {
+	pass "detach attach1"
+    }
+    -re ".*$gdb_prompt $" {
+	fail "detach attach1"
+    }
+    timeout {
+	fail "detach attach1 (timeout)"
+    }
+}
+
+send_gdb "attach $testpid\n"
+gdb_expect {
+    -re "Attaching to program.*$binfile.*\\\[New .*\\\].*$gdb_prompt $" {
+	pass "attach2"
+    }
+    -re ".*$gdb_prompt $" {
+	fail "attach2"
+    }
+    timeout {
+	fail "attach2 (timeout)"
+    }
+}
+
+send_gdb "kill\n"
+gdb_expect {
+    -re ".*Kill the program being debugged.*y or n. $" {
+	send_gdb "y\n"
+	gdb_expect {
+	    -re "$gdb_prompt $" {
+		pass "after attach2, exit"
+	    }
+	    timeout {
+		fail "after attach2, exit (timeout)"
+	    }
+	}
+    }
+    -re "$gdb_prompt $" {
+	fail "after attach2, exit"
+    }
+    timeout {
+	fail "after attach2, exit (timeout)"
+    }
+}
+
+return


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFA]: Test for threads attach/detach
       [not found] ` <3B5F4EC3.33CC33D3@cygnus.com>
@ 2001-07-26  2:40   ` Mark Kettenis
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Kettenis @ 2001-07-26  2:40 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches, fnasser

   Date: Wed, 25 Jul 2001 15:57:07 -0700
   From: Michael Snyder <msnyder@cygnus.com>

   Hey Mark, 
   Did you ever get resolution for this new test?
   Michael

Nope.  What do you think about it.  In the MAINTAINERS file we have:

testsuite
  ...
  threads (gdb.threads) Michael Snyder          msnyder@redhat.com

so you'll just have to mumble something that sounds like OK, and I'll
check it in :-).

Mark


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-07-26  2:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-06 10:11 [RFA]: Test for threads attach/detach Mark Kettenis
     [not found] ` <3B5F4EC3.33CC33D3@cygnus.com>
2001-07-26  2:40   ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox