From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kevin Buettner To: gdb-patches@sourceware.cygnus.com Cc: Michael Snyder Subject: [PATCH RFA] linux-thread.c, lin-thread.c changes Date: Fri, 24 Mar 2000 12:48:00 -0000 Message-id: <1000324204825.ZM4807@ocotillo.lan> X-SW-Source: 2000-03/msg00557.html I request approval for committing the changes below. The lines that read #if TARGET_PTR_BIT > TARGET_INT_BIT cause a compilation error on linux/ia64 due to the fact that TARGET_PTR_BIT and TARGET_INT_BIT are computed at runtime for the IA-64 architecture. (When we get around to multi-arching the other linux ports, they'll have the same problem.) * linux-thread.c, lin-thread.c (save_inferior_pid, restore_inferior_pid): Don't do compile time comparison of TARGET_PTR_BIT and TARGET_INT_BIT. Index: linux-thread.c =================================================================== RCS file: /cvs/src/src/gdb/linux-thread.c,v retrieving revision 1.5 diff -u -p -r1.5 linux-thread.c --- linux-thread.c 2000/03/18 01:56:31 1.5 +++ linux-thread.c 2000/03/24 20:36:43 @@ -378,25 +378,22 @@ linuxthreads_find_trap (pid, stop) /* Cleanup stub for save_inferior_pid. */ static void -restore_inferior_pid (arg) - void *arg; +restore_inferior_pid (void *arg) { -#if TARGET_PTR_BIT > TARGET_INT_BIT - inferior_pid = (int) ((long) arg); -#else - inferior_pid = (int) arg; -#endif + int *saved_pid_ptr = arg; + inferior_pid = *saved_pid_ptr; + free (arg); } /* Register a cleanup to restore the value of inferior_pid. */ static struct cleanup * -save_inferior_pid () +save_inferior_pid (void) { -#if TARGET_PTR_BIT > TARGET_INT_BIT - return make_cleanup (restore_inferior_pid, (void *) ((long) inferior_pid)); -#else - return make_cleanup (restore_inferior_pid, (void *) inferior_pid); -#endif + int *saved_pid_ptr; + + saved_pid_ptr = xmalloc (sizeof (int)); + *saved_pid_ptr = inferior_pid; + return make_cleanup (restore_inferior_pid, saved_pid_ptr); } static void Index: lin-thread.c =================================================================== RCS file: /cvs/src/src/gdb/lin-thread.c,v retrieving revision 1.2 diff -u -p -r1.2 lin-thread.c --- lin-thread.c 2000/02/09 08:52:46 1.2 +++ lin-thread.c 2000/03/24 20:36:47 @@ -658,21 +658,19 @@ init_thread_db_library () static struct cleanup * save_inferior_pid (void) { -#if TARGET_PTR_BIT > TARGET_INT_BIT - return make_cleanup (restore_inferior_pid, (void *) ((long) inferior_pid)); -#else - return make_cleanup (restore_inferior_pid, (void *) inferior_pid); -#endif + int *saved_pid_ptr; + + saved_pid_ptr = xmalloc (sizeof (int)); + *saved_pid_ptr = inferior_pid; + return make_cleanup (restore_inferior_pid, saved_pid_ptr); } static void -restore_inferior_pid (void *saved_pid) +restore_inferior_pid (void *arg) { -#if TARGET_PTR_BIT > TARGET_INT_BIT - inferior_pid = (int) ((long) saved_pid); -#else - inferior_pid = (int) saved_pid; -#endif + int *saved_pid_ptr = arg; + inferior_pid = *saved_pid_ptr; + free (arg); } /*