From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27118 invoked by alias); 8 Mar 2010 22:13:58 -0000 Received: (qmail 27107 invoked by uid 22791); 8 Mar 2010 22:13:57 -0000 X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 08 Mar 2010 22:13:54 +0000 Received: (qmail 18522 invoked from network); 8 Mar 2010 22:13:52 -0000 Received: from unknown (HELO caradoc.them.org) (dan@127.0.0.2) by mail.codesourcery.com with ESMTPA; 8 Mar 2010 22:13:52 -0000 Date: Mon, 08 Mar 2010 22:13:00 -0000 From: Daniel Jacobowitz To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch-testcase] Re: RFC: Verify AT_ENTRY before using it Message-ID: <20100308221349.GD2629@caradoc.them.org> Mail-Followup-To: Jan Kratochvil , gdb-patches@sourceware.org References: <20100224224913.GA25437@caradoc.them.org> <20100225221620.GA7830@host0.dyn.jankratochvil.net> <20100226211216.GC2630@caradoc.them.org> <20100301200428.GA14079@host0.dyn.jankratochvil.net> <20100301212216.GA30906@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20100301212216.GA30906@host0.dyn.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2010-03/txt/msg00341.txt.bz2 On Mon, Mar 01, 2010 at 10:22:16PM +0100, Jan Kratochvil wrote: > + if (info_verbose) > + { > + /* It can be printed repeatedly as there is no easy way to check > + the executable symbols/file has been already relocated to > + displacement. */ > + > + warning (_("Using PIE (Position Independent Executable) " > + "displacement %s for \"%s\""), > + paddress (target_gdbarch, displacement), > + bfd_get_filename (exec_bfd)); > + } > + > return displacement; > } This isn't a warning; just use printf_unfiltered. > + -re "Using PIE \\(Position Independent Executable\\) displacement 0x0 " { > + # Missing "$gdb_prompt $" is intentional. > + if {$displacement == "ZERO"} { > + pass $test_displacement > + # Permit multiple such messages. > + set displacement "FOUND-$displacement" > + } elseif {$displacement != "FOUND-ZERO"} { > + fail $test_displacement > + } > + exp_continue > + } > + -re "Using PIE \\(Position Independent Executable\\) displacement" { > + # Missing "$gdb_prompt $" is intentional. > + if {$displacement == "NONZERO"} { > + pass $test_displacement > + # Permit multiple such messages. > + set displacement "FOUND-$displacement" > + } elseif {$displacement != "FOUND-NONZERO"} { > + fail $test_displacement > + } > + exp_continue > + } This isn't a safe way to use expect, unfortunately. If you have two patterns, and the second one matches a subset of the first, either might match; it depends where the OS and C library break up GDB's call to 'write'. You have two choices: combine the patterns, and check the displacement inside, or make the second pattern not match the first. For instance, " 0x[0-9a-f]*[1-9a-f]*[0-9a-f]* " won't match 0x0. Otherwise OK. -- Daniel Jacobowitz CodeSourcery