Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jim Blandy <jimb@redhat.com>
To: Neil Booth <neil@daikokuya.demon.co.uk>
Cc: Eli Zaretskii <eliz@is.elta.co.il>, gdb-patches@sources.redhat.com
Subject: Re: RFA: add macro commands
Date: Sat, 11 May 2002 13:06:00 -0000	[thread overview]
Message-ID: <np8z6q30vp.fsf@zwingli.cygnus.com> (raw)
In-Reply-To: <20020510230813.GA30884@daikokuya.demon.co.uk>


Neil Booth <neil@daikokuya.demon.co.uk> 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


  parent reply	other threads:[~2002-05-11 20:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-05-09 16:58 Jim Blandy
2002-05-09 17:13 ` Daniel Jacobowitz
2002-05-09 20:43   ` Jim Blandy
2002-05-09 17:54 ` Andrew Cagney
2002-05-09 20:43   ` Jim Blandy
2002-05-10  0:16 ` Eli Zaretskii
2002-05-10  8:55   ` Jim Blandy
2002-05-10  9:33     ` Eli Zaretskii
2002-05-10 16:07     ` Neil Booth
2002-05-11  0:16       ` Eli Zaretskii
2002-05-11  3:45         ` Neil Booth
2002-05-11 13:06       ` Jim Blandy [this message]
2002-05-16 14:17 ` Jim Blandy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=np8z6q30vp.fsf@zwingli.cygnus.com \
    --to=jimb@redhat.com \
    --cc=eliz@is.elta.co.il \
    --cc=gdb-patches@sources.redhat.com \
    --cc=neil@daikokuya.demon.co.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox