diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c index 412bd53edda..7215e3c6484 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.c @@ -15,11 +15,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +volatile int global_var = 0; + /* Dummy main function. */ int main() { asm ("main_label: .globl main_label"); - return 0; + ++global_var; + return 0; /* Breakpoint here. */ } diff --git a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp index 8b3c2cf709e..e95526a069f 100644 --- a/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp +++ b/gdb/testsuite/gdb.debuginfod/fetch_src_and_symbols.exp @@ -161,6 +161,10 @@ proc_with_prefix no_url { } { if ![runto_main] { return -1 } + + gdb_breakpoint [gdb_get_line_number "Breakpoint here"] + gdb_continue_to_breakpoint "stop at last line of main" + gdb_test "generate-core-file $::corefile" "Saved corefile $::corefile" \ "file [file tail $::corefile] gen" file rename -force ${binfile}2 $debugdir @@ -217,7 +221,8 @@ proc_with_prefix local_url { } { gdb_test_no_output "set substitute-path $outputdir /dev/null" \ "set substitute-path" gdb_test "br main" "Breakpoint 1 at.*file.*" - gdb_test "l" ".*This program is distributed in the hope.*" + set lineno [gdb_get_line_number "Breakpoint here"] + gdb_test "list $lineno" "return 0;\[^\r\n\]+Breakpoint here\\. .*" # GDB should now find the executable file. clean_restart