From owner-p4-projects@FreeBSD.ORG Mon Jun 28 06:47:46 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id BDA4416A4D0; Mon, 28 Jun 2004 06:47:45 +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 98C8F16A4CE for ; Mon, 28 Jun 2004 06:47:45 +0000 (GMT) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7978143D31 for ; Mon, 28 Jun 2004 06:47:45 +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 i5S6liQv038346 for ; Mon, 28 Jun 2004 06:47:44 GMT (envelope-from marcel@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.11/8.12.11/Submit) id i5S6liux038343 for perforce@freebsd.org; Mon, 28 Jun 2004 06:47:44 GMT (envelope-from marcel@freebsd.org) Date: Mon, 28 Jun 2004 06:47:44 GMT Message-Id: <200406280647.i5S6liux038343@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 55986 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, 28 Jun 2004 06:47:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=55986 Change 55986 by marcel@marcel_nfs on 2004/06/28 06:46:43 Pass the lwpid in the thread info structure. This allows GDB to construct the thread list and select the right thread as the current thread. For libc_r only... Affected files ... .. //depot/projects/gdb/lib/libthread_db/td_ta_new.c#3 edit .. //depot/projects/gdb/lib/libthread_db/td_thr_get_info.c#4 edit .. //depot/projects/gdb/lib/libthread_db/thread_db_int.h#2 edit Differences ... ==== //depot/projects/gdb/lib/libthread_db/td_ta_new.c#3 (text+ko) ==== @@ -48,8 +48,14 @@ if (err != PS_OK) return (TD_ERR); - err = ps_pglobal_lookup(ta->ta_ph, NULL, "_thread_next_offset", - &addr); + err = ps_pglobal_lookup(ta->ta_ph, NULL, "_libc_r_lwpid", &addr); + if (err != PS_OK) + return (TD_ERR); + err = ps_pread(ta->ta_ph, addr, &ta->ta.libc_r.lwpid, sizeof(lwpid_t)); + if (err != PS_OK) + return (TD_ERR); + + err = ps_pglobal_lookup(ta->ta_ph, NULL, "_thread_next_offset", &addr); if (err != PS_OK) return (TD_ERR); err = ps_pread(ta->ta_ph, addr, &ta->ta.libc_r.offset_next, ==== //depot/projects/gdb/lib/libthread_db/td_thr_get_info.c#4 (text+ko) ==== @@ -36,18 +36,23 @@ td_thr_get_info(const td_thrhandle_t *th, td_thrinfo_t *ti) { const td_thragent_t *ta; - psaddr_t addr; + psaddr_t addr, current; ps_err_e err; ta = th->th_ta; ti->ti_ta = ta; switch (ta->ta_lib) { case PTHREAD_LIBC_R: + err = ps_pread(ta->ta_ph, ta->ta.libc_r.thread_run, ¤t, + sizeof(psaddr_t)); addr = (psaddr_t)((uintptr_t)th->th_thread + ta->ta.libc_r.offset_uniqueid); err = ps_pread(ta->ta_ph, addr, &ti->ti_tid, sizeof(thread_t)); - ti->ti_tid++; + if (current == th->th_thread) + ti->ti_lid = ta->ta.libc_r.lwpid; + else + ti->ti_lid = 0; return (err == PS_OK) ? TD_OK : TD_ERR; default: break; ==== //depot/projects/gdb/lib/libthread_db/thread_db_int.h#2 (text+ko) ==== @@ -44,6 +44,7 @@ struct { psaddr_t thread_list; psaddr_t thread_run; + lwpid_t lwpid; int offset_next; int offset_uniqueid; } libc_r;