[PATCH v2 0/3] Completer C++ template support
Keith Seitz
keiths@redhat.com
Mon Apr 20 21:57:05 GMT 2020
This small patch series fell of the map two years ago, but a recently
reported bug on the subject has spurred me into reviving this.
The original series is here
https://sourceware.org/pipermail/gdb-patches/2018-February/146790.html
This patch doesn't fix the newly reported bug (which I will follow-up with
in a later patch), but it does address a number of shortcomings when
completing on template parameters.
For example, consider this example:
struct Foozle
{
int x;
T1 t;
template <typename T2>
T2 fogey (T2 plop);
};
If we have several instantiations of this template and the member
function `fogey',
Foozle<int>::fogey<int>(int)
Foozle<char>::fogey<int>(int)
Foozle<Empty<int> >::fogey<int>(int)
[and other non-int instances of `Foozle' and `fogey']
If we want to set a breakpoint on all integer instances fo `fogey'
in class `Foozle', we cannot do that:
(gdb) b Foozle::fogey<int>(int)
Function "Foozle::fogey<int>(int)" not defined.
Make breakpoint pending on future shared library load? (y or [n]) n
[GDB *can* make this work with simply "b fogey<int>(int)", but that would
also get any other class with a member function named `fogey'.]
However, with this patch series, we can do a little better:
(gdb) b Foozle::fogey<int>(int)
Breakpoint 3 at 0x402799: Foozle::fogey<int>(int). (3 locations)
(gdb) i b
Num Type Disp Enb Address What
3 breakpoint keep y <MULTIPLE>
3.1 y 0x0000000000402799 in Foozle<int>::fogey<int>(int)
at templates.cc:763
3.2 y 0x00000000004027db in Foozle<char>::fogey<int>(int)
at templates.cc:763
3.3 y 0x0000000000402813 in Foozle<Empty<int> >::fogey<int>(int)
at templates.cc:763
Keith Seitz (3):
Move find_toplevel_char to utils.[ch]
Remove hard-coded line number from templates.exp
Support template lookups in strncmp_iw_with_mode
gdb/NEWS | 4 +
gdb/cp-support.c | 8 +-
gdb/doc/gdb.texinfo | 46 +++
gdb/linespec.c | 77 ----
gdb/linespec.h | 7 -
gdb/testsuite/gdb.cp/templates.cc | 66 ++-
gdb/testsuite/gdb.cp/templates.exp | 75 +++-
gdb/testsuite/gdb.linespec/cpcompletion.exp | 437 +++++++++++++++++++-
gdb/testsuite/gdb.linespec/cpls-ops.exp | 53 ++-
gdb/testsuite/gdb.linespec/cpls.cc | 110 ++++-
gdb/utils.c | 156 ++++++-
gdb/utils.h | 14 +-
12 files changed, 922 insertions(+), 131 deletions(-)
--
2.25.2
More information about the Gdb-patches
mailing list