Fix the gdb.ada/inline-section-gc.exp test
[binutils-gdb.git] / gdb / testsuite / gdb.ada / inline-section-gc.exp
index b707335eb042af99c2373151f3d2a05e3f16da18..4f8b8c9539596a7bbee6910c70da09b28122fbbe 100644 (file)
@@ -34,8 +34,23 @@ if {[gdb_compile_ada "${srcfile}" "${binfile}" executable $options] != ""} {
 
 clean_restart ${testfile}
 
-set bp_location [gdb_get_line_number "BREAK" ${testdir}/callee.adb]
+
+# Depending on the version of gnat, the location of the set breakpoint may
+# be reported as being at the requested location in file callee.adb or in
+# file caller.adb where the callee function was inlined.  Either way, only
+# one breakpoint should be reported and its address should not be at 0x0.
+set bp_location1 [gdb_get_line_number "BREAK" ${testdir}/callee.adb]
+set bp_location2 [gdb_get_line_number "CALLEE_LOC" ${testdir}/caller.adb]
+set test "break callee.adb:$bp_location1"
+set message "Breakpoint set"
+
 # The bug here was that gdb would set a breakpoint with two locations,
 # one of them at 0x0.
-gdb_test "break callee.adb:$bp_location" \
-    "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location."
+gdb_test_multiple $test $message {
+    -re "Breakpoint $decimal at $hex: file .*callee.adb, line $bp_location1." {
+       pass $test
+    }
+    -re "Breakpoint $decimal at $hex: file .*caller.adb, line $bp_location2." {
+       pass $test
+    }
+}