From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7397 invoked by alias); 3 Mar 2006 14:04:40 -0000 Received: (qmail 7382 invoked by uid 22791); 3 Mar 2006 14:04:39 -0000 X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 03 Mar 2006 14:04:36 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k23E4Yje004496; Fri, 3 Mar 2006 09:04:34 -0500 Received: from pobox.corp.redhat.com (pobox.corp.redhat.com [172.16.52.156]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k23E4T111874; Fri, 3 Mar 2006 09:04:29 -0500 Received: from free.oliva.athome.lsd.ic.unicamp.br (vpn50-54.rdu.redhat.com [172.16.50.54]) by pobox.corp.redhat.com (8.12.8/8.12.8) with ESMTP id k23E4SNG030054; Fri, 3 Mar 2006 09:04:28 -0500 Received: from free.oliva.athome.lsd.ic.unicamp.br (free.oliva.athome.lsd.ic.unicamp.br [127.0.0.1]) by free.oliva.athome.lsd.ic.unicamp.br (8.13.5/8.13.5) with ESMTP id k23E4NMS030033; Fri, 3 Mar 2006 11:04:24 -0300 Received: (from aoliva@localhost) by free.oliva.athome.lsd.ic.unicamp.br (8.13.5/8.13.5/Submit) id k23E4Mpx029941; Fri, 3 Mar 2006 11:04:22 -0300 To: gdb-patches@sourceware.org Subject: Re: Prelink.exp troubles References: <20060301200540.GE6465@nevyn.them.org> From: Alexandre Oliva Date: Fri, 03 Mar 2006 14:49:00 -0000 In-Reply-To: <20060301200540.GE6465@nevyn.them.org> (Daniel Jacobowitz's message of "Wed, 1 Mar 2006 15:05:40 -0500") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.18 (linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-03/txt/msg00073.txt.bz2 --=-=-= Content-length: 755 On Mar 1, 2006, Daniel Jacobowitz wrote: > First: you're using gdb_expect directly. I'm sorry I didn't notice > this before. Don't do that; use gdb_test_multiple instead. Tricky to catch two independent messages triggered by the same command that way while still producing a fail if either fails to match, so I put them now in a single regexp. > We need to either copy the libraries around (complicated, fragile), or > punt if the system ld.so is not prelinked. Punting it is :-) Tricky, since prelink doesn't report an error in this case. Fortunately prelink -u does. How's this? I've tested it on amd64-linux-gnu, with and without prelinked system libraries. I got the warning in the latter case, and a pass in the former. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=gdb-prelink-test-tweak.patch Content-length: 2971 for gdb/testsuite/ChangeLog from Alexandre Oliva * gdb.base/prelink.exp: Add -q to prelink runs. Rename executable to prelinkt. Don't re-prelink if we didn't get a core file. Test prelink -u exit status to tell whether prelinking failed. Use gdb_test_multiple. Index: trunk/gdb/testsuite/gdb.base/prelink.exp =================================================================== --- trunk.orig/gdb/testsuite/gdb.base/prelink.exp 2006-02-28 01:28:27.000000000 -0300 +++ trunk/gdb/testsuite/gdb.base/prelink.exp 2006-03-03 10:57:20.000000000 -0300 @@ -40,8 +40,6 @@ if {$gcc_compiled == 0} { } set testfile "prelink" -set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} set libsrcfile ${testfile}-lib.c set libfile ${objdir}/${subdir}/${testfile}.so @@ -50,13 +48,13 @@ if { [gdb_compile "${srcdir}/${subdir}/$ return -1 } -if {[catch "system \"prelink -NR ${libfile}\""] != 0} { +if {[catch "system \"prelink -qNR ${libfile}\""] != 0} { # Maybe we don't have prelink. return -1 } set srcfile ${testfile}.c -set binfile ${objdir}/${subdir}/${testfile} +set binfile ${objdir}/${subdir}/${testfile}t if { [gdb_compile "${srcdir}/${subdir}/${srcfile} ${libfile}" "${binfile}" executable [list debug "additional_flags=-Wl,-rpath,${objdir}/${subdir}"]] != ""} { return -1; } @@ -82,9 +80,6 @@ if { $found == 0 } { } } -catch "system \"prelink -u ${libfile}\"" -catch "system \"prelink -NR ${libfile}\"" - # Try to clean up after ourselves. remote_file build delete [file join $coredir coremmap.data] remote_exec build "rmdir $coredir" @@ -94,6 +89,12 @@ if { $found == 0 } { return 0 } +if {[catch "system \"prelink -uN ${libfile}\""] != 0} { + warning "${libfile} was not prelinked, maybe system libraries are not prelinked?" + return 0 +} +catch "system \"prelink -qNR ${libfile}\"" + # Start with a fresh gdb gdb_exit @@ -101,26 +102,12 @@ gdb_start gdb_reinitialize_dir $srcdir/$subdir gdb_load ${binfile} -set oldtimeout $timeout -set timeout [expr "$timeout + 60"] -verbose "Timeout is now $timeout seconds" 2 -send_gdb "core-file $objdir/$subdir/prelink.core\n" -gdb_expect { - -re "warning: \.dynamic section.*not at the expected address" { - pass "changed base address" - } - -re ".*$gdb_prompt $" { fail "changed base address" } - timeout { fail "(timeout) changed base address" } -} -gdb_expect { - -re "warning: difference.*caused by prelink, adjusting" { - pass "prelink adjustment" +set test "prelink" +gdb_test_multiple "core-file $objdir/$subdir/prelink.core" "$test" { + -re "warning: \.dynamic section.*not at the expected address.*warning: difference.*caused by prelink, adjusting expectations." { + pass "$test" } - -re ".*$gdb_prompt $" { fail "prelink adjustment" } - timeout { fail "(timeout) prelink adjustment" } } -set timeout $oldtimeout -verbose "Timeout is now $timeout seconds" 2 gdb_exit --=-=-= Content-length: 249 -- Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/ Secretary for FSF Latin America http://www.fsfla.org/ Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org} Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org} --=-=-=--