a59add0c2e
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.
69 lines
1.1 KiB
C
69 lines
1.1 KiB
C
#include <signal.h>
|
|
#include <unistd.h>
|
|
#include <stdlib.h>
|
|
|
|
void foo (void);
|
|
void bar (void);
|
|
|
|
void subroutine (int);
|
|
void handler (int);
|
|
void have_a_very_merry_interrupt (void);
|
|
|
|
int
|
|
main ()
|
|
{
|
|
foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
|
|
|
|
|
|
have_a_very_merry_interrupt ();
|
|
return 0;
|
|
}
|
|
|
|
void
|
|
foo (void)
|
|
{
|
|
}
|
|
|
|
void
|
|
bar (void)
|
|
{
|
|
*(char *)0 = 0; /* try to cause a segfault */
|
|
|
|
/* On MMU-less system, previous memory access to address zero doesn't
|
|
trigger a SIGSEGV. Trigger a SIGILL. Each arch should define its
|
|
own illegal instruction here. */
|
|
#if defined(__arm__)
|
|
asm(".word 0xf8f00000");
|
|
#elif defined(__TMS320C6X__)
|
|
asm(".word 0x56454313");
|
|
#else
|
|
#endif
|
|
|
|
}
|
|
|
|
void
|
|
handler (int sig)
|
|
{
|
|
subroutine (sig);
|
|
}
|
|
|
|
/* The first statement in subroutine () is a place for a breakpoint.
|
|
Without it, the breakpoint is put on the while comparison and will
|
|
be hit at each iteration. */
|
|
|
|
void
|
|
subroutine (int in)
|
|
{
|
|
int count = in;
|
|
while (count < 100)
|
|
count++;
|
|
}
|
|
|
|
void
|
|
have_a_very_merry_interrupt (void)
|
|
{
|
|
signal (SIGALRM, handler);
|
|
alarm (1);
|
|
sleep (2); /* We'll receive that signal while sleeping */
|
|
}
|
|
|