summaryrefslogtreecommitdiff
path: root/gdb/linespec.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2011-12-21 07:24:38 +0000
committerJoel Brobecker <brobecker@gnat.com>2011-12-21 07:24:38 +0000
commit23bef9c11849e876883ac5c543c20dbd32b17d14 (patch)
tree72d72eec642dfbdd555d133f71a08578c5b13702 /gdb/linespec.c
parentce49cc988a406151d9c8d7c61e6a1b410c4dee28 (diff)
downloadgdb-23bef9c11849e876883ac5c543c20dbd32b17d14.tar.gz
Add handling for unqualified Ada operators in linespecs
This patch enhances the linespec parser to recognize unqualified operator names in linespecs. This allows the user to insert a breakpoint on operator "+" as follow, for instance: (gdb) break "+" Previously, it was possible to insert such a breakpoint, but one had to fully qualify the function name. For instance: (gdb) break ops."+" gdb/ChangeLog: * linespec.c (locate_first_half): Add handling of Ada operators when the current language is Ada.
Diffstat (limited to 'gdb/linespec.c')
-rw-r--r--gdb/linespec.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 4d4447821cd..5ad32531c7b 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1331,6 +1331,24 @@ locate_first_half (char **argptr, int *is_quote_enclosed)
char *p, *p1;
int has_comma;
+ /* Check if the linespec starts with an Ada operator (such as "+",
+ or ">", for instance). */
+ p = *argptr;
+ if (p[0] == '"'
+ && current_language->la_language == language_ada)
+ {
+ const struct ada_opname_map *op;
+
+ for (op = ada_opname_table; op->encoded != NULL; op++)
+ if (strncmp (op->decoded, p, strlen (op->decoded)) == 0)
+ break;
+ if (op->encoded != NULL)
+ {
+ *is_quote_enclosed = 0;
+ return p + strlen (op->decoded);
+ }
+ }
+
/* Maybe we were called with a line range FILENAME:LINENUM,FILENAME:LINENUM
and we must isolate the first half. Outer layers will call again later
for the second half.