From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28010 invoked by alias); 9 May 2011 11:39:18 -0000 Received: (qmail 27670 invoked by uid 22791); 9 May 2011 11:39:17 -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; Mon, 09 May 2011 11:39:03 +0000 Received: (qmail 28390 invoked from network); 9 May 2011 11:39:02 -0000 Received: from unknown (HELO scottsdale.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 9 May 2011 11:39:02 -0000 From: Pedro Alves To: "Wei-cheng Wang" Subject: Re: [testsuite] setting sysroot for target-board Date: Mon, 09 May 2011 11:39:00 -0000 User-Agent: KMail/1.13.5 (Linux/2.6.35-28-generic; KDE/4.6.2; x86_64; ; ) Cc: gdb-patches@sourceware.org, Tom Tromey References: <201105061047.24349.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201105091239.47267.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/msg00216.txt.bz2 On Sunday 08 May 2011 18:01:16, Wei-cheng Wang wrote: > On Fri, May 6, 2011 at 5:47 PM, Pedro Alves wrot= e: > > On Friday 06 May 2011 03:24:08, Wei-cheng Wang wrote: > > Doing this here assumes you'll only need the sysroot after connecting. > > How have you tested this? It seems you forgot the MI equivalent. > Yes, I did test it. > I found this issue when I tested gdb/gdbserver with a remote > cross-target. Some thread- and shared library-related test cases > failed due to using the wrong shared libraries for the host, so I > tried to add sysroot support and I=E2=80=99ve tested it again to make sur= e gdb > will use the right shared libraries for the target. > > 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. > I agree. It=E2=80=99s better to put this in default_gdb_start/default_mi_= gdb_start. > Since these two functions are not just a few of lines, You'd override "gdb_start", which is already a hook, not default_gdb_start itself: proc gdb_start { } { default_gdb_start } You can also override big functions in tcl and rename/call the overridden version, so that the fact that the functions are big is not a problem, though that's a bit hackish. > I will suggest adding this support, so it much easier to set sysroot as n= eeded. Agreed. > And here is the update according to your suggestion. Thanks. Thanks. The tab/space/indenting looked a bit off, not sure that's just patch/email tricking me, but otherwise looks good to me. > - - - - > 2011-05-06 Wei-cheng Wang >=20 > * lib/gdb.exp (default_gdb_start): Add support for setting sysroo= t for > target system. > * lib/mi-support.exp (default_mi_gdb_start): Likewise. >=20 > diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp > index 20e2fb7..c6fa62d 100644 > --- a/gdb/testsuite/lib/gdb.exp > +++ b/gdb/testsuite/lib/gdb.exp > @@ -1349,6 +1349,18 @@ proc default_gdb_start { } { > warning "Couldn't set the width to 0." > } > } > + > + if [target_info exists gdb,sysroot] { > + send_gdb "set sysroot [target_info gdb,sysroot]\n" > + gdb_expect 10 { > + -re "$gdb_prompt $" { > + verbose "Setting sysroot to [target_info gdb,sysroot]" 2 > + } > + timeout { > + warning "Couldn't set the sysroot to [target_info gdb,sy= sroot]" > + } > + } > + } > return 0; > } >=20 > diff --git a/gdb/testsuite/lib/mi-support.exp b/gdb/testsuite/lib/mi-supp= ort.exp > index e1dbd19..15565bc 100644 > --- a/gdb/testsuite/lib/mi-support.exp > +++ b/gdb/testsuite/lib/mi-support.exp > @@ -221,6 +221,17 @@ proc default_mi_gdb_start { args } { > } > } > } > + if [target_info exists gdb,sysroot] { > + send_gdb "103-gdb-set sysroot [target_info gdb,sysroot]\n" > + gdb_expect 10 { > + -re ".*103-gdb-set sysroot [target_info > gdb,sysroot]\r\n103\\\^done\r\n$mi_gdb_prompt$" { > + verbose "Setting sysroot to [target_info gdb,sysroot]" 2 > + } > + timeout { > + warning "Couldn't set the sysroot to [target_info gdb,sysroot]." > + } > + } > + } >=20 > detect_async >=20 --=20 Pedro Alves