Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Simon Marchi via Gdb <gdb@sourceware.org>
To: Tom Tromey <tom@tromey.com>, Simon Marchi via Gdb <gdb@sourceware.org>
Cc: David Blaikie <dblaikie@gmail.com>
Subject: Re: Decl/def matching with templates without template parameters in the DW_AT_name
Date: Mon, 16 Jan 2023 16:18:40 -0500	[thread overview]
Message-ID: <4fd385ad-fa48-7fab-0131-d24ae2db45a9@simark.ca> (raw)
In-Reply-To: <87pmbgq2s0.fsf@tromey.com>

> The main thing I would want to avoid here is trying to put this extra
> name-construction into the indexer.  That will just slow it down -- but
> this is normally the most user-visible slow thing in gdb, and most CUs
> are of no interest anyway.
> 
> The downside of this decision is that expansion may expand too many
> CUs.  So for example if there are a million instantiation of template X
> and the user types "break X<int>::method", gdb might expand every CU
> referencing X and then still only set one breakpoint.
> 
> However if this is an issue I think the solution could be to be more
> selective at expansion time.  That is, let the user input "X<int>" match
> X, but then actually examine the DIE tree to decide if this match should
> result in an expansion.

This is my understanding of what you are saying.  Save the name without
the template part in the cooked index, but attach to it a data structure
that describes the template parameters.  When the user types, let's say,
"b my_class<int, 2>::my_method", "my_class<int, 2>" gets translated to
the name "my_class" plus a description of the concrete arguments (the
type argument "int" and the value argument 2).  Then, when checking if a
given CU should expanded, and we have a match for the "my_class" name,
we compare the data structures describing the parameters to the one
describing the arguments, see if it's really a match.  Does that sound
right?

I'm just a bit worried that it might be difficult to implement this "is
there a match function", given the complex rules of C++ template
deduction.  But maybe it's not so bad, or we already have that logic
somewhere.

Simon


  reply	other threads:[~2023-01-16 21:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-06 17:37 David Blaikie via Gdb
2023-01-11 18:24 ` Simon Marchi via Gdb
2023-01-11 23:50   ` David Blaikie via Gdb
2023-01-12  1:46     ` Simon Marchi via Gdb
2023-01-14 20:28       ` Tom Tromey
2023-01-16 21:18         ` Simon Marchi via Gdb [this message]
2023-01-18 22:08           ` David Blaikie via Gdb
2023-01-18 22:12         ` David Blaikie via Gdb
2023-01-18 22:01       ` David Blaikie via Gdb
2023-01-12  2:32     ` Simon Marchi via Gdb
2023-01-18 22:04       ` David Blaikie via Gdb

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=4fd385ad-fa48-7fab-0131-d24ae2db45a9@simark.ca \
    --to=gdb@sourceware.org \
    --cc=dblaikie@gmail.com \
    --cc=simark@simark.ca \
    --cc=tom@tromey.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