From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7463 invoked by alias); 30 Jan 2011 19:11:42 -0000 Received: (qmail 7430 invoked by uid 22791); 30 Jan 2011 19:11:41 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 30 Jan 2011 19:11:37 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id p0UJBZph016326 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 30 Jan 2011 14:11:35 -0500 Received: from host1.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id p0UJBX8O018952 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sun, 30 Jan 2011 14:11:34 -0500 Received: from host1.dyn.jankratochvil.net (localhost [127.0.0.1]) by host1.dyn.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p0UJBW4j021244 for ; Sun, 30 Jan 2011 20:11:32 +0100 Received: (from jkratoch@localhost) by host1.dyn.jankratochvil.net (8.14.4/8.14.4/Submit) id p0UJBT21021237 for gdb-patches@sourceware.org; Sun, 30 Jan 2011 20:11:29 +0100 Date: Sun, 30 Jan 2011 23:14:00 -0000 From: Jan Kratochvil To: gdb-patches@sourceware.org Subject: [patch] testcase: PR 8210 corefiles threads Message-ID: <20110130191128.GA21123@host1.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-01/txt/msg00567.txt.bz2 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 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