From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26697 invoked by alias); 20 May 2014 20:33:17 -0000 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 Received: (qmail 26684 invoked by uid 89); 20 May 2014 20:33:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-qc0-f202.google.com Received: from mail-qc0-f202.google.com (HELO mail-qc0-f202.google.com) (209.85.216.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 20 May 2014 20:33:16 +0000 Received: by mail-qc0-f202.google.com with SMTP id x3so175559qcv.5 for ; Tue, 20 May 2014 13:33:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:subject:in-reply-to :references; bh=TY83AkOtgIT5ne/pAsiukRz9uxiPdc+eODJYXBeM3yA=; b=ljZnbE+J8zFU8RgbOwTuxg5YosRSj4d5WwHq0w8XQPc+WbGWISC/9wOk3OVll0s2Qv 3/jNY+s/qOygmcKdwzxw/wMNz0vxbN3MdwdfK++sbs+Uk0h+3W4goXzdVQXPJOyqq6oC ZjWcUrXHAp+RlGXWhCqqaLI3RTAobKIUzT7Q7bdHRU73vUoZlF+gnLdO77jdhe3UzIDa NGgbJOI9XjVTpV5ah0faBwxKBmqhwBTMwpYkQiP3qTk4Kq4V5wcgMb8UJFXj/eUuHnot kpYcnCqB7MQ65q320QmFazvBhcVsc1hd3TxIEyQOTVJ0quW2lv51C0/ty/sdvgYDESxR k61g== X-Gm-Message-State: ALoCoQlbLToAscK7D0fysEtjrmGOXfD+o/19IYpOzmEAYnsGntVK2fApzuHSO9V6oeTgUJeR6vWo X-Received: by 10.58.94.232 with SMTP id df8mr12535997veb.23.1400617993610; Tue, 20 May 2014 13:33:13 -0700 (PDT) Received: from corp2gmr1-1.hot.corp.google.com (corp2gmr1-1.hot.corp.google.com [172.24.189.92]) by gmr-mx.google.com with ESMTPS id a44si1081151yhb.6.2014.05.20.13.33.13 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 May 2014 13:33:13 -0700 (PDT) Received: from ruffy.mtv.corp.google.com (ruffy.mtv.corp.google.com [172.17.128.44]) by corp2gmr1-1.hot.corp.google.com (Postfix) with ESMTP id 1A20131C227; Tue, 20 May 2014 13:33:12 -0700 (PDT) From: Doug Evans MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <21371.48136.536907.879292@ruffy.mtv.corp.google.com> Date: Tue, 20 May 2014 20:33:00 -0000 To: Yao Qi , Subject: Re: [PATCH] Fix gdb.multi/base.exp, gdb memory corruption In-Reply-To: <537AEA79.2090602@codesourcery.com> References: <537AEA79.2090602@codesourcery.com> X-IsSubscribed: yes X-SW-Source: 2014-05/txt/msg00445.txt.bz2 Here is what I checked in. 2014-05-20 Doug Evans * python/py-progspace.c (py_free_pspace): Call target_gdbarch instead of get_current_arch. diff --git a/gdb/python/py-progspace.c b/gdb/python/py-progspace.c index cda5a86..db4c564 100644 --- a/gdb/python/py-progspace.c +++ b/gdb/python/py-progspace.c @@ -241,7 +241,16 @@ py_free_pspace (struct program_space *pspace, void *datum) { struct cleanup *cleanup; pspace_object *object = datum; - struct gdbarch *arch = get_current_arch (); + /* This is a fiction, but we're in a nasty spot: The pspace is in the + process of being deleted, we can't rely on anything in it. Plus + this is one time when the current program space and current inferior + are not in sync: All inferiors that use PSPACE may no longer exist. + We don't need to do much here, and since "there is always an inferior" + using target_gdbarch suffices. + Note: We cannot call get_current_arch because it may try to access + the target, which may involve accessing data in the pspace currently + being deleted. */ + struct gdbarch *arch = target_gdbarch (); cleanup = ensure_python_env (arch, current_language); object->pspace = NULL;