diff options
author | Tom Tromey <tromey@adacore.com> | 2022-02-22 13:12:02 -0700 |
---|---|---|
committer | Tom Tromey <tromey@adacore.com> | 2022-04-04 12:46:09 -0600 |
commit | d4da1b2c1b7b85968da608dde03e054cc0b1f7ca (patch) | |
tree | 96c22080bfa90440d2f3a26359c47c9328f54081 /gdb/testsuite | |
parent | 484e7c5ff5fd24cfb2946fadd76b6b67bbeb4169 (diff) | |
download | gdb-d4da1b2c1b7b85968da608dde03e054cc0b1f7ca.zip gdb-d4da1b2c1b7b85968da608dde03e054cc0b1f7ca.tar.gz gdb-d4da1b2c1b7b85968da608dde03e054cc0b1f7ca.tar.bz2 |
Add context-sensitive field name completion to Ada parser
This updates the Ada expression parser to implement context-sensitive
field name completion. This is PR ada/28727.
This is somewhat complicated due to some choices in the Ada lexer --
it chooses to represent a sequence of "."-separated identifiers as a
single token, so the parser must partially recreate the completer's
logic to find the completion word boundaries.
Despite the minor warts in this patch, though, it is a decent
improvement. It's possible that the DWARF reader rewrite will help
fix the package completion problem pointed out in this patch as well.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28727
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.ada/ptype_field.exp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.ada/ptype_field.exp b/gdb/testsuite/gdb.ada/ptype_field.exp index cd45fbe..25147a8 100644 --- a/gdb/testsuite/gdb.ada/ptype_field.exp +++ b/gdb/testsuite/gdb.ada/ptype_field.exp @@ -42,3 +42,34 @@ gdb_test "ptype circle.pos" \ gdb_test "ptype circle.pos.x" \ "type = <\[0-9\]+-byte integer>" + +gdb_test "complete print my_circ" "print my_circle" +gdb_test "complete print my_circle.r" "print my_circle\\.radius" +gdb_test "complete print my_circle.po" "print my_circle\\.pos" +gdb_test "complete print my_circle . po" "print my_circle \\. pos" \ + "complete with spaces" +gdb_test "complete print my_circle." \ + [multi_line \ + "print my_circle\\.pos" \ + "print my_circle\\.radius"] +gdb_test "complete print (my_circle).r" "print \\(my_circle\\)\\.radius" +gdb_test "complete print (my_circle).po" "print \\(my_circle\\)\\.pos" +gdb_test "complete print (my_circle)." \ + [multi_line \ + "print \\(my_circle\\)\\.pos" \ + "print \\(my_circle\\)\\.radius"] + +gdb_test "complete ptype pck.pos" "ptype pck\\.position" +gdb_test "complete ptype pck.c" "ptype pck\\.circle" + +# We can't query the members of a package yet, and this yields a bit +# too much output, so comment out for now instead of kfailing. +# gdb_test "complete ptype pck." \ +# [multi_line \ +# "ptype pck\\.circle" \ +# "ptype pck\\.position"] + +gdb_test "complete ptype circle.pos." \ + [multi_line \ + "ptype circle\\.pos\\.x" \ + "ptype circle\\.pos\\.y"] |