From patchwork Tue May 20 20:33:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Evans X-Patchwork-Id: 1034 Return-Path: X-Original-To: siddhesh@wilcox.dreamhost.com Delivered-To: siddhesh@wilcox.dreamhost.com Received: from homiemail-mx22.g.dreamhost.com (mx2.sub5.homie.mail.dreamhost.com [208.113.200.128]) by wilcox.dreamhost.com (Postfix) with ESMTP id 459C836007B for ; Tue, 20 May 2014 13:33:20 -0700 (PDT) Received: by homiemail-mx22.g.dreamhost.com (Postfix, from userid 14314964) id E34B75B517BE; Tue, 20 May 2014 13:33:19 -0700 (PDT) X-Original-To: gdb@patchwork.siddhesh.in Delivered-To: x14314964@homiemail-mx22.g.dreamhost.com Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by homiemail-mx22.g.dreamhost.com (Postfix) with ESMTPS id 971C25B517BE for ; Tue, 20 May 2014 13:33:19 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:subject :in-reply-to:references; q=dns; s=default; b=PcwG0cMOHtP2ek3VcXM oQXd9jWhpobOkYfzQGnqQTXGR69AHQ0Yu+AcLbiAefEcLg1mDB0OToOHLvR5LQ6S ykfN672wdjUI22WaFeWsKdbWZPUjgGUjz8Li0ioTFzM0nRnTK7SV3oT7NK44P9xJ R8NVvt9t8+tLugfLm5jLW6sU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:mime-version:content-type :content-transfer-encoding:message-id:date:to:subject :in-reply-to:references; s=default; bh=ZLyMiypbURhPchsWWjRKJkE2A 3w=; b=SUX5lORNhgz2n/EydBbjlYXmI362enVFnbJPUJiTHGe6StyB6er4/DQE5 KSeBQufKnOkVvSt06L7xLUwF+mLXjSB0/2YK9uzKNgyTo1JmYGIoMWu5D6443bR8 WrxFYD5tN574GcPQxxIjNe4T0V2aTnwy3uT4MnapTQBkFDAoVQ= 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-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@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 Message-ID: <21371.48136.536907.879292@ruffy.mtv.corp.google.com> Date: Tue, 20 May 2014 13:33:12 -0700 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-DH-Original-To: gdb@patchwork.siddhesh.in 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;