This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: extend symtabs_from_filename skipping for C++
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 10 Feb 2012 14:33:49 +0100
- Subject: Re: RFC: extend symtabs_from_filename skipping for C++
- References: <m3aa4taxyg.fsf@fleche.redhat.com>
On Wed, 08 Feb 2012 21:09:59 +0100, Tom Tromey wrote:
> --- a/gdb/linespec.c
> +++ b/gdb/linespec.c
> @@ -912,9 +912,11 @@ decode_line_internal (struct linespec_state *self, char **argptr)
> /* First things first: if ARGPTR starts with a filename, get its
> symtab and strip the filename from ARGPTR.
> Avoid calling symtab_from_filename if we know can,
> - it can be expensive. */
> + it can be expensive. We know we can avoid the call if we see a
> + single word (e.g., "break NAME") or if we see a qualified C++
> + name ("break QUAL::NAME"). */
>
> - if (*p != '\0')
> + if (*p != '\0' && p[1] != ':')
I failed to find a countercase but wouldn't you prefer:
- if (*p != '\0')
+ if (*p != '\0' && !(p[0] == ':' && p[1] == ':'))
(I did not regression test it.)
I find it OK either way.
Thanks,
Jan