From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11547 invoked by alias); 6 Feb 2009 02:12:44 -0000 Received: (qmail 11536 invoked by uid 22791); 6 Feb 2009 02:12:43 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (65.74.133.4) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Feb 2009 02:12:37 +0000 Received: (qmail 27222 invoked from network); 6 Feb 2009 02:12:35 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 6 Feb 2009 02:12:35 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [commit] Fix gdb crashes when using target extended-remote against linux gdbserver. Date: Fri, 06 Feb 2009 02:12:00 -0000 User-Agent: KMail/1.9.10 References: <20090206013101.5B5AAEAEE0@pedro-laptop-dell> In-Reply-To: <20090206013101.5B5AAEAEE0@pedro-laptop-dell> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200902060212.45362.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: 2009-02/txt/msg00146.txt.bz2 All that talk, and in the end... On Friday 06 February 2009 01:31:01, Pedro Alves wrote: > Index: src/gdb/target.c > =================================================================== > --- src.orig/gdb/target.c 2009-02-06 00:55:23.000000000 +0000 > +++ src/gdb/target.c 2009-02-06 00:55:34.000000000 +0000 > @@ -2218,18 +2218,15 @@ target_get_osdata (const char *type) > char *document; > struct target_ops *t; > > - if (target_can_run (¤t_target)) > - t = ¤t_target; > - else > + if (current_target.to_stratum == dummy_stratum) > t = find_default_run_target ("get OS data"); > + else > + t = current_target.beneath; > ... this didn't take into the account the file_stratum. The below fixed it. Checked in. Oh the day I get things right the first time... -- Pedro Alves 2009-02-06 Pedro Alves * target.c (target_get_osdata): Check for equal or higher than process_stratum, not dummy_stratum. --- gdb/target.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) Index: src/gdb/target.c =================================================================== --- src.orig/gdb/target.c 2009-02-06 02:01:47.000000000 +0000 +++ src/gdb/target.c 2009-02-06 02:02:59.000000000 +0000 @@ -2218,10 +2218,13 @@ target_get_osdata (const char *type) char *document; struct target_ops *t; - if (current_target.to_stratum == dummy_stratum) - t = find_default_run_target ("get OS data"); - else + /* If we're already connected to something that can get us OS + related data, use it. Otherwise, try using the native + target. */ + if (current_target.to_stratum >= process_stratum) t = current_target.beneath; + else + t = find_default_run_target ("get OS data"); if (!t) return NULL;