Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: "Frank van Eijkelenburg" <frank.van.eijkelenburg@technolution.nl>
To: "Gnu Debugger mailing list" <gdb@sources.redhat.com>
Subject: unresolved symbols with libthread_db library
Date: Mon, 20 Jan 2003 14:57:00 -0000	[thread overview]
Message-ID: <JJEILELDMJJENLCGJHOIAEECCEAA.frank.van.eijkelenburg@technolution.nl> (raw)

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


             reply	other threads:[~2003-01-20 14:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-20 14:57 Frank van Eijkelenburg [this message]
2003-01-20 16:31 ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=JJEILELDMJJENLCGJHOIAEECCEAA.frank.van.eijkelenburg@technolution.nl \
    --to=frank.van.eijkelenburg@technolution.nl \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox