Date: Mon, 28 Jun 2004 06:47:44 GMT From: Marcel Moolenaar <marcel@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 55986 for review Message-ID: <200406280647.i5S6liux038343@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200406280647.i5S6liux038343>