diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 0f02f4a97f5..52a689f5886 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,10 @@ +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> diff --git a/gdb/testsuite/gdb.base/break.exp b/gdb/testsuite/gdb.base/break.exp index 8a21222ac1d..7f035a8cf59 100644 --- a/gdb/testsuite/gdb.base/break.exp +++ b/gdb/testsuite/gdb.base/break.exp @@ -847,7 +847,20 @@ gdb_test_multiple "" $test { # 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" @@ -865,4 +878,4 @@ gdb_test "commands\nend" ">end" "clear breakpoint commands" # 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"