Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] testcase: PR 8210 corefiles threads
Date: Sun, 30 Jan 2011 23:14:00 -0000	[thread overview]
Message-ID: <20110130191128.GA21123@host1.dyn.jankratochvil.net> (raw)

Hi,

PR 8210 did not provide a new testcase, here it is.  I have limited the check
only to *-*-linux* as other targets seem to identify the thread differently
(untested outside of GNU/Linux).

I will check it in after a while, it seems safe to me.

Tested on x86_64-fedora14-linux-gnu.


Thanks,
Jan


gdb/testsuite/
2011-01-30  Jan Kratochvil  <jan.kratochvil@redhat.com>

	Test PR corefiles/8210.
	* gdb.threads/gcore-thread.exp (pthread_self): New.
	New variables main_self, thread1_self, thread2_self.
	(main pthread_self found, thread1 pthread_self found)
	(thread2 pthread_self found): New tests.

--- ./gdb/testsuite/gdb.threads/gcore-thread.exp	2010-06-02 21:58:21.000000000 +0200
+++ ./gdb/testsuite/gdb.threads/gcore-thread.exp	2011-01-30 20:02:53.000000000 +0100
@@ -53,6 +53,19 @@ set horiz "\[^\n\r\]*"
 # regexp for newline
 set nl "\[\r\n\]+"
 
+proc pthread_self {name} {
+    global gdb_prompt
+
+    set test "print pthread_t of $name"
+    gdb_test_multiple "p/x (*(pthread_t (*)(void)) pthread_self) ()" $test {
+	-re " = (0x\[0-9a-f\]+)\r\n$gdb_prompt $" {
+	    pass $test
+	    return $expect_out(1,string)
+	}
+    }
+    return ""
+}
+
 set prev_timeout $timeout
 set timeout 30
 
@@ -82,15 +95,19 @@ gdb_test_multiple "info threads" "thread
     }
 }
 
+set main_self [pthread_self main]
+
 # Make sure thread 1 is running
 delete_breakpoints
 gdb_breakpoint "thread1"
 gdb_test "continue" "Continuing.*Breakpoint.* thread1 .*" "thread 1 is running"
+set thread1_self [pthread_self thread1]
 
 # Make sure thread 2 is running
 delete_breakpoints
 gdb_breakpoint "thread2"
 gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
+set thread2_self [pthread_self thread2]
 
 set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
 # Drop corefile
@@ -159,4 +176,10 @@ gdb_test "info threads" ".* thread2 .*" 
 gdb_test "info threads" ".*${nl}\\* ${horiz} thread2 .*" \
 	"thread2 is current thread in corefile"
 
+if [istarget "*-*-linux*"] then {
+    gdb_test "info threads" "Thread $main_self .*" "main pthread_self found"
+    gdb_test "info threads" "Thread $thread1_self .*" "thread1 pthread_self found"
+    gdb_test "info threads" "Thread $thread2_self .*" "thread2 pthread_self found"
+}
+
 set timeout $prev_timeout


             reply	other threads:[~2011-01-30 19:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-30 23:14 Jan Kratochvil [this message]
2011-04-19 20:44 ` [patch] testcase: PR 8210 corefiles threads #2 Jan Kratochvil
2011-04-20 18:50   ` Tom Tromey
2011-04-20 18:57     ` Jan Kratochvil
2011-04-24 15:07   ` [patch] testcase: PR 8210 corefiles threads #3 Jan Kratochvil
2011-05-06 16:04     ` [commit] " Jan Kratochvil

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=20110130191128.GA21123@host1.dyn.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    /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