From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12921 invoked by alias); 18 Dec 2010 02:13:38 -0000 Received: (qmail 12913 invoked by uid 22791); 18 Dec 2010 02:13:37 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,TW_BJ X-Spam-Check-By: sourceware.org Received: from imr4.ericy.com (HELO imr4.ericy.com) (198.24.6.8) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 18 Dec 2010 02:13:32 +0000 Received: from eusaamw0706.eamcs.ericsson.se ([147.117.20.31]) by imr4.ericy.com (8.14.3/8.14.3/Debian-9.1ubuntu1) with ESMTP id oBI2isks031884; Fri, 17 Dec 2010 20:44:55 -0600 Received: from EUSAACMS0703.eamcs.ericsson.se ([169.254.1.63]) by eusaamw0706.eamcs.ericsson.se ([147.117.20.31]) with mapi; Fri, 17 Dec 2010 21:13:02 -0500 From: Marc Khouzam To: Tom Tromey CC: "'Joel Brobecker'" , "'gdb-patches@sourceware.org'" Date: Sat, 18 Dec 2010 02:13:00 -0000 Subject: RE: [Python] Segfault when clearing pspace Message-ID: References: <20101214150430.GV2596@adacore.com> , In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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: 2010-12/txt/msg00351.txt.bz2 From: gdb-patches-owner@sourceware.org [gdb-patches-owner@sourceware.org] O= n Behalf Of Tom Tromey [tromey@redhat.com] >>>>> "Marc" =3D=3D Marc Khouzam writes: Marc> The existing FIXME comment about how to get the arch seems to Marc> confirm that something should be fixed there. Marc> Below the patch is a session that shows how to reproduce Marc> the crash. Marc> What do you think? > Please remove the FIXME comment. > This is ok with that change plus a ChangeLog entry. I committed the following to HEAD and 7_2. Thanks Tom! Marc 2010-12-17 Marc Khouzam * python/py-progspace.c (py_free_pspace): Obtain arch another way to avoid dereferencing a null pointer. ### Eclipse Workspace Patch 1.0 #P src Index: gdb/python/py-progspace.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/gdb/python/py-progspace.c,v retrieving revision 1.3 diff -u -r1.3 py-progspace.c --- gdb/python/py-progspace.c 17 May 2010 21:23:25 -0000 1.3 +++ gdb/python/py-progspace.c 18 Dec 2010 01:26:51 -0000 @@ -23,6 +23,7 @@ #include "progspace.h" #include "objfiles.h" #include "language.h" +#include "arch-utils.h" =20 typedef struct { @@ -134,9 +135,7 @@ { struct cleanup *cleanup; pspace_object *object =3D datum; - /* FIXME: What's the right way to get a program space's arch? - There may be multiple. */ - struct gdbarch *arch =3D get_objfile_arch (pspace->symfile_object_file); + struct gdbarch *arch =3D get_current_arch (); =20 cleanup =3D ensure_python_env (arch, current_language); object->pspace =3D NULL;