From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20382 invoked by alias); 1 Dec 2012 20:25:42 -0000 Received: (qmail 20369 invoked by uid 22791); 1 Dec 2012 20:25:40 -0000 X-SWARE-Spam-Status: No, hits=-6.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS,TW_BJ X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 01 Dec 2012 20:25:29 +0000 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qB1KPQin003677 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 1 Dec 2012 15:25:27 -0500 Received: from host2.jankratochvil.net (ovpn-116-104.ams2.redhat.com [10.36.116.104]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id qB1KPNXN010090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Sat, 1 Dec 2012 15:25:25 -0500 Date: Sat, 01 Dec 2012 20:25:00 -0000 From: Jan Kratochvil To: Sanjoy Das Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 1/3] Fix segfault when unwinding JIT frames using a custom reader. Message-ID: <20121201202522.GA22812@host2.jankratochvil.net> References: <1352048631-25042-1-git-send-email-sanjoy@playingwithpointers.com> <1352048631-25042-2-git-send-email-sanjoy@playingwithpointers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1352048631-25042-2-git-send-email-sanjoy@playingwithpointers.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: 2012-12/txt/msg00007.txt.bz2 On Sun, 04 Nov 2012 18:03:49 +0100, Sanjoy Das wrote: > Issue http://sourceware.org/bugzilla/show_bug.cgi?id=14550 [...] > --- a/gdb/jit.c > +++ b/gdb/jit.c > @@ -724,8 +724,18 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile) > gdb_block_iter = gdb_block_iter->next) > { > if (gdb_block_iter->parent != NULL) > - BLOCK_SUPERBLOCK (gdb_block_iter->real_block) = > - gdb_block_iter->parent->real_block; > + { > + /* If the plugin specifically mentioned a parent block, we > + use that. */ > + BLOCK_SUPERBLOCK (gdb_block_iter->real_block) = > + gdb_block_iter->parent->real_block; > + } > + else > + { > + /* And if not, we set a default parent block. */ > + BLOCK_SUPERBLOCK (gdb_block_iter->real_block) = > + BLOCKVECTOR_BLOCK (symtab->blockvector, STATIC_BLOCK); > + } While I find this patch correct: (1) The interface for JIT readers was AFAIK designed to be easier than what GDB provides internally. Therefore I think gdb_block->parent should not exist, it can be rebuilt from gdb_block->begin and gdb_block->end, together with some assumption about gdb_block->next ordering. (2) Otherwise to keep it ABI compatible one should at least sanity check and error if gdb_block->begin and gdb_block->end do not match the ordering via gdb_block->parent. Thanks, Jan