Source-Changes-HG archive

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

[src/trunk]: src/lib Remove pt_blockuc. If the debugger attempts to muck wit...



details:   https://anonhg.NetBSD.org/src/rev/c8b98c74a6df
branches:  trunk
changeset: 570475:c8b98c74a6df
user:      mycroft <mycroft%NetBSD.org@localhost>
date:      Tue Oct 12 22:17:56 2004 +0000

description:
Remove pt_blockuc.  If the debugger attempts to muck with the state of a
blocked thread, return an error; this should be done through ptrace(2).

diffstat:

 lib/libpthread/pthread_int.h     |   4 ++--
 lib/libpthread/pthread_sa.c      |   5 ++---
 lib/libpthread_dbg/pthread_dbg.c |  26 ++++++--------------------
 3 files changed, 10 insertions(+), 25 deletions(-)

diffs (124 lines):

diff -r cd75737167d8 -r c8b98c74a6df lib/libpthread/pthread_int.h
--- a/lib/libpthread/pthread_int.h      Tue Oct 12 22:16:34 2004 +0000
+++ b/lib/libpthread/pthread_int.h      Tue Oct 12 22:17:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_int.h,v 1.29 2004/08/24 01:45:54 nathanw Exp $ */
+/*     $NetBSD: pthread_int.h,v 1.30 2004/10/12 22:17:56 mycroft Exp $ */
 
 /*-
  * Copyright (c) 2001,2002,2003 The NetBSD Foundation, Inc.
@@ -114,7 +114,7 @@
        stack_t         pt_stack;       /* Our stack */
        ucontext_t      *pt_uc;         /* Saved context when we're stopped */
        ucontext_t      *pt_trapuc;     /* Kernel-saved context */
-       ucontext_t      *pt_blockuc;    /* Kernel-saved context when blocked */
+       ucontext_t      *__pt_blockuc;  /* Kernel-saved context when blocked */
 
        sigset_t        pt_sigmask;     /* Signals we won't take. */
        sigset_t        pt_siglist;     /* Signals pending for us. */
diff -r cd75737167d8 -r c8b98c74a6df lib/libpthread/pthread_sa.c
--- a/lib/libpthread/pthread_sa.c       Tue Oct 12 22:16:34 2004 +0000
+++ b/lib/libpthread/pthread_sa.c       Tue Oct 12 22:17:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_sa.c,v 1.32 2004/07/20 12:40:53 he Exp $       */
+/*     $NetBSD: pthread_sa.c,v 1.33 2004/10/12 22:17:56 mycroft Exp $  */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_sa.c,v 1.32 2004/07/20 12:40:53 he Exp $");
+__RCSID("$NetBSD: pthread_sa.c,v 1.33 2004/10/12 22:17:56 mycroft Exp $");
 
 #include <err.h>
 #include <errno.h>
@@ -132,7 +132,6 @@
                SDPRINTF(("(up %p) blocker %d %p(%d)\n", self,
                             sas[1]->sa_id, t, t->pt_type));
                pthread__assert(t->pt_vpid == sas[1]->sa_cpu);
-               t->pt_blockuc = sas[1]->sa_context;
                t->pt_blockedlwp = sas[1]->sa_id;
                t->pt_blockgen += 2;
                if (t->pt_cancel)
diff -r cd75737167d8 -r c8b98c74a6df lib/libpthread_dbg/pthread_dbg.c
--- a/lib/libpthread_dbg/pthread_dbg.c  Tue Oct 12 22:16:34 2004 +0000
+++ b/lib/libpthread_dbg/pthread_dbg.c  Tue Oct 12 22:17:56 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread_dbg.c,v 1.29 2004/07/18 21:24:52 chs Exp $     */
+/*     $NetBSD: pthread_dbg.c,v 1.30 2004/10/12 22:17:56 mycroft Exp $ */
 
 /*-
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_dbg.c,v 1.29 2004/07/18 21:24:52 chs Exp $");
+__RCSID("$NetBSD: pthread_dbg.c,v 1.30 2004/10/12 22:17:56 mycroft Exp $");
 
 #define __EXPOSE_STACK 1
 #include <sys/param.h>
@@ -423,20 +423,12 @@
                break;
        case PT_STATE_RUNNABLE:
        case PT_STATE_SUSPENDED:
-       case _PT_STATE_BLOCKED_SYS:
        case PT_STATE_BLOCKED_QUEUE:
                /*
                 * The register state of the thread is in the ucontext_t 
                 * of the thread structure.
                 */
-               if (tmp == _PT_STATE_BLOCKED_SYS) {
-                       val = READ(thread->proc, 
-                           thread->addr + offsetof(struct __pthread_st, pt_blockuc),
-                           &addr, sizeof(addr));
-                       if (val != 0)
-                               return val;
-               } else
-                       addr = 0;
+               addr = 0;
                if (addr == 0) {
                        val = READ(thread->proc, 
                            thread->addr + offsetof(struct __pthread_st, pt_trapuc),
@@ -477,6 +469,7 @@
                        return TD_ERR_INVAL;
                }
                break;
+       case _PT_STATE_BLOCKED_SYS:
        case PT_STATE_ZOMBIE:
        default:
                return TD_ERR_BADTHREAD;
@@ -519,7 +512,6 @@
                break;
        case PT_STATE_RUNNABLE:
        case PT_STATE_SUSPENDED:
-       case _PT_STATE_BLOCKED_SYS:
        case PT_STATE_BLOCKED_QUEUE:
                /*
                 * The register state of the thread is in the ucontext_t 
@@ -528,14 +520,7 @@
                 * Fetch the uc first, since there is state in it
                 * besides the registers that should be preserved.
                 */
-               if (tmp == _PT_STATE_BLOCKED_SYS) {
-                       val = READ(thread->proc, 
-                           thread->addr + offsetof(struct __pthread_st, pt_blockuc),
-                           &addr, sizeof(addr));
-                       if (val != 0)
-                               return val;
-               } else
-                       addr = 0;
+               addr = 0;
                if (addr == 0) {
                        val = READ(thread->proc, 
                            thread->addr + offsetof(struct __pthread_st, pt_trapuc),
@@ -579,6 +564,7 @@
                        return val;
 
                break;
+       case _PT_STATE_BLOCKED_SYS:
        case PT_STATE_ZOMBIE:
        default:
                return TD_ERR_BADTHREAD;



Home | Main Index | Thread Index | Old Index