From 162f1a6f6611eae3f19ae0d01f1cfbecfc483455 Mon Sep 17 00:00:00 2001 From: David Taylor Date: Mon, 11 Jan 1999 05:38:09 +0000 Subject: [PATCH] renamed files -- HP merge. --- gdb/testsuite/gdb.hp/follow-exec.c | 35 ---- gdb/testsuite/gdb.hp/follow-fork.c | 25 --- gdb/testsuite/gdb.hp/follow-vfork-and-exec.c | 15 -- gdb/testsuite/gdb.hp/thread-local-in-lib.c | 79 --------- gdb/testsuite/gdb.hp/thread-local-in-lib.h | 7 - .../gdb.hp/thread-local-in-lib.lib.c | 92 ---------- gdb/testsuite/gdb.hp/watchpoint-hp.c | 166 ------------------ 7 files changed, 419 deletions(-) delete mode 100644 gdb/testsuite/gdb.hp/follow-exec.c delete mode 100644 gdb/testsuite/gdb.hp/follow-fork.c delete mode 100644 gdb/testsuite/gdb.hp/follow-vfork-and-exec.c delete mode 100644 gdb/testsuite/gdb.hp/thread-local-in-lib.c delete mode 100644 gdb/testsuite/gdb.hp/thread-local-in-lib.h delete mode 100644 gdb/testsuite/gdb.hp/thread-local-in-lib.lib.c delete mode 100644 gdb/testsuite/gdb.hp/watchpoint-hp.c diff --git a/gdb/testsuite/gdb.hp/follow-exec.c b/gdb/testsuite/gdb.hp/follow-exec.c deleted file mode 100644 index c51fa52dcfd..00000000000 --- a/gdb/testsuite/gdb.hp/follow-exec.c +++ /dev/null @@ -1,35 +0,0 @@ -#include - -int global_i = 100; - -main () -{ - int local_j = global_i+1; - int local_k = local_j+1; - - printf ("follow-exec is about to execlp(execd-program)...\n"); - - execlp ("gdb.hp/execd-program", - "gdb.hp/execd-program", - "execlp arg1 from follow-exec", - (char *)0); - - printf ("follow-exec is about to execl(execd-program)...\n"); - - execl ("gdb.hp/execd-program", - "gdb.hp/execd-program", - "execl arg1 from follow-exec", - "execl arg2 from follow-exec", - (char *)0); - - { - static char * argv[] = { - "gdb.hp/execd-program", - "execv arg1 from follow-exec", - 0}; - - printf ("follow-exec is about to execv(execd-program)...\n"); - - execv ("gdb.hp/execd-program", argv); - } -} diff --git a/gdb/testsuite/gdb.hp/follow-fork.c b/gdb/testsuite/gdb.hp/follow-fork.c deleted file mode 100644 index 89f92ae22fe..00000000000 --- a/gdb/testsuite/gdb.hp/follow-fork.c +++ /dev/null @@ -1,25 +0,0 @@ -#include - -void callee (i) - int i; -{ - printf("callee: %d\n", i); -} - -main () -{ - int pid; - int v = 5; - - pid = fork (); - if (pid == 0) - { - v++; - /* printf ("I'm the child!\n"); */ - } - else - { - v--; - /* printf ("I'm the proud parent of child #%d!\n", pid); */ - } -} diff --git a/gdb/testsuite/gdb.hp/follow-vfork-and-exec.c b/gdb/testsuite/gdb.hp/follow-vfork-and-exec.c deleted file mode 100644 index c7e6cd32909..00000000000 --- a/gdb/testsuite/gdb.hp/follow-vfork-and-exec.c +++ /dev/null @@ -1,15 +0,0 @@ -#include - -main () -{ - int pid; - - pid = vfork (); - if (pid == 0) { - printf ("I'm the child!\n"); - execlp ("gdb.hp/vforked-program", "gdb.hp/vforked-program", (char *)0); - } - else { - printf ("I'm the proud parent of child #%d!\n", pid); - } -} diff --git a/gdb/testsuite/gdb.hp/thread-local-in-lib.c b/gdb/testsuite/gdb.hp/thread-local-in-lib.c deleted file mode 100644 index c42dce96fff..00000000000 --- a/gdb/testsuite/gdb.hp/thread-local-in-lib.c +++ /dev/null @@ -1,79 +0,0 @@ -/* Thread local in a library. -*/ -#include "thread-local-in-lib.h" -/* - * #define NTHREADS 4 - * #define NUM_ELEMS 12 - */ - -extern void* adder( void * ); - -pthread_mutex_t mutex; /* mutex for protecting global data total */ - -int numbers[NUM_ELEMS] = {5, 4, 3, 2, 1, 6, 7, 8, 9, 10, 12, 11}; -int total = 0; - -int debugger_saw[NTHREADS][ELEMS_PER_THREAD]; /* [4][3] */ -int the_code_saw[NTHREADS][ELEMS_PER_THREAD]; - -int get_number(i) -int i; -{ - /* sleep to force context switch to another thread in non-MP system - * so that TLS symbols are used by multiple threads concurrently - * in some way. - */ - sleep(1); - return numbers[i]; -} - -main() -{ - pthread_t thread[NTHREADS]; - void *status; - int i, j, ret; - - printf("== Thread: Test started\n"); - - for( i = 0; i < NTHREADS; i++ ) { - for( j = 0; j < ELEMS_PER_THREAD; j++ ) { - debugger_saw[i][j] = 0; - the_code_saw[i][j] = 0; - } - } - - ret = pthread_mutex_init(&mutex, NULL); - if (ret != 0) { - printf("== Thread: pthread_mutex_init() error: %d\n", ret); - exit(1); - } - - for (i=0; i < NTHREADS; i++) { - ret = pthread_create( &thread[i], - NULL, - adder, - (void *) i); - if (ret != 0) { - printf("== Thread: pthread_create() error: %d\n", ret); - exit(1); - } - printf("== Thread: thread %d created\n", i); - } - - for (i=0; i < NTHREADS; i++) { - pthread_join( thread[i], &status); - } - - printf("== Thread: total = %d\n", total); /* Expect "78" */ - - for( i = 0; i < NTHREADS; i++ ) { - for( j = 0; j < ELEMS_PER_THREAD; j++ ) { - printf( "== Thread: the debugger saw %d, the program saw %d\n", - debugger_saw[i][j], - the_code_saw[i][j] ); - } - } - - printf("== Thread: Test ended\n"); - exit(0); -} diff --git a/gdb/testsuite/gdb.hp/thread-local-in-lib.h b/gdb/testsuite/gdb.hp/thread-local-in-lib.h deleted file mode 100644 index c9395dfd0ca..00000000000 --- a/gdb/testsuite/gdb.hp/thread-local-in-lib.h +++ /dev/null @@ -1,7 +0,0 @@ -#include -#include - -#define NTHREADS 4 -#define NUM_ELEMS 12 - -#define ELEMS_PER_THREAD (NUM_ELEMS/NTHREADS) diff --git a/gdb/testsuite/gdb.hp/thread-local-in-lib.lib.c b/gdb/testsuite/gdb.hp/thread-local-in-lib.lib.c deleted file mode 100644 index 0fe03b35e52..00000000000 --- a/gdb/testsuite/gdb.hp/thread-local-in-lib.lib.c +++ /dev/null @@ -1,92 +0,0 @@ -#include - -/* Library code for thread local in lib test. -*/ -#include "thread-local-in-lib.h" - -extern pthread_mutex_t mutex; -extern int get_number(); -extern int total; -extern int the_code_saw[NTHREADS][ELEMS_PER_THREAD]; - -/* The debugger should see this without a declaration. - * - * extern int debugger_saw[NTHREADS][ELEMS_PER_THREAD]; - */ - -/* The actual thread locals. - */ -__thread int sum; -__thread int x[ ELEMS_PER_THREAD ]; /* [3] */ - -void sumup() -{ - int j; - - sum = 0; - for (j = 0; j < ELEMS_PER_THREAD; j++) { - sum += x[j]; - } - - if( sum == x[0] ) - /* It won't be "==", but this lets us set a breakpoint - * and look at the thread-local storage. - */ - sum++; - - x[0] = x[2]; /* Another no-op for debugger use */ -} - -void *adder( vid ) - void * vid; -{ - int id; - int i, j; - int ret; - - id = (int) vid; - - /* printf( "== Thread: Welcome to adder %d\n", id ); */ - - for (j = 0; j < ELEMS_PER_THREAD; j++) { - x[j] = 0; - } - - for (i = id, j = 0; i < NUM_ELEMS; i += NTHREADS, j++ ) { - - /* printf( "== Thread: id %d, i %d, j %d\n", id, i, j ); - fflush( stdout ); */ - - x[j] = get_number(i); /* {0,1,2,3} +0, +4, +8 */ - - /* Record for posterity; the debugger will gather - * the same data here, using "x[j]". - */ - the_code_saw[ id ][ j ] = x[j]; - - /* printf( "== Thread %d, sample %d, val %d, i %d\n", id, j, x[j],i ); - fflush( stdout ); */ - } - - sumup(); - /* printf("== Thread: adder %d contributes total %d\n", id, sum); */ - - /* protect global data */ - ret = pthread_mutex_lock(&mutex); - if (ret != 0) { - printf("== Thread: pthread_mutex_lock() error: %d\n", ret); - exit(1); - } - - total += sum; - - ret = pthread_mutex_unlock(&mutex); - if (ret != 0) { - printf("== Thread: pthread_mutex_unlock() error: %d\n", ret); - exit(1); - } - - if( NTHREADS != 4 || ELEMS_PER_THREAD != 3 || NUM_ELEMS != 12 ) { - printf( "** ERROR in test code **\n" ); - } -} diff --git a/gdb/testsuite/gdb.hp/watchpoint-hp.c b/gdb/testsuite/gdb.hp/watchpoint-hp.c deleted file mode 100644 index 7336fe2bec8..00000000000 --- a/gdb/testsuite/gdb.hp/watchpoint-hp.c +++ /dev/null @@ -1,166 +0,0 @@ -#include -/* - * Since using watchpoints can be very slow, we have to take some pains to - * ensure that we don't run too long with them enabled or we run the risk - * of having the test timeout. To help avoid this, we insert some marker - * functions in the execution stream so we can set breakpoints at known - * locations, without worrying about invalidating line numbers by changing - * this file. We use null bodied functions are markers since gdb does - * not support breakpoints at labeled text points at this time. - * - * One place we need is a marker for when we start executing our tests - * instructions rather than any process startup code, so we insert one - * right after entering main(). Another is right before we finish, before - * we start executing any process termination code. - * - * Another problem we have to guard against, at least for the test - * suite, is that we need to ensure that the line that causes the - * watchpoint to be hit is still the current line when gdb notices - * the hit. Depending upon the specific code generated by the compiler, - * the instruction after the one that triggers the hit may be part of - * the same line or part of the next line. Thus we ensure that there - * are always some instructions to execute on the same line after the - * code that should trigger the hit. - */ - -int count = -1; -int ival1 = -1; -int ival2 = -1; -int ival3 = -1; -int ival4 = -1; -int ival5 = -1; -char buf[10]; -struct foo -{ - int val; -}; -struct foo struct1, struct2, *ptr1, *ptr2; - -int doread = 0; - -void marker1 () -{ -} - -void marker2 () -{ -} - -void marker4 () -{ -} - -void marker5 () -{ -} - -void marker6 () -{ -} - -void recurser (x) - int x; -{ - int local_x; - - if (x > 0) - recurser (x-1); - local_x = x; -} - -void -func2 () -{ - int local_a; - static int static_b; - - ival5++; - local_a = ival5; - static_b = local_a; -} - -int -func1 () -{ - /* The point of this is that we will set a breakpoint at this call. - - Then, if DECR_PC_AFTER_BREAK equals the size of a function call - instruction (true on a sun3 if this is gcc-compiled--FIXME we - should use asm() to make it work for any compiler, present or - future), then we will end up branching to the location just after - the breakpoint. And we better not confuse that with hitting the - breakpoint. */ - func2 (); - return 73; -} - -int main () -{ - struct1.val = 1; - struct2.val = 2; - ptr1 = &struct1; - ptr2 = &struct2; - marker1 (); - func1 (); - for (count = 0; count < 4; count++) { - ival1 = count; - ival3 = count; ival4 = count; - } - ival1 = count; /* Outside loop */ - ival2 = count; - ival3 = count; ival4 = count; - marker2 (); - if (doread) - { - static char msg[] = "type stuff for buf now:"; - write (1, msg, sizeof (msg) - 1); - read (0, &buf[0], 5); - } - marker4 (); - - /* We have a watchpoint on ptr1->val. It should be triggered if - ptr1's value changes. */ - ptr1 = ptr2; - - /* This should not trigger the watchpoint. If it does, then we - used the wrong value chain to re-insert the watchpoints or we - are not evaluating the watchpoint expression correctly. */ - struct1.val = 5; - marker5 (); - - /* We have a watchpoint on ptr1->val. It should be triggered if - ptr1's value changes. */ - ptr1 = ptr2; - - /* This should not trigger the watchpoint. If it does, then we - used the wrong value chain to re-insert the watchpoints or we - are not evaluating the watchpoint expression correctly. */ - struct1.val = 5; - marker5 (); - - /* We're going to watch locals of func2, to see that out-of-scope - watchpoints are detected and properly deleted. - */ - marker6 (); - - /* This invocation is used for watches of a single - local variable. */ - func2 (); - - /* This invocation is used for watches of an expression - involving a local variable. */ - func2 (); - - /* This invocation is used for watches of a static - (non-stack-based) local variable. */ - func2 (); - - /* This invocation is used for watches of a local variable - when recursion happens. - */ - marker6 (); - recurser (2); - - marker6 (); - return 0; -} -- 2.30.2