From: Kevin Buettner Date: Fri, 24 Mar 2000 21:07:17 +0000 (+0000) Subject: Don't do compile time comparison of TARGET_PTR_BIT and TARGET_INT_BIT. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a91f7ea9baf74ec6527944b0b69c23c9c9b238bd;p=binutils-gdb.git Don't do compile time comparison of TARGET_PTR_BIT and TARGET_INT_BIT. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 5312fd93865..41b7a768500 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2000-03-24 Kevin Buettner + + * 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. + Thu Mar 23 13:18:26 2000 Philippe De Muyter * m68k-tdep.c (P_LINKL_FP, P_LINKW_FP): Macros renamed from P_LINK_L diff --git a/gdb/lin-thread.c b/gdb/lin-thread.c index a4f388dedb4..de530f68882 100644 --- a/gdb/lin-thread.c +++ b/gdb/lin-thread.c @@ -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); } /* diff --git a/gdb/linux-thread.c b/gdb/linux-thread.c index 2b9597db45f..146481c6ac8 100644 --- a/gdb/linux-thread.c +++ b/gdb/linux-thread.c @@ -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