Source-Changes-HG archive

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

[src/nathanw_sa]: src/gnu/dist/toolchain/gdb Remove the PID/lwpid/thread macr...



details:   https://anonhg.NetBSD.org/src/rev/263a7380360f
branches:  nathanw_sa
changeset: 506346:263a7380360f
user:      nathanw <nathanw%NetBSD.org@localhost>
date:      Wed Oct 16 19:38:48 2002 +0000

description:
Remove the PID/lwpid/thread macros; they're now in nm-nbsd.h.

Call td_map_lwps() in find_active_thread() to make the mapping
correct.

Pass the LWP parameter to the getregs/setregs callbacks down into
inferior_pid in both the live-process and core cases.

Only call bfd_map_over_sections on a core file if thread debugging is
active.

diffstat:

 gnu/dist/toolchain/gdb/nbsd-thread.c |  36 +++++++++++++++++-------------------
 1 files changed, 17 insertions(+), 19 deletions(-)

diffs (77 lines):

diff -r 06a81fe520dc -r 263a7380360f gnu/dist/toolchain/gdb/nbsd-thread.c
--- a/gnu/dist/toolchain/gdb/nbsd-thread.c      Wed Oct 16 19:34:15 2002 +0000
+++ b/gnu/dist/toolchain/gdb/nbsd-thread.c      Wed Oct 16 19:38:48 2002 +0000
@@ -58,13 +58,6 @@
 
 extern int child_suppress_run;
 
-
-#define THREAD_FLAG            0x80000000
-#define IS_THREAD(ARG)         (((ARG) & THREAD_FLAG) != 0)
-#define GET_THREAD(PID)                (((PID) >> 16) & 0x7fff)
-#define GET_PROCESS(PID)       ((PID) & 0xffff)
-#define BUILD_THREAD(TID, PID) ((TID) << 16 | (PID) | THREAD_FLAG)
-
 /* inferior_pid is a global variable that is used by gdb to identify
    the entity that is under the debugging microscope. In normal
    operation, it would be the PID of the child process. For threaded
@@ -230,6 +223,10 @@
   if (!nbsd_thread_active)
     return -1;
 
+  val = td_map_lwps(main_ta);
+  if (val != 0)
+    return -1;
+
   if (cached_thread != 0)
     return cached_thread;
 
@@ -883,9 +880,11 @@
 {
   orig_core_ops.to_open (filename, from_tty);
   main_pid = elf_tdata (core_bfd)->core_pid;
-  bfd_map_over_sections (core_bfd, nbsd_add_to_thread_list,
-                        bfd_get_section_by_name (core_bfd, ".reg"));
-  nbsd_find_new_threads();
+  if (nbsd_thread_active) {
+    bfd_map_over_sections (core_bfd, nbsd_add_to_thread_list,
+                          bfd_get_section_by_name (core_bfd, ".reg"));
+    nbsd_find_new_threads();
+  }
 }
 
 static void
@@ -992,17 +991,14 @@
 
   old_chain = save_inferior_pid ();
   inferior_pid = main_pid;
-       
-  /* Live process? LWPs? We can't cope with that right now.... */
+  
+  /* Fetching registers requires that inferior_pid have the
+     funky LWP/process mix that the kernel drops. */
+     inferior_pid = BUILD_LWP(lwp, inferior_pid);
   if (target_has_execution)
     child_ops.to_fetch_registers (-1);
   else
-    {
-      /* Fetching core registers requires that inferior_pid have the
-         funky LWP/process mix that the kernel drops. */
-      inferior_pid = inferior_pid | (lwp << 16);
-      orig_core_ops.to_fetch_registers (-1);
-    }
+    orig_core_ops.to_fetch_registers (-1);
 
   nbsd_internal_to_reg(&gregs);
   nbsd_internal_to_fpreg(&fpregs);
@@ -1049,7 +1045,9 @@
       ret = TD_ERR_INVAL;
     }
 
-  /* Live process? LWPs? We can't cope with that right now.... */
+  /* Storing registers requires that inferior_pid have the
+     funky LWP/process mix that the kernel drops. */
+  inferior_pid = BUILD_LWP(lwp, inferior_pid);
   nbsd_reg_to_internal(&gregs);
   nbsd_fpreg_to_internal(&fpregs);
   child_ops.to_store_registers (-1);



Home | Main Index | Thread Index | Old Index