Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb replace the old macros with the f...



details:   https://anonhg.NetBSD.org/src/rev/3cd3a29bc90c
branches:  trunk
changeset: 330606:3cd3a29bc90c
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jul 15 17:35:39 2014 +0000

description:
replace the old macros with the function names like the rest of the code did.

diffstat:

 external/gpl3/gdb/dist/gdb/nbsd-thread.c |  48 ++++++++++++++-----------------
 1 files changed, 22 insertions(+), 26 deletions(-)

diffs (144 lines):

diff -r ac787967a166 -r 3cd3a29bc90c external/gpl3/gdb/dist/gdb/nbsd-thread.c
--- a/external/gpl3/gdb/dist/gdb/nbsd-thread.c  Tue Jul 15 16:17:15 2014 +0000
+++ b/external/gpl3/gdb/dist/gdb/nbsd-thread.c  Tue Jul 15 17:35:39 2014 +0000
@@ -83,12 +83,6 @@
 static ptid_t find_active_thread (void);
 static void nbsd_find_new_threads (struct target_ops *);
 
-#define GET_PID(ptid)          ptid_get_pid (ptid)
-#define GET_LWP(ptid)          ptid_get_lwp (ptid)
-
-#define IS_LWP(ptid)           (GET_LWP (ptid) != 0)
-
-#define BUILD_LWP(lwp, ptid)   ptid_build (GET_PID(ptid), (lwp), 0)
 
 static td_proc_t *main_ta;
 
@@ -143,7 +137,8 @@
   nbsd_thread_active = 1;
   main_ptid = inferior_ptid;
   cached_thread = minus_one_ptid;
-  thread_change_ptid(inferior_ptid, BUILD_LWP(1, inferior_ptid));
+  thread_change_ptid(inferior_ptid,
+      ptid_build (ptid_get_pid (inferior_ptid), 1, 0));
   nbsd_find_new_threads (NULL);
   inferior_ptid = find_active_thread ();
 }
@@ -280,10 +275,11 @@
   if (target_has_execution)
     {
       pl.pl_lwpid = 0;
-      val = ptrace (PT_LWPINFO, GET_PID(inferior_ptid), (void *)&pl, sizeof(pl));
+      val = ptrace (PT_LWPINFO, ptid_get_pid(inferior_ptid), (void *)&pl, sizeof(pl));
       while ((val != -1) && (pl.pl_lwpid != 0) &&
-            (pl.pl_event != PL_EVENT_SIGNAL))
-       val = ptrace (PT_LWPINFO, GET_PID(inferior_ptid), (void *)&pl, sizeof(pl));
+            (pl.pl_event != PL_EVENT_SIGNAL)) {
+       val = ptrace (PT_LWPINFO, ptid_get_pid(inferior_ptid), (void *)&pl, sizeof(pl));
+    }
       if (pl.pl_lwpid == 0)
        /* found no "active" thread, stay with current */
        pl.pl_lwpid = inferior_ptid.lwp;
@@ -293,7 +289,7 @@
       return inferior_ptid;
     }
 
-  cached_thread = BUILD_LWP (pl.pl_lwpid, main_ptid);
+  cached_thread = ptid_build (ptid_get_pid (main_ptid), pl.pl_lwpid, 0);
   return cached_thread;
 }
 
@@ -341,8 +337,8 @@
 
   if (!target_has_execution)
     {
-      inferior_ptid = pid_to_ptid ((GET_LWP (inferior_ptid) << 16) | 
-                                   GET_PID (inferior_ptid));
+      inferior_ptid = pid_to_ptid ((ptid_get_lwp (inferior_ptid) << 16) | 
+                                   ptid_get_pid (inferior_ptid));
     }
     beneath->to_fetch_registers (beneath, cache, regno);
   
@@ -418,11 +414,11 @@
   td_thread_t *th;
   char name[32];
 
-  if ((GET_LWP(ptid) == 0) && 
+  if ((ptid_get_lwp(ptid) == 0) && 
       (nbsd_thread_active == 0))
-    sprintf (buf, "process %d", GET_PID (ptid));
+    sprintf (buf, "process %d", ptid_get_pid (ptid));
   else
-    sprintf (buf, "LWP %ld", GET_LWP (ptid));
+    sprintf (buf, "LWP %ld", ptid_get_lwp (ptid));
 
   return buf;
 }
@@ -440,7 +436,7 @@
 
   regval = atoi (bfd_section_name (abfd, asect) + 5);
 
-  add_thread (BUILD_LWP(regval, main_ptid));
+  add_thread (ptid_build (ptid_get_pid (main_ptid), regval, 0));
 }
 #endif
 
@@ -505,11 +501,11 @@
 
   if (nbsd_thread_active)
     {
-      if (IS_LWP (ptid))
+      if (ptid_lwp_p (ptid))
        {
          struct ptrace_lwpinfo pl;
-         pl.pl_lwpid = GET_LWP (ptid);
-         val = ptrace (PT_LWPINFO, GET_PID (ptid), (void *)&pl, sizeof(pl));
+         pl.pl_lwpid = ptid_get_lwp (ptid);
+         val = ptrace (PT_LWPINFO, ptid_get_pid (ptid), (void *)&pl, sizeof(pl));
          if (val == -1)
            val = 0;
          else
@@ -553,13 +549,13 @@
     {
       struct ptrace_lwpinfo pl;
       pl.pl_lwpid = 0;
-      retval = ptrace (PT_LWPINFO, GET_PID(inferior_ptid), (void *)&pl, sizeof(pl));
+      retval = ptrace (PT_LWPINFO, ptid_get_pid(inferior_ptid), (void *)&pl, sizeof(pl));
       while ((retval != -1) && pl.pl_lwpid != 0)
        {
-         ptid = BUILD_LWP (pl.pl_lwpid, main_ptid);
+         ptid = ptid_build (ptid_get_pid (main_ptid), pl.pl_lwpid, 0);
          if (!in_thread_list (ptid))
            add_thread (ptid);
-         retval = ptrace (PT_LWPINFO, GET_PID(inferior_ptid), (void *)&pl, sizeof(pl));
+         retval = ptrace (PT_LWPINFO, ptid_get_pid(inferior_ptid), (void *)&pl, sizeof(pl));
        }
     }
 }
@@ -668,7 +664,7 @@
     {
       /* Fetching registers from a live process requires that
         inferior_ptid is a LWP value rather than a thread value. */
-      inferior_ptid = BUILD_LWP (lwp, main_ptid);
+      inferior_ptid = ptid_build (ptid_get_pid (main_ptid), lwp, 0);
       beneath->to_fetch_registers (beneath, cache, -1);
     }
   else
@@ -676,7 +672,7 @@
       /* Fetching registers from a core process requires that
         the PID value of inferior_ptid have the funky value that
         the kernel drops rather than the real PID. Gross. */
-      inferior_ptid = pid_to_ptid ((lwp << 16) | GET_PID (main_ptid));
+      inferior_ptid = pid_to_ptid ((lwp << 16) | ptid_get_pid (main_ptid));
       beneath->to_fetch_registers (ops, cache, -1);
     }
 
@@ -729,7 +725,7 @@
 
   /* Storing registers requires that inferior_ptid is a LWP value
      rather than a thread value. */
-  inferior_ptid = BUILD_LWP (lwp, main_ptid);
+  inferior_ptid = ptid_build (ptid_get_pid (main_ptid), lwp, 0);
   beneath->to_store_registers (beneath, cache, -1);
   do_cleanups (old_chain);
 



Home | Main Index | Thread Index | Old Index