PERFORCE change 57145 for review
Marcel Moolenaar
marcel at FreeBSD.org
Sun Jul 11 20:42:33 PDT 2004
http://perforce.freebsd.org/chv.cgi?CH=57145
Change 57145 by marcel at 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;
More information about the p4-projects
mailing list