int main () { callee1 (2, "A string argument.", 3.5); callee1 (2, "A string argument.", 3.5); do_nothing (); /* Hello, World! */ callme (1); callme (2); return 0; }
main () { callee1 (2, "A string argument.", 3.5); callee1 (2, "A string argument.", 3.5); printf ("Hello, World!"); callme (1); callme (2); return 0; }
main () { func callme = get_callback (); if (callme (0, 0, 0, 0x1234, 0x1234567890abcdefLL)) abort (); return 0; }
int bar (int i) { try { __builtin_printf ("foo %d\n", i); } catch (...) { callme(); } }
int foo (int i) { try { printf ("foo %d\n", i); } catch (...) { callme(); } }
void callme(struct big_struct bs) { volatile int minfree = StackHeapMinFree(); debug_printf("\t Call(%d) MinRemainingStack: %d; Stack Free: %d\n", callcount++, minfree, (int)StackHeapFree()); if((bs.i) && (minfree > sizeof(g_bs))) { bs.i--; callme(bs); } }
void * child_function_2 (void *arg) { int my_number = (long) arg; volatile int *myp = (int *) &args[my_number]; pthread_barrier_wait (&barrier); while (*myp > 0) { (*myp) ++; callme (); /* set breakpoint child_one here */ } *myp = 1; while (*myp > 0) { (*myp) ++; callme (); } pthread_exit (NULL); }
int main () { int res; long i; signal (SIGUSR1, handler); /* Call these early so that PLTs for these are resolved soon, instead of in the threads. RTLD_NOW should work as well. */ usleep (0); pthread_barrier_init (&barrier, NULL, 1); pthread_barrier_wait (&barrier); pthread_barrier_init (&barrier, NULL, 2); i = 0; args[i] = 1; res = pthread_create (&child_thread_2, NULL, child_function_2, (void *) i); pthread_barrier_wait (&barrier); callme (); /* set wait-thread-2 breakpoint here */ i = 1; args[i] = 1; res = pthread_create (&child_thread_3, NULL, child_function_3, (void *) i); pthread_barrier_wait (&barrier); callme (); /* set wait-thread-3 breakpoint here */ pthread_kill (child_thread_2, SIGUSR1); pthread_join (child_thread_2, NULL); pthread_join (child_thread_3, NULL); exit(EXIT_SUCCESS); }
// load a valid module, export a symbol, call it, and unload module void Test1() { DynamicLibrary library(getLibraryFileName(VALID_LIBRARY_NAME)); PEGASUS_TEST_ASSERT(library.getFileName() == getLibraryFileName(VALID_LIBRARY_NAME)); library.load(); PEGASUS_TEST_ASSERT(library.isLoaded()); Uint32 (* callme)(void) = (Uint32 (*)(void))library.getSymbol("callme"); PEGASUS_TEST_ASSERT(callme); PEGASUS_TEST_ASSERT(callme() == 0xdeadbeef); Uint32 (* badfunc)(void) = (Uint32 (*)(void))library.getSymbol("badfunc"); PEGASUS_TEST_ASSERT(badfunc == 0); library.unload(); PEGASUS_TEST_ASSERT(!library.isLoaded()); }
int main(void) { debug_printf("Starting with %d bytes of stack/heap. max/current usage: %d/%d. Size of one struct: %d\n", (int)StackHeapSize(), (int)StackHeapMinFree(), (int)StackHeapFree(), sizeof(g_bs)); while(1) { callcount = 0; callme(g_bs); debug_printf("callme(%d): %d/%d\n", g_bs.i, (int)StackHeapMinFree(), (int)StackHeapFree()); g_bs.i++; } // Enter an infinite loop, just incrementing a counter volatile static int i = 0 ; while(1) { i++ ; } return 0 ; }
int main (void) { struct sigaction sa; int i; callme (); memset (&sa, 0, sizeof (sa)); sa.sa_sigaction = handler; sa.sa_flags = SA_SIGINFO; i = sigemptyset (&sa.sa_mask); assert (i == 0); i = sigaction (SIGUSR1, &sa, NULL); assert (i == 0); i = raise (SIGUSR1); assert (i == 0); sleep (600); return 0; }