This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/RFA] do not call decode_compound with Ada expressions.
> Yeah, but decode_compound is really just about inheritance.
OK. I understand your logic and it makes sense. I still included
language_c in the list, because I tend to think that C++ programer
might be expecting this language to support as much C++ as
language_cplus. But I can fix that too.
Here is a revised patch, tested on x86_64-linux.
Thanks,
--
Joel
commit 74be6bfedd8b8043c42607648688d94e8fd9019c
Author: Joel Brobecker <brobecker@adacore.com>
Date: Tue Dec 13 19:16:38 2011 -0500
do not call decode_compound with Ada expressions.
Trying to insert a breakpoint on `ops."<"', we get the following error:
(gdb) b ops."<"
malformed template specification in command
This is because locate_first_half skips the linespec until the dot,
and the decode_line_internal thinks that the dot might mean that
we have C++ or Java compound. It then tries calling decode_compound
which errors out because it sees the opening angle bracket but not
the closing one (I am guessing).
This patch short-circuits this part of the code when the current
language is Ada.
gdb/ChangeLog:
* linespec.c (decode_line_internal): Check for C++ or Java
compound constructs only if the current language is C, C++
or Java.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index a1a3b9d..0c76098 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -969,6 +969,16 @@ decode_line_internal (struct linespec_state *self, char **argptr)
if (p[0] == '.' || p[1] == ':')
{
+ /* We only perform this check for the languages where it might
+ make sense. For instance, Ada does not use this type of
+ syntax, and trying to apply this logic on an Ada linespec
+ may trigger a spurious error (for instance, decode_compound
+ does not like expressions such as `ops."<"', which is a
+ valid function name in Ada). */
+ if (current_language->la_language == language_c
+ || current_language->la_language == language_cplus
+ || current_language->la_language == language_java)
+ {
struct symtabs_and_lines values;
volatile struct gdb_exception ex;
char *saved_argptr = *argptr;
@@ -997,6 +1007,7 @@ decode_line_internal (struct linespec_state *self, char **argptr)
*argptr = saved_argptr;
}
+ }
else
{
/* If there was an exception looking up a specified filename earlier,