[gdb/testsuite] Restore breakpoint command in ui-redirect.exp
authorTom de Vries <tdevries@suse.de>
Thu, 5 Sep 2019 12:33:10 +0000 (14:33 +0200)
committerTom de Vries <tdevries@suse.de>
Thu, 5 Sep 2019 12:33:10 +0000 (14:33 +0200)
commit30331a6ca014f6b51b17627aa968c6b79627ce21
tree6966a4e816ce52a4fc9ab07861646f5376d90034
parente47d413a2c8a8710eaff12510bab64d128930d7c
[gdb/testsuite] Restore breakpoint command in ui-redirect.exp

In gdb.base/ui-redirect.exp, the "save breakpoint" command is used to write
the current breakpoints to a file, but the actual output is not verified.

Consequently, the test has regressed in that the "print 1" command associated
with a breakpoint on main is removed by a subsequent runto_main, which first
deletes all breakpoints:
...
(gdb) break main
Breakpoint 1 at 0x4004d7: file start.c, line 34.
(gdb) commands
Type commands for breakpoint(s) 1, one per line.
End with a line saying just "end".
> PASS: gdb.base/ui-redirect.exp: commands
print 1
> PASS: gdb.base/ui-redirect.exp: print 1
end
(gdb) PASS: gdb.base/ui-redirect.exp: end
delete breakpoints
Delete all breakpoints? (y or n) y
...
and consequently the "save breakpoint" output is missing the breakpoint
command for main:
...
 break main
-  commands
-    print 1
-  end
 break foo
 break bar
...

Fix this by replacing "gdb_breakpoint main" with runto_main, and verifying the
"save breakpoints" output.

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2019-09-05  Tom de Vries  <tdevries@suse.de>

* lib/gdb.exp (cmp_file_string): New proc.
* gdb.base/ui-redirect.exp: Replace "gdb_breakpoint main" with
runto_main.  Verify save breakpoints output.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/ui-redirect.exp
gdb/testsuite/lib/gdb.exp