From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28335 invoked by alias); 6 May 2011 09:47:15 -0000 Received: (qmail 28325 invoked by uid 22791); 6 May 2011 09:47:14 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD 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; Fri, 06 May 2011 09:47:00 +0000 Received: (qmail 32621 invoked from network); 6 May 2011 09:47:00 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 May 2011 09:47:00 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [testsuite] setting sysroot for target-board Date: Fri, 06 May 2011 09:47:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.2; x86_64; ; ) Cc: "Wei-cheng Wang" , Tom Tromey References: In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <201105061047.24349.pedro@codesourcery.com> 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-05/txt/msg00179.txt.bz2 On Friday 06 May 2011 03:24:08, Wei-cheng Wang wrote: > Here is the update :-) > > 2011-05-06 Wei-cheng Wang > > * lib/gdbserver-support.exp: Add support for setting sysroot for > target system. > > --- a/gdb/testsuite/lib/gdbserver-support.exp > +++ b/gdb/testsuite/lib/gdbserver-support.exp > @@ -36,6 +36,10 @@ > # Port id to use for socket connection. If not set explicitly, > # it will start at "2345" and increment for each use. > # > +# set_board_info gdb,sysroot > +# System root for the target to find shared libraries. > +# If target and host are different, this should be properly set. > +# > > # > # gdb_target_cmd > @@ -44,6 +48,11 @@ > proc gdb_target_cmd { targetname serialport } { > global gdb_prompt Doing this here assumes you'll only need the sysroot after connecting. How have you tested this? It seems you forgot the MI equivalent. I think a better place would be right after spawning gdb (default_gdb_start/default_mi_gdb_start). If since you already have a board file anyway, you could also override *gdb_start and do it there instead of adding a new flag. > > + if [target_info exists gdb,sysroot] { > + set gdb_sysroot [target_info gdb,sysroot] > + send_gdb "set sysroot $gdb_sysroot\n" This leaves a gdb prompt in the expect buffer, which is a recipe for trouble. I guess it doesn't cause trouble as it, because the "target foo" command below doesn't happen to have a '-re ".*$gdb_prompt"' match, but that's fragile. (actually it may cause trouble afterwards if the -notransfer regex matches) > + } > > Wei-cheng > > On Fri, May 6, 2011 at 1:36 AM, Tom Tromey wrote: > >>>>>> ">" == Wei-cheng Wang writes: > > > >>> When testing remote cross-target, libc and other shared libraries > >>> will not be compatible with the one on host. > > > >>> This patch adds support for setting sysroot in target-board files, e.g., > >>> set_board_info gdb,sysroot "/path/to/target/libc", > >>> so that testsuite can be used for remote cross-target. > > > > I think this looks reasonable. > > > > There is a comment just above the definition of gdb_target_cmd that > > needs an update for this new parameter. > > > > This patch also needs a ChangeLog entry. > > > > Tom > > > -- Pedro Alves