[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help! about thread debug
From: |
Xu Long |
Subject: |
help! about thread debug |
Date: |
Tue, 16 Sep 2003 14:33:09 +0800 |
Hi,
I'm trying to program with thread debugging functions: td_ta_new(), ta_ok()
etc. Some errors occurred when I used the following gcc command to compile my
test program. ( ps: thread_db.h has already included.)
]$ gcc testmini.c -lpthread -lthread_db
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_pdwrite'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_pglobal_lookup'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_lsetfpregs'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_getpid'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_lsetregs'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_pdread'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_lgetfpregs'
/usr/lib/gcc-lib/i386-redhat-linux/3.2.2/../../../libthread_db.so: undefined
reference to `ps_lgetregs'
collect2: ld returned 1 exit status
The error message shows there are undefined references to 'ps_pdwrite',
'ps_pdread' and etc. in libthread_db.so. Then I used 'nm' and 'grep' to check
out whether these symbols are in libthread_db.so. The result indicated that
they were undefined. I guess we are missing somewhat like .so files. Any expert
could tell me what it is and where to get it, thanks.
The following is the program:
#include <stdio.h>
#include <thread_db.h>
static int thread_cb ( const td_thrhandle_t *th_p, void *s );
struct ps_prochandle { // ps: user defined
pid_t pid; // process id
};
// make an instance of ps_prochandle
struct ps_prochandle ph = { 1 };
td_thragent_t* ta_p; // create a thread agent pointer
int
main ()
{
td_err_e td_return;
//td_init()
//initialize libthread_db
td_return = td_init();
if ( td_return != TD_OK )
{
printf("Initialization error on td_init()!\n");
return(1);
}
//td_ta_new()
//
td_return = td_ta_new(&ph, &ta_p);
if ( td_return == TD_OK )
{
//td_ta_thr_iter()
//
td_ta_thr_iter (ta_p,
thread_cb,
"Import calls test",
TD_THR_ANY_STATE,
TD_THR_LOWEST_PRIORITY,
TD_SIGNO_MASK,
TD_THR_ANY_USER_FLAGS);
}
return 0;
}
//Call back function for iterator
static int
thread_cb ( const td_thrhandle_t *th_p, void *s )
{
int return_val = 0;
td_err_e td_return;
td_thrinfo_t to;
td_return = td_thr_get_info( th_p, &(to) );
if ( td_return == TD_ERR )
{
printf("Thread update failed\n");
return_val = 1;
}
return return_val;
}
Regards
Xu Long
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- help! about thread debug,
Xu Long <=