From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15729 invoked by alias); 4 Jan 2006 03:45:16 -0000 Received: (qmail 15721 invoked by uid 22791); 4 Jan 2006 03:45:15 -0000 X-Spam-Check-By: sourceware.org Received: from zproxy.gmail.com (HELO zproxy.gmail.com) (64.233.162.201) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 04 Jan 2006 03:45:13 +0000 Received: by zproxy.gmail.com with SMTP id x3so2879471nzd for ; Tue, 03 Jan 2006 19:45:11 -0800 (PST) Received: by 10.36.13.16 with SMTP id 16mr127018nzm; Tue, 03 Jan 2006 19:45:11 -0800 (PST) Received: by 10.37.2.42 with HTTP; Tue, 3 Jan 2006 19:45:11 -0800 (PST) Message-ID: <8f2776cb0601031945gb876b84i48c145c291ecbcee@mail.gmail.com> Date: Wed, 04 Jan 2006 03:45:00 -0000 From: Jim Blandy To: fnf@specifix.com Subject: Re: [PATCH] Fix ptype problem printing typedefs defined differently in different compilation units Cc: gdb-patches@sourceware.org In-Reply-To: <200601032147.14083.fnf@specifix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: <200601031517.50309.fnf@specifix.com> <8f2776cb0601031515m8ef145x5e23aa5f80644428@mail.gmail.com> <200601032147.14083.fnf@specifix.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-01/txt/msg00023.txt.bz2 On 1/3/06, Fred Fish wrote: > > I have some questions about the patch, though. > > get_current_source_symtab_and_line is a user-interface thing, and I'm > > uncomfortable calling it from one of our fundamental lookup functions. > > There is a static pointer to the current source symtab in source.c, > and only functions in that file have direct access to it. All the > rest of gdb seems to use one of the accessor functions exported from > source.c: > > get_current_source_symtab_and_line > set_current_source_symtab_and_line > clear_current_source_symtab_and_line I wasn't making an argument from the layout of GDB's source code.=20 Conceptually, the current source file and line are properties of the user interface --- of a command-line user interface, really. The fundamantal lookup code ought to be independent of that, it seems to me. > > Why isn't the right block being passed to lookup_symbol in the first > > place? > ... > parse_exp_in_context() sees that block is zero and tries to find > expression_context_block by calling get_selected_block(), but since > the target isn't running, that returns zero, which gets saved in > expression_context_block. What would break if get_selected_block used, in the absence of a frame, the current source position? Or, if get_selected_block really needs to return zero when there's no stack, what would break if parse_exp_in_context used the current source position as a fallback when get_selected_block returns zero? It seems reasonable to me.