Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* unresolved symbols with libthread_db library
@ 2003-01-20 14:57 Frank van Eijkelenburg
  2003-01-20 16:31 ` Daniel Jacobowitz
  0 siblings, 1 reply; 2+ messages in thread
From: Frank van Eijkelenburg @ 2003-01-20 14:57 UTC (permalink / raw)
  To: Gnu Debugger mailing list

I'm trying to compile a simple program which uses the libthread_db library
(see code at the end). However I have some unresolved symbols. Does anyone
know what to include to resolve these symbols. Or should I implement
something myself? With this program I want to try debugging a multithreaded
program with use of gdbserver.

/*Specify libthread_db.so.1 on link line to access correct version.
 *   cc thisfile.c /lib/libthread_db.so.1
 */
#include <stdio.h>
#include <sys/types.h>
#include <thread_db.h>
#include <dlfcn.h>

static int thread_cb( const td_thrhandle_t *th_p, void *s );
struct ps_prochandle {
   pid_t pid;
};
struct ps_prochandle ph = {1};
td_thragent_t *ta_p;

/*
 *   libthread_db example.
 *      Initialize libthread_db
 *      Create a thread agent
 *      Call thread iterator
 */
int main()
{
   td_err_e td_return;
   /*
    *   td_init()
    */
   td_return = td_init();
   if ( td_return != TD_OK ) {
      printf("Initialization error on td_init() call\n");
      return 0;
   }
   /*
    *   td_ta_new()
    */
   td_return = td_ta_new(&ph, &ta_p);
   if ( td_return == TD_OK ) {
      /*
       * td_ta_thr_iter()
       */
      (void) 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;
}

static int thread_cb( const td_thrhandle_t *th_p, void *s )
/*
 *  Description:
 *     Call back function for iterator
 *
 *  Input:
 *     *th_p - thread handle
 *     *s - data
 *
 *  Output:
 *     none
 *
 */
{
   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;
}


TIA,
Frank


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-20 16:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-20 14:57 unresolved symbols with libthread_db library Frank van Eijkelenburg
2003-01-20 16:31 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox