public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: sami wagiaalla <swagiaal@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 1/3] Template Lookup
Date: Tue, 31 Aug 2010 22:05:00 -0000	[thread overview]
Message-ID: <m339tufnez.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4C7690B4.7020504@redhat.com> (sami wagiaalla's message of "Thu,	26 Aug 2010 12:05:08 -0400")

>>>>> "Sami" == sami wagiaalla <swagiaal@redhat.com> writes:

Sami> Hmm.. can you give me an example of this ? I tried to construct an
Sami> example with an extern function but I learned that cplus does not
Sami> allow extern template functions.

Ordinarily, to make a test involving psymtab expansion, you have to make
two compilation units.

Put this into one file:

    template<typename T> double f (T x) { return x; }

    int g (void)
    {
      return f(1.0) + f(2);
    }

Put this in another file:

    extern int g(void);

    int main()
    {
      return g();
    }

Compile, debug, and "start".

Now in main:

    (gdb) p f(1.0)
    No symbol "f" in current context.
    (gdb) p f<double>(1.0)
    $1 = 1

... but if you step into g, it works:

    (gdb) s
    g () at q1.cc:5
    5	  return f(1.0) + f(2);
    (gdb) p f(1.0)
    $2 = 1

Tom> There are a couple instances of this that have to be updated in light of
Tom> Doug's recent change to how this is done.

Sami> What is the change that Doug made ?

He added various set_lang_ functions.
Maybe I'm mistaken about the need for this, as there doesn't seem to be
a special function for C++.

Tom

  reply	other threads:[~2010-08-31 22:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-19 15:28 sami wagiaalla
2010-07-20 20:42 ` sami wagiaalla
2010-08-18 21:45   ` Tom Tromey
2010-08-26 16:05     ` sami wagiaalla
2010-08-31 22:05       ` Tom Tromey [this message]
2010-09-23 18:43         ` [patch 4/4] " sami wagiaalla
2010-09-23 17:55       ` [patch 1/4] " sami wagiaalla
2010-10-05 19:08         ` sami wagiaalla
2010-10-14 15:23           ` sami wagiaalla
2010-11-01 20:15             ` sami wagiaalla
2010-08-11 18:13 ` [patch 1/3] " sami wagiaalla

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=m339tufnez.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=swagiaal@redhat.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).