From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1389 invoked by alias); 22 Apr 2009 19:17:31 -0000 Received: (qmail 1379 invoked by uid 22791); 22 Apr 2009 19:17:30 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx2.redhat.com (HELO mx2.redhat.com) (66.187.237.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 22 Apr 2009 19:17:22 +0000 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n3MJHFUn019837 for ; Wed, 22 Apr 2009 15:17:16 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n3MJHEAK006811; Wed, 22 Apr 2009 15:17:15 -0400 Received: from opsy.redhat.com (vpn-14-158.rdu.redhat.com [10.11.14.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n3MJHDTw015457; Wed, 22 Apr 2009 15:17:14 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 242E4888034; Wed, 22 Apr 2009 13:17:13 -0600 (MDT) To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] Make a function for block->objfile lookups References: <20090422183915.GA20196@host0.dyn.jankratochvil.net> From: Tom Tromey Reply-To: tromey@redhat.com Date: Wed, 22 Apr 2009 19:17:00 -0000 In-Reply-To: <20090422183915.GA20196@host0.dyn.jankratochvil.net> (Jan Kratochvil's message of "Wed\, 22 Apr 2009 20\:39\:15 +0200") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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-04/txt/msg00605.txt.bz2 >>>>> "Jan" == Jan Kratochvil writes: Jan> 2009-04-22 Jan Kratochvil Jan> * block.c (block_objfile): New function. Jan> * block.h (block_objfile): New prototype. Jan> * objfiles.c (matching_objfiles): New function. Jan> * objfiles.h (matching_objfiles): New prototype. Jan> * printcmd.c: Remove include solib.h. Jan> (display_uses_solib_p): Rename to ... Jan> (display_uses_objfile): ... a new function name. Change the SOLIB Jan> parameter to OBJFILE parameter. Use now a matching_objfiles call. Jan> (clear_dangling_display_expressions): Update the caller. Jan> +struct objfile *block_objfile (const struct block *block) Newline after the "*". Jan> + struct symbol *func; Jan> + Jan> + if (block == NULL) Jan> + return NULL; Jan> + Jan> + func = block_linkage_function (block); Jan> + if (func == NULL) Jan> + return NULL; Just to be sure I understand... in the loop in display_uses_solib_p, there are two checks: if (block != NULL && solib_contains_address_p (solib, block->startaddr)) return 1; if (section && section->objfile == solib->objfile) return 1; So I gather from this change that the first check is checking for functions and the second one will handle variables coming from the solib? And that is why it is ok to replace the first change with block_objfile? My concern here is that the patch not affect the semantics of the existing check; and I don't really know the block stuff very well. Jan> --- gdb/objfiles.h 15 Jan 2009 16:35:22 -0000 1.59 Jan> +++ gdb/objfiles.h 22 Apr 2009 18:15:45 -0000 Jan> @@ -508,6 +508,7 @@ extern void set_objfile_data (struct obj Jan> const struct objfile_data *data, void *value); Jan> extern void *objfile_data (struct objfile *objfile, Jan> const struct objfile_data *data); Jan> +extern int matching_objfiles (struct objfile *a, struct objfile *b); I think this declaration should not be in this section, which is all related to the objfile_data stuff. Instead just move it above the comment introducing objfile_data. Assuming my understanding of the semantics is correct, then this is ok with the above fixlets. Thanks. Tom