From owner-p4-projects@FreeBSD.ORG Mon Jul 12 03:42:33 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id DABEB16A4D0; Mon, 12 Jul 2004 03:42:32 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B611616A4CE for ; Mon, 12 Jul 2004 03:42:32 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id B038C43D1F for ; Mon, 12 Jul 2004 03:42:32 +0000 (GMT) (envelope-from marcel@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.11/8.12.11) with ESMTP id i6C3gWBH098583 for ; Mon, 12 Jul 2004 03:42:32 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i6C3gWZZ098580 for perforce@freebsd.org; Mon, 12 Jul 2004 03:42:32 GMT (envelope-from marcel@freebsd.org) Date: Mon, 12 Jul 2004 03:42:32 GMT Message-Id: <200407120342.i6C3gWZZ098580@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to marcel@freebsd.org using -f From: Marcel Moolenaar To: Perforce Change Reviews Subject: PERFORCE change 57145 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Jul 2004 03:42:33 -0000 http://perforce.freebsd.org/chv.cgi?CH=57145 Change 57145 by marcel@marcel_nfs on 2004/07/12 03:41:54 libc_r has initialized _thread_run with something other than a NULL pointer. Since we may be asked to map a LWP to a thread handle before libc_r has been initialized and we should not return a handle in that case, we need to check for something that indicates whether libc_r is initialized. Use _thread_initial for that. Affected files ... .. //depot/projects/gdb/lib/libthread_db/libc_r_db.c#3 edit Differences ... ==== //depot/projects/gdb/lib/libthread_db/libc_r_db.c#3 (text+ko) ==== @@ -41,6 +41,7 @@ struct td_thragent { TD_THRAGENT_FIELDS; struct ps_prochandle *ta_ph; + psaddr_t ta_thread_initial; psaddr_t ta_thread_list; psaddr_t ta_thread_run; int ta_ofs_ctx; @@ -91,9 +92,15 @@ libc_r_db_ta_map_lwp2thr(const td_thragent_t *ta, lwpid_t lwpid, td_thrhandle_t *th) { + psaddr_t addr; ps_err_e err; th->th_ta = ta; + err = ps_pread(ta->ta_ph, ta->ta_thread_initial, &addr, sizeof(addr)); + if (err != PS_OK) + return (TD_ERR); + if (addr == NULL) + return (TD_NOLWP); err = ps_pread(ta->ta_ph, ta->ta_thread_run, &th->th_thread, sizeof(psaddr_t)); return ((err == PS_OK) ? TD_OK : TD_ERR); @@ -112,6 +119,10 @@ ta->ta_ph = ph; + err = ps_pglobal_lookup(ph, NULL, "_thread_initial", + &ta->ta_thread_initial); + if (err != PS_OK) + goto fail; err = ps_pglobal_lookup(ph, NULL, "_thread_list", &ta->ta_thread_list); if (err != PS_OK) goto fail;