old-cross-binutils/gdb/testsuite/gdb.base/async.c
Pedro Alves f48088c7de 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.
2014-03-19 15:50:53 +00:00

49 lines
387 B
C

#ifdef PROTOTYPES
int
foo (void)
#else
int
foo ()
#endif
{
int y;
volatile int x;
x = 5; x = 5;
y = 3;
return x + y;
}
#ifdef PROTOTYPES
int
main (void)
#else
int
main ()
#endif
{
int y, z;
y = 2;
z = 9;
y = foo ();
z = y;
y = y + 2; /* jump here */
y = baz ();
return 0; /* until here */
}
#ifdef PROTOTYPES
int
baz (void)
#else
int
baz ()
#endif
{
return 5;
}