binutils-gdb/gdb/testsuite/gdb.base/async.c

34 lines
265 B
C
Raw Normal View History

1999-08-31 03:14:27 +02:00
int
foo (void)
{
int y;
volatile int x;
1999-08-31 03:14:27 +02:00
Tweak gdb.base/async.exp I see two fails in async.exp on arm-none-eabi target: nexti&^M (gdb) 0x000001ba 14 x = 5; x = 5;^M completed.^M FAIL: gdb.base/async.exp: nexti& finish&^M Run till exit from #0 0x000001ba in foo () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:14^M (gdb) 0x000001e6 in main () at /scratch/yqi/arm-none-eabi-lite/src/gdb-trunk/gdb/testsuite/gdb.base/async.c:32^M 32 y = foo ();^M Value returned is $1 = 8^M completed.^M FAIL: gdb.base/async.exp: finish& The corresponding test is "test_background "nexti&" "" ".*y = 3.*"", and it assumes that GDB "nexti" into the next source line. It is wrong on arm. After "nexti", it still stops at the same source line, and it fails. When gdb does "finish", if the PC is in the middle of a source line, the PC address is printed too. See stack.c:print_frame, if (opts.addressprint) if (!sal.symtab || frame_show_address (frame, sal) || print_what == LOC_AND_ADDRESS) { annotate_frame_address (); if (pc_p) ui_out_field_core_addr (uiout, "addr", gdbarch, pc); else ui_out_field_string (uiout, "addr", "<unavailable>"); annotate_frame_address_end (); ui_out_text (uiout, " in "); } frame_show_address checks whether PC is the middle of a source line. Since after "nexti", the inferior stops at the middle of a source line, when we do "finish" the PC address is displayed. In sum, GDB works well, but test case needs update. This patch is to add a statement at the same line to make sure "nexti" doesn't go to the new line, match the next instruction address in the output and match the hex address the output of "finish". gdb/testsuite: 2014-06-06 Yao Qi <yao@codesourcery.com> * gdb.base/async.c (foo): Add one statement. * gdb.base/async.exp: Get the next instruction address and match the output of "nexti" by instruction address. Match the hex address in the output of "finish".
2014-06-06 08:32:42 +02:00
x = 5; x = 5; x = 5;
1999-08-31 03:14:27 +02:00
y = 3;
return x + y;
}
GDB testsuite: Fix warnings with -std=gnu11 Since upstream GCC has changed the default C language dialect to 'gnu11', it yields multiple warnings in the GDB testsuite for missing function return types and implicit function declarations. This patch attempts to fix these. gdb/testsuite/ChangeLog: * gdb.ada/cond_lang/foo.c (callme): Add return type. * gdb.base/call-sc.c (zed): Likewise. * gdb.base/checkpoint.c (main): Likewise. * gdb.base/dump.c (main): Likewise. * gdb.base/gcore.c (main): Likewise. * gdb.base/huge.c (main): Likewise. * gdb.base/multi-forks.c (main): Likewise. * gdb.base/pr10179-a.c (main): Likewise. * gdb.base/savedregs.c (main): Likewise. * gdb.base/sigaltstack.c (main): Likewise. * gdb.base/siginfo.c (main): Likewise. * gdb.base/structs.c (zed): Likewise. * gdb.mi/mi-stack.c (callee3, callee2, callee1, main): Likewise. * gdb.mi/mi-syn-frame.c (main): Likewise. * gdb.mi/until.c (foo, main): Likewise. * gdb.base/global-var-nested-by-dso.c (b_main, c_main): Declare. * gdb.base/solib-weak.c (foo): Declare. * gdb.base/attach-twice.c: Include stdio.h. * gdb.base/weaklib1.c: Likewise. * gdb.base/weaklib2.c: Likewise. * gdb.base/catch-signal-fork.c: Include stdio.h and sys/wait.h. * gdb.mi/mi-condbreak-call-thr-state-mt.c: Include stdio.h and unistd.h. * gdb.base/attach-pie-misread.c: Include stdlib.h. * gdb.mi/mi-exit-code.c: Likewise. * gdb.base/break-interp-lib.c: Include string.h. * gdb.base/coremaker.c: Likewise. * gdb.base/testenv.c: Likewise. * gdb.python/py-finish-breakpoint.c: Likewise. * gdb.base/inferior-died.c: Include sys/wait.h. * gdb.base/fileio.c: Include time.h. * gdb.base/async-shell.c: Include unistd.h. * gdb.base/dprintf-non-stop.c: Likewise. * gdb.base/info-os.c: Likewise. * gdb.mi/mi-console.c: Likewise. * gdb.mi/watch-nonstop.c: Likewise. * gdb.python/py-events.c: Likewise. * gdb.base/async.c (baz): Move up before its invocation. * gdb.base/code_elim2.c (my_global_func): Likewise. * gdb.base/skip-solib-lib.c (multiply): Likewise. * gdb.base/advance.c (func2): Likewise.
2014-10-28 13:39:22 +01:00
int
baz (void)
{
return 5;
}
1999-08-31 03:14:27 +02:00
int
main (void)
{
int y, z;
y = 2;
z = 9;
y = foo ();
z = y;
y = y + 2; /* jump here */
1999-08-31 03:14:27 +02:00
y = baz ();
return 0; /* until here */
1999-08-31 03:14:27 +02:00
}