Source-Changes-HG archive

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

[src/trunk]: src/gnu/dist/gdb6/gdb Lookup lwp0.l_addr instead of proc0paddr t...



details:   https://anonhg.NetBSD.org/src/rev/965747447e02
branches:  trunk
changeset: 749338:965747447e02
user:      enami <enami%NetBSD.org@localhost>
date:      Fri Nov 27 02:51:15 2009 +0000

description:
Lookup lwp0.l_addr instead of proc0paddr to locate PCB.

diffstat:

 gnu/dist/gdb6/gdb/bsd-kvm.c |  21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diffs (31 lines):

diff -r 42248b7eb88c -r 965747447e02 gnu/dist/gdb6/gdb/bsd-kvm.c
--- a/gnu/dist/gdb6/gdb/bsd-kvm.c       Fri Nov 27 01:37:30 2009 +0000
+++ b/gnu/dist/gdb6/gdb/bsd-kvm.c       Fri Nov 27 02:51:15 2009 +0000
@@ -211,6 +211,27 @@
       return;
     }
 
+#if 1 /* TODO: HAVE_STRUCT_LWP_L_ADDR */
+  memset (nl, 0, sizeof nl);
+  nl[0].n_name = "_lwp0";
+
+  if (kvm_nlist (core_kd, nl) == -1)
+    error (("%s"), kvm_geterr (core_kd));
+
+  if (nl[0].n_value != 0)
+    {
+      struct pcb *paddr;
+
+      /* Found lwp0.  */
+      nl[0].n_value += offsetof (struct lwp, l_addr);
+      if (kvm_read (core_kd, nl[0].n_value, &paddr, sizeof paddr) == -1)
+       error (("%s"), kvm_geterr (core_kd));
+
+      bsd_kvm_fetch_pcb (paddr);
+      return;
+    }
+#endif
+
 #ifdef HAVE_STRUCT_THREAD_TD_PCB
   /* In FreeBSD kernels for 5.0-RELEASE and later, the PCB no longer
      lives in `struct proc' but in `struct thread'.  The `struct



Home | Main Index | Thread Index | Old Index