From 86b442599bca468f997a3f1f58cba68b752ef6b2 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 14 Dec 2020 08:14:06 -0700 Subject: Handle block-local names for Ada GNAT can generate a mangled name with "B_N" (where N is a number) in the middle, like "hello__B_1__fourth.0". This is used for names local to a block. Multiple levels of block-local name can also occur, a possibility that was neglected by v1 of this patch. This patch changes gdb to handle these names. The wild name matcher is updated a straightforward way. The full matcher is rewritten. The hash function is updated to ensure that this works. This version does not seem to have the performance problems that affected v1. In particular, the previously-slow "bt" problem has been fixed. gdb/ChangeLog 2020-12-14 Tom Tromey * dictionary.c (language_defn::search_name_hash): Ignore "B". * ada-lang.c (advance_wild_match): Ignore "B". (full_match): Remove. (do_full_match): Rewrite. gdb/testsuite/ChangeLog 2020-12-14 Tom Tromey * gdb.ada/nested.exp: Add new tests. * gdb.ada/nested/hello.adb (Fourth, Fifth): New procedures. --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.ada/nested.exp | 15 +++++++++++++++ gdb/testsuite/gdb.ada/nested/hello.adb | 18 ++++++++++++++++-- 3 files changed, 36 insertions(+), 2 deletions(-) (limited to 'gdb/testsuite') diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index f0d452b..d5442f9 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2020-12-14 Tom Tromey + * gdb.ada/nested.exp: Add new tests. + * gdb.ada/nested/hello.adb (Fourth, Fifth): New procedures. + +2020-12-14 Tom Tromey + * gdb.dwarf2/ada-thick-pointer.exp: New file. 2020-12-14 Tom Tromey diff --git a/gdb/testsuite/gdb.ada/nested.exp b/gdb/testsuite/gdb.ada/nested.exp index ea4bb4d..74f9f1f 100644 --- a/gdb/testsuite/gdb.ada/nested.exp +++ b/gdb/testsuite/gdb.ada/nested.exp @@ -34,3 +34,18 @@ gdb_test "break first" \ "Breakpoint $any_nb at $any_addr: file .*hello.adb, line $any_nb." \ "break on nested function First" +gdb_test "break fourth" \ + "Breakpoint $any_nb at $any_addr: file .*hello.adb, line $any_nb." \ + "break on nested function fourth" + +gdb_test "break hello.fourth" \ + "Breakpoint $any_nb at $any_addr: file .*hello.adb, line $any_nb." \ + "full-qualified break on nested function fourth" + +gdb_test "break fifth" \ + "Breakpoint $any_nb at $any_addr: file .*hello.adb, line $any_nb." \ + "break on nested function fifth" + +gdb_test "break hello.fourth.fifth" \ + "Breakpoint $any_nb at $any_addr: file .*hello.adb, line $any_nb." \ + "full-qualified break on nested function fifth" diff --git a/gdb/testsuite/gdb.ada/nested/hello.adb b/gdb/testsuite/gdb.ada/nested/hello.adb index 2d1e532..10ec6bf 100644 --- a/gdb/testsuite/gdb.ada/nested/hello.adb +++ b/gdb/testsuite/gdb.ada/nested/hello.adb @@ -31,6 +31,20 @@ procedure Hello is end Third; begin - Third; + declare + procedure Fourth is + begin + Third; + declare + procedure Fifth is + begin + Second; + end Fifth; + begin + Fifth; + end; + end Fourth; + begin + Fourth; + end; end Hello; - -- cgit v1.1