From a86c5755b965bb1e060130319cb1e09ab2e2d92c Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Fri, 25 Nov 2011 15:21:19 -0800 Subject: [PATCH 5/5] Call current_language->la_iterate_over_symbols for FILE:FUNCTION linespecs Without this, breakpoints using FILE:FUNCTION linespecs fail for Ada units. For instance, consider for the following trivial program: procedure Foo is begin null; end Foo; Trying to insert a breakpoint on foo.adb:foo fails: (gdb) b foo.adb:foo Function "foo" not defined in "foo.adb". Make breakpoint pending on future shared library load? (y or [n]) This is because the default method of matching symbols does not work in this case, because the linkage name for procedure "Foo" here is _ada_foo. We need to apply Ada-specific symbol-name matching. gdb/ChangeLog: * linespec.c (add_matching_symbols_to_info): Add call current_language->la_iterate_over_symbols after call to iterate_over_symbols. gdb/testsuite/ChangeLog: * gdb.ada/file_fun_bp: New testcase. --- gdb/linespec.c | 4 +++ gdb/testsuite/gdb.ada/file_fun_bp.exp | 32 +++++++++++++++++++++++++++++ gdb/testsuite/gdb.ada/file_fun_bp/foo.adb | 19 +++++++++++++++++ 3 files changed, 55 insertions(+), 0 deletions(-) create mode 100644 gdb/testsuite/gdb.ada/file_fun_bp.exp create mode 100644 gdb/testsuite/gdb.ada/file_fun_bp/foo.adb diff --git a/gdb/linespec.c b/gdb/linespec.c index 146163a..1e713ee 100644 --- a/gdb/linespec.c +++ b/gdb/linespec.c @@ -2806,6 +2806,10 @@ add_matching_symbols_to_info (const char *name, iterate_over_symbols (get_search_block (elt), name, VAR_DOMAIN, collect_symbols, info); + if (current_language->la_iterate_over_symbols) + (*current_language->la_iterate_over_symbols) (name, VAR_DOMAIN, + collect_symbols, + info); } } } diff --git a/gdb/testsuite/gdb.ada/file_fun_bp.exp b/gdb/testsuite/gdb.ada/file_fun_bp.exp new file mode 100644 index 0000000..06b757a --- /dev/null +++ b/gdb/testsuite/gdb.ada/file_fun_bp.exp @@ -0,0 +1,32 @@ +# Copyright 2011 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +load_lib "ada.exp" + +set testdir "file_fun_bp" +set testfile "${testdir}/foo" +set srcfile ${srcdir}/${subdir}/${testfile}.adb +set binfile ${objdir}/${subdir}/${testfile} + +file mkdir ${objdir}/${subdir}/${testdir} +if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } { + return -1 +} + +clean_restart ${testfile} + +gdb_test "break foo.adb:foo" \ + "Breakpoint \[0-9\]+ at 0x\[0-9a-f]+: file .*foo.adb, line \[0-9\]+." + diff --git a/gdb/testsuite/gdb.ada/file_fun_bp/foo.adb b/gdb/testsuite/gdb.ada/file_fun_bp/foo.adb new file mode 100644 index 0000000..6d251fc --- /dev/null +++ b/gdb/testsuite/gdb.ada/file_fun_bp/foo.adb @@ -0,0 +1,19 @@ +-- Copyright 2011 Free Software Foundation, Inc. +-- +-- This program is free software; you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation; either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see . + +procedure Foo is +begin + null; +end Foo; -- 1.7.1