+2018-01-30 Joel Brobecker <brobecker@adacore.com>
+
+ * gdb.base/break.exp: Save the location where the breakpoint
+ on break.c:47 was actually inserted when debugging the version
+ compiled at -O2 and use it in the expected output of the "info
+ break" test performed soon after.
+
2018-01-22 Pedro Alves <palves@redhat.com>
Sergio Durigan Junior <sergiodj@redhat.com>
#
set line [gdb_get_line_number "set breakpoint 1 here"]
gdb_test_no_output "set \$l = $line"
-gdb_breakpoint ${srcfile}:\$l
+
+set line_actual "-1"
+set test "break ${srcfile}:\$l"
+gdb_test_multiple "$test" $test {
+ -re "Breakpoint $decimal at $hex: file .*break\\.c, line ($decimal)\\.\r\n$gdb_prompt $" {
+ # Save the actual line number on which the breakpoint was
+ # actually set. On some systems (Eg: Ubuntu 16.04 with GCC
+ # version 5.4.0), that line gets completely inlined, including
+ # the call to printf, and so we end up inserting the breakpoint
+ # on one of the following lines instead.
+ set line_actual $expect_out(1,string)
+ pass $test
+ }
+}
gdb_test_no_output "set \$foo=81.5" \
"set convenience variable \$foo to 81.5"
# We verify that the commands were cleared by ensuring that the last
# breakpoint's location ends the output -- if there were commands,
# they would have been printed after the location.
-gdb_test "info break" "$srcfile:$line" "verify that they were cleared"
+gdb_test "info break" "$srcfile:$line_actual" "verify that they were cleared"