Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@cygnus.com>
To: gdb-patches@sourceware.cygnus.com
Cc: Michael Snyder <msnyder@cygnus.com>
Subject: [PATCH RFA] linux-thread.c, lin-thread.c changes
Date: Fri, 24 Mar 2000 12:48:00 -0000	[thread overview]
Message-ID: <1000324204825.ZM4807@ocotillo.lan> (raw)

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


             reply	other threads:[~2000-03-24 12:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-24 12:48 Kevin Buettner [this message]
2000-03-24 12:51 ` Michael Snyder

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1000324204825.ZM4807@ocotillo.lan \
    --to=kevinb@cygnus.com \
    --cc=gdb-patches@sourceware.cygnus.com \
    --cc=msnyder@cygnus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox