gdb.base/async.exp: Leave gdb_protocol alone.

Many eons ago, async was only implemented in the remote target, and
you'd activate it by doing "target async" rather than "target remote".
That's long gone now, replaced by "set target-async on".

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.exp: Don't frob gdb_protocol.
gdb.base/async.exp: Don't hardcode line numbers.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.c (main): Add "jump here" and "until here" line
	marker comments.
	* gdb.base/async.exp (jump_here): New global.
	(jump& test): Use it.
	(until_here): New global.
	(until& test): Use it.
gdb.base/async.exp: Fix stepi& test.

Currently the test assumes that "stepi" over:

 13       x = 5;

end up somewhere midline.  But, (at least) on x86, that assignment
ends up compiled as just one movl instruction, so a stepi stops at the
next line already:

 completed.
 PASS: gdb.base/async.exp: step &
 step&
 (gdb) foo () at ../../../src/gdb/testsuite/gdb.base/async.c:13
 13       x = 5;
 completed.
 PASS: gdb.base/async.exp: step &
 stepi&
 (gdb) 14         y = 3;
 completed.
 FAIL: gdb.base/async.exp: (timeout) stepi &
 nexti&
 (gdb) 16         return x + y;
 completed.
 FAIL: gdb.base/async.exp: (timeout) nexti &
 finish&
 Run till exit from #0  foo () at ../../../src/gdb/testsuite/gdb.base/async.c:16

This patch fixes it, by making sure there's more than one instruction
in that line.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.c (foo): Make 'x' volatile.  Write to it twice in
	the same line.
gdb.base/async.exp: Use prepare_for_testing.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.exp: Use prepare_for_testing.
gdb.base/async.exp: Factor out test pattern to a procedure.

All the tests here follow the same pattern (and they all have the same
problem, not fixed here yet).  Add a new procedure, factoring out the
pattern to a simple place.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.exp (test_background): New procedure.
	Use it for all background execution command tests.
gdb.base/async.exp: Fix races.

This test is currently racy:

 PASS: gdb.base/async.exp: step&
 stepi&
 (gdb) 0x0000000000400547        14       x = 5; x = 5;
 completed.
 PASS: gdb.base/async.exp: stepi&
 nexti&
 (gdb) 15         y = 3;
 completed.FAIL: gdb.base/async.exp: nexti&

The problem is here:

 	-re "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\.\r\n" {
 	    pass "$command"
 	}
	-re "$gdb_prompt.*completed\.$" {
 	    fail "$command"
	}

Note how the fail pattern is a subset of the pass pattern.  If the
expect buffer happens to end up with:

  "^$command\r\n${before_prompt}${gdb_prompt}${after_prompt}completed\."

that is, the final "\r\n" has't reached the expect buffer yet, but
"completed." has, then the fail pattern matches...

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.exp (test_background): Expect \r\n after
	"completed." in the fail pattern.
gdb.base/async.exp: Make test messages unique.

 $ cat gdb.sum| grep PASS| sort | uniq -c |sort -n
       1 PASS: gdb.base/async.exp: finish&
       1 PASS: gdb.base/async.exp: jump&
       1 PASS: gdb.base/async.exp: next&
       1 PASS: gdb.base/async.exp: nexti&
       1 PASS: gdb.base/async.exp: set exec-done-display off
       1 PASS: gdb.base/async.exp: set exec-done-display on
       1 PASS: gdb.base/async.exp: set target-async on
       1 PASS: gdb.base/async.exp: stepi&
       1 PASS: gdb.base/async.exp: until&
       2 PASS: gdb.base/async.exp: step&

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.exp (step& tests): Pass explicit test messages.
gdb.base/async.exp: Enable it.

There's no reason not to enable this test anymore.

Even if the current output isn't ideal (we mess up the prompt), it's what
we have today.  We can adjust the test if the output improves.

gdb/testsuite/
2014-03-19  Pedro Alves  <palves@redhat.com>

	* gdb.base/async.exp: Remove early return.