Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH RFA] linux-thread.c, lin-thread.c changes
@ 2000-03-24 12:48 Kevin Buettner
  2000-03-24 12:51 ` Michael Snyder
  0 siblings, 1 reply; 2+ messages in thread
From: Kevin Buettner @ 2000-03-24 12:48 UTC (permalink / raw)
  To: gdb-patches; +Cc: Michael Snyder

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);
 }
 
 /*


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-03-24 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-24 12:48 [PATCH RFA] linux-thread.c, lin-thread.c changes Kevin Buettner
2000-03-24 12:51 ` Michael Snyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox