From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8374 invoked by alias); 11 May 2002 20:06:37 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8357 invoked from network); 11 May 2002 20:06:36 -0000 Received: from unknown (HELO zwingli.cygnus.com) (208.245.165.35) by sources.redhat.com with SMTP; 11 May 2002 20:06:36 -0000 Received: by zwingli.cygnus.com (Postfix, from userid 442) id EA8E65EA11; Sat, 11 May 2002 15:06:34 -0500 (EST) To: Neil Booth Cc: Eli Zaretskii , gdb-patches@sources.redhat.com Subject: Re: RFA: add macro commands References: <20020509235822.DC4F95EA11@zwingli.cygnus.com> <8011-Fri10May2002101418+0300-eliz@is.elta.co.il> <20020510230813.GA30884@daikokuya.demon.co.uk> From: Jim Blandy Date: Sat, 11 May 2002 13:06:00 -0000 In-Reply-To: <20020510230813.GA30884@daikokuya.demon.co.uk> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-05/txt/msg00397.txt.bz2 Neil Booth writes: > Jim Blandy wrote:- > > > > It would be nice to have completion only on macro names in these > > > commands. But if that cannot be done easily, at least let's disable > > > completion entirely until something appropriate is coded. > > > > I hadn't thought about completion at all. > > > > Given that the macros are stored in a splay tree, they're all sorted > > in a way that would make efficient completion straightforward. So it > > wouldn't be too hard to write a macro-only completion function. > > Just in case you'd not realized, macro expansions are frequently > different, depending on location in the source files. GDB's macro data structures are meant to take into account macros being #defined, #undefined, and re-#defined, and source files being #included multiple times, and perhaps #defining different symbols each time (e.g., under the influence of #if directives). In order to look up a macro's definition, you need to provide the macro name, the line number, and a structure representing, not a source file, but a particular #inclusion of a source file. The lookup function returns you the #definition that was in force at that line of that #inclusion. (The main source file is treated as the "root" #inclusion.) I believe GDB's data structures are as precise as libcpp's linemap structures and logical line numbers. I think the linemap structure is more graceful, though. For the details, see the data structures in macrotab.h and macrotab.c: http://sources.redhat.com/ml/gdb-patches/2002-05/msg00135.html