{
try
{
- CORE_ADDR curr_pc = get_frame_pc (get_selected_frame ());
- symtab_and_line curr_sal = find_sal_for_pc (curr_pc, 0);
+ frame_info_ptr frame = get_selected_frame ();
+ symtab_and_line curr_sal = find_frame_sal (frame);
/* Apply GCC PR debug/108716 workaround. */
if (boundary != 0
--- /dev/null
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2026 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 <http://www.gnu.org/licenses/>. */
+
+namespace mod_a
+{
+ int xxx = 10;
+}
+
+static inline int __attribute__((always_inline))
+inlined ()
+{
+ return 0;
+}
+
+static void
+foo ()
+{
+}
+
+int
+main ()
+{
+ foo (); /* stop 1. */
+ using namespace mod_a;
+ int res = inlined (); /* stop 2. */
+ return res + xxx; /* stop 3. */
+}
--- /dev/null
+# Copyright 2026 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 <http://www.gnu.org/licenses/>.
+
+standard_testfile .c
+
+set stop2_line [gdb_get_line_number "stop 2"]
+set stop3_line [gdb_get_line_number "stop 3"]
+
+if {[prepare_for_testing "failed to prepare" $testfile $srcfile \
+ {debug c++}]} {
+ return
+}
+
+if {![runto_main]} {
+ return
+}
+
+# Xfail for incorrect decl_line on DW_TAG_imported_module,
+# GCC PR debug/108716.
+set have_gcc108716_xfail \
+ [expr {[test_compiler_info gcc-*] && [gcc_major_version] < 13}]
+
+set re_pass [string_to_regexp {No symbol "xxx" in current context.}]
+set re_xfail "$valnum_re = 10"
+
+with_test_prefix "stop 1" {
+ gdb_test_multiple "print xxx" "" {
+ -re -wrap $re_pass {
+ pass $gdb_test_name
+ }
+ -re -wrap $re_xfail {
+ if {$have_gcc108716_xfail} {
+ setup_xfail *-*-* gcc/108716
+ }
+ fail $gdb_test_name
+ }
+ }
+}
+
+gdb_test "next" \
+ "\r\n$stop2_line\t\[^\r\n\]+" \
+ "next to stop 2"
+
+with_test_prefix "stop 2" {
+ # Regression test for PR exp/34201.
+ gdb_test "print xxx" \
+ "$valnum_re = 10"
+}
+
+gdb_test "next" \
+ "\r\n$stop3_line\t\[^\r\n\]+" \
+ "next to stop 3"
+
+with_test_prefix "stop 3" {
+ gdb_test "print xxx" \
+ "$valnum_re = 10"
+}